original_code:
int ship_control(int *field, int size, int counter, int type, char direct){
int *pointer;
int i,j;
int x_count;
int y_count;
int x_check;
int y_check;
int counter_check;
x_count=counter % size;
y_count=counter/size;
switch(direct){
 case 'o': if((y_count-type+1)<0){return -1;}
    x_check=x_count-1;
    y_check=y_count-type;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+i)<size)&&((x_check+i)>=0)&&((y_check+j)<size)&&((y_check+j)>=0)){
       counter_check=(y_check+j)*size+x_check+i;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 case 'u': if((y_count+type-1)>=size){return -1;}
     x_check=x_count-1;
     y_check=y_count-1;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+i)<size)&&((x_check+i)>=0)&&((y_check+j)<size)&&((y_check+j)>=0)){
       counter_check=(y_check+j)*size+x_check+i;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 case 'r': if((x_count+type-1)>=size){return -1;}
    x_check=x_count-1;
    y_check=y_count-1;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+j)<size)&&((x_check+j)>=0)&&((y_check+i)<size)&&((y_check+i)>=0)){
       counter_check=(y_check+i)*size+x_check+j;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 case 'l': if((x_count-type+1)<0){return -1;}
    x_check=x_count-type;
    y_check=y_count-1;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+j)<size)&&((x_check+j)>=0)&&((y_check+i)<size)&&((y_check+i)>=0)){
       counter_check=(y_check+i)*size+x_check+j;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 }
 return 0;
 }

canonical_original_code:
int ship_control(int *field, int size, int counter, int type, char direct){
int *pointer;
int i; int j;
int x_count;
int y_count;
int x_check;
int y_check;
int counter_check;
x_count=counter % size;
y_count=counter/size;
switch(direct){
 case 'o': if((y_count-type+1)<0){return -1;}
    x_check=x_count-1;
    y_check=y_count-type;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+i)<size)&&((x_check+i)>=0)&&((y_check+j)<size)&&((y_check+j)>=0)){
       counter_check=(y_check+j)*size+x_check+i;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 case 'u': if((y_count+type-1)>=size){return -1;}
     x_check=x_count-1;
     y_check=y_count-1;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+i)<size)&&((x_check+i)>=0)&&((y_check+j)<size)&&((y_check+j)>=0)){
       counter_check=(y_check+j)*size+x_check+i;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 case 'r': if((x_count+type-1)>=size){return -1;}
    x_check=x_count-1;
    y_check=y_count-1;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+j)<size)&&((x_check+j)>=0)&&((y_check+i)<size)&&((y_check+i)>=0)){
       counter_check=(y_check+i)*size+x_check+j;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 case 'l': if((x_count-type+1)<0){return -1;}
    x_check=x_count-type;
    y_check=y_count-1;
    for(i=0;i<3;i++){
     for(j=0;j<type+2;j++){
      if(((x_check+j)<size)&&((x_check+j)>=0)&&((y_check+i)<size)&&((y_check+i)>=0)){
       counter_check=(y_check+i)*size+x_check+j;
       pointer=field+counter_check;
       if(*pointer!=0){return -1;};
       }
      }
     }
  break;
 }
 return 0;
 }

variable_types:
field
int *

variable_types: counter int

variable_types: type int

variable_types: direct char

variable_types:
pointer
int *

variable_types: j int


formuleSimpsonSinus

decompiled_code:
double __fastcall formuleSimpsonSinus(double a1, double a2)
{
double v3; // [rsp+8h] [rbp-20h]
double v5; // [rsp+10h] [rbp-18h]
double v6; // [rsp+18h] [rbp-10h]

v3 = sin(a1);
v6 = a1;
v5 = sin(0.5 * (a2 + a1));
return (v3 + 4.0 * v5 + sin(a2)) * ((a2 - v6) / 6.0);
}

canonical_decompiled_code:
double __fastcall func0(double a1, double a2)
{
double v3; // [rsp+8h] [rbp-20h]
double v5; // [rsp+10h] [rbp-18h]
double v6; // [rsp+18h] [rbp-10h]

v3 = sin(a1);
v6 = a1;
v5 = sin(0.5 * (a2 + a1));
return (v3 + 4.0 * v5 + sin(a2)) * ((a2 - v6) / 6.0);
}

original_code:
double formuleSimpsonSinus(double a, double b){
 return ( (b-a)/6 ) * ( sin(a) + 4*sin((a+b)/2) + sin(b) );
}

variable_types: a double

variable_types: b double

return_type: double


methodeSimpsonSinus

decompiled_code:
void __fastcall methodeSimpsonSinus(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = formuleSimpsonSinus(v3, v3 + i);
v3 = v3 + i;
}
}

canonical_decompiled_code:
void __fastcall func1(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = func0(v3, v3 + i);
v3 = v3 + i;
}
}

original_code:
double methodeSimpsonSinus(double a, double b, double nbPts){
 double integrale = 0.0;
 double i = a;
 double pas = (b-a)/ (2*nbPts);
 while(i <= b){
  integrale += formuleSimpsonSinus(i, i+pas);
  i+=pas;
 }
 return integrale;
}

variable_types: nbPts double

variable_types: integrale double

variable_types: i double

variable_types: pas double


formuleSimpsonRacineLn

decompiled_code:
double __fastcall formuleSimpsonRacineLn(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))racineLn)();
v4 = v3 + racineLn(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (racineLn(a2) + v4);
}

canonical_decompiled_code:
double __fastcall func2(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))racineLn)();
v4 = v3 + racineLn(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (racineLn(a2) + v4);
}

original_code:
double formuleSimpsonRacineLn(double a, double b){
 return ( (b-a)/6 ) * ( racineLn(a) + 4*racineLn((a+b)/2) + racineLn(b) );
}


methodeSimpsonRacineLn

decompiled_code:
void __fastcall methodeSimpsonRacineLn(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = formuleSimpsonRacineLn(v3, v3 + i);
v3 = v3 + i;
}
}

canonical_decompiled_code:
void __fastcall func3(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = func2(v3, v3 + i);
v3 = v3 + i;
}
}

original_code:
double methodeSimpsonRacineLn(double a, double b, double nbPts){
 double integrale = 0.0;
 double i = a;
 double pas = (b-a)/ (2*nbPts);
 while(i <= b){
  integrale += formuleSimpsonRacineLn(i, i+pas);
  i+=pas;
 }
 return integrale;
}


formuleSimpsonSinusCube

decompiled_code:
double __fastcall formuleSimpsonSinusCube(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))sinusCube)();
v4 = v3 + sinusCube(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (sinusCube(a2) + v4);
}

canonical_decompiled_code:
double __fastcall func4(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))sinusCube)();
v4 = v3 + sinusCube(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (sinusCube(a2) + v4);
}

original_code:
double formuleSimpsonSinusCube(double a, double b){
 return ( (b-a)/6 ) * ( sinusCube(a) + 4*sinusCube((a+b)/2) + sinusCube(b) );
}


methodeSimpsonSinusCube

decompiled_code:
void __fastcall methodeSimpsonSinusCube(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = formuleSimpsonSinusCube(v3, v3 + i);
v3 = v3 + i;
}
}

canonical_decompiled_code:
void __fastcall func5(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = func4(v3, v3 + i);
v3 = v3 + i;
}
}

original_code:
double methodeSimpsonSinusCube(double a, double b, double nbPts){
 double integrale = 0.0;
 double i = a;
 double pas = (b-a)/ (2*nbPts);
 while(i <= b){
  integrale += formuleSimpsonSinusCube(i, i+pas);
  i+=pas;
 }
 return integrale;
}


formuleSimpsonInverseTanExpQuatre

decompiled_code:
double __fastcall formuleSimpsonInverseTanExpQuatre(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))inverseTanExpQuatre)();
v4 = v3 + inverseTanExpQuatre(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (inverseTanExpQuatre(a2) + v4);
}

canonical_decompiled_code:
double __fastcall func6(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))inverseTanExpQuatre)();
v4 = v3 + inverseTanExpQuatre(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (inverseTanExpQuatre(a2) + v4);
}

original_code:
double formuleSimpsonInverseTanExpQuatre(double a, double b){
 return ( (b-a)/6 ) * ( inverseTanExpQuatre(a) + 4*inverseTanExpQuatre((a+b)/2) + inverseTanExpQuatre(b) );
}


methodeSimpsonInverseTanExpQuatre

decompiled_code:
void __fastcall methodeSimpsonInverseTanExpQuatre(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = formuleSimpsonInverseTanExpQuatre(v3, v3 + i);
v3 = v3 + i;
}
}

canonical_decompiled_code:
void __fastcall func7(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = func6(v3, v3 + i);
v3 = v3 + i;
}
}

original_code:
double methodeSimpsonInverseTanExpQuatre(double a, double b, double nbPts){
 double integrale = 0.0;
 double i = a;
 double pas = (b-a)/ (2*nbPts);
 while(i <= b){
  integrale += formuleSimpsonInverseTanExpQuatre(i, i+pas);
  i+=pas;
 }
 return integrale;
}


formuleSimpsonCosCarreExp

decompiled_code:
double __fastcall formuleSimpsonCosCarreExp(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))cosCarreExp)();
v4 = v3 + cosCarreExp(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (cosCarreExp(a2) + v4);
}

canonical_decompiled_code:
double __fastcall func8(double a1, double a2)
{
double v3; // [rsp+10h] [rbp-18h]
double v4; // [rsp+10h] [rbp-18h]

v3 = ((double (*)(void))cosCarreExp)();
v4 = v3 + cosCarreExp(0.5 * (a2 + a1)) * 4.0;
return (a2 - a1) / 6.0 * (cosCarreExp(a2) + v4);
}

original_code:
double formuleSimpsonCosCarreExp(double a, double b){
 return ( (b-a)/6 ) * ( cosCarreExp(a) + 4*cosCarreExp((a+b)/2) + cosCarreExp(b) );
}


methodeSimpsonCosCarreExp

decompiled_code:
void __fastcall methodeSimpsonCosCarreExp(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = formuleSimpsonCosCarreExp(v3, v3 + i);
v3 = v3 + i;
}
}

canonical_decompiled_code:
void __fastcall func9(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // xmm0_8
double i; // [rsp+10h] [rbp-10h]

v3 = a1;
v4 = (a2 - a1) / (a3 + a3);
v5 = 0.0;
for ( i = v4; a2 >= v3; v5 = v5 + v6 )
{
v6 = func8(v3, v3 + i);
v3 = v3 + i;
}
}

original_code:
double methodeSimpsonCosCarreExp(double a, double b, double nbPts){
 double integrale = 0.0;
 double i = a;
 double pas = (b-a)/ (2*nbPts);
 while(i <= b){
  integrale += formuleSimpsonCosCarreExp(i, i+pas);
  i+=pas;
 }
 return integrale;
}


formuleSimpsonPolynome

decompiled_code:
double __fastcall formuleSimpsonPolynome(__int64 a1, unsigned int a2, double a3, double a4)
{
double v5; // [rsp+10h] [rbp-28h]
double v6; // [rsp+10h] [rbp-28h]

v5 = ((double (*)(void))polynome)();
v6 = v5 + polynome(a1, a2, 0.5 * (a4 + a3)) * 4.0;
return (a4 - a3) / 6.0 * (polynome(a1, a2, a4) + v6);
}

canonical_decompiled_code:
double __fastcall func10(__int64 a1, unsigned int a2, double a3, double a4)
{
double v5; // [rsp+10h] [rbp-28h]
double v6; // [rsp+10h] [rbp-28h]

v5 = ((double (*)(void))polynome)();
v6 = v5 + polynome(a1, a2, 0.5 * (a4 + a3)) * 4.0;
return (a4 - a3) / 6.0 * (polynome(a1, a2, a4) + v6);
}

original_code:
double formuleSimpsonPolynome(double a, double b, double coef[], int degre){
 return ( (b-a)/6 ) * ( polynome(a, coef, degre) + 4*polynome((a+b)/2, coef, degre) + polynome(b, coef, degre) );
}

variable_types:
coef
double []

variable_types: degre int


methodeSimpsonPolynome

decompiled_code:
void __fastcall methodeSimpsonPolynome(__int64 a1, unsigned int a2, double a3, double a4, double a5)
{
double v5; // xmm3_8
double v6; // xmm0_8
double v7; // xmm2_8
double v8; // xmm0_8
double i; // [rsp+10h] [rbp-20h]

v5 = a3;
v6 = (a4 - a3) / (a5 + a5);
v7 = 0.0;
for ( i = v6; a4 >= v5; v7 = v7 + v8 )
{
v8 = formuleSimpsonPolynome(a1, a2, v5, v5 + i);
v5 = v5 + i;
}
}

canonical_decompiled_code:
void __fastcall func11(__int64 a1, unsigned int a2, double a3, double a4, double a5)
{
double v5; // xmm3_8
double v6; // xmm0_8
double v7; // xmm2_8
double v8; // xmm0_8
double i; // [rsp+10h] [rbp-20h]

v5 = a3;
v6 = (a4 - a3) / (a5 + a5);
v7 = 0.0;
for ( i = v6; a4 >= v5; v7 = v7 + v8 )
{
v8 = func10(a1, a2, v5, v5 + i);
v5 = v5 + i;
}
}

original_code:
double methodeSimpsonPolynome(double a, double b, double nbPts, double coef[], int degre){
 double integrale = 0.0;
 double i = a;
 double pas = (b-a)/ (2*nbPts);
 while(i <= b){
  integrale += formuleSimpsonPolynome(i, i+pas, coef, degre);
  i+=pas;
 }
 return integrale;
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *i; // rdi
int v4; // eax
double v5; // xmm0_8
void *v6; // r12
double v7; // xmm0_8
double v8; // xmm4_8
double v9; // xmm1_8
char *v11; // rax
char *v12; // rbp
int v13; // ebx
__int64 v14; // rsi
double v15; // xmm0_8
double v16; // xmm0_8
double v17; // xmm0_8
double v18; // xmm0_8
double v19; // xmm0_8
double v20; // [rsp+0h] [rbp-48h]
double v21; // [rsp+0h] [rbp-48h]
double v22; // [rsp+0h] [rbp-48h]
double v23; // [rsp+0h] [rbp-48h]
double v24; // [rsp+0h] [rbp-48h]
double v25; // [rsp+0h] [rbp-48h]
double v26; // [rsp+0h] [rbp-48h]
int v27; // [rsp+14h] [rbp-34h] BYREF
int v28; // [rsp+18h] [rbp-30h] BYREF
int v29; // [rsp+1Ch] [rbp-2Ch] BYREF
double v30; // [rsp+20h] [rbp-28h] BYREF
double v31[4]; // [rsp+28h] [rbp-20h] BYREF

v27 = 0;
v28 = 0;
v30 = 0.0;
v31[0] = 0.0;
v29 = 0;
puts("\n--------------------------------------------------------");
puts(aCalculDeLAppro);
puts("--------------------------------------------------------\n");
for ( i = (const char *)&unk_C8; ; i = "Choix incorrect, veuillez recommencer\n" )
{
puts(i);
v4 = v27;
if ( (unsigned int)(v27 - 1) <= 6 )
break;
puts("\nVoulez-vous :\n");
printf(format, 1LL);
puts(aOuCalculerLInt);
printf(" %d. sin(x)\n", 2LL);
printf(" %d. ln(x)^1/2\n", 3LL);
printf(aDSin, 4LL);
printf(aD1Tan, 5LL);
printf(aDCos, 6LL);
printf(" %d. Quitter le programme\n\n", 7LL);
printf("Votre choix : ");
argv = (const char **)&v27;
_isoc99_scanf("%d", &v27);
v4 = v27;
if ( (unsigned int)(v27 - 1) <= 6 )
break;
}
if ( v4 == 7 )
{
puts("Au revoir !\n");
exit(1);
}
puts(aVeuillezMainte);
printf(aBorneInf, argv);
_isoc99_scanf("%lf", &v30);
printf(aBorneSup);
_isoc99_scanf("%lf", v31);
v5 = v31[0];
if ( v30 > v31[0] )
{
v31[0] = v30;
v30 = v5;
}
printf(aNombreDeSousIn);
_isoc99_scanf("%d", &v29);
switch ( v27 )
{
case 1:
printf(aEntrezLeDegr_0);
while ( 1 )
{
_isoc99_scanf("%d", &v28);
if ( v28 >= 0 )
break;
puts(aDegr);
printf(aEntrezLeDegr);
}
v11 = (char *)malloc(8LL * (v28 + 1));
v6 = v11;
if ( v28 >= 0 )
{
v12 = v11;
v13 = 0;
do
{
v14 = (unsigned int)v13++;
printf(aSaisissezLeCoe, v14);
_isoc99_scanf("%lf", v12);
v12 += 8;
}
while ( v28 >= v13 );
}
v21 = methodeSimpsonPolynome(v6, v30, v31[0], (double)v29);
v15 = methodeRombergPolynome(v6, (unsigned int)v28, v30, v31[0], 15.0, 15.0);
v8 = v21;
v9 = v15;
break;
case 2:
v6 = 0LL;
v22 = methodeSimpsonSinus(v30, v31[0], (double)v29);
v16 = methodeRombergSinus(v30, v31[0], 15.0, 15.0);
v8 = v22;
v9 = v16;
break;
case 3:
if ( v30 <= 0.0 || v31[0] <= 0.0 )
goto LABEL_27;
v6 = 0LL;
v26 = methodeSimpsonRacineLn(v30, v31[0], (double)v29);
v19 = methodeRombergRacineLn(v30, v31[0], 15.0, 15.0);
v8 = v26;
v9 = v19;
break;
case 4:
v6 = 0LL;
v23 = methodeSimpsonSinusCube(v30, v31[0], (double)v29);
v17 = methodeRombergSinusCube(v30, v31[0], 15.0, 15.0);
v8 = v23;
v9 = v17;
break;
case 5:
if ( v30 <= 0.0 && v31[0] >= 0.0 )
{
LABEL_27:
v6 = 0LL;
puts("Votre intervalle contient une valeur interdite !");
v9 = 0.0;
v8 = 0.0;
}
else
{
v6 = 0LL;
v24 = methodeSimpsonInverseTanExpQuatre(v30, v31[0], (double)v29);
v18 = methodeRombergInverseTanExpQuatre(v30, v31[0], 15.0, 15.0);
v8 = v24;
v9 = v18;
}
break;
case 6:
v6 = 0LL;
v20 = methodeSimpsonCosCarreExp(v30, v31[0], (double)v29);
v7 = methodeRombergCosCarreExp(v30, v31[0], 15.0, 15.0);
v8 = v20;
v9 = v7;
break;
default:
v6 = 0LL;
printf("Choix incorrect");
v9 = 0.0;
v8 = 0.0;
break;
}
if ( v27 == 1 )
{
v25 = v8;
free(v6);
v8 = v25;
}
printf(aLInt, v8);
printf(aLInt_0, v9);
return 0;
}

original_code:
int main(int argc, char *argv[]){
 int fonction = 0;
 int saisieCorrecte = 0;
 double *polynome = ((void *)0);
 int degre = 0;
 int cpt = 0;
 double integrale_s = 0.0;
 double integrale_r = 0.0;
 double temp = 0.0;
 double borneInf = 0.0;
 double borneSup = 0.0;
 int nbPts = 0;
 printf("\n--------------------------------------------------------\n");
 printf("-      Calcul de l'approximation d'une intégrale       -\n");
 printf("--------------------------------------------------------\n\n");
 printf("Appuyer sur le numéro correspondant à votre choix\n");
 while ( (fonction > 7 || fonction < 1) && (!saisieCorrecte) ) {
  printf("\nVoulez-vous :\n\n");
  printf("  %d. Entrez le polynôme de votre choix\n\n", 1);
  printf("...ou calculer l'intégrale d'une fonction prédéfinie : \n\n");
  printf("  %d. sin(x)\n", 2);
  printf("  %d. ln(x)^1/2\n", 3);
  printf("  %d. sin³(x)\n", 4);
  printf("  %d. 1/tan⁴(x)\n", 5);
  printf("  %d. cos²(x)*exp(x)\n", 6);
  printf("  %d. Quitter le programme\n\n", 7);
  printf("Votre choix : ");
  scanf("%d", &fonction);
  if (fonction > 7 || fonction < 1)
   printf("Choix incorrect, veuillez recommencer\n\n");
  else
   saisieCorrecte = 1;
 }
 if (fonction == 7){
  printf("Au revoir !\n\n");
  exit(1);
 }
 printf("Veuillez maintenant entrer les bornes de l'intervalle sur lequel vous voulez intégrer, ainsi que le nombre de sous-intervalles\n");
 printf("Borne inférieure : ");
 scanf("%lf", &borneInf);
 printf("Borne supérieure : ");
 scanf("%lf", &borneSup);
 if (borneSup < borneInf){
  temp = borneSup;
  borneSup = borneInf;
  borneInf = temp;
 }
 printf("Nombre de sous-intervalles (valeur max conseillée = 1 000 000) : ");
 scanf("%d", &nbPts);
 switch (fonction) {
  case 1 :
   printf("\nEntrez le degré de votre polynôme : ");
   scanf("%d", &degre);
   while(degre < 0){
    printf("Degré de polynôme incorrect\n");
    printf("Entrez le degré de votre polynôme : ");
    scanf("%d", &degre);
   }
   polynome = malloc( sizeof(double)* (degre + 1) );
   for (cpt = 0; cpt<=degre; cpt++){
    printf("Saisissez le coefficicent du terme de degré %d\n", cpt);
    scanf("%lf", &polynome[cpt]);
   }
   integrale_s = methodeSimpsonPolynome(borneInf, borneSup, nbPts, polynome, degre);
   integrale_r = methodeRombergPolynome(borneInf, borneSup, 15, 15, polynome, degre);
   break;
  case 2 :
   integrale_s = methodeSimpsonSinus(borneInf, borneSup, nbPts);
   integrale_r = methodeRombergSinus(borneInf, borneSup, 15, 15);
   break;
  case 3 :
   if (borneInf <= 0 || borneSup <= 0)
    printf("Votre intervalle contient une valeur interdite !\n");
   else{
    integrale_s = methodeSimpsonRacineLn(borneInf, borneSup, nbPts);
    integrale_r = methodeRombergRacineLn(borneInf, borneSup, 15, 15);
   }
   break;
  case 4 :
   integrale_s = methodeSimpsonSinusCube(borneInf, borneSup, nbPts);
   integrale_r = methodeRombergSinusCube(borneInf, borneSup, 15, 15);
   break;
  case 5 :
   if (borneInf <= 0 && borneSup >= 0)
    printf("Votre intervalle contient une valeur interdite !\n");
   else{
    integrale_s = methodeSimpsonInverseTanExpQuatre(borneInf, borneSup, nbPts);
    integrale_r = methodeRombergInverseTanExpQuatre(borneInf, borneSup, 15, 15);
   }
   break;
  case 6 :
   integrale_s = methodeSimpsonCosCarreExp(borneInf, borneSup, nbPts);
   integrale_r = methodeRombergCosCarreExp(borneInf, borneSup, 15, 15);
   break;
  default :
   printf("Choix incorrect");
 }
 if (fonction == 1)
  free(polynome);
 printf("\nL'intégrale de votre fonction, calculée avec la méthode Simpson, vaut %g\n", integrale_s);
 printf("L'intégrale de votre fonction, calculée avec la méthode Romberg, vaut %g\n", integrale_r);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: fonction int

variable_types: saisieCorrecte int

variable_types:
polynome
double *

variable_types: cpt int

variable_types: temp double

variable_types: borneInf double

variable_types: borneSup double

variable_types: nbPts int

return_type: int


methodeTrapezeSinus

decompiled_code:
double __fastcall methodeTrapezeSinus(double a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm3_8
double v6; // xmm2_8
double v7; // xmm4_8
double v8; // xmm0_8
double v10; // [rsp+8h] [rbp-20h]
double v11; // [rsp+8h] [rbp-20h]
double v12; // [rsp+10h] [rbp-18h]

v12 = (a2 - a1) / a3;
v10 = sin(a1);
v3 = sin(a2);
v4 = a2 + v12;
v5 = a1;
v6 = v10;
v7 = (v3 + v10) * 0.5;
if ( v4 >= a1 )
{
while ( 1 )
{
v5 = v5 + v12;
v7 = v7 + v6;
if ( v4 < v5 )
break;
v11 = v7;
v8 = sin(v5);
v7 = v11;
v6 = v8;
}
}
return v12 * v7;
}

canonical_decompiled_code:
double __fastcall func0(double a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm3_8
double v6; // xmm2_8
double v7; // xmm4_8
double v8; // xmm0_8
double v10; // [rsp+8h] [rbp-20h]
double v11; // [rsp+8h] [rbp-20h]
double v12; // [rsp+10h] [rbp-18h]

v12 = (a2 - a1) / a3;
v10 = sin(a1);
v3 = sin(a2);
v4 = a2 + v12;
v5 = a1;
v6 = v10;
v7 = (v3 + v10) * 0.5;
if ( v4 >= a1 )
{
while ( 1 )
{
v5 = v5 + v12;
v7 = v7 + v6;
if ( v4 < v5 )
break;
v11 = v7;
v8 = sin(v5);
v7 = v11;
v6 = v8;
}
}
return v12 * v7;
}

original_code:
double methodeTrapezeSinus(double a, double b, double nbPts){
 double pas = (b-a)/nbPts;
 double integrale = ( sin(a) + sin(b) )/2;
 double cpt;
 for (cpt=a; cpt <= b+pas; cpt+=pas)
  integrale += sin(cpt);
 return integrale*pas;
}

variable_types: a double

variable_types: b double

variable_types: cpt double


methodeTrapezeRacineLn

decompiled_code:
double __fastcall methodeTrapezeRacineLn(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm6_8
double v5; // rbx
double v6; // xmm1_8
double v7; // xmm0_8

v3 = a1;
v4 = (a2 - a1) / a3;
v5 = a2 + v4;
v6 = 0.0;
if ( v5 >= a1 )
{
do
{
v7 = racineLn(v3);
v3 = v3 + v4;
v6 = v6 + v7;
}
while ( v5 >= v3 );
}
return v4 * v6;
}

canonical_decompiled_code:
double __fastcall func1(double a1, double a2, double a3)
{
double v3; // xmm3_8
double v4; // xmm6_8
double v5; // rbx
double v6; // xmm1_8
double v7; // xmm0_8

v3 = a1;
v4 = (a2 - a1) / a3;
v5 = a2 + v4;
v6 = 0.0;
if ( v5 >= a1 )
{
do
{
v7 = racineLn(v3);
v3 = v3 + v4;
v6 = v6 + v7;
}
while ( v5 >= v3 );
}
return v4 * v6;
}

original_code:
double methodeTrapezeRacineLn(double a, double b, double nbPts){
 double pas = (b-a)/nbPts;
 double integrale = 0;
 double cpt;
 for (cpt=a; cpt <= b+pas; cpt+=pas)
  integrale += racineLn(cpt);
 return integrale*pas;
}

variable_types: nbPts double

variable_types: integrale double


methodeTrapezeSinusCube

decompiled_code:
double __fastcall methodeTrapezeSinusCube(int a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double i; // xmm3_8
double v7; // xmm0_8
double v9; // [rsp+0h] [rbp-28h]
double v10; // [rsp+10h] [rbp-18h]

v10 = (a3 - a2) / (double)a1;
v9 = sinusCube(a2);
v3 = sinusCube(a3);
v4 = a3 + v10;
v5 = a2;
for ( i = 0.5 * (v9 + v3); v4 >= v5; i = i + v7 )
{
v7 = sinusCube(v5);
v5 = v5 + v10;
}
return v10 * i;
}

canonical_decompiled_code:
double __fastcall func2(int a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double i; // xmm3_8
double v7; // xmm0_8
double v9; // [rsp+0h] [rbp-28h]
double v10; // [rsp+10h] [rbp-18h]

v10 = (a3 - a2) / (double)a1;
v9 = sinusCube(a2);
v3 = sinusCube(a3);
v4 = a3 + v10;
v5 = a2;
for ( i = 0.5 * (v9 + v3); v4 >= v5; i = i + v7 )
{
v7 = sinusCube(v5);
v5 = v5 + v10;
}
return v10 * i;
}

original_code:
double methodeTrapezeSinusCube(double a, double b, int nbPts){
 double pas = (b-a)/nbPts;
 double integrale = ( sinusCube(a) + sinusCube(b) )/2;
 double cpt;
 for (cpt=a; cpt <= b+pas; cpt+=pas)
  integrale += sinusCube(cpt);
 return integrale*pas;
}

variable_types: pas double


methodeTrapezeInverseTanExpQuatre

decompiled_code:
double __fastcall methodeTrapezeInverseTanExpQuatre(int a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double i; // xmm3_8
double v7; // xmm0_8
double v9; // [rsp+0h] [rbp-28h]
double v10; // [rsp+10h] [rbp-18h]

v10 = (a3 - a2) / (double)a1;
v9 = inverseTanExpQuatre(a2);
v3 = inverseTanExpQuatre(a3);
v4 = a3 + v10;
v5 = a2;
for ( i = 0.5 * (v9 + v3); v4 >= v5; i = i + v7 )
{
v7 = inverseTanExpQuatre(v5);
v5 = v5 + v10;
}
return v10 * i;
}

canonical_decompiled_code:
double __fastcall func3(int a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double i; // xmm3_8
double v7; // xmm0_8
double v9; // [rsp+0h] [rbp-28h]
double v10; // [rsp+10h] [rbp-18h]

v10 = (a3 - a2) / (double)a1;
v9 = inverseTanExpQuatre(a2);
v3 = inverseTanExpQuatre(a3);
v4 = a3 + v10;
v5 = a2;
for ( i = 0.5 * (v9 + v3); v4 >= v5; i = i + v7 )
{
v7 = inverseTanExpQuatre(v5);
v5 = v5 + v10;
}
return v10 * i;
}

original_code:
double methodeTrapezeInverseTanExpQuatre(double a, double b, int nbPts){
 double pas = (b-a)/nbPts;
 double integrale = ( inverseTanExpQuatre(a) + inverseTanExpQuatre(b) )/2;
 double cpt;
 for (cpt=a; cpt <= b+pas; cpt+=pas)
  integrale += inverseTanExpQuatre(cpt);
 return integrale*pas;
}


methodeTrapezeCosCarreExp

decompiled_code:
double __fastcall methodeTrapezeCosCarreExp(int a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double i; // xmm3_8
double v7; // xmm0_8
double v9; // [rsp+0h] [rbp-28h]
double v10; // [rsp+10h] [rbp-18h]

v10 = (a3 - a2) / (double)a1;
v9 = cosCarreExp(a2);
v3 = cosCarreExp(a3);
v4 = a3 + v10;
v5 = a2;
for ( i = 0.5 * (v9 + v3); v4 >= v5; i = i + v7 )
{
v7 = cosCarreExp(v5);
v5 = v5 + v10;
}
return v10 * i;
}

canonical_decompiled_code:
double __fastcall func4(int a1, double a2, double a3)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double i; // xmm3_8
double v7; // xmm0_8
double v9; // [rsp+0h] [rbp-28h]
double v10; // [rsp+10h] [rbp-18h]

v10 = (a3 - a2) / (double)a1;
v9 = cosCarreExp(a2);
v3 = cosCarreExp(a3);
v4 = a3 + v10;
v5 = a2;
for ( i = 0.5 * (v9 + v3); v4 >= v5; i = i + v7 )
{
v7 = cosCarreExp(v5);
v5 = v5 + v10;
}
return v10 * i;
}

original_code:
double methodeTrapezeCosCarreExp(double a, double b, int nbPts){
 double pas = (b-a)/nbPts;
 double integrale = ( cosCarreExp(a) + cosCarreExp(b) )/2;
 double cpt;
 for (cpt=a; cpt <= b+pas; cpt+=pas)
  integrale += cosCarreExp(cpt);
 return integrale*pas;
}


methodeTrapezePolynome

decompiled_code:
void __fastcall methodeTrapezePolynome(int a1, __int64 a2, unsigned int a3, double a4, double a5)
{
double v6; // xmm0_8
double v7; // xmm1_8
double v8; // xmm2_8
double i; // xmm3_8
double v10; // xmm0_8
double v11; // [rsp+0h] [rbp-38h]
double v12; // [rsp+10h] [rbp-28h]

v12 = (a5 - a4) / (double)a1;
v11 = polynome(a2, a3, a4);
v6 = polynome(a2, a3, a5);
v7 = a5 + v12;
v8 = a4;
for ( i = 0.5 * (v11 + v6); v7 >= v8; i = i + v10 )
{
v10 = polynome(a2, a3, v8);
v8 = v8 + v12;
}
}

canonical_decompiled_code:
void __fastcall func5(int a1, __int64 a2, unsigned int a3, double a4, double a5)
{
double v6; // xmm0_8
double v7; // xmm1_8
double v8; // xmm2_8
double i; // xmm3_8
double v10; // xmm0_8
double v11; // [rsp+0h] [rbp-38h]
double v12; // [rsp+10h] [rbp-28h]

v12 = (a5 - a4) / (double)a1;
v11 = polynome(a2, a3, a4);
v6 = polynome(a2, a3, a5);
v7 = a5 + v12;
v8 = a4;
for ( i = 0.5 * (v11 + v6); v7 >= v8; i = i + v10 )
{
v10 = polynome(a2, a3, v8);
v8 = v8 + v12;
}
}

original_code:
double methodeTrapezePolynome(double a, double b, int nbPts, double coef[], int degre){
 double pas = (b-a)/nbPts;
 double integrale = ( polynome(a, coef, degre) + polynome(b, coef, degre) )/2;
 double cpt;
 for (cpt=a; cpt <= b+pas; cpt+=pas)
  integrale += polynome(cpt, coef, degre);
 return integrale*pas;
}

variable_types:
coef
double []

variable_types: degre int


racineLn

decompiled_code:
void __fastcall racineLn(double a1)
{
double v1; // xmm0_8

if ( a1 <= 0.0 )
{
puts("Valeur interdite !");
}
else
{
v1 = log(a1);
if ( v1 < 0.0 )
sqrt(v1);
}
}

canonical_decompiled_code:
void __fastcall func0(double a1)
{
double v1; // xmm0_8

if ( a1 <= 0.0 )
{
puts("Valeur interdite !");
}
else
{
v1 = log(a1);
if ( v1 < 0.0 )
sqrt(v1);
}
}

original_code:
double racineLn(double x){
 double valeur = 0.0;
 if (x <= 0)
  printf("Valeur interdite !\n");
 else
  valeur = sqrt( log(x) );
 return valeur;
}

variable_types: x double

variable_types: valeur double


sinusCube

decompiled_code:
void __fastcall sinusCube(double a1)
{
double v1; // xmm0_8

v1 = sin(a1);
pow(v1, 3.0);
}

canonical_decompiled_code:
void __fastcall func1(double a1)
{
double v1; // xmm0_8

v1 = sin(a1);
pow(v1, 3.0);
}

original_code:
double sinusCube(double x){
 return pow( sin(x), 3);
}


inverseTanExpQuatre

decompiled_code:
double __fastcall inverseTanExpQuatre(double a1)
{
double result; // xmm0_8
double v2; // xmm0_8

if ( a1 == 0.0 )
{
puts("Valeur interdite !");
result = 0.0;
}
else
{
v2 = tan(a1);
result = 1.0 / pow(v2, 4.0);
}
return result;
}

canonical_decompiled_code:
double __fastcall func2(double a1)
{
double result; // xmm0_8
double v2; // xmm0_8

if ( a1 == 0.0 )
{
puts("Valeur interdite !");
result = 0.0;
}
else
{
v2 = tan(a1);
result = 1.0 / pow(v2, 4.0);
}
return result;
}

original_code:
double inverseTanExpQuatre(double x){
 double valeur = 0.0;
 if (x == 0.0)
  printf("Valeur interdite !\n");
 else
  valeur = 1/pow( tan(x), 4);
 return valeur;
}


cosCarreExp

decompiled_code:
double __fastcall cosCarreExp(double a1)
{
double v2; // [rsp+0h] [rbp-18h]

v2 = cos(a1);
return exp(a1) * (v2 * v2);
}

canonical_decompiled_code:
double __fastcall func3(double a1)
{
double v2; // [rsp+0h] [rbp-18h]

v2 = cos(a1);
return exp(a1) * (v2 * v2);
}

original_code:
double cosCarreExp(double x){
 return pow( cos(x), 2 )* exp(x);
}


polynome

decompiled_code:
double __fastcall polynome(__int64 a1, int a2, double a3)
{
double v3; // xmm2_8
__int64 v5; // rbx
double v6; // xmm0_8
__int64 v7; // rax
double v9; // [rsp+0h] [rbp-38h]

if ( a2 < 0 )
return 0.0;
v3 = 0.0;
v5 = 0LL;
do
{
v9 = *(double *)(a1 + 8 * v5);
v6 = pow(a3, (double)(int)v5);
v7 = v5++;
v3 = v3 + v6 * v9;
}
while ( v7 != a2 );
return v3;
}

canonical_decompiled_code:
double __fastcall func4(__int64 a1, int a2, double a3)
{
double v3; // xmm2_8
__int64 v5; // rbx
double v6; // xmm0_8
__int64 v7; // rax
double v9; // [rsp+0h] [rbp-38h]

if ( a2 < 0 )
return 0.0;
v3 = 0.0;
v5 = 0LL;
do
{
v9 = *(double *)(a1 + 8 * v5);
v6 = pow(a3, (double)(int)v5);
v7 = v5++;
v3 = v3 + v6 * v9;
}
while ( v7 != a2 );
return v3;
}

original_code:
double polynome(double x, double coef[], int degre){
 int cpt;
 double polynome = 0;
 for (cpt = 0; cpt <= degre; cpt++)
  polynome += ( coef[cpt] * pow(x, cpt) );
 return polynome;
}

variable_types: polynome double


methodeRombergSinus

decompiled_code:
void __fastcall methodeRombergSinus(double a1, double a2, double a3, double a4)
{
double v5; // xmm2_8

if ( a3 <= 0.0 )
{
v5 = pow(2.0, a4);
methodeTrapezeSinus(a1, a2, v5);
}
else
{
pow(4.0, a3);
methodeRombergSinus(a1, a2);
methodeRombergSinus(a1, a2);
pow(4.0, a3);
}
}

canonical_decompiled_code:
void __fastcall func0(double a1, double a2, double a3, double a4)
{
double v5; // xmm2_8

if ( a3 <= 0.0 )
{
v5 = pow(2.0, a4);
methodeTrapezeSinus(a1, a2, v5);
}
else
{
pow(4.0, a3);
func0(a1, a2);
func0(a1, a2);
pow(4.0, a3);
}
}

original_code:
double methodeRombergSinus(double a, double b, double i, double precision){
 if (i <= 0)
  return methodeTrapezeSinus(a, b, pow(2, precision) );
 else
  return ( pow(4, i) * methodeRombergSinus(a, b, i-1, precision) - methodeRombergSinus(a, b, i-1, precision-1) ) / ( pow(4, i) - 1 );
}

variable_types: i double

variable_types: precision double


methodeRombergRacineLn

decompiled_code:
void __fastcall methodeRombergRacineLn(double a1, double a2, double a3, double a4)
{
double v5; // xmm2_8

if ( a3 <= 0.0 )
{
v5 = pow(2.0, a4);
methodeTrapezeRacineLn(a1, a2, v5);
}
else
{
pow(4.0, a3);
methodeRombergRacineLn(a1, a2);
methodeRombergRacineLn(a1, a2);
pow(4.0, a3);
}
}

canonical_decompiled_code:
void __fastcall func1(double a1, double a2, double a3, double a4)
{
double v5; // xmm2_8

if ( a3 <= 0.0 )
{
v5 = pow(2.0, a4);
methodeTrapezeRacineLn(a1, a2, v5);
}
else
{
pow(4.0, a3);
func1(a1, a2);
func1(a1, a2);
pow(4.0, a3);
}
}

original_code:
double methodeRombergRacineLn(double a, double b, double i, double precision){
 if (i <= 0)
  return methodeTrapezeRacineLn(a, b, pow(2, precision) );
 else
  return ( pow(4, i) * methodeRombergRacineLn(a, b, i-1, precision) - methodeRombergRacineLn(a, b, i-1, precision-1) ) / ( pow(4, i) - 1 );
}


methodeRombergSinusCube

decompiled_code:
void __fastcall methodeRombergSinusCube(double a1, double a2, double a3, double a4)
{
__int64 v5; // rdi

if ( a3 <= 0.0 )
{
v5 = (unsigned int)(int)pow(2.0, a4);
methodeTrapezeSinusCube(v5, a1, a2);
}
else
{
pow(4.0, a3);
methodeRombergSinusCube(a1, a2);
methodeRombergSinusCube(a1, a2);
pow(4.0, a3);
}
}

canonical_decompiled_code:
void __fastcall func2(double a1, double a2, double a3, double a4)
{
__int64 v5; // rdi

if ( a3 <= 0.0 )
{
v5 = (unsigned int)(int)pow(2.0, a4);
methodeTrapezeSinusCube(v5, a1, a2);
}
else
{
pow(4.0, a3);
func2(a1, a2);
func2(a1, a2);
pow(4.0, a3);
}
}

original_code:
double methodeRombergSinusCube(double a, double b, double i, double precision){
 if (i <= 0)
  return methodeTrapezeSinusCube(a, b, pow(2, precision) );
 else
  return ( pow(4, i) * methodeRombergSinusCube(a, b, i-1, precision) - methodeRombergSinusCube(a, b, i-1, precision-1) ) / ( pow(4, i) - 1 );
}


methodeRombergInverseTanExpQuatre

decompiled_code:
void __fastcall methodeRombergInverseTanExpQuatre(double a1, double a2, double a3, double a4)
{
__int64 v5; // rdi

if ( a3 <= 0.0 )
{
v5 = (unsigned int)(int)pow(2.0, a4);
methodeTrapezeInverseTanExpQuatre(v5, a1, a2);
}
else
{
pow(4.0, a3);
methodeRombergInverseTanExpQuatre(a1, a2);
methodeRombergInverseTanExpQuatre(a1, a2);
pow(4.0, a3);
}
}

canonical_decompiled_code:
void __fastcall func3(double a1, double a2, double a3, double a4)
{
__int64 v5; // rdi

if ( a3 <= 0.0 )
{
v5 = (unsigned int)(int)pow(2.0, a4);
methodeTrapezeInverseTanExpQuatre(v5, a1, a2);
}
else
{
pow(4.0, a3);
func3(a1, a2);
func3(a1, a2);
pow(4.0, a3);
}
}

original_code:
double methodeRombergInverseTanExpQuatre(double a, double b, double i, double precision){
 if (i <= 0)
  return methodeTrapezeInverseTanExpQuatre(a, b, pow(2, precision) );
 else
  return ( pow(4, i) * methodeRombergInverseTanExpQuatre(a, b, i-1, precision) - methodeRombergInverseTanExpQuatre(a, b, i-1, precision-1) ) / ( pow(4, i) - 1 );
}


methodeRombergCosCarreExp

decompiled_code:
void __fastcall methodeRombergCosCarreExp(double a1, double a2, double a3, double a4)
{
__int64 v5; // rdi

if ( a3 <= 0.0 )
{
v5 = (unsigned int)(int)pow(2.0, a4);
methodeTrapezeCosCarreExp(v5, a1, a2);
}
else
{
pow(4.0, a3);
methodeRombergCosCarreExp(a1, a2);
methodeRombergCosCarreExp(a1, a2);
pow(4.0, a3);
}
}

canonical_decompiled_code:
void __fastcall func4(double a1, double a2, double a3, double a4)
{
__int64 v5; // rdi

if ( a3 <= 0.0 )
{
v5 = (unsigned int)(int)pow(2.0, a4);
methodeTrapezeCosCarreExp(v5, a1, a2);
}
else
{
pow(4.0, a3);
func4(a1, a2);
func4(a1, a2);
pow(4.0, a3);
}
}

original_code:
double methodeRombergCosCarreExp(double a, double b, double i, double precision){
 if (i <= 0)
  return methodeTrapezeCosCarreExp(a, b, pow(2, precision) );
 else
  return ( pow(4, i) * methodeRombergCosCarreExp(a, b, i-1, precision) - methodeRombergCosCarreExp(a, b, i-1, precision-1) ) / ( pow(4, i) - 1 );
}


methodeRombergPolynome

decompiled_code:
void __fastcall methodeRombergPolynome(__int64 a1, unsigned int a2, double a3, double a4, double a5, double a6)
{
double v7; // xmm0_8

if ( a5 <= 0.0 )
{
v7 = pow(2.0, a6);
methodeTrapezePolynome((unsigned int)(int)v7, a1, a2, a3, a4);
}
else
{
pow(4.0, a5);
methodeRombergPolynome(a1, a2, a3, a4);
methodeRombergPolynome(a1, a2, a3, a4);
pow(4.0, a5);
}
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1, unsigned int a2, double a3, double a4, double a5, double a6)
{
double v7; // xmm0_8

if ( a5 <= 0.0 )
{
v7 = pow(2.0, a6);
methodeTrapezePolynome((unsigned int)(int)v7, a1, a2, a3, a4);
}
else
{
pow(4.0, a5);
func5(a1, a2, a3, a4);
func5(a1, a2, a3, a4);
pow(4.0, a5);
}
}

original_code:
double methodeRombergPolynome(double a, double b, double i, double precision, double coef[], int degre){
 if (i <= 0)
  return methodeTrapezePolynome(a, b, pow(2, precision), coef, degre );
 else
  return ( pow(4, i) * methodeRombergPolynome(a, b, i-1, precision, coef, degre) - methodeRombergPolynome(a, b, i-1, precision-1, coef, degre) ) / ( pow(4, i) - 1);
}


repo: TuckermanGroup/PINY

decompiled_code:
__int64 __fastcall control_pimd_trans_mode(__int64 a1, __int64 a2)
{
__int64 result; // rax

result = *(unsigned int *)(a2 + 60);
if ( *(_DWORD *)(a1 + 3232) == 1 )
{
if ( (_DWORD)result == 1 )
{
result = convert_pimd_mode_stag(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_mode_cent(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
}
else if ( (_DWORD)result == 1 )
{
result = convert_pimd_mode_stag_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_mode_cent_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 result; // rax

result = *(unsigned int *)(a2 + 60);
if ( *(_DWORD *)(a1 + 3232) == 1 )
{
if ( (_DWORD)result == 1 )
{
result = convert_pimd_mode_stag(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_mode_cent(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
}
else if ( (_DWORD)result == 1 )
{
result = convert_pimd_mode_stag_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_mode_cent_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
return result;
}

original_code:
void control_pimd_trans_mode(CLASS *class, GENERAL_DATA *general_data) {
  ("PI transformation - forward");
  if (class->communicate.np_beads == 1) {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_mode_stag(&class->clatoms_info,
                             class->clatoms_pos,
                             &class->clatoms_tran);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_mode_cent(&class->clatoms_info,
                             class->clatoms_pos,
                             &class->clatoms_tran);
    }
  } else {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_mode_stag_par(&class->clatoms_info,
                                 class->clatoms_pos,
                                 &class->clatoms_tran,
                                 &class->communicate);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_mode_cent_par(&class->clatoms_info,
                                 class->clatoms_pos,
                                 &class->clatoms_tran,
                                 &class->communicate);
    }
  }
  ("PI transformation - forward");
}

canonical_original_code:
void control_pimd_trans_mode(struct class *class, struct general_data *general_data) {
  ("PI transformation - forward");
  if (class->communicate.np_beads == 1) {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_mode_stag(&class->clatoms_info,
                             class->clatoms_pos,
                             &class->clatoms_tran);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_mode_cent(&class->clatoms_info,
                             class->clatoms_pos,
                             &class->clatoms_tran);
    }
  } else {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_mode_stag_par(&class->clatoms_info,
                                 class->clatoms_pos,
                                 &class->clatoms_tran,
                                 &class->communicate);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_mode_cent_par(&class->clatoms_info,
                                 class->clatoms_pos,
                                 &class->clatoms_tran,
                                 &class->communicate);
    }
  }
  ("PI transformation - forward");
}

variable_types: struct class { struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; } clatoms_info; struct clatoms_tran { int pi_beads_proc; int pi_atm_proc; int pi_atm_proc_use; int pi_proc_rem; int nwork; int *sendcounts; int *senddspls; int *ifax; double *rat1_stag; double *path_eig; double *work; double *work3; double *x_trans; double *x_temp; double *xt_temp; } clatoms_tran; struct clatoms_pos { double *mass; double *x; double *vx; double *fx; double *fxt; double *fxm; double *hess_xx; } *clatoms_pos; struct ghost_atoms { int nghost_tot; int natm_comp_max; int nghost_mall; int nghost_old; int ncomp_mall; int ncomp_old; int *ighost_map; int *natm_comp; int **iatm_comp; double **coef; } ghost_atoms; struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; } atommaps; struct therm_info { int num_nhc; int len_nhc; int nres_nhc; int nyosh_nhc; int therm_typ; int num_nhc_proc; int num_nhc_share; int mytherm_start; double dt_nhc; int *inhc_x; int *itherm_nshare; double *ditherm_nshare_i; int *map_share; double *text_nhc; double *wdti; double **mass_nhc; } therm_info_class; struct therm_info therm_info_bead; struct therm_pos { double **x_nhc; double x_nhc_tot; } therm_class; struct therm_pos *therm_bead; struct vel_samp_class { int ivel_smpl_on; int ivel_scale_on; int nvx_smpl; int nvx_scale; int nvnhc_smpl; int iseed; double qseed; } vel_samp_class; struct energy_ctrl { int pme_on; int int_res_ter; int isep_vvdw; int iswit_vdw; int block_std_on; int iget_pe_real_inter_freq; int iget_pe_real_inter; int itime; int iget_full_inter; int iget_full_intra; int iget_full_pimd; } energy_ctrl; struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist { int iver_init; int iver_fill; int nolst_ver_update; int jver_pad; int nmem_min_lst; int nver_lst; int nver_lst_res; int nver_lst_now; int nver_lst_now_res; int *nter; int *jter; int *jver_off; int *nter_res; int *jter_res; int *jver_off_res; double mem_safe; } verlist; struct lnklist { int ilnk_init; int lnk_for_odd; int ncell_div_avg; int lnk_excl_safe; int lnk_vol_safe; int ncell_a; int natm_cell_max; int lnk_list_dim; int nshft_lnk; int nshft_lnk_res; double vol_lnk_map; double rcut_max; int *lnk_list; int *ishft_a; int *iexl_chk; int *ishft_a_res; int *iexl_chk_res; int *natm_cell; double *shft_wght; double *shft_wght_res; double *hmat_lnk; } lnklist; struct brnch_root { int nbrnch_tot; int nroot_tot; int natm_add_tot; int nbrnch_root_max; double brnch_root_dist_max; double cutdif_min_brnch_root; double cutdif_min_brnch_brnch; double cutdif_min_brnch_root_res; double cutdif_min_brnch_brnch_res; double r2_nocheck_dist; double r2_nocheck_dist_res; double cutskin_bb_min; double cutskin_bb_min_res; int *brnch_atm_list; int *brnch_atm_root; int *root_atm_list; int *root_atm_map; int *brnch_atm_map; int *nbrnch_of_root_big; int *nbrnch_of_root; int **ibrnch_of_root; int *natm_add; int *iatm_add; int *iatm_add_off; } brnch_root; } nbr_list; struct interact { int nsplin; int iswit_vdw; int dielectric_opt; int ishave_opt; int nter_typ; int nsplin_tot; int ninter_mall; int nsplin_mall_tot; int *inter_map_index; double dielectric_rheal; double dielectric_cut; double dielectric_eps; double brnch_root_skin; double skin; double brnch_root_cut; double rheal_res; double pten_inter_guess; double pten_kin_guess; double clong; double clong_res; double spread_now; double spread_lnk; double brnch_root_skin_lnk; double cutoff_max; double *cutoff; double *cutoff_res; double *cutti; double *cutskin; double *cutskin_res; double *cutskin_root; double *cutskin_root_res; double *vcut_coul; double *rmin_spl; double *dr_spl; double *cv0; double *cdv0; double *cv0_c; double *cdv0_c; } interact; struct int_scr { double v_lnv; double *x; double *vx; double *gx; double **x_nhc; double *vgmat; double *x_vol_nhc; double *sc; double *sc_temp; double *atm_kin; double *step_up; struct therm_scr { double *sc; double *atm_kin; } *therm_scr; } int_scr; struct ewd_scr { double *q; double *x; double *fx; double *heli; double *cossc; double *fx2; double *temp; double *helr_now; } ewd_scr; struct for_scr { int nlen; int nsplin_t; int num_brk; int intact; double wght_lnk; double wght_ter; double wght_ter_res; double wght_tra; double wght_tra_res; double wght_pimd; int *j_indext; int *i_indext2; int *j_lnk; int *j_index; int *num_brk_i; int *iexcl; int *index_atm; } for_scr; double tot_memory; struct part_mesh { int pme_on; int kmax_pme; int n_interp; int pme_res_on; int kmax_pme_res; int n_interp_res; int pme_para_opt; int nlen_pme; int nktot_pme; int ngrid_a; int nktot_pme_res; int ngrid_a_res; int ninterp_mall; int ninterp_tot_mall; int *iatemp; int *nc; int **igrid_a; int **igrid_now; double ecut; double ecut_res; double *bweight_tot_res; double *bweight_tot; double *qgrid; double *qgrid_scr; double *qgrid_tmp_real; double *qgrid_tmp_imag; double *frac_a; double *aj; double **ua; double **mn_a; double **dmn_a; double **qgrid_now; } part_mesh; struct surface { int isurf_on; int natm_typ; int nsplin_surf; int nsplin_tot; double zheal; double surface_height; double *surface_pot; double *surface_forc; double *zcut_off; double *dz_spl; double *dzi_spl; double *zmin_spl; char surface_type[50]; } surface; struct communicate { int np_beads; int myid; int myid_bead_forc; int myid_bead; int myid_bead_prime; int myid_state; int myid_forc; int myid_forc_source; int myid_forc_target; int world; int comm_beads; int comm_beads_forc; int comm_states; int comm_forc; int comm_forc_source; int comm_forc_target; int comm_faux; } communicate; struct class_comm_forc_pkg { int num_proc; int myid; int myatm_start; int mytherm_start; int *displs_atm; int *displs_therm; int comm; int world; double dbl_num_proc; struct class_plimpton_ind { int num_proc_source; int num_proc_target; int myid_source; int myid_target; int natoms_tot; int *index_src; int *index_src_even; int *index_src_odd; int *index_trg; int *index_trg_even; int *index_trg_odd; int *displs_atm_trg; int *displs_atm_src; int *src_odd_end; int *src_even_end; int *trg_odd_end; int *trg_even_end; int *src_odd_begin; int *src_even_begin; int *trg_odd_begin; int *trg_even_begin; int my_src_odd_counts; int my_src_even_counts; int my_trg_odd_counts; int my_trg_even_counts; int *my_src_odd; int *my_src_even; int *my_trg_odd; int *my_trg_even; int **jmax; int *jmin; int **imax; int source; int target; } plimpton_ind; } class_comm_forc_pkg; } *

variable_types: struct general_data { struct simopts { int md; int pimd; int minimize; int cp; int cp_pimd; int cp_wave; int cp_wave_pimd; int cp_wave_min_pimd; int cp_min; int cp_wave_min; int debug; int debug_pimd; int debug_cp; int debug_cp_pimd; int pi_beads; int pi_md_typ; int initial_spread_opt; int anneal_opt; double ann_rate; double ann_start_temp; double ann_target_temp; } simopts; struct minopts { int min_std; int min_cg; int min_diis; int diis_hist_len; int cp_min_std; int cp_min_cg; int cp_min_diis; int cp_diis_hist_len; int cp_cg_line_min_len; int min_atm_com_fix_opt; double tol_coef; double tol_atom; } minopts; struct ensopts { int nve; } ensopts; struct filenames { char *iname; char *dname; char *dnamec; char *cpname; char *ksname; char *elfname; char *cvname; char *ccname; char *cpparname; char *centname; char *forcename; int low_lim_par; int high_lim_par; int iwrite_screen; int iwrite_inst; int iwrite_dump; int iwrite_kseigs; int iwrite_confv; int iwrite_confp; int iwrite_par_confp; int iwrite_confc; int iwrite_path_cent; int ifile_open; int iwrite_conf_binary; int iwrite_units; int iwrite_atm_for; int iwrite_elf; } filenames; struct statepoint { double pext; } statepoint; struct cell { int iperd; int intra_perds; int cubic_box_flag; int hmat_int_typ; int hmat_cons_typ; int imov_cp_box; double vol; double vol_cp; double vol0; double area; double alpha_conv_dual; double *hmat; double *hmat_ewd; double *hmat_cp; double *cp_box_center; double *cp_box_center_rel; double *cp_vbox_center; double *cp_fbox_center; } cell; struct timeinfo { int ntime; int ix_respa; int int_res_ter; int nres_ter; int int_res_tor; int int_res_pimd; int iget_pe_real_inter_freq; int exit_flag; double dt; } timeinfo; struct baro { int len_nhc; double x_lnv; double v_lnv_glob; double v_lnv_g; double f_lnv_p; double vol; double mass_lnv; double c2_lnv; double roll_scv; double roll_scg; double roll_scg0; double x_lnv_o; double v_lnv_g_wght; double area; double *x_vol_nhc; double *f_vol_nhc; double *hmato; } baro; struct par_rahman { double vol; double mass_hm; double c1_hm; double roll_scg; double roll_scg0; double area; double *vgmat; double *vgmat_glob; double *fgmat_p; double *roll_mtv; double *roll_mtvv; double *vtemps; double *vexpdt; double *vtempx; double *hmat_t; double *fv1; double *vgmat_g_wght; } par_rahman; struct ptens { double *tvten; double *pvten; double *pvten_inc; double *pvten_tmp_res; double *pvten_inc_t1; double *pvten_inc_a; double *pvten_inc_old; double *count_inc; double *pvten_inc_glob; double *pvten_mode; } ptens; struct stat_avg { int nexclt; int iter_shake; int iswit_vdw; int itime_update; int iter_shake_cp; int write_cp_atm_flag; double vintert; double vintrat; double vsurft; double vbondt; double vbend_bndt; double vbend_bnd_bond; double vbondt_watts; double vreal; double vvdw; double vlong; double vbond_free; double vbar_free; double kinet; double kinet_v; double vol; double kinet_nhc; double kinet_nhc_bead; double aikinet_nhc_bead; double akinet_nhc_bead; double vpot_v; double vpotnhc; double aiter_shake; double iter_23; double aiter_23; double aiter_21; double iter_23r; double aiter_23r; double aiter_21r; double acella; double aicella; double acellab; double aicellab; double apress; double press_inter; double apress_inter; double apress_intra; double press_kin; double apress_kin; double econv0; double cp_kconv0; double cpu1; double updates; double kinet_cp_up; double kinet_cp_dn; double kinet_cp; double kinet_nhc_cp; double vpotnhc_cp; double cp_ehart; double cp_eext; double cp_exc; double cp_muxc; double cp_eke; double cp_enl; double aiter_shake_cp; double maxfc; double pi_ke_prim; double api_ke_prim; double aipi_ke_prim; double kin_harm; double *apten; double fc_mag_up; double fc_max_up; double fatm_max; double count_diag_srot; double econv_now; double isokconv; } stat_avg; struct ewald { int nsplin_g; int nktot; int nktot_res; int nktot_mall; int nktot_res_mall; int nkc_max; int nkb_max; double alp_ewd; double self_erf; double ecut; double ecut_clus; double alp_clus; double gs_max; int *kastr; int *ibrk1; int *kastr_res; int *ibrk1_res; double *clus_corr_r; double *clus_corr_r_res; double *cvgs_2d0; double *vgc_1d_y; } ewald; struct para_fft_pkg3d { int nktot; int ncoef_use; int nfft_size; int nfft; int igeneric_opt; int scale_opt; int len_ifax; int nwork1; double ecut; int comm; int num_proc; int *map_proc; int *recv_counts_rho; int *recv_counts_coef; int *map_pme_dn; int *recvcounts_pme_dn; int *sendcounts_pme_dn; int *map_pme_up; int *recvcounts_pme_up; int *sendcounts_pme_up; int ndata_kc; int nkf3; int str_fft_kc_proc; int ska_fft_kc_proc; int skb_fft_kc_proc; int *sendcounts_fft_kc; int *recvcounts_fft_kc; int *sum_fft_kc_proc; int nka_fft_kc; int *ka_fft_kc; int *ifax_c_f; double *work_1c_f; double *work_1c_r; int ndata_kb; int nkf2; int str_fft_kb_proc; int ska_fft_kb_proc; int skc_fft_kb_proc; int *ska_fft_kb_proc_all; int *skc_fft_kb_proc_all; int *sendcounts_fft_kb; int *recvcounts_fft_kb; int *sum_fft_kb_proc; int *ifax_b_f; double *work_1b_f; double *work_1b_r; int ndata_ka; int nkf1; int str_fft_ka_proc; int skb_fft_ka_proc; int skc_fft_ka_proc; int *skb_fft_ka_proc_all; int *skc_fft_ka_proc_all; int *sendcounts_fft_ka; int *recvcounts_fft_ka; int *ifax_a_f; double *work_1a_f; double *work_1a_r; int *send_counts_row_big_small; int *recv_counts_row_big_small; int *sdispls_row_big_small; int *rdispls_row_big_small; int *send_counts_dual_map; int *recv_counts_dual_map; int *sdispls_dual_map; int *rdispls_dual_map; int *send_counts_row_big_small_upack; int *recv_counts_row_big_small_upack; int *sdispls_row_big_small_upack; int *rdispls_row_big_small_upack; int *send_counts_dual_map_upack; int *recv_counts_dual_map_upack; int *sdispls_dual_map_upack; int *rdispls_dual_map_upack; int *send_counts_ioff_big_small; int *recv_counts_ioff_big_small; int *sdispls_ioff_big_small; int *rdispls_ioff_big_small; } pme_fft_pkg; struct para_fft_pkg3d pme_res_fft_pkg; int error_check_on; } *

return_type: void

user_defined_types: struct class { struct clatoms_info clatoms_info; struct clatoms_tran clatoms_tran; struct clatoms_pos *clatoms_pos; struct ghost_atoms ghost_atoms; struct atommaps atommaps; struct therm_info therm_info_class; struct therm_info therm_info_bead; struct therm_pos therm_class; struct therm_pos *therm_bead; struct vel_samp_class vel_samp_class; struct energy_ctrl energy_ctrl; struct nbr_list nbr_list; struct interact interact; struct int_scr int_scr; struct ewd_scr ewd_scr; struct for_scr for_scr; double tot_memory; struct part_mesh part_mesh; struct surface surface; struct communicate communicate; struct class_comm_forc_pkg class_comm_forc_pkg; }

user_defined_types: struct general_data { struct simopts simopts; struct minopts minopts; struct ensopts ensopts; struct filenames filenames; struct statepoint statepoint; struct cell cell; struct timeinfo timeinfo; struct baro baro; struct par_rahman par_rahman; struct ptens ptens; struct stat_avg stat_avg; struct ewald ewald; struct para_fft_pkg3d pme_fft_pkg; struct para_fft_pkg3d pme_res_fft_pkg; int error_check_on; }

user_defined_types: struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist verlist; struct lnklist lnklist; struct brnch_root brnch_root; }

user_defined_types: struct int_scr { double v_lnv; double *x; double *vx; double *gx; double **x_nhc; double *vgmat; double *x_vol_nhc; double *sc; double *sc_temp; double *atm_kin; double *step_up; struct therm_scr *therm_scr; }

user_defined_types: struct class_comm_forc_pkg { int num_proc; int myid; int myatm_start; int mytherm_start; int *displs_atm; int *displs_therm; int comm; int world; double dbl_num_proc; struct class_plimpton_ind plimpton_ind; }


original_code:
void control_pimd_trans_pos(CLASS *class, GENERAL_DATA *general_data) {
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
  int i;
  double *xmod = class->clatoms_info.xmod;
  double *ymod = class->clatoms_info.ymod;
  double *zmod = class->clatoms_info.zmod;
  double *x = class->clatoms_pos[1].x;
  double *y = class->clatoms_pos[1].y;
  double *z = class->clatoms_pos[1].z;
  double *xtemp = class->ewd_scr.x;
  double *ytemp = class->ewd_scr.y;
  double *ztemp = class->ewd_scr.z;
  int natm_tot = class->clatoms_info.natm_tot;
  int myid_forc = class->communicate.myid_forc;
  int numproc = class->communicate.np_beads;
  int np_forc = class->communicate.np_forc;
  int pi_beads_proc_st = class->clatoms_info.pi_beads_proc_st;
  int myatm_start = class->clatoms_info.myatm_start;
  int myatm_end = class->clatoms_info.myatm_end;
  int *recv_count_atm = class->class_comm_forc_pkg.recv_count_atm;
  int *displs_atm = class->class_comm_forc_pkg.displs_atm;
  int comm_beads_forc = class->communicate.comm_beads_forc;
  int comm_forc = class->communicate.comm_forc;
  ("PI transformation - reverse");
  if (pi_beads_proc_st == 1) {
    for(i=myatm_start; i<=myatm_end; i++) {
      xmod[i] = x[i];
      ymod[i] = y[i];
      zmod[i] = z[i];
    }
  }
  if (numproc > 1) {
    Bcast(&(xmod[0]), natm_tot+1, MPI_DOUBLE, 0, comm_beads_forc);
    Bcast(&(ymod[0]), natm_tot+1, MPI_DOUBLE, 0, comm_beads_forc);
    Bcast(&(zmod[0]), natm_tot+1, MPI_DOUBLE, 0, comm_beads_forc);
  }
  if (np_forc > 1) {
    Allgatherv(&(xmod[myatm_start]), recv_count_atm[(myid_forc+1)],
               MPI_DOUBLE, &(xtemp[1]), &recv_count_atm[1], &displs_atm[1],
               MPI_DOUBLE, 0, comm_forc);
    Allgatherv(&(ymod[myatm_start]), recv_count_atm[(myid_forc+1)],
               MPI_DOUBLE, &(ytemp[1]), &recv_count_atm[1], &displs_atm[1],
               MPI_DOUBLE, 0, comm_forc);
    Allgatherv(&(zmod[myatm_start]), recv_count_atm[(myid_forc+1)],
               MPI_DOUBLE, &(ztemp[1]), &recv_count_atm[1], &displs_atm[1],
               MPI_DOUBLE, 0, comm_forc);
    for(i=1; i<=natm_tot; i++) {
      xmod[i] = xtemp[i];
      ymod[i] = ytemp[i];
      zmod[i] = ztemp[i];
    }
  }
  if (class->communicate.np_beads == 1) {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_pos_stag(&class->clatoms_info,
                            class->clatoms_pos,
                            &class->clatoms_tran);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_pos_cent(&class->clatoms_info,
                            class->clatoms_pos,
                            &class->clatoms_tran);
    }
  } else {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_pos_stag_par(&class->clatoms_info,
                                class->clatoms_pos,
                                &class->clatoms_tran,
                                &class->communicate);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_pos_cent_par(&class->clatoms_info,
                                class->clatoms_pos,
                                &class->clatoms_tran,
                                &class->communicate);
    }
  }
  ("PI transformation - reverse");
}

canonical_original_code:
void control_pimd_trans_pos(struct class *class, struct general_data *general_data) {
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
  int i;
  double *xmod = class->clatoms_info.xmod;
  double *ymod = class->clatoms_info.ymod;
  double *zmod = class->clatoms_info.zmod;
  double *x = class->clatoms_pos[1].x;
  double *y = class->clatoms_pos[1].y;
  double *z = class->clatoms_pos[1].z;
  double *xtemp = class->ewd_scr.x;
  double *ytemp = class->ewd_scr.y;
  double *ztemp = class->ewd_scr.z;
  int natm_tot = class->clatoms_info.natm_tot;
  int myid_forc = class->communicate.myid_forc;
  int numproc = class->communicate.np_beads;
  int np_forc = class->communicate.np_forc;
  int pi_beads_proc_st = class->clatoms_info.pi_beads_proc_st;
  int myatm_start = class->clatoms_info.myatm_start;
  int myatm_end = class->clatoms_info.myatm_end;
  int *recv_count_atm = class->class_comm_forc_pkg.recv_count_atm;
  int *displs_atm = class->class_comm_forc_pkg.displs_atm;
  int comm_beads_forc = class->communicate.comm_beads_forc;
  int comm_forc = class->communicate.comm_forc;
  ("PI transformation - reverse");
  if (pi_beads_proc_st == 1) {
    for(i=myatm_start; i<=myatm_end; i++) {
      xmod[i] = x[i];
      ymod[i] = y[i];
      zmod[i] = z[i];
    }
  }
  if (numproc > 1) {
    Bcast(&(xmod[0]), natm_tot+1, MPI_DOUBLE, 0, comm_beads_forc);
    Bcast(&(ymod[0]), natm_tot+1, MPI_DOUBLE, 0, comm_beads_forc);
    Bcast(&(zmod[0]), natm_tot+1, MPI_DOUBLE, 0, comm_beads_forc);
  }
  if (np_forc > 1) {
    Allgatherv(&(xmod[myatm_start]), recv_count_atm[(myid_forc+1)],
               MPI_DOUBLE, &(xtemp[1]), &recv_count_atm[1], &displs_atm[1],
               MPI_DOUBLE, 0, comm_forc);
    Allgatherv(&(ymod[myatm_start]), recv_count_atm[(myid_forc+1)],
               MPI_DOUBLE, &(ytemp[1]), &recv_count_atm[1], &displs_atm[1],
               MPI_DOUBLE, 0, comm_forc);
    Allgatherv(&(zmod[myatm_start]), recv_count_atm[(myid_forc+1)],
               MPI_DOUBLE, &(ztemp[1]), &recv_count_atm[1], &displs_atm[1],
               MPI_DOUBLE, 0, comm_forc);
    for(i=1; i<=natm_tot; i++) {
      xmod[i] = xtemp[i];
      ymod[i] = ytemp[i];
      zmod[i] = ztemp[i];
    }
  }
  if (class->communicate.np_beads == 1) {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_pos_stag(&class->clatoms_info,
                            class->clatoms_pos,
                            &class->clatoms_tran);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_pos_cent(&class->clatoms_info,
                            class->clatoms_pos,
                            &class->clatoms_tran);
    }
  } else {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_pos_stag_par(&class->clatoms_info,
                                class->clatoms_pos,
                                &class->clatoms_tran,
                                &class->communicate);
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_pos_cent_par(&class->clatoms_info,
                                class->clatoms_pos,
                                &class->clatoms_tran,
                                &class->communicate);
    }
  }
  ("PI transformation - reverse");
}

variable_types: i int

variable_types:
xmod
double *

variable_types:
ymod
double *

variable_types:
zmod
double *

variable_types:
x
double *

variable_types:
y
double *

variable_types:
z
double *

variable_types:
xtemp
double *

variable_types:
ytemp
double *

variable_types:
ztemp
double *

variable_types: numproc int

user_defined_types: struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; }

user_defined_types: struct clatoms_tran { int pi_beads_proc; int pi_atm_proc; int pi_atm_proc_use; int pi_proc_rem; int nwork; int *sendcounts; int *senddspls; int *ifax; double *rat1_stag; double *path_eig; double *work; double *work3; double *x_trans; double *x_temp; double *xt_temp; }

user_defined_types: struct ghost_atoms { int nghost_tot; int natm_comp_max; int nghost_mall; int nghost_old; int ncomp_mall; int ncomp_old; int *ighost_map; int *natm_comp; int **iatm_comp; double **coef; }

user_defined_types: struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; }

user_defined_types: struct therm_info { int num_nhc; int len_nhc; int nres_nhc; int nyosh_nhc; int therm_typ; int num_nhc_proc; int num_nhc_share; int mytherm_start; double dt_nhc; int *inhc_x; int *itherm_nshare; double *ditherm_nshare_i; int *map_share; double *text_nhc; double *wdti; double **mass_nhc; }

user_defined_types: struct therm_pos { double **x_nhc; double x_nhc_tot; }

user_defined_types: struct vel_samp_class { int ivel_smpl_on; int ivel_scale_on; int nvx_smpl; int nvx_scale; int nvnhc_smpl; int iseed; double qseed; }

user_defined_types: struct energy_ctrl { int pme_on; int int_res_ter; int isep_vvdw; int iswit_vdw; int block_std_on; int iget_pe_real_inter_freq; int iget_pe_real_inter; int itime; int iget_full_inter; int iget_full_intra; int iget_full_pimd; }

user_defined_types: struct interact { int nsplin; int iswit_vdw; int dielectric_opt; int ishave_opt; int nter_typ; int nsplin_tot; int ninter_mall; int nsplin_mall_tot; int *inter_map_index; double dielectric_rheal; double dielectric_cut; double dielectric_eps; double brnch_root_skin; double skin; double brnch_root_cut; double rheal_res; double pten_inter_guess; double pten_kin_guess; double clong; double clong_res; double spread_now; double spread_lnk; double brnch_root_skin_lnk; double cutoff_max; double *cutoff; double *cutoff_res; double *cutti; double *cutskin; double *cutskin_res; double *cutskin_root; double *cutskin_root_res; double *vcut_coul; double *rmin_spl; double *dr_spl; double *cv0; double *cdv0; double *cv0_c; double *cdv0_c; }

user_defined_types: struct ewd_scr { double *q; double *x; double *fx; double *heli; double *cossc; double *fx2; double *temp; double *helr_now; }

user_defined_types: struct for_scr { int nlen; int nsplin_t; int num_brk; int intact; double wght_lnk; double wght_ter; double wght_ter_res; double wght_tra; double wght_tra_res; double wght_pimd; int *j_indext; int *i_indext2; int *j_lnk; int *j_index; int *num_brk_i; int *iexcl; int *index_atm; }

user_defined_types: struct part_mesh { int pme_on; int kmax_pme; int n_interp; int pme_res_on; int kmax_pme_res; int n_interp_res; int pme_para_opt; int nlen_pme; int nktot_pme; int ngrid_a; int nktot_pme_res; int ngrid_a_res; int ninterp_mall; int ninterp_tot_mall; int *iatemp; int *nc; int **igrid_a; int **igrid_now; double ecut; double ecut_res; double *bweight_tot_res; double *bweight_tot; double *qgrid; double *qgrid_scr; double *qgrid_tmp_real; double *qgrid_tmp_imag; double *frac_a; double *aj; double **ua; double **mn_a; double **dmn_a; double **qgrid_now; }

user_defined_types: struct surface { int isurf_on; int natm_typ; int nsplin_surf; int nsplin_tot; double zheal; double surface_height; double *surface_pot; double *surface_forc; double *zcut_off; double *dz_spl; double *dzi_spl; double *zmin_spl; char surface_type[50]; }

user_defined_types: struct communicate { int np_beads; int myid; int myid_bead_forc; int myid_bead; int myid_bead_prime; int myid_state; int myid_forc; int myid_forc_source; int myid_forc_target; int world; int comm_beads; int comm_beads_forc; int comm_states; int comm_forc; int comm_forc_source; int comm_forc_target; int comm_faux; }

user_defined_types: struct simopts { int md; int pimd; int minimize; int cp; int cp_pimd; int cp_wave; int cp_wave_pimd; int cp_wave_min_pimd; int cp_min; int cp_wave_min; int debug; int debug_pimd; int debug_cp; int debug_cp_pimd; int pi_beads; int pi_md_typ; int initial_spread_opt; int anneal_opt; double ann_rate; double ann_start_temp; double ann_target_temp; }

user_defined_types: struct minopts { int min_std; int min_cg; int min_diis; int diis_hist_len; int cp_min_std; int cp_min_cg; int cp_min_diis; int cp_diis_hist_len; int cp_cg_line_min_len; int min_atm_com_fix_opt; double tol_coef; double tol_atom; }

user_defined_types: struct filenames { char *iname; char *dname; char *dnamec; char *cpname; char *ksname; char *elfname; char *cvname; char *ccname; char *cpparname; char *centname; char *forcename; int low_lim_par; int high_lim_par; int iwrite_screen; int iwrite_inst; int iwrite_dump; int iwrite_kseigs; int iwrite_confv; int iwrite_confp; int iwrite_par_confp; int iwrite_confc; int iwrite_path_cent; int ifile_open; int iwrite_conf_binary; int iwrite_units; int iwrite_atm_for; int iwrite_elf; }

user_defined_types: struct cell { int iperd; int intra_perds; int cubic_box_flag; int hmat_int_typ; int hmat_cons_typ; int imov_cp_box; double vol; double vol_cp; double vol0; double area; double alpha_conv_dual; double *hmat; double *hmat_ewd; double *hmat_cp; double *cp_box_center; double *cp_box_center_rel; double *cp_vbox_center; double *cp_fbox_center; }

user_defined_types: struct timeinfo { int ntime; int ix_respa; int int_res_ter; int nres_ter; int int_res_tor; int int_res_pimd; int iget_pe_real_inter_freq; int exit_flag; double dt; }

user_defined_types: struct baro { int len_nhc; double x_lnv; double v_lnv_glob; double v_lnv_g; double f_lnv_p; double vol; double mass_lnv; double c2_lnv; double roll_scv; double roll_scg; double roll_scg0; double x_lnv_o; double v_lnv_g_wght; double area; double *x_vol_nhc; double *f_vol_nhc; double *hmato; }

user_defined_types: struct par_rahman { double vol; double mass_hm; double c1_hm; double roll_scg; double roll_scg0; double area; double *vgmat; double *vgmat_glob; double *fgmat_p; double *roll_mtv; double *roll_mtvv; double *vtemps; double *vexpdt; double *vtempx; double *hmat_t; double *fv1; double *vgmat_g_wght; }

user_defined_types: struct ptens { double *tvten; double *pvten; double *pvten_inc; double *pvten_tmp_res; double *pvten_inc_t1; double *pvten_inc_a; double *pvten_inc_old; double *count_inc; double *pvten_inc_glob; double *pvten_mode; }

user_defined_types: struct stat_avg { int nexclt; int iter_shake; int iswit_vdw; int itime_update; int iter_shake_cp; int write_cp_atm_flag; double vintert; double vintrat; double vsurft; double vbondt; double vbend_bndt; double vbend_bnd_bond; double vbondt_watts; double vreal; double vvdw; double vlong; double vbond_free; double vbar_free; double kinet; double kinet_v; double vol; double kinet_nhc; double kinet_nhc_bead; double aikinet_nhc_bead; double akinet_nhc_bead; double vpot_v; double vpotnhc; double aiter_shake; double iter_23; double aiter_23; double aiter_21; double iter_23r; double aiter_23r; double aiter_21r; double acella; double aicella; double acellab; double aicellab; double apress; double press_inter; double apress_inter; double apress_intra; double press_kin; double apress_kin; double econv0; double cp_kconv0; double cpu1; double updates; double kinet_cp_up; double kinet_cp_dn; double kinet_cp; double kinet_nhc_cp; double vpotnhc_cp; double cp_ehart; double cp_eext; double cp_exc; double cp_muxc; double cp_eke; double cp_enl; double aiter_shake_cp; double maxfc; double pi_ke_prim; double api_ke_prim; double aipi_ke_prim; double kin_harm; double *apten; double fc_mag_up; double fc_max_up; double fatm_max; double count_diag_srot; double econv_now; double isokconv; }

user_defined_types: struct ewald { int nsplin_g; int nktot; int nktot_res; int nktot_mall; int nktot_res_mall; int nkc_max; int nkb_max; double alp_ewd; double self_erf; double ecut; double ecut_clus; double alp_clus; double gs_max; int *kastr; int *ibrk1; int *kastr_res; int *ibrk1_res; double *clus_corr_r; double *clus_corr_r_res; double *cvgs_2d0; double *vgc_1d_y; }

user_defined_types: struct para_fft_pkg3d { int nktot; int ncoef_use; int nfft_size; int nfft; int igeneric_opt; int scale_opt; int len_ifax; int nwork1; double ecut; int comm; int num_proc; int *map_proc; int *recv_counts_rho; int *recv_counts_coef; int *map_pme_dn; int *recvcounts_pme_dn; int *sendcounts_pme_dn; int *map_pme_up; int *recvcounts_pme_up; int *sendcounts_pme_up; int ndata_kc; int nkf3; int str_fft_kc_proc; int ska_fft_kc_proc; int skb_fft_kc_proc; int *sendcounts_fft_kc; int *recvcounts_fft_kc; int *sum_fft_kc_proc; int nka_fft_kc; int *ka_fft_kc; int *ifax_c_f; double *work_1c_f; double *work_1c_r; int ndata_kb; int nkf2; int str_fft_kb_proc; int ska_fft_kb_proc; int skc_fft_kb_proc; int *ska_fft_kb_proc_all; int *skc_fft_kb_proc_all; int *sendcounts_fft_kb; int *recvcounts_fft_kb; int *sum_fft_kb_proc; int *ifax_b_f; double *work_1b_f; double *work_1b_r; int ndata_ka; int nkf1; int str_fft_ka_proc; int skb_fft_ka_proc; int skc_fft_ka_proc; int *skb_fft_ka_proc_all; int *skc_fft_ka_proc_all; int *sendcounts_fft_ka; int *recvcounts_fft_ka; int *ifax_a_f; double *work_1a_f; double *work_1a_r; int *send_counts_row_big_small; int *recv_counts_row_big_small; int *sdispls_row_big_small; int *rdispls_row_big_small; int *send_counts_dual_map; int *recv_counts_dual_map; int *sdispls_dual_map; int *rdispls_dual_map; int *send_counts_row_big_small_upack; int *recv_counts_row_big_small_upack; int *sdispls_row_big_small_upack; int *rdispls_row_big_small_upack; int *send_counts_dual_map_upack; int *recv_counts_dual_map_upack; int *sdispls_dual_map_upack; int *rdispls_dual_map_upack; int *send_counts_ioff_big_small; int *recv_counts_ioff_big_small; int *sdispls_ioff_big_small; int *rdispls_ioff_big_small; }

user_defined_types: struct clatoms_pos { double *mass; double *x; double *vx; double *fx; double *fxt; double *fxm; double *hess_xx; }

user_defined_types: struct verlist { int iver_init; int iver_fill; int nolst_ver_update; int jver_pad; int nmem_min_lst; int nver_lst; int nver_lst_res; int nver_lst_now; int nver_lst_now_res; int *nter; int *jter; int *jver_off; int *nter_res; int *jter_res; int *jver_off_res; double mem_safe; }

user_defined_types: struct lnklist { int ilnk_init; int lnk_for_odd; int ncell_div_avg; int lnk_excl_safe; int lnk_vol_safe; int ncell_a; int natm_cell_max; int lnk_list_dim; int nshft_lnk; int nshft_lnk_res; double vol_lnk_map; double rcut_max; int *lnk_list; int *ishft_a; int *iexl_chk; int *ishft_a_res; int *iexl_chk_res; int *natm_cell; double *shft_wght; double *shft_wght_res; double *hmat_lnk; }

user_defined_types: struct brnch_root { int nbrnch_tot; int nroot_tot; int natm_add_tot; int nbrnch_root_max; double brnch_root_dist_max; double cutdif_min_brnch_root; double cutdif_min_brnch_brnch; double cutdif_min_brnch_root_res; double cutdif_min_brnch_brnch_res; double r2_nocheck_dist; double r2_nocheck_dist_res; double cutskin_bb_min; double cutskin_bb_min_res; int *brnch_atm_list; int *brnch_atm_root; int *root_atm_list; int *root_atm_map; int *brnch_atm_map; int *nbrnch_of_root_big; int *nbrnch_of_root; int **ibrnch_of_root; int *natm_add; int *iatm_add; int *iatm_add_off; }

user_defined_types: struct class_plimpton_ind { int num_proc_source; int num_proc_target; int myid_source; int myid_target; int natoms_tot; int *index_src; int *index_src_even; int *index_src_odd; int *index_trg; int *index_trg_even; int *index_trg_odd; int *displs_atm_trg; int *displs_atm_src; int *src_odd_end; int *src_even_end; int *trg_odd_end; int *trg_even_end; int *src_odd_begin; int *src_even_begin; int *trg_odd_begin; int *trg_even_begin; int my_src_odd_counts; int my_src_even_counts; int my_trg_odd_counts; int my_trg_even_counts; int *my_src_odd; int *my_src_even; int *my_trg_odd; int *my_trg_even; int **jmax; int *jmin; int **imax; int source; int target; }

user_defined_types: struct therm_scr { double *sc; double *atm_kin; }


decompiled_code:
__int64 __fastcall control_pimd_trans_force(__int64 a1, __int64 a2)
{
__int64 result; // rax

result = *(unsigned int *)(a2 + 60);
if ( *(_DWORD *)(a1 + 3232) == 1 )
{
if ( (_DWORD)result == 1 )
{
result = convert_pimd_force_stag(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_force_cent(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
}
else if ( (_DWORD)result == 1 )
{
result = convert_pimd_force_stag_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_force_cent_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
__int64 result; // rax

result = *(unsigned int *)(a2 + 60);
if ( *(_DWORD *)(a1 + 3232) == 1 )
{
if ( (_DWORD)result == 1 )
{
result = convert_pimd_force_stag(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_force_cent(a1, *(_QWORD *)(a1 + 512), a1 + 320);
}
}
else if ( (_DWORD)result == 1 )
{
result = convert_pimd_force_stag_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
else if ( (_DWORD)result == 2 )
{
result = convert_pimd_force_cent_par(a1, *(_QWORD *)(a1 + 512), a1 + 320, a1 + 3232);
}
return result;
}

original_code:
void control_pimd_trans_force(CLASS *class, GENERAL_DATA *general_data) {
  ("PI transformation - forces");
  if (class->communicate.np_beads == 1) {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_force_stag(&(class->clatoms_info),
                              class->clatoms_pos,
                              &(class->clatoms_tran));
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_force_cent(&(class->clatoms_info),
                              class->clatoms_pos,
                              &(class->clatoms_tran));
    }
  } else {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_force_stag_par(&(class->clatoms_info),
                                  class->clatoms_pos,
                                  &(class->clatoms_tran),
                                  &(class->communicate));
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_force_cent_par(&(class->clatoms_info),
                                  class->clatoms_pos,
                                  &(class->clatoms_tran),
                                  &(class->communicate));
    }
  }
  ("PI transformation - forces");
}

canonical_original_code:
void control_pimd_trans_force(struct class *class, struct general_data *general_data) {
  ("PI transformation - forces");
  if (class->communicate.np_beads == 1) {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_force_stag(&(class->clatoms_info),
                              class->clatoms_pos,
                              &(class->clatoms_tran));
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_force_cent(&(class->clatoms_info),
                              class->clatoms_pos,
                              &(class->clatoms_tran));
    }
  } else {
    if (general_data->simopts.pi_md_typ == 1) {
      convert_pimd_force_stag_par(&(class->clatoms_info),
                                  class->clatoms_pos,
                                  &(class->clatoms_tran),
                                  &(class->communicate));
    } else if (general_data->simopts.pi_md_typ == 2) {
      convert_pimd_force_cent_par(&(class->clatoms_info),
                                  class->clatoms_pos,
                                  &(class->clatoms_tran),
                                  &(class->communicate));
    }
  }
  ("PI transformation - forces");
}

user_defined_types: struct class { struct clatoms_info clatoms_info; struct clatoms_tran clatoms_tran; struct clatoms_pos *clatoms_pos; struct ghost_atoms ghost_atoms; struct atommaps atommaps; struct therm_info therm_info_class; struct therm_info therm_info_bead; struct therm_pos therm_class; struct therm_pos *therm_bead; struct vel_samp_class vel_samp_class; struct energy_ctrl energy_ctrl; struct nbr_list nbr_list; struct interact interact; struct int_scr int_scr; struct ewd_scr ewd_scr; struct for_scr for_scr; double tot_memory; struct part_mesh part_mesh; struct surface surface; struct communicate communicate; struct class_comm_forc_pkg class_comm_forc_pkg; }

user_defined_types: struct general_data { struct simopts simopts; struct minopts minopts; struct ensopts ensopts; struct filenames filenames; struct statepoint statepoint; struct cell cell; struct timeinfo timeinfo; struct baro baro; struct par_rahman par_rahman; struct ptens ptens; struct stat_avg stat_avg; struct ewald ewald; struct para_fft_pkg3d pme_fft_pkg; struct para_fft_pkg3d pme_res_fft_pkg; int error_check_on; }

user_defined_types: struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; }

user_defined_types: struct clatoms_tran { int pi_beads_proc; int pi_atm_proc; int pi_atm_proc_use; int pi_proc_rem; int nwork; int *sendcounts; int *senddspls; int *ifax; double *rat1_stag; double *path_eig; double *work; double *work3; double *x_trans; double *x_temp; double *xt_temp; }

user_defined_types: struct ghost_atoms { int nghost_tot; int natm_comp_max; int nghost_mall; int nghost_old; int ncomp_mall; int ncomp_old; int *ighost_map; int *natm_comp; int **iatm_comp; double **coef; }

user_defined_types: struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; }

user_defined_types: struct therm_info { int num_nhc; int len_nhc; int nres_nhc; int nyosh_nhc; int therm_typ; int num_nhc_proc; int num_nhc_share; int mytherm_start; double dt_nhc; int *inhc_x; int *itherm_nshare; double *ditherm_nshare_i; int *map_share; double *text_nhc; double *wdti; double **mass_nhc; }

user_defined_types: struct therm_pos { double **x_nhc; double x_nhc_tot; }

user_defined_types: struct vel_samp_class { int ivel_smpl_on; int ivel_scale_on; int nvx_smpl; int nvx_scale; int nvnhc_smpl; int iseed; double qseed; }

user_defined_types: struct energy_ctrl { int pme_on; int int_res_ter; int isep_vvdw; int iswit_vdw; int block_std_on; int iget_pe_real_inter_freq; int iget_pe_real_inter; int itime; int iget_full_inter; int iget_full_intra; int iget_full_pimd; }

user_defined_types: struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist verlist; struct lnklist lnklist; struct brnch_root brnch_root; }

user_defined_types: struct interact { int nsplin; int iswit_vdw; int dielectric_opt; int ishave_opt; int nter_typ; int nsplin_tot; int ninter_mall; int nsplin_mall_tot; int *inter_map_index; double dielectric_rheal; double dielectric_cut; double dielectric_eps; double brnch_root_skin; double skin; double brnch_root_cut; double rheal_res; double pten_inter_guess; double pten_kin_guess; double clong; double clong_res; double spread_now; double spread_lnk; double brnch_root_skin_lnk; double cutoff_max; double *cutoff; double *cutoff_res; double *cutti; double *cutskin; double *cutskin_res; double *cutskin_root; double *cutskin_root_res; double *vcut_coul; double *rmin_spl; double *dr_spl; double *cv0; double *cdv0; double *cv0_c; double *cdv0_c; }

user_defined_types: struct int_scr { double v_lnv; double *x; double *vx; double *gx; double **x_nhc; double *vgmat; double *x_vol_nhc; double *sc; double *sc_temp; double *atm_kin; double *step_up; struct therm_scr *therm_scr; }

user_defined_types: struct ewd_scr { double *q; double *x; double *fx; double *heli; double *cossc; double *fx2; double *temp; double *helr_now; }

user_defined_types: struct for_scr { int nlen; int nsplin_t; int num_brk; int intact; double wght_lnk; double wght_ter; double wght_ter_res; double wght_tra; double wght_tra_res; double wght_pimd; int *j_indext; int *i_indext2; int *j_lnk; int *j_index; int *num_brk_i; int *iexcl; int *index_atm; }

user_defined_types: struct part_mesh { int pme_on; int kmax_pme; int n_interp; int pme_res_on; int kmax_pme_res; int n_interp_res; int pme_para_opt; int nlen_pme; int nktot_pme; int ngrid_a; int nktot_pme_res; int ngrid_a_res; int ninterp_mall; int ninterp_tot_mall; int *iatemp; int *nc; int **igrid_a; int **igrid_now; double ecut; double ecut_res; double *bweight_tot_res; double *bweight_tot; double *qgrid; double *qgrid_scr; double *qgrid_tmp_real; double *qgrid_tmp_imag; double *frac_a; double *aj; double **ua; double **mn_a; double **dmn_a; double **qgrid_now; }

user_defined_types: struct surface { int isurf_on; int natm_typ; int nsplin_surf; int nsplin_tot; double zheal; double surface_height; double *surface_pot; double *surface_forc; double *zcut_off; double *dz_spl; double *dzi_spl; double *zmin_spl; char surface_type[50]; }

user_defined_types: struct communicate { int np_beads; int myid; int myid_bead_forc; int myid_bead; int myid_bead_prime; int myid_state; int myid_forc; int myid_forc_source; int myid_forc_target; int world; int comm_beads; int comm_beads_forc; int comm_states; int comm_forc; int comm_forc_source; int comm_forc_target; int comm_faux; }

user_defined_types: struct class_comm_forc_pkg { int num_proc; int myid; int myatm_start; int mytherm_start; int *displs_atm; int *displs_therm; int comm; int world; double dbl_num_proc; struct class_plimpton_ind plimpton_ind; }

user_defined_types: struct simopts { int md; int pimd; int minimize; int cp; int cp_pimd; int cp_wave; int cp_wave_pimd; int cp_wave_min_pimd; int cp_min; int cp_wave_min; int debug; int debug_pimd; int debug_cp; int debug_cp_pimd; int pi_beads; int pi_md_typ; int initial_spread_opt; int anneal_opt; double ann_rate; double ann_start_temp; double ann_target_temp; }


original_code:
void check_ver_list(CLATOMS_INFO *clatoms_info,CLATOMS_POS *clatoms_pos,
                    NBR_LIST *nbr_list,INTERACT *interact,
                    int *iflag)
{
  int i,iii;
  double dx,dy,dz,dspread;
  double r2,rmax,skin2,rtmp;
  int pi_beads = clatoms_info->pi_beads;
  int natm_tot = clatoms_info->natm_tot;
  double *x = clatoms_pos->x;
  double *y = clatoms_pos->y;
  double *z = clatoms_pos->z;
  double *x0 = nbr_list->x0;
  double *y0 = nbr_list->y0;
  double *z0 = nbr_list->z0;
  double spread_now = interact->spread_now;
  double spread = interact->spread;
  double skin = interact->skin;
      rmax = 0.0;
      for(i=1;i<=natm_tot;i++){
         dx = x[i]-x0[i];
         dy = y[i]-y0[i];
         dz = z[i]-z0[i];
         r2 = dx*dx+dy*dy+dz*dz;
         rtmp=rmax;
         rmax = (((rtmp)>(r2))?(rtmp):(r2));
      }
      rmax=sqrt(rmax);
      dspread = 0.0;
      if(pi_beads>1){dspread = (((0.0)>(spread_now - spread))?(0.0):(spread_now - spread));}
      skin2 = (skin)/2.0 + dspread;
      (*iflag) = 0;
      if(rmax>skin2){
         (*iflag)=1;
         if(pi_beads>1){interact->spread=spread_now;}
      }
                }

canonical_original_code:
void check_ver_list(struct clatoms_info *clatoms_info, struct clatoms_pos *clatoms_pos, struct nbr_list *nbr_list, struct interact *interact, int *iflag)
{
  int i; int iii;
  double dx; double dy; double dz; double dspread;
  double r2; double rmax; double skin2; double rtmp;
  int pi_beads = clatoms_info->pi_beads;
  int natm_tot = clatoms_info->natm_tot;
  double *x = clatoms_pos->x;
  double *y = clatoms_pos->y;
  double *z = clatoms_pos->z;
  double *x0 = nbr_list->x0;
  double *y0 = nbr_list->y0;
  double *z0 = nbr_list->z0;
  double spread_now = interact->spread_now;
  double spread = interact->spread;
  double skin = interact->skin;
      rmax = 0.0;
      for(i=1;i<=natm_tot;i++){
         dx = x[i]-x0[i];
         dy = y[i]-y0[i];
         dz = z[i]-z0[i];
         r2 = dx*dx+dy*dy+dz*dz;
         rtmp=rmax;
         rmax = (((rtmp)>(r2))?(rtmp):(r2));
      }
      rmax=sqrt(rmax);
      dspread = 0.0;
      if(pi_beads>1){dspread = (((0.0)>(spread_now - spread))?(0.0):(spread_now - spread));}
      skin2 = (skin)/2.0 + dspread;
      (*iflag) = 0;
      if(rmax>skin2){
         (*iflag)=1;
         if(pi_beads>1){interact->spread=spread_now;}
      }
                }

variable_types: struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; } *

variable_types: struct clatoms_pos { double *mass; double *x; double *vx; double *fx; double *fxt; double *fxm; double *hess_xx; } *

variable_types: struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist { int iver_init; int iver_fill; int nolst_ver_update; int jver_pad; int nmem_min_lst; int nver_lst; int nver_lst_res; int nver_lst_now; int nver_lst_now_res; int *nter; int *jter; int *jver_off; int *nter_res; int *jter_res; int *jver_off_res; double mem_safe; } verlist; struct lnklist { int ilnk_init; int lnk_for_odd; int ncell_div_avg; int lnk_excl_safe; int lnk_vol_safe; int ncell_a; int natm_cell_max; int lnk_list_dim; int nshft_lnk; int nshft_lnk_res; double vol_lnk_map; double rcut_max; int *lnk_list; int *ishft_a; int *iexl_chk; int *ishft_a_res; int *iexl_chk_res; int *natm_cell; double *shft_wght; double *shft_wght_res; double *hmat_lnk; } lnklist; struct brnch_root { int nbrnch_tot; int nroot_tot; int natm_add_tot; int nbrnch_root_max; double brnch_root_dist_max; double cutdif_min_brnch_root; double cutdif_min_brnch_brnch; double cutdif_min_brnch_root_res; double cutdif_min_brnch_brnch_res; double r2_nocheck_dist; double r2_nocheck_dist_res; double cutskin_bb_min; double cutskin_bb_min_res; int *brnch_atm_list; int *brnch_atm_root; int *root_atm_list; int *root_atm_map; int *brnch_atm_map; int *nbrnch_of_root_big; int *nbrnch_of_root; int **ibrnch_of_root; int *natm_add; int *iatm_add; int *iatm_add_off; } brnch_root; } *

variable_types: struct interact { int nsplin; int iswit_vdw; int dielectric_opt; int ishave_opt; int nter_typ; int nsplin_tot; int ninter_mall; int nsplin_mall_tot; int *inter_map_index; double dielectric_rheal; double dielectric_cut; double dielectric_eps; double brnch_root_skin; double skin; double brnch_root_cut; double rheal_res; double pten_inter_guess; double pten_kin_guess; double clong; double clong_res; double spread_now; double spread_lnk; double brnch_root_skin_lnk; double cutoff_max; double *cutoff; double *cutoff_res; double *cutti; double *cutskin; double *cutskin_res; double *cutskin_root; double *cutskin_root_res; double *vcut_coul; double *rmin_spl; double *dr_spl; double *cv0; double *cdv0; double *cv0_c; double *cdv0_c; } *

variable_types:
iflag
int *

variable_types: iii int

variable_types: dx double

variable_types: dy double

variable_types: dz double

variable_types: dspread double

variable_types: rmax double

variable_types: rtmp double

variable_types: spread double

variable_types: skin double