thinkbetter

original_code:
void thinkbetter() {
 int besetzteFelder[16]={0};
 int guteFelder[16]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
 int spielsteineSchlecht[16]={0};
 int frei = -1;
 int stein;
 int isThereAStone=0;
 int isThereAField=0;
 srand(time(((void *)0)));
 besetzteSteine[shmPtr->nextStone] = 1;
 for(int i=0; i<16; i++) {
  spielsteineSchlecht[i]=besetzteSteine[i];
  if (shmPtr_Sf[i] >-1) {
   besetzteFelder[i] =1;
  }
 }
 if ((frei = checkReihe(0,1,2,3,besetzteFelder,spielsteineSchlecht))!= 16){
    if (frei >0) guteFelder[frei]=0;
    if ((frei = checkReihe(4,5,6,7,besetzteFelder,spielsteineSchlecht))!= 16){
       if (frei >0) guteFelder[frei]=0;
       if ((frei = checkReihe(8,9,10,11,besetzteFelder,spielsteineSchlecht))!= 16){
          if (frei >0) guteFelder[frei]=0;
          if ((frei = checkReihe(12,13,14,15,besetzteFelder,spielsteineSchlecht))!= 16){
             if (frei >0) guteFelder[frei]=0;
             if ((frei = checkReihe(0,4,8,12,besetzteFelder,spielsteineSchlecht))!= 16){
                if (frei >0) guteFelder[frei]=0;
                if ((frei = checkReihe(1,5,9,13,besetzteFelder,spielsteineSchlecht))!= 16){
                   if (frei >0) guteFelder[frei]=0;
                   if ((frei = checkReihe(2,6,10,14,besetzteFelder,spielsteineSchlecht))!= 16){
                      if (frei >0) guteFelder[frei]=0;
                      if ((frei = checkReihe(3,7,11,15,besetzteFelder,spielsteineSchlecht))!= 16){
                         if (frei >0) guteFelder[frei]=0;
                         if ((frei = checkReihe(0,5,10,15,besetzteFelder,spielsteineSchlecht))!= 16){
                            if (frei >0) guteFelder[frei]=0;
                            frei = checkReihe(3,6,9,12,besetzteFelder,spielsteineSchlecht);
                            if (frei >0) guteFelder[frei]=0;
         }
               }
              }
             }
            }
           }
   }
  }
 }
 log_printf(2,"guteFelder: ");
 for (int i=0; i<16; i++) {
  log_printf(2,"%i ",guteFelder[i]);
  if (guteFelder[i] == 0) {
   isThereAField = 1;
  }
 }
 log_printf(2,"\n");
 log_printf(2,"isThereAField: %i\n",isThereAField);
 if(frei < 16) {
  if(isThereAField==1){
   log_printf(2,"there is\n");
   saveField(randomField(guteFelder));
  } else{
   log_printf(2,"Nope, there isn't\n");
   saveField(randomField(besetzteFelder));
  }
 }
 spielzug[2] = ',';
 log_printf(2,"schlechte Steine: ");
 if(frei < 16) {
  for (int i=0; i<16; i++) {
   log_printf(2,"%i ",spielsteineSchlecht[i]);
   if (spielsteineSchlecht[i] == 0) {
    isThereAStone = 1;
   }
  }
 }
 log_printf(2,"\n");
 log_printf(2,"isThereAStone: %i\n",isThereAStone);
 if(isThereAStone==1){
  log_printf(2,"there is\n");
  stein = randomStone(spielsteineSchlecht);
 } else{
  log_printf(2,"Nope, there isn't\n");
  stein = randomStone(besetzteSteine);
 }
 log_printf(2,"stein: %i\n",stein);
 sprintf(spielzug+3,"%i",stein);
 log_printf(2,"Spielzug: %s\n",spielzug);
}

canonical_original_code:
void thinkbetter() {
 int besetzteFelder[16] = {0};
 int guteFelder[16] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
 int spielsteineSchlecht[16] = {0};
 int frei = -1;
 int stein;
 int isThereAStone = 0;
 int isThereAField = 0;
 srand(time(((void *)0)));
 besetzteSteine[shmPtr->nextStone] = 1;
 for(int i = 0; i<16; i++) {
  spielsteineSchlecht[i]=besetzteSteine[i];
  if (shmPtr_Sf[i] >-1) {
   besetzteFelder[i] =1;
  }
 }
 if ((frei = checkReihe(0,1,2,3,besetzteFelder,spielsteineSchlecht))!= 16){
    if (frei >0) guteFelder[frei]=0;
    if ((frei = checkReihe(4,5,6,7,besetzteFelder,spielsteineSchlecht))!= 16){
       if (frei >0) guteFelder[frei]=0;
       if ((frei = checkReihe(8,9,10,11,besetzteFelder,spielsteineSchlecht))!= 16){
          if (frei >0) guteFelder[frei]=0;
          if ((frei = checkReihe(12,13,14,15,besetzteFelder,spielsteineSchlecht))!= 16){
             if (frei >0) guteFelder[frei]=0;
             if ((frei = checkReihe(0,4,8,12,besetzteFelder,spielsteineSchlecht))!= 16){
                if (frei >0) guteFelder[frei]=0;
                if ((frei = checkReihe(1,5,9,13,besetzteFelder,spielsteineSchlecht))!= 16){
                   if (frei >0) guteFelder[frei]=0;
                   if ((frei = checkReihe(2,6,10,14,besetzteFelder,spielsteineSchlecht))!= 16){
                      if (frei >0) guteFelder[frei]=0;
                      if ((frei = checkReihe(3,7,11,15,besetzteFelder,spielsteineSchlecht))!= 16){
                         if (frei >0) guteFelder[frei]=0;
                         if ((frei = checkReihe(0,5,10,15,besetzteFelder,spielsteineSchlecht))!= 16){
                            if (frei >0) guteFelder[frei]=0;
                            frei = checkReihe(3,6,9,12,besetzteFelder,spielsteineSchlecht);
                            if (frei >0) guteFelder[frei]=0;
         }
               }
              }
             }
            }
           }
   }
  }
 }
 log_printf(2,"guteFelder: ");
 for (int i = 0; i<16; i++) {
  log_printf(2,"%i ",guteFelder[i]);
  if (guteFelder[i] == 0) {
   isThereAField = 1;
  }
 }
 log_printf(2,"\n");
 log_printf(2,"isThereAField: %i\n",isThereAField);
 if(frei < 16) {
  if(isThereAField==1){
   log_printf(2,"there is\n");
   saveField(randomField(guteFelder));
  } else{
   log_printf(2,"Nope, there isn't\n");
   saveField(randomField(besetzteFelder));
  }
 }
 spielzug[2] = ',';
 log_printf(2,"schlechte Steine: ");
 if(frei < 16) {
  for (int i = 0; i<16; i++) {
   log_printf(2,"%i ",spielsteineSchlecht[i]);
   if (spielsteineSchlecht[i] == 0) {
    isThereAStone = 1;
   }
  }
 }
 log_printf(2,"\n");
 log_printf(2,"isThereAStone: %i\n",isThereAStone);
 if(isThereAStone==1){
  log_printf(2,"there is\n");
  stein = randomStone(spielsteineSchlecht);
 } else{
  log_printf(2,"Nope, there isn't\n");
  stein = randomStone(besetzteSteine);
 }
 log_printf(2,"stein: %i\n",stein);
 sprintf(spielzug+3,"%i",stein);
 log_printf(2,"Spielzug: %s\n",spielzug);
}

variable_types:
besetzteFelder
int [16]

variable_types:
guteFelder
int [16]

variable_types:
spielsteineSchlecht
int [16]

variable_types: stein int

variable_types: isThereAStone int

variable_types: isThereAField int


think

repo: pc-coholic/Quarto

decompiled_code:
__int64 think()
{
int v0; // ebx
_DWORD *v1; // rsi
__int64 v2; // rdx
__int64 v3; // rcx
_DWORD *v4; // rax

v0 = *(_DWORD *)(shmPtr + 592LL) * *(_DWORD *)(shmPtr + 588LL);
if ( !shmPtr_Sf )
{
shmPtr_Sf = shmSpielfeldAnbinden(*(unsigned int *)(shmPtr + 596LL));
shmDelete(*(unsigned int *)(shmPtr + 596LL));
}
if ( v0 > 0 )
{
v1 = (_DWORD *)shmPtr_Sf;
v2 = 0LL;
v3 = shmPtr_Sf + 4LL * (unsigned int)(v0 - 1) + 4;
do
{
besetzteSteine[v2] = 0;
v4 = v1;
while ( *v4 != (_DWORD)v2 )
{
if ( ++v4 == (_DWORD *)v3 )
goto LABEL_9;
}
besetzteSteine[v2] = 1;
LABEL_9:
++v2;
}
while ( v2 != v0 );
}
log_printf(2LL, asc_1812);
return thinkbetter();
}

canonical_decompiled_code:
__int64 func8()
{
int v0; // ebx
_DWORD *v1; // rsi
__int64 v2; // rdx
__int64 v3; // rcx
_DWORD *v4; // rax

v0 = *(_DWORD *)(shmPtr + 592LL) * *(_DWORD *)(shmPtr + 588LL);
if ( !shmPtr_Sf )
{
shmPtr_Sf = shmSpielfeldAnbinden(*(unsigned int *)(shmPtr + 596LL));
shmDelete(*(unsigned int *)(shmPtr + 596LL));
}
if ( v0 > 0 )
{
v1 = (_DWORD *)shmPtr_Sf;
v2 = 0LL;
v3 = shmPtr_Sf + 4LL * (unsigned int)(v0 - 1) + 4;
do
{
besetzteSteine[v2] = 0;
v4 = v1;
while ( *v4 != (_DWORD)v2 )
{
if ( ++v4 == (_DWORD *)v3 )
goto LABEL_9;
}
besetzteSteine[v2] = 1;
LABEL_9:
++v2;
}
while ( v2 != v0 );
}
log_printf(2LL, asc_1812);
return func7();
}

original_code:
void think() {
 int groesse = shmPtr->breite * shmPtr->hoehe;
 if(shmPtr_Sf == ((void *)0)) {
  shmPtr_Sf = shmSpielfeldAnbinden(shmPtr->shmid_Sf);
  shmDelete(shmPtr->shmid_Sf);
 }
 for(int i=0;i<groesse;i++) {
  besetzteSteine[i]=0;
  for(int j=0;j<groesse;j++) {
   if (shmPtr_Sf[j] ==i) {
    besetzteSteine[i]=1;
    break;
   }
  }
 }
 log_printf(2,"fängt an zu denken\n");
 thinkbetter();
}

canonical_original_code:
void think() {
 int groesse = shmPtr->breite * shmPtr->hoehe;
 if(shmPtr_Sf == ((void *)0)) {
  shmPtr_Sf = shmSpielfeldAnbinden(shmPtr->shmid_Sf);
  shmDelete(shmPtr->shmid_Sf);
 }
 for(int i = 0;i<groesse;i++) {
  besetzteSteine[i]=0;
  for(int j = 0;j<groesse;j++) {
   if (shmPtr_Sf[j] ==i) {
    besetzteSteine[i]=1;
    break;
   }
  }
 }
 log_printf(2,"fängt an zu denken\n");
 thinkbetter();
}

variable_types: groesse int

variable_types: i int

variable_types: j int

return_type: void


saveField

decompiled_code:
__int64 __fastcall saveField(int a1)
{
int v1; // edi
__int64 result; // rax

spielzug = a1 % *(_DWORD *)(shmPtr + 588LL) + 65;
v1 = a1 / *(_DWORD *)(shmPtr + 592LL);
result = (unsigned int)(52 - v1);
*(&spielzug + 1) = 52 - v1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
int v1; // edi
__int64 result; // rax

spielzug = a1 % *(_DWORD *)(shmPtr + 588LL) + 65;
v1 = a1 / *(_DWORD *)(shmPtr + 592LL);
result = (unsigned int)(52 - v1);
*(&spielzug + 1) = 52 - v1;
return result;
}

original_code:
void saveField(int index) {
 spielzug[0] ='A' +(index % shmPtr->breite);
 spielzug[1] ='4' -(index/shmPtr->hoehe);
}

variable_types: index int


shmSegment

decompiled_code:
int shmSegment()
{
int result; // eax

result = shmget(0, 4uLL, 950);
if ( result == -1 )
{
perror("Fehler beim Segment erstellen");
result = -1;
}
return result;
}

canonical_decompiled_code:
int func0()
{
int result; // eax

result = shmget(0, 4uLL, 950);
if ( result == -1 )
{
perror("Fehler beim Segment erstellen");
result = -1;
}
return result;
}

original_code:
int shmSegment(int size){
 int shmid;
 if((shmid = shmget(((__key_t) 0), sizeof(size), 01000 | 0666) )==-1){
  perror("Fehler beim Segment erstellen");
 }
 return shmid;
}

canonical_original_code:
int shmSegment(int size){
 int shmid;
 if((shmid = shmget(((int) 0), sizeof(size), 01000 | 0666) )==-1){
  perror("Fehler beim Segment erstellen");
 }
 return shmid;
}

variable_types: size int

variable_types: shmid int

return_type: int


shmAnbinden

decompiled_code:
__int64 __fastcall shmAnbinden(int a1)
{
__int64 result; // rax

result = (__int64)shmat(a1, 0LL, 0);
if ( result == -1 )
{
perror("Fehler beim Binden des SHM an einen Prozess");
result = -1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1)
{
__int64 result; // rax

result = (__int64)shmat(a1, 0LL, 0);
if ( result == -1 )
{
perror("Fehler beim Binden des SHM an einen Prozess");
result = -1LL;
}
return result;
}

original_code:
struct shmInfos* shmAnbinden(int shmid){
 struct shmInfos *shm_ptr = shmat(shmid, ((void *)0), 0);
 if (shm_ptr==(struct shmInfos*)-1) {
  perror("Fehler beim Binden des SHM an einen Prozess");
 }
 return shm_ptr;
}

canonical_original_code:
struct shmInfos *shmAnbinden(int shmid){
 struct shmInfos *shm_ptr = shmat(shmid, ((void *)0), 0);
 if (shm_ptr==(struct shmInfos *)-1) {
  perror("Fehler beim Binden des SHM an einen Prozess");
 }
 return shm_ptr;
}

variable_types: struct shmInfos { char spielname[30]; int eigSpielernummer; int anzahlSpieler; int pid0; int pid1; int flag; struct playerAttr { int spielerNr; char name[256]; int registered; } attr[2]; int moveTimeout; int nextStone; int breite; int hoehe; int shmid_Sf; int gameover; } *

user_defined_types: struct shmInfos { char spielname[30]; int eigSpielernummer; int anzahlSpieler; int pid0; int pid1; int flag; struct playerAttr attr[2]; int moveTimeout; int nextStone; int breite; int hoehe; int shmid_Sf; int gameover; }


shmSpielfeldAnbinden

decompiled_code:
// attributes: thunk
__int64 __fastcall shmSpielfeldAnbinden(int a1)
{
return shmAnbinden(a1);
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1)
{
return func1(a1);
}

original_code:
int* shmSpielfeldAnbinden(int shmid){
 int *shm_ptr_Sf = shmat(shmid, ((void *)0), 0);
 if (shm_ptr_Sf==(int*)-1) {
  perror("Fehler beim Binden des SHM an einen Prozess");
 }
 return shm_ptr_Sf;
}

canonical_original_code:
int *shmSpielfeldAnbinden(int shmid){
 int *shm_ptr_Sf = shmat(shmid, ((void *)0), 0);
 if (shm_ptr_Sf==(int *)-1) {
  perror("Fehler beim Binden des SHM an einen Prozess");
 }
 return shm_ptr_Sf;
}

return_type: int *


shmDelete

decompiled_code:
void __fastcall shmDelete(int a1)
{
if ( shmctl(a1, 0, 0LL) == -1 )
perror("Fehler beim Loeschen des Shared Memory Segments");
}

canonical_decompiled_code:
void __fastcall func3(int a1)
{
if ( shmctl(a1, 0, 0LL) == -1 )
perror("Fehler beim Loeschen des Shared Memory Segments");
}

original_code:
void shmDelete(int shmid){
 if(shmctl(shmid, 0, ((void *)0))==-1) {
 perror("Fehler beim Loeschen des Shared Memory Segments");
 }
}


netRecv

decompiled_code:
ssize_t __fastcall netRecv(void *buf, size_t n)
{
ssize_t result; // rax

result = recv(socke, buf, n, 0);
if ( (int)result <= 0 )
{
log_printf(0LL, "Fehler beim Empfangen der Daten vom Server!\n");
exit(1);
}
return result;
}

canonical_decompiled_code:
ssize_t __fastcall func0(void *buf, size_t n)
{
ssize_t result; // rax

result = recv(socke, buf, n, 0);
if ( (int)result <= 0 )
{
log_printf(0LL, "Fehler beim Empfangen der Daten vom Server!\n");
exit(1);
}
return result;
}

original_code:
static int netRecv(char* bufAnf, size_t bufRestLen){
 int len = recv(socke, bufAnf, bufRestLen,0);
 if(len <= 0) {
  log_printf(0,"Fehler beim Empfangen der Daten vom Server!\n");
  exit(1);
 }
 return len;
}

canonical_original_code:
static int netRecv(char *bufAnf, unsigned long bufRestLen){
 int len = recv(socke, bufAnf, bufRestLen,0);
 if(len <= 0) {
  log_printf(0,"Fehler beim Empfangen der Daten vom Server!\n");
  exit(1);
 }
 return len;
}

variable_types:
bufAnf
char *

variable_types:
bufRestLen
unsigned long

variable_types: len int


netReadLine

decompiled_code:
char *netReadLine()
{
int v0; // er9
__int64 v1; // rax
int v3; // eax
int v4; // er9

v0 = bufferBenutzt_2;
if ( bufferBenutzt_2 > 0 && bufferEnde_1 > 0 )
{
v3 = netUpdateBuffer_constprop_0(bufferBenutzt_2, bufferEnde_1);
v0 = v4 - v3;
bufferBenutzt_2 = v0;
}
while ( 1 )
{
v1 = 0LL;
if ( v0 > 0 )
break;
LABEL_9:
bufferBenutzt_2 += netRecv(&bufferGet_0[v0], 251 - v0);
v0 = bufferBenutzt_2;
}
while ( bufferGet_0[v1] != 10 )
{
if ( ++v1 == v0 )
goto LABEL_9;
}
bufferEnde_1 = v1;
bufferGet_0[(int)v1] = 0;
log_printf(2LL, "\x1B[1m\x1B[33mS: \x1B[0m%s\n", bufferGet_0);
return bufferGet_0;
}

canonical_decompiled_code:
char *func2()
{
int v0; // er9
__int64 v1; // rax
int v3; // eax
int v4; // er9

v0 = bufferBenutzt_2;
if ( bufferBenutzt_2 > 0 && bufferEnde_1 > 0 )
{
v3 = func1(bufferBenutzt_2, bufferEnde_1);
v0 = v4 - v3;
bufferBenutzt_2 = v0;
}
while ( 1 )
{
v1 = 0LL;
if ( v0 > 0 )
break;
LABEL_9:
bufferBenutzt_2 += func0(&bufferGet_0[v0], 251 - v0);
v0 = bufferBenutzt_2;
}
while ( bufferGet_0[v1] != 10 )
{
if ( ++v1 == v0 )
goto LABEL_9;
}
bufferEnde_1 = v1;
bufferGet_0[(int)v1] = 0;
log_printf(2LL, "\x1B[1m\x1B[33mS: \x1B[0m%s\n", bufferGet_0);
return bufferGet_0;
}

original_code:
char* netReadLine() {
 static int bufferBenutzt = 0;
 static int bufferEnde = 0;
 static char bufferGet[251];
 if (bufferBenutzt > 0 && bufferEnde > 0) {
    bufferBenutzt -= netUpdateBuffer(bufferGet, bufferBenutzt, bufferEnde);
 }
 while(1) {
 for (int i=0; i<bufferBenutzt; i++) {
  if(bufferGet[i]=='\n') {
    bufferGet[i] = '\0';
     bufferEnde = i;
     log_printf(2,"\033[1m\033[33m""S: ""\033[0m""%s\n",bufferGet);
     return bufferGet;
   }
 }
 bufferBenutzt += netRecv(bufferGet + bufferBenutzt, 251 -bufferBenutzt);
 }
}

canonical_original_code:
char *netReadLine() {
 static int bufferBenutzt = 0;
 static int bufferEnde = 0;
 static char bufferGet[251];
 if (bufferBenutzt > 0 && bufferEnde > 0) {
    bufferBenutzt -= netUpdateBuffer(bufferGet, bufferBenutzt, bufferEnde);
 }
 while(1) {
 for (int i = 0; i<bufferBenutzt; i++) {
  if(bufferGet[i]=='\n') {
    bufferGet[i] = '\0';
     bufferEnde = i;
     log_printf(2,"\033[1m\033[33m""S: ""\033[0m""%s\n",bufferGet);
     return bufferGet;
   }
 }
 bufferBenutzt += netRecv(bufferGet + bufferBenutzt, 251 -bufferBenutzt);
 }
}

variable_types: bufferBenutzt int

variable_types: bufferEnde int

variable_types:
bufferGet
char [251]

return_type: char *


netWrite

decompiled_code:
__int64 __fastcall netWrite(void *buf)
{
int v1; // eax
__int64 result; // rax

v1 = strlen((const char *)buf);
if ( write(socke, buf, v1) < 0 )
{
log_printf(0LL, "Fehler beim Schreiben in den Socket\n");
result = 0LL;
}
else
{
log_printf(2LL, "\x1B[1m\x1B[36mC: \x1B[0m%s", (const char *)buf);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(void *buf)
{
int v1; // eax
__int64 result; // rax

v1 = strlen((const char *)buf);
if ( write(socke, buf, v1) < 0 )
{
log_printf(0LL, "Fehler beim Schreiben in den Socket\n");
result = 0LL;
}
else
{
log_printf(2LL, "\x1B[1m\x1B[36mC: \x1B[0m%s", (const char *)buf);
result = 1LL;
}
return result;
}

original_code:
int netWrite(char *bufferSend) {
 int len = strlen(bufferSend);
 if(write(socke, bufferSend, len*sizeof(char)) < 0) {
  log_printf(0,"Fehler beim Schreiben in den Socket\n");
  return 0;
 }
 log_printf(2,"\033[1m\033[36m""C: ""\033[0m""%s",bufferSend);
 return 1;
}

variable_types:
bufferSend
char *


netConnect

decompiled_code:
__int64 __fastcall netConnect(char *service, char *name)
{
struct addrinfo *v2; // rbx
struct addrinfo *pai; // [rsp+0h] [rbp-40h] BYREF
struct addrinfo req; // [rsp+8h] [rbp-38h] BYREF

*(_OWORD *)&req.ai_flags = 0LL;
*(_OWORD *)&req.ai_addrlen = 0LL;
req.ai_socktype = 1;
*(_OWORD *)&req.ai_canonname = 0LL;
if ( getaddrinfo(name, service, &req, &pai) )
{
log_printf(0LL, "Fehler beim Servernamen\n");
LABEL_9:
exit(1);
}
v2 = pai;
if ( !pai )
{
LABEL_8:
log_printf(0LL, "Client konnte nicht verbunden werden.\n");
goto LABEL_9;
}
while ( 1 )
{
socke = socket(v2->ai_family, v2->ai_socktype, v2->ai_protocol);
if ( socke != -1 )
break;
log_printf(0LL, "Socket konnte nicht angelegt werden.\n");
LABEL_7:
v2 = v2->ai_next;
if ( !v2 )
goto LABEL_8;
}
if ( connect(socke, v2->ai_addr, v2->ai_addrlen) == -1 )
{
close(socke);
log_printf(0LL, "Verbindung mit Socket fehlgeschlagen.\n");
goto LABEL_7;
}
freeaddrinfo(pai);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(char *service, char *name)
{
struct addrinfo *v2; // rbx
struct addrinfo *pai; // [rsp+0h] [rbp-40h] BYREF
struct addrinfo req; // [rsp+8h] [rbp-38h] BYREF

*(_OWORD *)&req.ai_flags = 0LL;
*(_OWORD *)&req.ai_addrlen = 0LL;
req.ai_socktype = 1;
*(_OWORD *)&req.ai_canonname = 0LL;
if ( getaddrinfo(name, service, &req, &pai) )
{
log_printf(0LL, "Fehler beim Servernamen\n");
LABEL_9:
exit(1);
}
v2 = pai;
if ( !pai )
{
LABEL_8:
log_printf(0LL, "Client konnte nicht verbunden werden.\n");
goto LABEL_9;
}
while ( 1 )
{
socke = socket(v2->ai_family, v2->ai_socktype, v2->ai_protocol);
if ( socke != -1 )
break;
log_printf(0LL, "Socket konnte nicht angelegt werden.\n");
LABEL_7:
v2 = v2->ai_next;
if ( !v2 )
goto LABEL_8;
}
if ( connect(socke, v2->ai_addr, v2->ai_addrlen) == -1 )
{
close(socke);
log_printf(0LL, "Verbindung mit Socket fehlgeschlagen.\n");
goto LABEL_7;
}
freeaddrinfo(pai);
return 1LL;
}

original_code:
int netConnect(char* port, char* hostname ) {
  struct addrinfo hints, *servinfo, *p;
 memset(&hints, 0, sizeof hints);
  hints.ai_family = 0;
  hints.ai_socktype = SOCK_STREAM;
  if (getaddrinfo(hostname, port, &hints, &servinfo) != 0) {
    log_printf(0, "Fehler beim Servernamen\n");
    exit(1);
  }
  for(p = servinfo; p != ((void *)0); p = p->ai_next) {
    if ((socke = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
      log_printf(0, "Socket konnte nicht angelegt werden.\n");
        continue;
    }
    if (connect(socke, p->ai_addr, p->ai_addrlen) == -1) {
      close(socke);
      log_printf(0, "Verbindung mit Socket fehlgeschlagen.\n");
      continue;
    }
    break;
  }
 if (p == ((void *)0)) {
  log_printf(0, "Client konnte nicht verbunden werden.\n");
  exit(1);
 }
 freeaddrinfo(servinfo);
 return 1;
}

canonical_original_code:
int netConnect(char *port, char *hostname) {
  struct addrinfo hints; struct addrinfo *servinfo; struct addrinfo *p;
 memset(&hints, 0, sizeof hints);
  hints.ai_family = 0;
  hints.ai_socktype = SOCK_STREAM;
  if (getaddrinfo(hostname, port, &hints, &servinfo) != 0) {
    log_printf(0, "Fehler beim Servernamen\n");
    exit(1);
  }
  for(p = servinfo; p != ((void *)0); p = p->ai_next) {
    if ((socke = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
      log_printf(0, "Socket konnte nicht angelegt werden.\n");
        continue;
    }
    if (connect(socke, p->ai_addr, p->ai_addrlen) == -1) {
      close(socke);
      log_printf(0, "Verbindung mit Socket fehlgeschlagen.\n");
      continue;
    }
    break;
  }
 if (p == ((void *)0)) {
  log_printf(0, "Client konnte nicht verbunden werden.\n");
  exit(1);
 }
 freeaddrinfo(servinfo);
 return 1;
}

variable_types:
port
char *

variable_types:
hostname
char *

variable_types: struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr { unsigned short sa_family; char sa_data[14]; } *ai_addr; char *ai_canonname; struct addrinfo *ai_next; } *

user_defined_types: struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct addrinfo *ai_next; }


getSocketFd

decompiled_code:
__int64 getSocketFd()
{
return (unsigned int)socke;
}

canonical_decompiled_code:
__int64 func5()
{
return (unsigned int)socke;
}

original_code:
int getSocketFd(){
 return socke;
}

canonical_original_code:
int getSocketFd(){
 return socke;
}


netDisconnect

decompiled_code:
__int64 netDisconnect()
{
close(socke);
return 0LL;
}

canonical_decompiled_code:
__int64 func6()
{
close(socke);
return 0LL;
}

original_code:
int netDisconnect() {
 close(socke);
 return 0;
}


decompiled_code:
__int64 __fastcall pipe_read(int *a1, char *a2)
{
__int64 result; // rax

close(a1[1]);
if ( read(*a1, a2, 0xAuLL) < 0 )
{
log_printf(0LL, "Fehler beim Lesen der Pipe");
perror("Error: ");
result = 0LL;
}
else
{
log_printf(2LL, "Pipe gelesen: %s\n", a2);
result = 1LL;
}
return result;
}

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

close(a1[1]);
if ( read(*a1, a2, 0xAuLL) < 0 )
{
log_printf(0LL, "Fehler beim Lesen der Pipe");
perror("Error: ");
result = 0LL;
}
else
{
log_printf(2LL, "Pipe gelesen: %s\n", a2);
result = 1LL;
}
return result;
}

original_code:
int pipe_read(int pipe_fd[],char * getText){
 close(pipe_fd[1]);
 if((read(pipe_fd[0],getText,10)) < 0) {
  log_printf(0,"Fehler beim Lesen der Pipe");
  perror("Error: ");
  return 0;
 }
 log_printf(2,"Pipe gelesen: %s\n", getText);
 return 1;
}

canonical_original_code:
int pipe_read(int pipe_fd[], char *getText){
 close(pipe_fd[1]);
 if((read(pipe_fd[0],getText,10)) < 0) {
  log_printf(0,"Fehler beim Lesen der Pipe");
  perror("Error: ");
  return 0;
 }
 log_printf(2,"Pipe gelesen: %s\n", getText);
 return 1;
}

variable_types:
getText
char *


decompiled_code:
__int64 __fastcall pipe_write(int *a1)
{
__int64 result; // rax

close(*a1);
if ( write(a1[1], &spielzug, 6uLL) == 6 )
{
log_printf(2LL, "Pipe geschrieben\n");
result = 1LL;
}
else
{
log_printf(0LL, "Fehler beim Schreiben in die Pipe\n");
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(int *a1)
{
__int64 result; // rax

close(*a1);
if ( write(a1[1], &spielzug, 6uLL) == 6 )
{
log_printf(2LL, "Pipe geschrieben\n");
result = 1LL;
}
else
{
log_printf(0LL, "Fehler beim Schreiben in die Pipe\n");
result = 0LL;
}
return result;
}

original_code:
int pipe_write(int pipe_fd[]){
 close(pipe_fd[0]);
 if((write(pipe_fd[1],spielzug,6))!=6){
  log_printf(0,"Fehler beim Schreiben in die Pipe\n");
  return 0;
 }
 log_printf(2,"Pipe geschrieben\n");
 return 1;
}


ueberwacheFd

decompiled_code:
__int64 __fastcall ueberwacheFd(int *a1, char *a2)
{
int v3; // edx
int v4; // edi
int v5; // eax
__int64 result; // rax
fd_set v7; // [rsp+0h] [rbp-98h] BYREF

v3 = getSocketFd();
memset(&v7, 0, sizeof(v7));
v4 = *a1;
v7.fds_bits[v4 / 64] |= 1LL << (v4 % 64);
v7.fds_bits[v3 / 64] |= 1LL << (v3 % 64);
if ( v4 < v3 )
v4 = v3;
if ( select(v4 + 1, &v7, 0LL, 0LL, 0LL) <= 0 )
{
log_printf(0LL, "Fehler bei Select\n");
perror("error");
result = 0LL;
}
else
{
v5 = *a1 + 63;
if ( *a1 >= 0 )
v5 = *a1;
if ( (v7.fds_bits[v5 >> 6] & (1LL << (*a1 % 64))) != 0 )
{
log_printf(2LL, "Gandalf hat gedacht.\n");
result = pipe_read(a1, a2);
}
else
{
log_printf(2LL, "Gandalf denkt zu langsam.\n");
result = 2LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(int *a1, char *a2)
{
int v3; // edx
int v4; // edi
int v5; // eax
__int64 result; // rax
fd_set v7; // [rsp+0h] [rbp-98h] BYREF

v3 = getSocketFd();
memset(&v7, 0, sizeof(v7));
v4 = *a1;
v7.fds_bits[v4 / 64] |= 1LL << (v4 % 64);
v7.fds_bits[v3 / 64] |= 1LL << (v3 % 64);
if ( v4 < v3 )
v4 = v3;
if ( select(v4 + 1, &v7, 0LL, 0LL, 0LL) <= 0 )
{
log_printf(0LL, "Fehler bei Select\n");
perror("error");
result = 0LL;
}
else
{
v5 = *a1 + 63;
if ( *a1 >= 0 )
v5 = *a1;
if ( (v7.fds_bits[v5 >> 6] & (1LL << (*a1 % 64))) != 0 )
{
log_printf(2LL, "Gandalf hat gedacht.\n");
result = func0(a1, a2);
}
else
{
log_printf(2LL, "Gandalf denkt zu langsam.\n");
result = 2LL;
}
}
return result;
}

original_code:
int ueberwacheFd(int pipe_fd[],char *getText){
 int socket_fd = getSocketFd();
 fd_set set;
 do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&set)->__fds_bits)[0]) : "memory"); } while (0);
 ((void) (((&set)->__fds_bits)[((pipe_fd[0]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((pipe_fd[0]) % (8 * (int) sizeof (__fd_mask)))))));
 ((void) (((&set)->__fds_bits)[((socket_fd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((socket_fd) % (8 * (int) sizeof (__fd_mask)))))));
 int max = pipe_fd[0];
 if (max < socket_fd) {
  max = socket_fd;
 }
 int ret = select(max+1,&set,((void *)0),((void *)0),((void *)0));
 if(ret < 1){
  log_printf(0,"Fehler bei Select\n");
  perror("error");
  return 0;
 }
 else if (((((&set)->__fds_bits)[((pipe_fd[0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((pipe_fd[0]) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {
   log_printf(2,"Gandalf hat gedacht.\n");
   return pipe_read(pipe_fd, getText); }
 log_printf(2,"Gandalf denkt zu langsam.\n");
 return 2;
}

canonical_original_code:
int ueberwacheFd(int pipe_fd[], char *getText){
 int socket_fd = getSocketFd();
 struct fd_set set;
 do { int __d0; int __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&set)->__fds_bits)[0]) : "memory"); } while (0);
 ((void) (((&set)->__fds_bits)[((pipe_fd[0]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((pipe_fd[0]) % (8 * (int) sizeof (__fd_mask)))))));
 ((void) (((&set)->__fds_bits)[((socket_fd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((socket_fd) % (8 * (int) sizeof (__fd_mask)))))));
 int max = pipe_fd[0];
 if (max < socket_fd) {
  max = socket_fd;
 }
 int ret = select(max+1,&set,((void *)0),((void *)0),((void *)0));
 if(ret < 1){
  log_printf(0,"Fehler bei Select\n");
  perror("error");
  return 0;
 }
 else if (((((&set)->__fds_bits)[((pipe_fd[0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((pipe_fd[0]) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {
   log_printf(2,"Gandalf hat gedacht.\n");
   return pipe_read(pipe_fd, getText); }
 log_printf(2,"Gandalf denkt zu langsam.\n");
 return 2;
}

variable_types:
set
struct fd_set { long __fds_bits[-1]; }

variable_types: max int

variable_types: ret int


printSteinNummern

decompiled_code:
__int64 __fastcall printSteinNummern(__int64 a1, int a2, int a3)
{
int *v4; // rbp
__int64 v5; // r13
__int64 v6; // rdx
int v7; // ebx

log_printf(1LL, " | \x1B[2m");
if ( a2 )
{
v4 = (int *)(a1 + 4LL * a3);
v5 = a1 + 4 * ((unsigned int)(a2 - 1) + (__int64)a3) + 4;
do
{
v6 = (unsigned int)*v4;
if ( (_DWORD)v6 == -1 )
{
v7 = 0;
if ( a2 > 0 )
{
do
{
++v7;
log_printf(1LL, " ");
}
while ( a2 != v7 );
}
}
else
{
log_printf(1LL, "\x1B[2m(%i)\x1B[0m", v6);
if ( *v4 <= 9 )
log_printf(1LL, " ");
}
++v4;
log_printf(1LL, " ");
}
while ( v4 != (int *)v5 );
}
return log_printf(1LL, "|\n");
}

original_code:
void printSteinNummern(int field[],int breite, int currentPlace) {
 int n = breite;
 log_printf(1,"  | ""\033[2m");
 while (n) {
  if (field[currentPlace] == -1) {
   for (int i=0; i<breite; i++) {
       log_printf(1," ");
      }
    }
    else {
     log_printf(1,"\033[2m""(%i)""\033[0m",field[currentPlace]);
   if(field[currentPlace] < 10) {
    log_printf(1," ");
   }
    }
    log_printf(1," ");
    currentPlace++;
    n--;
 }
 log_printf(1,"|\n");
 currentPlace = currentPlace - breite;
 n= breite;
}

canonical_original_code:
void printSteinNummern(int field[], int breite, int currentPlace) {
 int n = breite;
 log_printf(1,"  | ""\033[2m");
 while (n) {
  if (field[currentPlace] == -1) {
   for (int i = 0; i<breite; i++) {
       log_printf(1," ");
      }
    }
    else {
     log_printf(1,"\033[2m""(%i)""\033[0m",field[currentPlace]);
   if(field[currentPlace] < 10) {
    log_printf(1," ");
   }
    }
    log_printf(1," ");
    currentPlace++;
    n--;
 }
 log_printf(1,"|\n");
 currentPlace = currentPlace - breite;
 n= breite;
}

variable_types:
field
int []

variable_types: breite int

variable_types: currentPlace int

variable_types: n int

variable_types: i int


printSpaltenNamen

decompiled_code:
__int64 __fastcall printSpaltenNamen(int a1)
{
int v1; // ebx

if ( a1 )
{
v1 = a1;
do
log_printf(1LL, " %c", (unsigned int)(char)(a1 + 65 - v1--));
while ( v1 );
}
return log_printf(1LL, "\n");
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1)
{
int v1; // ebx

if ( a1 )
{
v1 = a1;
do
log_printf(1LL, " %c", (unsigned int)(char)(a1 + 65 - v1--));
while ( v1 );
}
return log_printf(1LL, "\n");
}

original_code:
void printSpaltenNamen(int breite) {
 char c = 'A';
 while (breite) {
  log_printf(1,"    %c",c);
  c++;
  breite--;
 }
 log_printf(1,"\n");
}

variable_types: c char


printSpielstein

decompiled_code:
__int64 __fastcall printSpielstein(int a1)
{
__int64 result; // rax
int i; // ebp

result = shmPtr;
for ( i = *(_DWORD *)(shmPtr + 588LL); i; --i )
{
if ( (a1 & 1) != 0 )
log_printf(1LL, "\x1B[41m ");
else
log_printf(1LL, "\x1B[42m ");
a1 >>= 1;
result = log_printf(1LL, "\x1B[0m");
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1)
{
__int64 result; // rax
int i; // ebp

result = shmPtr;
for ( i = *(_DWORD *)(shmPtr + 588LL); i; --i )
{
if ( (a1 & 1) != 0 )
log_printf(1LL, "\x1B[41m ");
else
log_printf(1LL, "\x1B[42m ");
a1 >>= 1;
result = log_printf(1LL, "\x1B[0m");
}
return result;
}

original_code:
void printSpielstein(int i) {
 int breite = shmPtr->breite;
 while (breite) {
  if (i & 1) {
   log_printf(1,"\033[41m"" ");
  } else {
   log_printf(1,"\033[42m"" ");
  }
 log_printf(1,"\033[0m");
 i >>= 1;
 breite--;
 }
}


printField

decompiled_code:
__int64 printField()
{
int v0; // ebp
unsigned int v1; // er13
int v2; // er14
int *v3; // rbx
int v4; // er15
__int64 v6; // [rsp+8h] [rbp-40h]

v0 = *(_DWORD *)(shmPtr + 588LL);
v1 = *(_DWORD *)(shmPtr + 592LL);
v6 = shmPtr_Sf;
log_printf(1LL, "\n");
printSpaltenNamen(v0);
printMultiZeichen_constprop_0(v0);
if ( v1 )
{
v2 = 0;
do
{
printSteinNummern(v6, v0, v2);
log_printf(1LL, "%i | ", v1);
if ( v0 )
{
v3 = (int *)(v6 + 4LL * v2);
do
{
if ( *v3 == -1 )
{
v4 = 0;
if ( v0 > 0 )
{
do
{
++v4;
log_printf(1LL, "*");
}
while ( v0 != v4 );
}
}
else
{
printSpielstein(*v3);
}
++v3;
log_printf(1LL, " ");
}
while ( v3 != (int *)(v6 + 4 * (v2 + (unsigned __int64)(unsigned int)(v0 - 1)) + 4) );
v2 += v0;
}
log_printf(1LL, "| %i\n", v1--);
}
while ( v1 );
}
printMultiZeichen_constprop_0(v0);
return printSpaltenNamen(v0);
}

original_code:
void printField() {
 int breite= shmPtr->breite;
 int hoehe = shmPtr->hoehe;
 int *field = shmPtr_Sf;
 int currentPlace = 0;
 log_printf(1,"\n");
 printSpaltenNamen(breite);
 printMultiZeichen(breite,'+','-');
 while (hoehe) {
  int n=breite;
  if(1) {printSteinNummern(field,breite,currentPlace);}
  log_printf(1,"%i | ",hoehe);
  while (n) {
   if (field[currentPlace] == -1) {
    for (int i=0; i<breite; i++) {
     log_printf(1,"*");
    }
   }
   else {
    printSpielstein(field[currentPlace]);
   }
   log_printf(1," ");
   currentPlace++;
   n--;
  }
  log_printf(1,"| %i\n",hoehe);
  hoehe--;
 }
 printMultiZeichen(breite,'+','-');
 printSpaltenNamen(breite);
}

canonical_original_code:
void printField() {
 int breite = shmPtr->breite;
 int hoehe = shmPtr->hoehe;
 int *field = shmPtr_Sf;
 int currentPlace = 0;
 log_printf(1,"\n");
 printSpaltenNamen(breite);
 printMultiZeichen(breite,'+','-');
 while (hoehe) {
  int n = breite;
  if(1) {printSteinNummern(field,breite,currentPlace);}
  log_printf(1,"%i | ",hoehe);
  while (n) {
   if (field[currentPlace] == -1) {
    for (int i = 0; i<breite; i++) {
     log_printf(1,"*");
    }
   }
   else {
    printSpielstein(field[currentPlace]);
   }
   log_printf(1," ");
   currentPlace++;
   n--;
  }
  log_printf(1,"| %i\n",hoehe);
  hoehe--;
 }
 printMultiZeichen(breite,'+','-');
 printSpaltenNamen(breite);
}

variable_types: hoehe int

variable_types:
field
int *


repo: pcazade/MDBas

decompiled_code:
double __fastcall coulomb_none(__int64 a1, _QWORD *a2)
{
*a2 = 0LL;
return 0.0;
}

canonical_decompiled_code:
double __fastcall func1(__int64 a1, _QWORD *a2)
{
*a2 = 0LL;
return 0.0;
}

original_code:
double coulomb_none(const PARAM *param,double *delec,const double qel,
      const double r2,const double rt)
{
  *delec=0.;
  return 0.;
}

canonical_original_code:
double coulomb_none(struct PARAM *param, double *delec, double qel, double r2, double rt)
{
  *delec=0.;
  return 0.;
}

variable_types: struct PARAM { int step; double timeStep; int nAtom; int nBond; int nConst; double tolShake; double chargeConst; double cutOff; double cutOn; double temp0; double tolMinim; } *

variable_types:
delec
double *

variable_types: qel double

variable_types: rt double

return_type: double


original_code:
void coulomb_full(ENERGY *ener,PARAM *param,PBC *box,double *x,double *y,
    double *z,double *fx, double *fy, double *fz,double *q,
    int **exclList,int *exclPair)
{
  int i,j,k,exclude;
  double elec=0.,pelec,delec;
  double r,r2,rt,fxi,fyi,fzi,fxj,fyj,fzj;
  double delta[3];
  for(i=0;i<param->nAtom-1;i++)
  {
    fxi=0.;
    fyi=0.;
    fzi=0.;
    for(j=i+1;j<param->nAtom;j++)
    {
      exclude=0;
      for (k=0;k<exclPair[i];k++)
      {
 if(exclList[i][k]==j)
 {
   exclude=1;
   break;
 }
      }
      if(!exclude)
      {
 delta[0]=x[j]-x[i];
 delta[1]=y[j]-y[i];
 delta[2]=z[j]-z[i];
 r2=dist(box,delta);
 r=sqrt(r2);
 rt=1./r;
 pelec=param->chargeConst*q[i]*q[j]*rt;
 elec+=pelec;
 delec=-pelec*rt;
 fxj=delec*delta[0]*rt;
 fyj=delec*delta[1]*rt;
 fzj=delec*delta[2]*rt;
 fxi+=fxj;
 fyi+=fyj;
 fzi+=fzj;
 fx[j]+=-fxj;
 fy[j]+=-fyj;
 fz[j]+=-fzj;
      }
    }
    fx[i]+=fxi;
    fy[i]+=fyi;
    fz[i]+=fzi;
  }
  ener->elec+=elec;
}

canonical_original_code:
void coulomb_full(struct ENERGY *ener, struct PARAM *param, struct PBC *box, double *x, double *y, double *z, double *fx, double *fy, double *fz, double *q, int **exclList, int *exclPair)
{
  int i; int j; int k; int exclude;
  double elec = 0.; double pelec; double delec;
  double r; double r2; double rt; double fxi; double fyi; double fzi; double fxj; double fyj; double fzj;
  double delta[3];
  for(i=0;i<param->nAtom-1;i++)
  {
    fxi=0.;
    fyi=0.;
    fzi=0.;
    for(j=i+1;j<param->nAtom;j++)
    {
      exclude=0;
      for (k=0;k<exclPair[i];k++)
      {
 if(exclList[i][k]==j)
 {
   exclude=1;
   break;
 }
      }
      if(!exclude)
      {
 delta[0]=x[j]-x[i];
 delta[1]=y[j]-y[i];
 delta[2]=z[j]-z[i];
 r2=dist(box,delta);
 r=sqrt(r2);
 rt=1./r;
 pelec=param->chargeConst*q[i]*q[j]*rt;
 elec+=pelec;
 delec=-pelec*rt;
 fxj=delec*delta[0]*rt;
 fyj=delec*delta[1]*rt;
 fzj=delec*delta[2]*rt;
 fxi+=fxj;
 fyi+=fyj;
 fzi+=fzj;
 fx[j]+=-fxj;
 fy[j]+=-fyj;
 fz[j]+=-fzj;
      }
    }
    fx[i]+=fxi;
    fy[i]+=fyi;
    fz[i]+=fzi;
  }
  ener->elec+=elec;
}

variable_types: struct ENERGY { double tot; double elec; double bond; double conint; double virelec; double virshake; } *

variable_types: struct PBC { enum BOX_TYPE { NOBOX=0, CUBIC=1, ORBIC=2, TCLIN=3 } type; double a; double u; double pa; double stress1; double stress4; double stress7; } *

variable_types:
x
double *

variable_types:
y
double *

variable_types:
z
double *

variable_types:
fx
double *

variable_types:
fy
double *

variable_types:
fz
double *

variable_types:
q
double *

variable_types:
exclList
int **

variable_types:
exclPair
int *

variable_types: j int

variable_types: k int

variable_types: exclude int

variable_types: elec double

variable_types: pelec double

variable_types: delec double

variable_types: r double

variable_types: fxi double

variable_types: fyi double

variable_types: fzi double

variable_types: fxj double

variable_types: fyj double

variable_types: fzj double

variable_types:
delta
double [3]

user_defined_types: struct PARAM { int step; double timeStep; int nAtom; int nBond; int nConst; double tolShake; double chargeConst; double cutOff; double cutOn; double temp0; double tolMinim; }

user_defined_types: struct PBC { enum BOX_TYPE type; double a; double u; double pa; double stress1; double stress4; double stress7; }


original_code:
double coulomb_shift1(const PARAM *param,double *delec,const double qel,
        const double r2,const double rt)
{
  double elec=0.,pelec,shift1,shift2,shiftFunc,dshiftFunc;
  shift1=rt*r2*param->rcutOff;
  shift2=r2*param->rcutOff2;
  shiftFunc=1.-2.*shift1+shift2;
  dshiftFunc=2.*(shift2-shift1);
  pelec=param->chargeConst*qel*rt;
  elec=pelec*shiftFunc;
  *delec=pelec*rt*(dshiftFunc-shiftFunc);
  return elec;
}

canonical_original_code:
double coulomb_shift1(struct PARAM *param, double *delec, double qel, double r2, double rt)
{
  double elec = 0.; double pelec; double shift1; double shift2; double shiftFunc; double dshiftFunc;
  shift1=rt*r2*param->rcutOff;
  shift2=r2*param->rcutOff2;
  shiftFunc=1.-2.*shift1+shift2;
  dshiftFunc=2.*(shift2-shift1);
  pelec=param->chargeConst*qel*rt;
  elec=pelec*shiftFunc;
  *delec=pelec*rt*(dshiftFunc-shiftFunc);
  return elec;
}

variable_types: struct PARAM { int step; double timeStep; int nAtom; int nBond; int nConst; double tolShake; double chargeConst; double cutOff; double cutOn; double temp0; double tolMinim; } *

variable_types:
delec
double *

variable_types: qel double

variable_types: rt double

variable_types: shiftFunc double

variable_types: dshiftFunc double


original_code:
double coulomb_switch(const PARAM *param,double *delec,const double qel,
        const double r2,const double rt)
{
  double elec=0.,pelec,switch1,switchFunc,dswitchFunc;
  if(r2<=param->cutOn2)
  {
    pelec=param->chargeConst*qel*rt;
    elec=pelec;
    *delec=-pelec*rt;
  }
  else
  {
    switch1=param->cutOff2-r2;
    switchFunc=((switch1)*(switch1))*(param->cutOff2+2.*r2-3.*param->cutOn2)*param->switch2;
    dswitchFunc=12.*r2*switch1*(param->cutOn2-r2)*param->switch2;
    pelec=param->chargeConst*qel*rt;
    elec=pelec*switchFunc;
    *delec=pelec*rt*(dswitchFunc-switchFunc);
  }
  return elec;
}

canonical_original_code:
double coulomb_switch(struct PARAM *param, double *delec, double qel, double r2, double rt)
{
  double elec = 0.; double pelec; double switch1; double switchFunc; double dswitchFunc;
  if(r2<=param->cutOn2)
  {
    pelec=param->chargeConst*qel*rt;
    elec=pelec;
    *delec=-pelec*rt;
  }
  else
  {
    switch1=param->cutOff2-r2;
    switchFunc=((switch1)*(switch1))*(param->cutOff2+2.*r2-3.*param->cutOn2)*param->switch2;
    dswitchFunc=12.*r2*switch1*(param->cutOn2-r2)*param->switch2;
    pelec=param->chargeConst*qel*rt;
    elec=pelec*switchFunc;
    *delec=pelec*rt*(dswitchFunc-switchFunc);
  }
  return elec;
}

variable_types: elec double

variable_types: switchFunc double

variable_types: dswitchFunc double


decompiled_code:
double __fastcall coulomb14_none(__int64 a1, _QWORD *a2)
{
return coulomb_none_constprop_0(a2);
}

canonical_decompiled_code:
double __fastcall func5(__int64 a1, _QWORD *a2)
{
return func0(a2);
}

original_code:
double coulomb14_none(const PARAM *param,double *delec,const double qel,
        const double r2,const double rt)
{
  *delec=0.;
  return 0.;
}

canonical_original_code:
double coulomb14_none(struct PARAM *param, double *delec, double qel, double r2, double rt)
{
  *delec=0.;
  return 0.;
}


decompiled_code:
void __fastcall coulomb14_full(__int64 a1, double *a2, double a3, double a4, double a5)
{
*a2 = a5 * COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a1 + 88) * *(double *)(a1 + 72) * a3 * a5) ^ LC2);
}

canonical_decompiled_code:
void __fastcall func6(__int64 a1, double *a2, double a3, double a4, double a5)
{
*a2 = a5 * COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a1 + 88) * *(double *)(a1 + 72) * a3 * a5) ^ LC2);
}

original_code:
double coulomb14_full(const PARAM *param,double *delec,const double qel,
        const double r2,const double rt)
{
  double elec=0.;
  elec=param->scal14*param->chargeConst*qel*rt;
  *delec=-elec*rt;
  return elec;
}

canonical_original_code:
double coulomb14_full(struct PARAM *param, double *delec, double qel, double r2, double rt)
{
  double elec = 0.;
  elec=param->scal14*param->chargeConst*qel*rt;
  *delec=-elec*rt;
  return elec;
}


decompiled_code:
double __fastcall coulomb14_switch(double *a1, double *a2, double a3, double a4, double a5)
{
double v5; // xmm5_8
double result; // xmm0_8
double v8; // xmm0_8
double v9; // xmm7_8
double v10; // xmm8_8
double v11; // xmm6_8
double v12; // xmm3_8

v5 = a1[17];
if ( v5 < a4 )
{
v8 = a1[14];
if ( v8 < a4 )
{
result = 0.0;
}
else
{
v9 = a1[18];
v10 = v8 - a4;
v11 = (a4 + a4 + v8 - 3.0 * v5) * (v10 * v10) * v9;
v12 = a3 * (a1[11] * a1[9]) * a5;
result = v11 * v12;
*a2 = (12.0 * a4 * v10 * (v5 - a4) * v9 - v11) * (a5 * v12);
}
}
else
{
result = a1[11] * a1[9] * a3 * a5;
*a2 = a5 * COERCE_DOUBLE(*(_QWORD *)&result ^ LC2);
}
return result;
}

original_code:
double coulomb14_switch(const PARAM *param,double *delec,const double qel,
   const double r2,const double rt)
{
  double elec=0.,pelec,switch1,switchFunc,dswitchFunc;
  if(r2<=param->cutOn2)
  {
    pelec=param->scal14*param->chargeConst*qel*rt;
    elec=pelec;
    *delec=-pelec*rt;
  }
  else if(r2<=param->cutOff2)
  {
    switch1=param->cutOff2-r2;
    switchFunc=((switch1)*(switch1))*(param->cutOff2+2.*r2-3.*param->cutOn2)*param->switch2;
    dswitchFunc=12.*r2*switch1*(param->cutOn2-r2)*param->switch2;
    pelec=param->scal14*param->chargeConst*qel*rt;
    elec=pelec*switchFunc;
    *delec=pelec*rt*(dswitchFunc-switchFunc);
  }
  return elec;
}

canonical_original_code:
double coulomb14_switch(struct PARAM *param, double *delec, double qel, double r2, double rt)
{
  double elec = 0.; double pelec; double switch1; double switchFunc; double dswitchFunc;
  if(r2<=param->cutOn2)
  {
    pelec=param->scal14*param->chargeConst*qel*rt;
    elec=pelec;
    *delec=-pelec*rt;
  }
  else if(r2<=param->cutOff2)
  {
    switch1=param->cutOff2-r2;
    switchFunc=((switch1)*(switch1))*(param->cutOff2+2.*r2-3.*param->cutOn2)*param->switch2;
    dswitchFunc=12.*r2*switch1*(param->cutOn2-r2)*param->switch2;
    pelec=param->scal14*param->chargeConst*qel*rt;
    elec=pelec*switchFunc;
    *delec=pelec*rt*(dswitchFunc-switchFunc);
  }
  return elec;
}

variable_types: pelec double


decompiled_code:
double __fastcall vdw_none(__int64 a1, _QWORD *a2)
{
*a2 = 0LL;
return 0.0;
}

original_code:
double vdw_none(const PARAM *param, double *dvdw, const double veps,
        const double vsig, const double r2, const double rt)
{
    *dvdw = 0.;
    return 0.;
}

canonical_original_code:
double vdw_none(struct PARAM *param, double *dvdw, double veps, double vsig, double r2, double rt)
{
    *dvdw = 0.;
    return 0.;
}

variable_types:
dvdw
double *

variable_types: veps double

variable_types: vsig double


original_code:
void vdw_full(const PARAM *param, ENERGY *ener, const PBC *box, double *x,
        double *y, double *z, double *fx, double *fy, double *fz, double *eps, double *sig,
        int **exclList, int *exclPair)
{
    int i, j, k, exclude;
    ;
    double evdw = 0., pvdw, dvdw;
    double r, r2, rt, fxj, fyj, fzj, fxi, fyi, fzi;
    double delta[3];
    for (i = 0; i < param->nAtom - 1; i++)
    {
        fxi = 0.;
        fyi = 0.;
        fzi = 0.;
        for (j = i + 1; j < param->nAtom; j++)
        {
            exclude = 0;
            for (k = 0; k < exclPair[i]; k++)
            {
                if (exclList[i][k] == j)
                {
                    exclude = 1;
                    break;
                }
            }
            if (!exclude)
            {
                delta[0] = x[j] - x[i];
                delta[1] = y[j] - y[i];
                delta[2] = z[j] - z[i];
                r2 = dist(box, delta);
                r = sqrt(r2);
                rt = 1. / r;
                pvdw = 4. * eps[i] * eps[j]*(((((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))*(((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))) - (((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))));
                dvdw = 24. * eps[i] * eps[j] / r * ((((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))) - 2. * ((((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))*(((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))));
                evdw += pvdw;
                fxj = dvdw * delta[0] / r;
                fyj = dvdw * delta[1] / r;
                fzj = dvdw * delta[2] / r;
                fxi += fxj;
                fyi += fyj;
                fzi += fzj;
                fx[j] += -fxj;
                fy[j] += -fyj;
                fz[j] += -fzj;
            }
        }
        fx[i] += fxi;
        fy[i] += fyi;
        fz[i] += fzi;
    }
    ener->vdw += evdw;
}

canonical_original_code:
void vdw_full(struct PARAM *param, struct ENERGY *ener, struct PBC *box, double *x, double *y, double *z, double *fx, double *fy, double *fz, double *eps, double *sig, int **exclList, int *exclPair)
{
    int i; int j; int k; int exclude;
    ;
    double evdw = 0.; double pvdw; double dvdw;
    double r; double r2; double rt; double fxj; double fyj; double fzj; double fxi; double fyi; double fzi;
    double delta[3];
    for (i = 0; i < param->nAtom - 1; i++)
    {
        fxi = 0.;
        fyi = 0.;
        fzi = 0.;
        for (j = i + 1; j < param->nAtom; j++)
        {
            exclude = 0;
            for (k = 0; k < exclPair[i]; k++)
            {
                if (exclList[i][k] == j)
                {
                    exclude = 1;
                    break;
                }
            }
            if (!exclude)
            {
                delta[0] = x[j] - x[i];
                delta[1] = y[j] - y[i];
                delta[2] = z[j] - z[i];
                r2 = dist(box, delta);
                r = sqrt(r2);
                rt = 1. / r;
                pvdw = 4. * eps[i] * eps[j]*(((((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))*(((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))) - (((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))));
                dvdw = 24. * eps[i] * eps[j] / r * ((((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))) - 2. * ((((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))*(((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r))*((((sig[i] + sig[j]) / r)*((sig[i] + sig[j]) / r))*((sig[i] + sig[j]) / r)))));
                evdw += pvdw;
                fxj = dvdw * delta[0] / r;
                fyj = dvdw * delta[1] / r;
                fzj = dvdw * delta[2] / r;
                fxi += fxj;
                fyi += fyj;
                fzi += fzj;
                fx[j] += -fxj;
                fy[j] += -fyj;
                fz[j] += -fzj;
            }
        }
        fx[i] += fxi;
        fy[i] += fyi;
        fz[i] += fzi;
    }
    ener->vdw += evdw;
}

variable_types: struct ENERGY { double tot; double elec; double bond; double conint; double virelec; double virshake; } *

variable_types: struct PBC { enum BOX_TYPE { NOBOX=0, CUBIC=1, ORBIC=2, TCLIN=3 } type; double a; double u; double pa; double stress1; double stress4; double stress7; } *

variable_types:
x
double *

variable_types:
y
double *

variable_types:
z
double *

variable_types:
fx
double *

variable_types:
fy
double *

variable_types:
fz
double *

variable_types:
eps
double *

variable_types:
sig
double *

variable_types:
exclList
int **

variable_types:
exclPair
int *

variable_types: i int

variable_types: j int

variable_types: k int

variable_types: exclude int

variable_types: evdw double

variable_types: pvdw double

variable_types: dvdw double

variable_types: r double

variable_types: fxj double

variable_types: fxi double

variable_types: fyi double

variable_types: fzi double


decompiled_code:
double __fastcall vdw14_none(__int64 a1, _QWORD *a2)
{
return vdw_none_constprop_0(a2);
}

canonical_decompiled_code:
double __fastcall func4(__int64 a1, _QWORD *a2)
{
return func0(a2);
}

original_code:
double vdw14_none(const PARAM *param, double *dvdw, const double veps,
        const double vsig, const double r2, const double rt)
{
    *dvdw = 0;
    return 0.;
}

canonical_original_code:
double vdw14_none(struct PARAM *param, double *dvdw, double veps, double vsig, double r2, double rt)
{
    *dvdw = 0;
    return 0.;
}

variable_types: struct PARAM { int step; double timeStep; int nAtom; int nBond; int nConst; double tolShake; double chargeConst; double cutOff; double cutOn; double temp0; double tolMinim; } *

variable_types:
dvdw
double *

variable_types: veps double

variable_types: vsig double

variable_types: rt double


original_code:
double vdw14_full(const PARAM *param, double *dvdw, const double veps,
        const double vsig, const double r2, const double rt)
{
    double evdw = 0.;
    double vsig6, vsig12;
    vsig6 = vsig*rt;
    vsig6 = ((((vsig6)*(vsig6))*(vsig6))*(((vsig6)*(vsig6))*(vsig6)));
    vsig12 = ((vsig6)*(vsig6));
    evdw = 4. * param->scal14 * veps * (vsig12 - vsig6);
    *dvdw = 24. * param->scal14 * veps * rt * (vsig6 - 2. * vsig12);
    return evdw;
}

canonical_original_code:
double vdw14_full(struct PARAM *param, double *dvdw, double veps, double vsig, double r2, double rt)
{
    double evdw = 0.;
    double vsig6; double vsig12;
    vsig6 = vsig*rt;
    vsig6 = ((((vsig6)*(vsig6))*(vsig6))*(((vsig6)*(vsig6))*(vsig6)));
    vsig12 = ((vsig6)*(vsig6));
    evdw = 4. * param->scal14 * veps * (vsig12 - vsig6);
    *dvdw = 24. * param->scal14 * veps * rt * (vsig6 - 2. * vsig12);
    return evdw;
}


minimise

decompiled_code:
void minimise()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

original_code:
void minimise(CTRL *ctrl,PARAM *param,ENERGY *ener,PBC *box,NEIGH *neigh,
       ATOM atom[],BOND bond[],BOND ub[],ANGLE angle[],DIHE dihe[],
       DIHE impr[])
{
}

canonical_original_code:
void minimise(struct CTRL *ctrl, struct PARAM *param, struct ENERGY *ener, struct PBC *box, struct NEIGH *neigh, struct ATOM atom[], struct BOND bond[], struct BOND ub[], struct ANGLE angle[], struct DIHE dihe[], struct DIHE impr[])
{
}

variable_types: struct CTRL { int newjob; int keyRand; int printOut; int keyMd; int seed; int keyMinim; int keyLink; int keyConstH; int keyNb14; int keyEwald; enum ELEC_TYPE { NOELEC=0, FULL=1, SHIFT1=2, SHIFT2=3, SWITCH=4 } elecType; enum VDW_TYPE { NOVDW=0, VFULL=1, VSWITCH=2 } vdwType; enum INTEGRATOR_TYPE { LEAPFROG=0, VELOCITY=1 } integrator; enum ENSEMBLE_TYPE { NVE=0, NVT_B=1, NPT_B=2, NVT_H=3, NPT_H=4 } ens; } *

variable_types: struct ENERGY { double tot; double elec; double bond; double conint; double virelec; double virshake; } *

variable_types: struct PBC { enum BOX_TYPE { NOBOX=0, CUBIC=1, ORBIC=2, TCLIN=3 } type; double a; double u; double pa; double stress1; double stress4; double stress7; } *

variable_types: struct NEIGH { int update; int linkRatio; int nCells; int sizeList; int nPair14; } *

variable_types: struct ATOM { char label[5]; int type; } []

variable_types: struct BOND { enum BOND_TYPE { BHARM=0, BMORSE=1 } type; int a; double k; } []

variable_types:
ub
struct BOND []

variable_types: struct ANGLE { enum ANGLE_TYPE { AHARM=0 } type; int a; double k; } []

variable_types: struct DIHE { enum DIHE_TYPE { DCOS=1, DHARM=2 } type; int order; int a; double k; } []

variable_types:
impr
struct DIHE []

user_defined_types: struct CTRL { int newjob; int keyRand; int printOut; int keyMd; int seed; int keyMinim; int keyLink; int keyConstH; int keyNb14; int keyEwald; enum ELEC_TYPE elecType; enum VDW_TYPE vdwType; enum INTEGRATOR_TYPE integrator; enum ENSEMBLE_TYPE ens; }

user_defined_types: struct BOND { enum BOND_TYPE type; int a; double k; }

user_defined_types: struct ANGLE { enum ANGLE_TYPE type; int a; double k; }

user_defined_types: struct DIHE { enum DIHE_TYPE type; int order; int a; double k; }


steepestDescent

original_code:
void steepestDescent(CTRL *ctrl,PARAM *param,ENERGY *ener,PBC *box,NEIGH *neigh,
       ATOM atom[],BOND bond[],BOND ub[],ANGLE angle[],DIHE dihe[],
       DIHE impr[],double x[],double y[],double z[],double fx[],
       double fy[],double fz[])
{
  double step = 1.0e-7 ;
  double prec = 1.0e-3 ;
  int maxSteps = 10000 ;
  double diff;
  double eprev = 0. , enow = 0. ;
  int i, currSt=0 ;
  eprev = ener->pot;
  do
  {
    for (i=0 ; i < param->nAtom ; i++)
    {
      x[i] += step * fx[i] ;
      y[i] += step * fy[i] ;
      z[i] += step * fz[i] ;
    }
    enow = ener->pot;
    diff = fabs(enow-eprev);
    eprev=enow;
    currSt++;
  } while ( (diff >= prec) && (currSt<=maxSteps) ) ;
}

canonical_original_code:
void steepestDescent(struct CTRL *ctrl, struct PARAM *param, struct ENERGY *ener, struct PBC *box, struct NEIGH *neigh, struct ATOM atom[], struct BOND bond[], struct BOND ub[], struct ANGLE angle[], struct DIHE dihe[], struct DIHE impr[], double x[], double y[], double z[], double fx[], double fy[], double fz[])
{
  double step = 1.0e-7;
  double prec = 1.0e-3;
  int maxSteps = 10000;
  double diff;
  double eprev = 0.; double enow = 0.;
  int i; int currSt = 0;
  eprev = ener->pot;
  do
  {
    for (i=0 ; i < param->nAtom ; i++)
    {
      x[i] += step * fx[i] ;
      y[i] += step * fy[i] ;
      z[i] += step * fz[i] ;
    }
    enow = ener->pot;
    diff = fabs(enow-eprev);
    eprev=enow;
    currSt++;
  } while ( (diff >= prec) && (currSt<=maxSteps) ) ;
}

variable_types:
x
double []

variable_types:
y
double []

variable_types:
z
double []

variable_types:
fx
double []

variable_types:
fy
double []

variable_types:
fz
double []

variable_types: step double

variable_types: prec double

variable_types: maxSteps int

variable_types: diff double

variable_types: eprev double

variable_types: enow double

variable_types: i int

variable_types: currSt int

user_defined_types: struct ENERGY { double tot; double elec; double bond; double conint; double virelec; double virshake; }

user_defined_types: struct NEIGH { int update; int linkRatio; int nCells; int sizeList; int nPair14; }

user_defined_types: struct ATOM { char label[5]; int type; }

user_defined_types: enum ELEC_TYPE { NOELEC=0, FULL=1, SHIFT1=2, SHIFT2=3, SWITCH=4 }

user_defined_types: enum VDW_TYPE { NOVDW=0, VFULL=1, VSWITCH=2 }

user_defined_types: enum INTEGRATOR_TYPE { LEAPFROG=0, VELOCITY=1 }

user_defined_types: enum ENSEMBLE_TYPE { NVE=0, NVT_B=1, NPT_B=2, NVT_H=3, NPT_H=4 }

user_defined_types: enum BOX_TYPE { NOBOX=0, CUBIC=1, ORBIC=2, TCLIN=3 }


conjugateGradients

decompiled_code:
void conjugateGradients()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
void conjugateGradients(CTRL *ctrl,PARAM *param,ENERGY *ener,PBC *box,NEIGH *neigh,
   ATOM atom[],BOND bond[],BOND ub[],ANGLE angle[],DIHE dihe[],
   DIHE impr[])
{
}

canonical_original_code:
void conjugateGradients(struct CTRL *ctrl, struct PARAM *param, struct ENERGY *ener, struct PBC *box, struct NEIGH *neigh, struct ATOM atom[], struct BOND bond[], struct BOND ub[], struct ANGLE angle[], struct DIHE dihe[], struct DIHE impr[])
{
}

variable_types: struct CTRL { int newjob; int keyRand; int printOut; int keyMd; int seed; int keyMinim; int keyLink; int keyConstH; int keyNb14; int keyEwald; enum ELEC_TYPE { NOELEC=0, FULL=1, SHIFT1=2, SHIFT2=3, SWITCH=4 } elecType; enum VDW_TYPE { NOVDW=0, VFULL=1, VSWITCH=2 } vdwType; enum INTEGRATOR_TYPE { LEAPFROG=0, VELOCITY=1 } integrator; enum ENSEMBLE_TYPE { NVE=0, NVT_B=1, NPT_B=2, NVT_H=3, NPT_H=4 } ens; } *

variable_types: struct PARAM { int step; double timeStep; int nAtom; int nBond; int nConst; double tolShake; double chargeConst; double cutOff; double cutOn; double temp0; double tolMinim; } *

variable_types: struct ENERGY { double tot; double elec; double bond; double conint; double virelec; double virshake; } *

variable_types: struct PBC { enum BOX_TYPE { NOBOX=0, CUBIC=1, ORBIC=2, TCLIN=3 } type; double a; double u; double pa; double stress1; double stress4; double stress7; } *

variable_types: struct NEIGH { int update; int linkRatio; int nCells; int sizeList; int nPair14; } *

variable_types: struct ATOM { char label[5]; int type; } []

variable_types: struct BOND { enum BOND_TYPE { BHARM=0, BMORSE=1 } type; int a; double k; } []

variable_types:
ub
struct BOND []

variable_types: struct ANGLE { enum ANGLE_TYPE { AHARM=0 } type; int a; double k; } []


decompiled_code:
void *__fastcall my_malloc(size_t a1)
{
void *v1; // r12

v1 = malloc(a1);
if ( !v1 )
my_error(1LL, "src/memory.c", 27LL, 0LL);
return v1;
}

canonical_decompiled_code:
void *__fastcall func0(size_t a1)
{
void *v1; // r12

v1 = malloc(a1);
if ( !v1 )
my_error(1LL, "src/memory.c", 27LL, 0LL);
return v1;
}

original_code:
void* my_malloc(size_t size)
{
  void *ptr = ((void *)0);
  ptr=(void*)malloc(size);
  if(ptr==((void *)0))
    my_error(MEM_ALLOC_ERROR,"src/memory.c",27,0);
  return ptr;
}

canonical_original_code:
void *my_malloc(unsigned long size)
{
  void *ptr = ((void *)0);
  ptr=(void *)malloc(size);
  if(ptr==((void *)0))
    my_error(MEM_ALLOC_ERROR,"src/memory.c",27,0);
  return ptr;
}

variable_types:
size
unsigned long

variable_types:
ptr
void *

return_type: void *


decompiled_code:
void *__fastcall my_realloc(void *a1, size_t a2)
{
void *v2; // r12

v2 = realloc(a1, a2);
if ( !v2 )
my_error(1LL, "src/memory.c", 40LL, 0LL);
return v2;
}

canonical_decompiled_code:
void *__fastcall func1(void *a1, size_t a2)
{
void *v2; // r12

v2 = realloc(a1, a2);
if ( !v2 )
my_error(1LL, "src/memory.c", 40LL, 0LL);
return v2;
}

original_code:
void* my_realloc(void *ptr1,size_t size)
{
  void *ptr2 = ((void *)0);
  ptr2=(void*)realloc(ptr1,size);
  if(ptr2==((void *)0))
    my_error(MEM_ALLOC_ERROR,"src/memory.c",40,0);
  return ptr2;
}

canonical_original_code:
void *my_realloc(void *ptr1, unsigned long size)
{
  void *ptr2 = ((void *)0);
  ptr2=(void *)realloc(ptr1,size);
  if(ptr2==((void *)0))
    my_error(MEM_ALLOC_ERROR,"src/memory.c",40,0);
  return ptr2;
}


decompiled_code:
void *__fastcall my_calloc(int a1, size_t a2)
{
void *v2; // r12

v2 = calloc(a1, a2);
if ( !v2 )
my_error(1LL, "src/memory.c", 53LL, 0LL);
return v2;
}

canonical_decompiled_code:
void *__fastcall func2(int a1, size_t a2)
{
void *v2; // r12

v2 = calloc(a1, a2);
if ( !v2 )
my_error(1LL, "src/memory.c", 53LL, 0LL);
return v2;
}

original_code:
void* my_calloc(int dim, size_t size)
{
  void *ptr = ((void *)0);
  ptr=(void*)calloc(dim,size);
  if(ptr==((void *)0))
    my_error(MEM_ALLOC_ERROR,"src/memory.c",53,0);
  return ptr;
}

canonical_original_code:
void *my_calloc(int dim, unsigned long size)
{
  void *ptr = ((void *)0);
  ptr=(void *)calloc(dim,size);
  if(ptr==((void *)0))
    my_error(MEM_ALLOC_ERROR,"src/memory.c",53,0);
  return ptr;
}

variable_types: dim int


decompiled_code:
char *free_2D(int a1, __int64 a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, ...)
{
char *result; // rax
void **v12; // r12
__int64 v13; // r14
void **v14; // rbx
void *v15; // rdi
void **v16; // rdx
gcc_va_list va; // [rsp+8h] [rbp-70h] BYREF
__int64 v18; // [rsp+28h] [rbp-50h]

va_start(va, a10);
v18 = a2;
result = (char *)va[0].reg_save_area;
if ( a2 )
{
v12 = (void **)a2;
v13 = (unsigned int)(a1 - 1) + 1LL;
do
{
v14 = v12;
if ( a1 > 0 )
{
do
{
v15 = *v14++;
free(v15);
}
while ( &v12[v13] != v14 );
}
free(v12);
if ( va[0].gp_offset > 0x2F )
{
v16 = (void **)va[0].overflow_arg_area;
result = (char *)va[0].overflow_arg_area + 8;
va[0].overflow_arg_area = (char *)va[0].overflow_arg_area + 8;
}
else
{
result = (char *)(va[0].gp_offset + 8);
v16 = (void **)((char *)va[0].reg_save_area + va[0].gp_offset);
va[0].gp_offset += 8;
}
v12 = (void **)*v16;
}
while ( *v16 );
}
return result;
}

canonical_decompiled_code:
char *func4(int a1, __int64 a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, ...)
{
char *result; // rax
void **v12; // r12
__int64 v13; // r14
void **v14; // rbx
void *v15; // rdi
void **v16; // rdx
gcc_va_list va; // [rsp+8h] [rbp-70h] BYREF
__int64 v18; // [rsp+28h] [rbp-50h]

va_start(va, a10);
v18 = a2;
result = (char *)va[0].reg_save_area;
if ( a2 )
{
v12 = (void **)a2;
v13 = (unsigned int)(a1 - 1) + 1LL;
do
{
v14 = v12;
if ( a1 > 0 )
{
do
{
v15 = *v14++;
free(v15);
}
while ( &v12[v13] != v14 );
}
free(v12);
if ( va[0].gp_offset > 0x2F )
{
v16 = (void **)va[0].overflow_arg_area;
result = (char *)va[0].overflow_arg_area + 8;
va[0].overflow_arg_area = (char *)va[0].overflow_arg_area + 8;
}
else
{
result = (char *)(va[0].gp_offset + 8);
v16 = (void **)((char *)va[0].reg_save_area + va[0].gp_offset);
va[0].gp_offset += 8;
}
v12 = (void **)*v16;
}
while ( *v16 );
}
return result;
}

original_code:
void free_2D(int dim1, ...)
{
    int i;
    void **array=((void *)0);
    va_list ap;
    __builtin_va_start(ap,dim1);
    array=__builtin_va_arg(ap,void**);
    while(array!=((void *)0))
    {
        for(i=0; i<dim1; i++)
            free(array[i]);
        free(array);
        array=((void *)0);
        array=__builtin_va_arg(ap,void**);
    }
    __builtin_va_end(ap);
}

canonical_original_code:
void free_2D(int dim1, ...)
{
    int i;
    void **array = ((void *)0);
    __builtin_va_list ap;
    __builtin_va_start(ap,dim1);
    array=__builtin_va_arg(ap,void**);
    while(array!=((void *)0))
    {
        for(i=0; i<dim1; i++)
            free(array[i]);
        free(array);
        array=((void *)0);
        array=__builtin_va_arg(ap,void**);
    }
    __builtin_va_end(ap);
}

variable_types:
array
void **


decompiled_code:
char *free_3D(int a1, int a2, __int64 a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11, ...)
{
char *result; // rax
void **v12; // r13
void **v13; // r14
__int64 v14; // r15
void *v15; // rdi
void *v16; // rdi
void **v17; // rdx
__int64 v19; // [rsp+8h] [rbp-90h]
gcc_va_list va; // [rsp+18h] [rbp-80h] BYREF
__int64 v21; // [rsp+40h] [rbp-58h]

va_start(va, a11);
v21 = a3;
result = (char *)va[0].reg_save_area;
if ( a3 )
{
v12 = (void **)a3;
v19 = (unsigned int)(a1 - 1) + 1LL;
do
{
if ( a1 > 0 )
{
v13 = v12;
do
{
v14 = 0LL;
if ( a2 > 0 )
{
do
{
v15 = *(void **)((char *)*v13 + v14);
v14 += 8LL;
free(v15);
}
while ( 8LL * (unsigned int)(a2 - 1) + 8 != v14 );
}
v16 = *v13++;
free(v16);
}
while ( v13 != &v12[v19] );
}
free(v12);
if ( va[0].gp_offset > 0x2F )
{
v17 = (void **)va[0].overflow_arg_area;
result = (char *)va[0].overflow_arg_area + 8;
va[0].overflow_arg_area = (char *)va[0].overflow_arg_area + 8;
}
else
{
result = (char *)(va[0].gp_offset + 8);
v17 = (void **)((char *)va[0].reg_save_area + va[0].gp_offset);
va[0].gp_offset += 8;
}
v12 = (void **)*v17;
}
while ( *v17 );
}
return result;
}

canonical_decompiled_code:
char *func5(int a1, int a2, __int64 a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11, ...)
{
char *result; // rax
void **v12; // r13
void **v13; // r14
__int64 v14; // r15
void *v15; // rdi
void *v16; // rdi
void **v17; // rdx
__int64 v19; // [rsp+8h] [rbp-90h]
gcc_va_list va; // [rsp+18h] [rbp-80h] BYREF
__int64 v21; // [rsp+40h] [rbp-58h]

va_start(va, a11);
v21 = a3;
result = (char *)va[0].reg_save_area;
if ( a3 )
{
v12 = (void **)a3;
v19 = (unsigned int)(a1 - 1) + 1LL;
do
{
if ( a1 > 0 )
{
v13 = v12;
do
{
v14 = 0LL;
if ( a2 > 0 )
{
do
{
v15 = *(void **)((char *)*v13 + v14);
v14 += 8LL;
free(v15);
}
while ( 8LL * (unsigned int)(a2 - 1) + 8 != v14 );
}
v16 = *v13++;
free(v16);
}
while ( v13 != &v12[v19] );
}
free(v12);
if ( va[0].gp_offset > 0x2F )
{
v17 = (void **)va[0].overflow_arg_area;
result = (char *)va[0].overflow_arg_area + 8;
va[0].overflow_arg_area = (char *)va[0].overflow_arg_area + 8;
}
else
{
result = (char *)(va[0].gp_offset + 8);
v17 = (void **)((char *)va[0].reg_save_area + va[0].gp_offset);
va[0].gp_offset += 8;
}
v12 = (void **)*v17;
}
while ( *v17 );
}
return result;
}

original_code:
void free_3D(int dim1, int dim2, ...)
{
    int i,j;
    void ***array=((void *)0);
    va_list ap;
    __builtin_va_start(ap,dim2);
    array=__builtin_va_arg(ap,void***);
    while(array!=((void *)0))
    {
        for(i=0; i<dim1; i++)
        {
            for(j=0; j<dim2; j++)
                free(array[i][j]);
            free(array[i]);
        }
        free(array);
        array=((void *)0);
        array=__builtin_va_arg(ap,void***);
    }
    __builtin_va_end(ap);
}

canonical_original_code:
void free_3D(int dim1, int dim2, ...)
{
    int i; int j;
    void ***array = ((void *)0);
    __builtin_va_list ap;
    __builtin_va_start(ap,dim2);
    array=__builtin_va_arg(ap,void***);
    while(array!=((void *)0))
    {
        for(i=0; i<dim1; i++)
        {
            for(j=0; j<dim2; j++)
                free(array[i][j]);
            free(array[i]);
        }
        free(array);
        array=((void *)0);
        array=__builtin_va_arg(ap,void***);
    }
    __builtin_va_end(ap);
}

variable_types: j int

variable_types:
array
void ***


numforce

decompiled_code:
double *__fastcall numforce(double a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, int a8, int a9, int a10, int a11, __int64 a12, double *a13, __int64 a14, __int64 a15, unsigned int a16)
{
double *result; // rax
int v17; // er8
double v18; // xmm3_8
__int64 v19; // rdi
__int64 v20; // rsi
double v21; // xmm5_8
__int64 v22; // rcx
__int64 v23; // r8
double v24; // xmm6_8
double v25; // xmm8_8
double v26; // xmm7_8
double v27; // xmm1_8
double v28; // xmm6_8
double v29; // xmm8_8
double v30; // xmm7_8
double v31; // xmm1_8
double v32; // xmm6_8
double v33; // xmm8_8
double v34; // xmm7_8
double v35; // xmm1_8
int v36; // er8
__int64 v37; // rdi
double v38; // xmm4_8
__int64 v39; // rsi
__int64 v40; // rcx
__int64 v41; // r8
double v42; // xmm3_8
double v43; // xmm5_8
double v44; // xmm3_8
double v45; // xmm5_8
double v46; // xmm3_8
double v47; // xmm5_8
int v48; // er8
double v49; // xmm3_8
__int64 v50; // rdi
__int64 v51; // rsi
double v52; // xmm4_8
__int64 v53; // rcx
__int64 v54; // r8
double v55; // xmm7_8
double v56; // xmm8_8
double v57; // xmm10_8
double v58; // xmm11_8
double v59; // xmm12_8
double v60; // xmm1_8
double v61; // xmm9_8
double v62; // xmm8_8
double v63; // xmm10_8
double v64; // xmm11_8
double v65; // xmm12_8
double v66; // xmm1_8
double v67; // xmm9_8
double v68; // xmm8_8
double v69; // xmm10_8
double v70; // xmm11_8
double v71; // xmm12_8
double v72; // xmm1_8
double v73; // xmm9_8

result = (double *)a16;
switch ( a16 )
{
case 2u:
v36 = *(_DWORD *)(a3 + 24);
if ( v36 > 0 )
{
result = a13;
v37 = a12;
v38 = a1 + a1;
v39 = a14;
v40 = a15;
v41 = (__int64)&a13[(unsigned int)(v36 - 1) + 1];
do
{
v42 = *result++;
v37 += 24LL;
v39 += 8LL;
v40 += 8LL;
*(result - 1) = v42 - a1;
v43 = *(double *)(a4 + 8);
*(result - 1) = a1 + v42;
*(double *)(v37 - 24) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a4 + 8) - v43) ^ LC0) / v38;
*(result - 1) = v42;
v44 = *(double *)(v39 - 8);
*(double *)(v39 - 8) = v44 - a1;
v45 = *(double *)(a4 + 8);
*(double *)(v39 - 8) = a1 + v44;
*(double *)(v37 - 16) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a4 + 8) - v45) ^ LC0) / v38;
*(double *)(v39 - 8) = v44;
v46 = *(double *)(v40 - 8);
*(double *)(v40 - 8) = v46 - a1;
v47 = *(double *)(a4 + 8);
*(double *)(v40 - 8) = a1 + v46;
*(double *)(v37 - 8) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a4 + 8) - v47) ^ LC0) / v38;
*(double *)(v40 - 8) = v46;
}
while ( result != (double *)v41 );
}
break;
case 4u:
v17 = *(_DWORD *)(a3 + 24);
if ( v17 > 0 )
{
result = a13;
v18 = a1 + a1;
v19 = a12;
v20 = a14;
v21 = 12.0 * a1;
v22 = a15;
v23 = (__int64)&a13[(unsigned int)(v17 - 1) + 1];
do
{
v24 = *result++;
v19 += 24LL;
v20 += 8LL;
v22 += 8LL;
*(result - 1) = v24 - v18;
v25 = *(double *)(a4 + 8);
*(result - 1) = v24 - a1;
v26 = *(double *)(a4 + 8);
*(result - 1) = a1 + v24;
v27 = *(double *)(a4 + 8);
*(result - 1) = v18 + v24;
*(double *)(v19 - 24) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v27 - v26) * 8.0 - (*(double *)(a4 + 8) - v25)) ^ LC0)
/ v21;
*(result - 1) = v24;
v28 = *(double *)(v20 - 8);
*(double *)(v20 - 8) = v28 - v18;
v29 = *(double *)(a4 + 8);
*(double *)(v20 - 8) = v28 - a1;
v30 = *(double *)(a4 + 8);
*(double *)(v20 - 8) = a1 + v28;
v31 = *(double *)(a4 + 8);
*(double *)(v20 - 8) = v18 + v28;
*(double *)(v19 - 16) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v31 - v30) * 8.0 - (*(double *)(a4 + 8) - v29)) ^ LC0)
/ v21;
*(double *)(v20 - 8) = v28;
v32 = *(double *)(v22 - 8);
*(double *)(v22 - 8) = v32 - v18;
v33 = *(double *)(a4 + 8);
*(double *)(v22 - 8) = v32 - a1;
v34 = *(double *)(a4 + 8);
*(double *)(v22 - 8) = a1 + v32;
v35 = *(double *)(a4 + 8);
*(double *)(v22 - 8) = v18 + v32;
*(double *)(v19 - 8) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v35 - v34) * 8.0 - (*(double *)(a4 + 8) - v33)) ^ LC0)
/ v21;
*(double *)(v22 - 8) = v32;
}
while ( result != (double *)v23 );
}
break;
case 6u:
v48 = *(_DWORD *)(a3 + 24);
if ( v48 > 0 )
{
result = a13;
v49 = a1 + a1;
v50 = a12;
v51 = a14;
v52 = 3.0 * a1;
v53 = a15;
v54 = (__int64)&a13[(unsigned int)(v48 - 1) + 1];
v55 = 60.0 * a1;
do
{
++result;
v50 += 24LL;
v51 += 8LL;
v53 += 8LL;
v56 = *(result - 1);
*(result - 1) = v56 - v52;
v57 = *(double *)(a4 + 8);
*(result - 1) = v56 - v49;
v58 = *(double *)(a4 + 8);
*(result - 1) = v56 - a1;
v59 = *(double *)(a4 + 8);
*(result - 1) = v56 + a1;
v60 = *(double *)(a4 + 8);
*(result - 1) = v49 + v56;
v61 = *(double *)(a4 + 8);
*(result - 1) = v52 + v56;
*(double *)(v50 - 24) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v60 - v59) * 45.0 - (v61 - v58) * 9.0 + *(double *)(a4 + 8) - v57) ^ LC0)
/ v55;
*(result - 1) = v56;
v62 = *(double *)(v51 - 8);
*(double *)(v51 - 8) = v62 - v52;
v63 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v62 - v49;
v64 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v62 - a1;
v65 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = a1 + v62;
v66 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v49 + v62;
v67 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v52 + v62;
*(double *)(v50 - 16) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v66 - v65) * 45.0 - (v67 - v64) * 9.0 + *(double *)(a4 + 8) - v63) ^ LC0)
/ v55;
*(double *)(v51 - 8) = v62;
v68 = *(double *)(v53 - 8);
*(double *)(v53 - 8) = v68 - v52;
v69 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v68 - v49;
v70 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v68 - a1;
v71 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = a1 + v68;
v72 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v49 + v68;
v73 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v52 + v68;
*(double *)(v50 - 8) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v72 - v71) * 45.0 - (v73 - v70) * 9.0 + *(double *)(a4 + 8) - v69) ^ LC0)
/ v55;
*(double *)(v53 - 8) = v68;
}
while ( result != (double *)v54 );
}
break;
}
return result;
}

canonical_decompiled_code:
double *__fastcall func0(double a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, int a8, int a9, int a10, int a11, __int64 a12, double *a13, __int64 a14, __int64 a15, unsigned int a16)
{
double *result; // rax
int v17; // er8
double v18; // xmm3_8
__int64 v19; // rdi
__int64 v20; // rsi
double v21; // xmm5_8
__int64 v22; // rcx
__int64 v23; // r8
double v24; // xmm6_8
double v25; // xmm8_8
double v26; // xmm7_8
double v27; // xmm1_8
double v28; // xmm6_8
double v29; // xmm8_8
double v30; // xmm7_8
double v31; // xmm1_8
double v32; // xmm6_8
double v33; // xmm8_8
double v34; // xmm7_8
double v35; // xmm1_8
int v36; // er8
__int64 v37; // rdi
double v38; // xmm4_8
__int64 v39; // rsi
__int64 v40; // rcx
__int64 v41; // r8
double v42; // xmm3_8
double v43; // xmm5_8
double v44; // xmm3_8
double v45; // xmm5_8
double v46; // xmm3_8
double v47; // xmm5_8
int v48; // er8
double v49; // xmm3_8
__int64 v50; // rdi
__int64 v51; // rsi
double v52; // xmm4_8
__int64 v53; // rcx
__int64 v54; // r8
double v55; // xmm7_8
double v56; // xmm8_8
double v57; // xmm10_8
double v58; // xmm11_8
double v59; // xmm12_8
double v60; // xmm1_8
double v61; // xmm9_8
double v62; // xmm8_8
double v63; // xmm10_8
double v64; // xmm11_8
double v65; // xmm12_8
double v66; // xmm1_8
double v67; // xmm9_8
double v68; // xmm8_8
double v69; // xmm10_8
double v70; // xmm11_8
double v71; // xmm12_8
double v72; // xmm1_8
double v73; // xmm9_8

result = (double *)a16;
switch ( a16 )
{
case 2u:
v36 = *(_DWORD *)(a3 + 24);
if ( v36 > 0 )
{
result = a13;
v37 = a12;
v38 = a1 + a1;
v39 = a14;
v40 = a15;
v41 = (__int64)&a13[(unsigned int)(v36 - 1) + 1];
do
{
v42 = *result++;
v37 += 24LL;
v39 += 8LL;
v40 += 8LL;
*(result - 1) = v42 - a1;
v43 = *(double *)(a4 + 8);
*(result - 1) = a1 + v42;
*(double *)(v37 - 24) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a4 + 8) - v43) ^ LC0) / v38;
*(result - 1) = v42;
v44 = *(double *)(v39 - 8);
*(double *)(v39 - 8) = v44 - a1;
v45 = *(double *)(a4 + 8);
*(double *)(v39 - 8) = a1 + v44;
*(double *)(v37 - 16) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a4 + 8) - v45) ^ LC0) / v38;
*(double *)(v39 - 8) = v44;
v46 = *(double *)(v40 - 8);
*(double *)(v40 - 8) = v46 - a1;
v47 = *(double *)(a4 + 8);
*(double *)(v40 - 8) = a1 + v46;
*(double *)(v37 - 8) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64(*(double *)(a4 + 8) - v47) ^ LC0) / v38;
*(double *)(v40 - 8) = v46;
}
while ( result != (double *)v41 );
}
break;
case 4u:
v17 = *(_DWORD *)(a3 + 24);
if ( v17 > 0 )
{
result = a13;
v18 = a1 + a1;
v19 = a12;
v20 = a14;
v21 = 12.0 * a1;
v22 = a15;
v23 = (__int64)&a13[(unsigned int)(v17 - 1) + 1];
do
{
v24 = *result++;
v19 += 24LL;
v20 += 8LL;
v22 += 8LL;
*(result - 1) = v24 - v18;
v25 = *(double *)(a4 + 8);
*(result - 1) = v24 - a1;
v26 = *(double *)(a4 + 8);
*(result - 1) = a1 + v24;
v27 = *(double *)(a4 + 8);
*(result - 1) = v18 + v24;
*(double *)(v19 - 24) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v27 - v26) * 8.0 - (*(double *)(a4 + 8) - v25)) ^ LC0)
/ v21;
*(result - 1) = v24;
v28 = *(double *)(v20 - 8);
*(double *)(v20 - 8) = v28 - v18;
v29 = *(double *)(a4 + 8);
*(double *)(v20 - 8) = v28 - a1;
v30 = *(double *)(a4 + 8);
*(double *)(v20 - 8) = a1 + v28;
v31 = *(double *)(a4 + 8);
*(double *)(v20 - 8) = v18 + v28;
*(double *)(v19 - 16) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v31 - v30) * 8.0 - (*(double *)(a4 + 8) - v29)) ^ LC0)
/ v21;
*(double *)(v20 - 8) = v28;
v32 = *(double *)(v22 - 8);
*(double *)(v22 - 8) = v32 - v18;
v33 = *(double *)(a4 + 8);
*(double *)(v22 - 8) = v32 - a1;
v34 = *(double *)(a4 + 8);
*(double *)(v22 - 8) = a1 + v32;
v35 = *(double *)(a4 + 8);
*(double *)(v22 - 8) = v18 + v32;
*(double *)(v19 - 8) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v35 - v34) * 8.0 - (*(double *)(a4 + 8) - v33)) ^ LC0)
/ v21;
*(double *)(v22 - 8) = v32;
}
while ( result != (double *)v23 );
}
break;
case 6u:
v48 = *(_DWORD *)(a3 + 24);
if ( v48 > 0 )
{
result = a13;
v49 = a1 + a1;
v50 = a12;
v51 = a14;
v52 = 3.0 * a1;
v53 = a15;
v54 = (__int64)&a13[(unsigned int)(v48 - 1) + 1];
v55 = 60.0 * a1;
do
{
++result;
v50 += 24LL;
v51 += 8LL;
v53 += 8LL;
v56 = *(result - 1);
*(result - 1) = v56 - v52;
v57 = *(double *)(a4 + 8);
*(result - 1) = v56 - v49;
v58 = *(double *)(a4 + 8);
*(result - 1) = v56 - a1;
v59 = *(double *)(a4 + 8);
*(result - 1) = v56 + a1;
v60 = *(double *)(a4 + 8);
*(result - 1) = v49 + v56;
v61 = *(double *)(a4 + 8);
*(result - 1) = v52 + v56;
*(double *)(v50 - 24) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v60 - v59) * 45.0 - (v61 - v58) * 9.0 + *(double *)(a4 + 8) - v57) ^ LC0)
/ v55;
*(result - 1) = v56;
v62 = *(double *)(v51 - 8);
*(double *)(v51 - 8) = v62 - v52;
v63 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v62 - v49;
v64 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v62 - a1;
v65 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = a1 + v62;
v66 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v49 + v62;
v67 = *(double *)(a4 + 8);
*(double *)(v51 - 8) = v52 + v62;
*(double *)(v50 - 16) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v66 - v65) * 45.0 - (v67 - v64) * 9.0 + *(double *)(a4 + 8) - v63) ^ LC0)
/ v55;
*(double *)(v51 - 8) = v62;
v68 = *(double *)(v53 - 8);
*(double *)(v53 - 8) = v68 - v52;
v69 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v68 - v49;
v70 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v68 - a1;
v71 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = a1 + v68;
v72 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v49 + v68;
v73 = *(double *)(a4 + 8);
*(double *)(v53 - 8) = v52 + v68;
*(double *)(v50 - 8) = COERCE_DOUBLE(COERCE_UNSIGNED_INT64((v72 - v71) * 45.0 - (v73 - v70) * 9.0 + *(double *)(a4 + 8) - v69) ^ LC0)
/ v55;
*(double *)(v53 - 8) = v68;
}
while ( result != (double *)v54 );
}
break;
}
return result;
}

original_code:
void numforce(CTRL *ctrl,PARAM *param,ENERGY *ener,PBC *box,NEIGH *neigh,
       BOND bond[],BOND ub[],ANGLE angle[],DIHE dihe[],DIHE impr[],
       DELTA nForce[],double x[],double y[],double z[],int npoints,double h)
{
  int i;
  double coord;
  if(npoints==2)
  {
    double a,b;
    for(i=0;i<param->nAtom;i++)
    {
      coord=x[i];
      x[i]=coord-h;
      a=ener->pot;
      x[i]=coord+h;
      b=ener->pot;
      nForce[i].x=-(b-a)/(2.*h);
      x[i]=coord;
      coord=y[i];
      y[i]=coord-h;
      a=ener->pot;
      y[i]=coord+h;
      b=ener->pot;
      nForce[i].y=-(b-a)/(2.*h);
      y[i]=coord;
      coord=z[i];
      z[i]=coord-h;
      a=ener->pot;
      z[i]=coord+h;
      b=ener->pot;
      nForce[i].z=-(b-a)/(2.*h);
      z[i]=coord;
    }
  }
  else if(npoints==4)
  {
    double a,b,c,d;
    for(i=0;i<param->nAtom;i++)
    {
      coord=x[i];
      x[i]=coord-(2.*h);
      a=ener->pot;
      x[i]=coord-h;
      b=ener->pot;
      x[i]=coord+h;
      c=ener->pot;
      x[i]=coord+(2.*h);
      d=ener->pot;
      nForce[i].x=-(8.*(c-b)-(d-a))/(12.*h);
      x[i]=coord;
      coord=y[i];
      y[i]=coord-(2.*h);
      a=ener->pot;
      y[i]=coord-h;
      b=ener->pot;
      y[i]=coord+h;
      c=ener->pot;
      y[i]=coord+(2.*h);
      d=ener->pot;
      nForce[i].y=-(8.*(c-b)-(d-a))/(12.*h);
      y[i]=coord;
      coord=z[i];
      z[i]=coord-(2.*h);
      a=ener->pot;
      z[i]=coord-h;
      b=ener->pot;
      z[i]=coord+h;
      c=ener->pot;
      z[i]=coord+(2.*h);
      d=ener->pot;
      nForce[i].z=-(8.*(c-b)-(d-a))/(12.*h);
      z[i]=coord;
    }
  }
  else if(npoints==6)
  {
    double a,b,c,d,e,f;
    for(i=0;i<param->nAtom;i++)
    {
      coord=x[i];
      x[i]=coord-(3.*h);
      a=ener->pot;
      x[i]=coord-(2.*h);
      b=ener->pot;
      x[i]=coord-h;
      c=ener->pot;
      x[i]=coord+h;
      d=ener->pot;
      x[i]=coord+(2.*h);
      e=ener->pot;
      x[i]=coord+(3.*h);
      f=ener->pot;
      nForce[i].x=-(45.*(d-c)-9.*(e-b)+(f-a))/(60.*h);
      x[i]=coord;
      coord=y[i];
      y[i]=coord-(3.*h);
      a=ener->pot;
      y[i]=coord-(2.*h);
      b=ener->pot;
      y[i]=coord-h;
      c=ener->pot;
      y[i]=coord+h;
      d=ener->pot;
      y[i]=coord+(2.*h);
      e=ener->pot;
      y[i]=coord+(3.*h);
      f=ener->pot;
      nForce[i].y=-(45.*(d-c)-9.*(e-b)+(f-a))/(60.*h);
      y[i]=coord;
      coord=z[i];
      z[i]=coord-(3.*h);
      a=ener->pot;
      z[i]=coord-(2.*h);
      b=ener->pot;
      z[i]=coord-h;
      c=ener->pot;
      z[i]=coord+h;
      d=ener->pot;
      z[i]=coord+(2.*h);
      e=ener->pot;
      z[i]=coord+(3.*h);
      f=ener->pot;
      nForce[i].z=-(45.*(d-c)-9.*(e-b)+(f-a))/(60.*h);
      z[i]=coord;
    }
  }
}

canonical_original_code:
void numforce(struct CTRL *ctrl, struct PARAM *param, struct ENERGY *ener, struct PBC *box, struct NEIGH *neigh, struct BOND bond[], struct BOND ub[], struct ANGLE angle[], struct DIHE dihe[], struct DIHE impr[], struct DELTA nForce[], double x[], double y[], double z[], int npoints, double h)
{
  int i;
  double coord;
  if(npoints==2)
  {
    double a; double b;
    for(i=0;i<param->nAtom;i++)
    {
      coord=x[i];
      x[i]=coord-h;
      a=ener->pot;
      x[i]=coord+h;
      b=ener->pot;
      nForce[i].x=-(b-a)/(2.*h);
      x[i]=coord;
      coord=y[i];
      y[i]=coord-h;
      a=ener->pot;
      y[i]=coord+h;
      b=ener->pot;
      nForce[i].y=-(b-a)/(2.*h);
      y[i]=coord;
      coord=z[i];
      z[i]=coord-h;
      a=ener->pot;
      z[i]=coord+h;
      b=ener->pot;
      nForce[i].z=-(b-a)/(2.*h);
      z[i]=coord;
    }
  }
  else if(npoints==4)
  {
    double a; double b; double c; double d;
    for(i=0;i<param->nAtom;i++)
    {
      coord=x[i];
      x[i]=coord-(2.*h);
      a=ener->pot;
      x[i]=coord-h;
      b=ener->pot;
      x[i]=coord+h;
      c=ener->pot;
      x[i]=coord+(2.*h);
      d=ener->pot;
      nForce[i].x=-(8.*(c-b)-(d-a))/(12.*h);
      x[i]=coord;
      coord=y[i];
      y[i]=coord-(2.*h);
      a=ener->pot;
      y[i]=coord-h;
      b=ener->pot;
      y[i]=coord+h;
      c=ener->pot;
      y[i]=coord+(2.*h);
      d=ener->pot;
      nForce[i].y=-(8.*(c-b)-(d-a))/(12.*h);
      y[i]=coord;
      coord=z[i];
      z[i]=coord-(2.*h);
      a=ener->pot;
      z[i]=coord-h;
      b=ener->pot;
      z[i]=coord+h;
      c=ener->pot;
      z[i]=coord+(2.*h);
      d=ener->pot;
      nForce[i].z=-(8.*(c-b)-(d-a))/(12.*h);
      z[i]=coord;
    }
  }
  else if(npoints==6)
  {
    double a; double b; double c; double d; double e; double f;
    for(i=0;i<param->nAtom;i++)
    {
      coord=x[i];
      x[i]=coord-(3.*h);
      a=ener->pot;
      x[i]=coord-(2.*h);
      b=ener->pot;
      x[i]=coord-h;
      c=ener->pot;
      x[i]=coord+h;
      d=ener->pot;
      x[i]=coord+(2.*h);
      e=ener->pot;
      x[i]=coord+(3.*h);
      f=ener->pot;
      nForce[i].x=-(45.*(d-c)-9.*(e-b)+(f-a))/(60.*h);
      x[i]=coord;
      coord=y[i];
      y[i]=coord-(3.*h);
      a=ener->pot;
      y[i]=coord-(2.*h);
      b=ener->pot;
      y[i]=coord-h;
      c=ener->pot;
      y[i]=coord+h;
      d=ener->pot;
      y[i]=coord+(2.*h);
      e=ener->pot;
      y[i]=coord+(3.*h);
      f=ener->pot;
      nForce[i].y=-(45.*(d-c)-9.*(e-b)+(f-a))/(60.*h);
      y[i]=coord;
      coord=z[i];
      z[i]=coord-(3.*h);
      a=ener->pot;
      z[i]=coord-(2.*h);
      b=ener->pot;
      z[i]=coord-h;
      c=ener->pot;
      z[i]=coord+h;
      d=ener->pot;
      z[i]=coord+(2.*h);
      e=ener->pot;
      z[i]=coord+(3.*h);
      f=ener->pot;
      nForce[i].z=-(45.*(d-c)-9.*(e-b)+(f-a))/(60.*h);
      z[i]=coord;
    }
  }
}

variable_types: struct DIHE { enum DIHE_TYPE { DCOS=1, DHARM=2 } type; int order; int a; double k; } []

variable_types:
impr
struct DIHE []

variable_types:
nForce
struct DELTA { double x; } []

variable_types:
x
double []

variable_types:
y
double []

variable_types:
z
double []

variable_types: npoints int

variable_types: h double

variable_types: i int

variable_types: coord double

variable_types: a double

variable_types: b double

variable_types: c double

variable_types: d double

variable_types: e double

variable_types: f double


decompiled_code:
__int64 __fastcall init_rand(unsigned int a1)
{
return dsfmt_chk_init_gen_rand(&dsfmt, a1, 19937LL);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1)
{
return dsfmt_chk_init_gen_rand(&dsfmt, a1, 19937LL);
}

original_code:
void init_rand(unsigned int seed)
{
  dsfmt_init_gen_rand(&dsfmt,seed);
}

variable_types:
seed
unsigned int


decompiled_code:
double get_rand()
{
int v0; // edx
__int64 *v1; // rax
__int64 v2; // rax

if ( dword_DE0 > 381 )
{
dsfmt_gen_rand_all(&dsfmt);
v1 = (__int64 *)&dsfmt;
v0 = 1;
}
else
{
v0 = dword_DE0 + 1;
v1 = (__int64 *)((char *)&dsfmt + 8 * dword_DE0);
}
v2 = *v1;
dword_DE0 = v0;
return COERCE_DOUBLE(v2 | 1) - 1.0;
}

canonical_decompiled_code:
double func1()
{
int v0; // edx
__int64 *v1; // rax
__int64 v2; // rax

if ( dword_DE0 > 381 )
{
dsfmt_gen_rand_all(&dsfmt);
v1 = (__int64 *)&dsfmt;
v0 = 1;
}
else
{
v0 = dword_DE0 + 1;
v1 = (__int64 *)((char *)&dsfmt + 8 * dword_DE0);
}
v2 = *v1;
dword_DE0 = v0;
return COERCE_DOUBLE(v2 | 1) - 1.0;
}

original_code:
double get_rand()
{
  return dsfmt_genrand_open_open(&dsfmt);
}


decompiled_code:
void __fastcall get_BoxMuller(double *a1, double *a2)
{
double v2; // xmm0_8
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm3_8
double v6; // xmm0_8
double v7; // xmm3_8
double v8; // xmm0_8
double v9; // xmm0_8
double v10; // xmm0_8
double v11; // xmm0_8
double x; // [rsp+8h] [rbp-30h]
double xa; // [rsp+8h] [rbp-30h]
double v14; // [rsp+10h] [rbp-28h]

do
{
v2 = get_rand();
x = v2 + v2 - 1.0;
v3 = get_rand();
v4 = v3 + v3 - 1.0;
v5 = x * x + v4 * v4;
}
while ( v5 >= 1.0 );
v14 = x;
xa = x * x + v4 * v4;
v6 = log(v5);
v7 = xa;
v8 = v6 * -2.0 / xa;
if ( v8 < 0.0 )
{
v9 = sqrt(v8);
v7 = xa;
}
else
{
v9 = sqrt(v8);
}
*a1 = v14 * v9;
v10 = log(v7) * -2.0 / v7;
if ( v10 < 0.0 )
v11 = sqrt(v10);
else
v11 = sqrt(v10);
*a2 = v4 * v11;
}

original_code:
void get_BoxMuller(double *u, double *v)
{
  double a,b,s;
  do
  {
      a = 2. * get_rand() - 1.;
      b = 2. * get_rand() - 1.;
      s = a*a + b*b;
  }while (s >= 1.);
  *u= a*sqrt(-2.*log(s)/s);
  *v= b*sqrt(-2.*log(s)/s);
}

canonical_original_code:
void get_BoxMuller(double *u, double *v)
{
  double a; double b; double s;
  do
  {
      a = 2. * get_rand() - 1.;
      b = 2. * get_rand() - 1.;
      s = a*a + b*b;
  }while (s >= 1.);
  *u= a*sqrt(-2.*log(s)/s);
  *v= b*sqrt(-2.*log(s)/s);
}

variable_types:
u
double *

variable_types:
v
double *

variable_types: s double


loadUserPlugin

decompiled_code:
void *__fastcall loadUserPlugin(const char *a1, const char *a2)
{
void *v3; // rdi
void *result; // rax

plugin = 0LL;
fnc = 0LL;
plugin = dlopen(a1, 1);
v3 = plugin;
if ( !plugin )
{
my_error(414LL, "src/user.c", 27LL, 2LL, "loadUserPlugin", a1);
v3 = plugin;
}
result = dlsym(v3, a2);
fnc = (__int64)result;
if ( !result )
{
my_error(415LL, "src/user.c", 32LL, 3LL, "loadUserPlugin", a1);
result = (void *)fnc;
}
return result;
}

canonical_decompiled_code:
void *__fastcall func0(const char *a1, const char *a2)
{
void *v3; // rdi
void *result; // rax

plugin = 0LL;
fnc = 0LL;
plugin = dlopen(a1, 1);
v3 = plugin;
if ( !plugin )
{
my_error(414LL, "src/user.c", 27LL, 2LL, "loadUserPlugin", a1);
v3 = plugin;
}
result = dlsym(v3, a2);
fnc = (__int64)result;
if ( !result )
{
my_error(415LL, "src/user.c", 32LL, 3LL, "loadUserPlugin", a1);
result = (void *)fnc;
}
return result;
}

original_code:
UserEnergyPtr loadUserPlugin(const char pluginName[], const char funcName[])
{
    plugin = ((void *)0);
    fnc = ((void *)0);
    plugin = dlopen(pluginName, 0x00001);
    if(plugin==((void *)0))
        my_error(PLUGINS_DLOPEN_ERROR,"src/user.c",27,2,__func__,pluginName);
    fnc = dlsym(plugin,funcName);
    if(fnc==((void *)0))
        my_error(PLUGINS_DLSYM_ERROR,"src/user.c",32,3,__func__,pluginName,funcName);
    UserEnergyPtr eneCustom = (UserEnergyPtr) fnc;
    return eneCustom;
}

canonical_original_code:
double (*loadUserPlugin(char pluginName[], char funcName[]))(struct PARAM *param, struct PBC *box, double x[], double y[], double z[], double fx[], double fy[], double fz[], int neighList[], int neighPair[], int neighOrder[], int neighList14[])
{
    plugin = ((void *)0);
    fnc = ((void *)0);
    plugin = dlopen(pluginName, 0x00001);
    if(plugin==((void *)0))
        my_error(PLUGINS_DLOPEN_ERROR,"src/user.c",27,2,__func__,pluginName);
    fnc = dlsym(plugin,funcName);
    if(fnc==((void *)0))
        my_error(PLUGINS_DLSYM_ERROR,"src/user.c",32,3,__func__,pluginName,funcName);
    double (*eneCustom)(struct PARAM *param, struct PBC *box, double x[], double y[], double z[], double fx[], double fy[], double fz[], int neighList[], int neighPair[], int neighOrder[], int neighList14[]) = (UserEnergyPtr) fnc;
    return eneCustom;
}

variable_types:
pluginName
char []

variable_types:
funcName
char []

variable_types: double (*)(struct PARAM { int step; double timeStep; int nAtom; int nBond; int nConst; double tolShake; double chargeConst; double cutOff; double cutOn; double temp0; double tolMinim; } *param, struct PBC { enum BOX_TYPE { NOBOX=0, CUBIC=1, ORBIC=2, TCLIN=3 } type; double a; double u; double pa; double stress1; double stress4; double stress7; } *box, double x[], double y[], double z[], double fx[], double fy[], double fz[], int neighList[], int neighPair[], int neighOrder[], int neighList14[])


closeUserPlugin

decompiled_code:
int closeUserPlugin()
{
return dlclose(plugin);
}

canonical_decompiled_code:
int func1()
{
return dlclose(plugin);
}

original_code:
void closeUserPlugin(void)
{
    int err = dlclose(plugin);
}

canonical_original_code:
void closeUserPlugin()
{
    int err = dlclose(plugin);
}

variable_types: err int


MyEnergyFunction

decompiled_code:
double MyEnergyFunction()
{
puts("Hello from my Plugin !");
return 0.0;
}

canonical_decompiled_code:
double func6()
{
puts("Hello from my Plugin !");
return 0.0;
}

original_code:
double MyEnergyFunction (const PARAM *param, const PBC *box,
                const double x[], const double y[], const double z[],
                double fx[], double fy[], double fz[],
                const int neighList[], const int neighPair[], const int neighOrder[],
                const int neighList14[])
{
    puts("Hello from my Plugin !");
    return 0.0;
}

canonical_original_code:
double MyEnergyFunction(struct PARAM *param, struct PBC *box, double x[], double y[], double z[], double fx[], double fy[], double fz[], int neighList[], int neighPair[], int neighOrder[], int neighList14[])
{
    puts("Hello from my Plugin !");
    return 0.0;
}

variable_types: struct PARAM { int step; double timeStep; int nAtom; int nBond; int nConst; double tolShake; double chargeConst; double cutOff; double cutOn; double temp0; double tolMinim; } *

variable_types: struct PBC { enum BOX_TYPE { NOBOX=0, CUBIC=1, ORBIC=2, TCLIN=3 } type; double a; double u; double pa; double stress1; double stress4; double stress7; } *

variable_types:
x
double []

variable_types:
y
double []

variable_types:
z
double []

variable_types:
fx
double []

variable_types:
fy
double []

variable_types:
fz
double []

variable_types:
neighList
int []

variable_types:
neighPair
int []

variable_types:
neighOrder
int []


repo: pcercuei/glfrontier

decompiled_code:
__int64 __fastcall parent_side(__int64 *a1)
{
__int64 v1; // rax

v1 = *a1;
if ( !*a1 )
return 0xFFFFFFFFLL;
if ( *(__int64 **)(v1 + 8) == a1 )
return 0LL;
return (unsigned int)(*(_QWORD *)(v1 + 16) != (_QWORD)a1) + 1;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 *a1)
{
__int64 v1; // rax

v1 = *a1;
if ( !*a1 )
return 0xFFFFFFFFLL;
if ( *(__int64 **)(v1 + 8) == a1 )
return 0LL;
return (unsigned int)(*(_QWORD *)(v1 + 16) != (_QWORD)a1) + 1;
}

original_code:
static int parent_side (const struct Node *node)
{
 if (node->parent == ((void *)0))
  return -1;
 else if (node->parent->child[0] == node)
  return 0;
 else if (node->parent->child[1] == node)
  return 1;
 else
  return 2;
}

canonical_original_code:
static int parent_side(struct Node *node)
{
 if (node->parent == ((void *)0))
  return -1;
 else if (node->parent->child[0] == node)
  return 0;
 else if (node->parent->child[1] == node)
  return 1;
 else
  return 2;
}

variable_types: struct Node { struct Node *parent; struct Node *child[2]; char balance; char *key; void *obj; } *