selectPoints

repo: CerebralBore/GeomAlgo

decompiled_code:
void selectPoints()
{
int v0; // edx
__int64 v1; // rbx
unsigned __int64 v2; // rbp
double *v3; // r12
__int64 v4; // r12

v0 = nbPoints - 1;
if ( nbPoints - 1 >= 0 )
{
v1 = 16LL * v0;
v2 = 16 * (nbPoints - (unsigned __int64)(unsigned int)v0) - 32;
do
{
v3 = (double *)(v1 + T);
*v3 = myRandom(10.0, 490.0);
v4 = v1 + T;
v1 -= 16LL;
*(double *)(v4 + 8) = myRandom(10.0, 490.0);
}
while ( v1 != v2 );
}
}

original_code:
void selectPoints (void)
{
  int n = nbPoints;
  while (--n >= 0)
   {
     T[n].coords[0] = myRandom(minX+10, maxX-10);
     T[n].coords[1] = myRandom(minY+10, maxY-10);
   }
}

canonical_original_code:
void selectPoints()
{
  int n = nbPoints;
  while (--n >= 0)
   {
     T[n].coords[0] = myRandom(minX+10, maxX-10);
     T[n].coords[1] = myRandom(minY+10, maxY-10);
   }
}

variable_types: n int


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax

opterr = 0;
while ( 1 )
{
v3 = getopt(argc, (char *const *)argv, "n:");
if ( v3 == -1 )
break;
if ( v3 == 63 )
{
puts("use option -nX (no space), with 0 < X.");
}
else if ( v3 == 110 )
{
if ( (unsigned int)__isoc99_sscanf() != 1 || nbPoints <= 0 )
nbPoints = 50;
}
else
{
puts("Shouldn't be here, really...");
}
}
if ( nbPoints <= 0 )
__assert_fail("nbPoints > 0", "two.c", 0x59u, "main");
T = (__int64)malloc(16LL * nbPoints);
if ( !T )
__assert_fail("T != NULL", "two.c", 0x5Bu, "main");
glutInit();
glutInitDisplayMode();
glutInitWindowPosition();
glutInitWindowSize();
glutCreateWindow();
winInit("My first OpenGL window...", 300LL);
selectPoints();
glutDisplayFunc();
glutMainLoop();
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax

opterr = 0;
while ( 1 )
{
v3 = getopt(argc, (char *const *)argv, "n:");
if ( v3 == -1 )
break;
if ( v3 == 63 )
{
puts("use option -nX (no space), with 0 < X.");
}
else if ( v3 == 110 )
{
if ( (unsigned int)__isoc99_sscanf() != 1 || nbPoints <= 0 )
nbPoints = 50;
}
else
{
puts("Shouldn't be here, really...");
}
}
if ( nbPoints <= 0 )
__assert_fail("nbPoints > 0", "two.c", 0x59u, "main");
T = (__int64)malloc(16LL * nbPoints);
if ( !T )
__assert_fail("T != NULL", "two.c", 0x5Bu, "main");
glutInit();
glutInitDisplayMode();
glutInitWindowPosition();
glutInitWindowSize();
glutCreateWindow();
func9("My first OpenGL window...", 300LL);
func10();
glutDisplayFunc();
glutMainLoop();
return 0;
}

original_code:
int main(int argc, char **argv)
{
  int c;
  opterr = 0;
  while ((c = getopt(argc, argv, "n:")) != (-1))
  {
 switch (c)
 {
  case 'n': if ((sscanf(optarg, "%d", &nbPoints) != 1) || nbPoints <= 0)
     nbPoints = 50;
      break;
  case '?': printf("use option -nX (no space), with 0 < X.\n");
      break;
  default : printf("Shouldn't be here, really...\n");
      break;
 }
  }
  ((void) sizeof ((nbPoints > 0) ? 1 : 0), __extension__ ({ if (nbPoints > 0) ; else __assert_fail ("nbPoints > 0", "two.c", 89, __extension__ __PRETTY_FUNCTION__); }));
  T = (vertex *) malloc(sizeof(vertex)*nbPoints);
  ((void) sizeof ((T != ((void *)0)) ? 1 : 0), __extension__ ({ if (T != ((void *)0)) ; else __assert_fail ("T != NULL", "two.c", 91, __extension__ __PRETTY_FUNCTION__); }));
  glutInit(&argc, argv);
  glutInitDisplayMode(0x0000 | 0x0000);
  glutInitWindowPosition(5,5);
  glutInitWindowSize(300,300);
  glutCreateWindow("My first OpenGL window...");
  winInit();
  selectPoints();
  glutDisplayFunc(display);
  glutMainLoop();
  return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
  int c;
  opterr = 0;
  while ((c = getopt(argc, argv, "n:")) != (-1))
  {
 switch (c)
 {
  case 'n': if ((sscanf(optarg, "%d", &nbPoints) != 1) || nbPoints <= 0)
     nbPoints = 50;
      break;
  case '?': printf("use option -nX (no space), with 0 < X.\n");
      break;
  default : printf("Shouldn't be here, really...\n");
      break;
 }
  }
  ((void) sizeof ((nbPoints > 0) ? 1 : 0), __extension__ ({ if (nbPoints > 0) ; else __assert_fail ("nbPoints > 0", "two.c", 89, __extension__ __PRETTY_FUNCTION__); }));
  T = (struct vertex *) malloc(sizeof(vertex)*nbPoints);
  ((void) sizeof ((T != ((void *)0)) ? 1 : 0), __extension__ ({ if (T != ((void *)0)) ; else __assert_fail ("T != NULL", "two.c", 91, __extension__ __PRETTY_FUNCTION__); }));
  glutInit(&argc, argv);
  glutInitDisplayMode(0x0000 | 0x0000);
  glutInitWindowPosition(5,5);
  glutInitWindowSize(300,300);
  glutCreateWindow("My first OpenGL window...");
  winInit();
  selectPoints();
  glutDisplayFunc(display);
  glutMainLoop();
  return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: c int

return_type: int


display

decompiled_code:
__int64 display()
{
__int64 v0; // rbp
unsigned int v1; // eax
__int64 v2; // rbx
__int64 v3; // rbp

v0 = nbPoints;
glColor3f();
glClear();
glColor3f();
glBegin();
v1 = v0 - 1;
if ( (int)v0 - 1 >= 0 )
{
v2 = 16LL * (int)v1;
v3 = 16 * (v0 - v1) - 32;
do
{
v2 -= 16LL;
glVertex2f();
}
while ( v3 != v2 );
}
glEnd();
return glFlush();
}

canonical_decompiled_code:
__int64 func7()
{
__int64 v0; // rbp
unsigned int v1; // eax
__int64 v2; // rbx
__int64 v3; // rbp

v0 = nbPoints;
glColor3f();
glClear();
glColor3f();
glBegin();
v1 = v0 - 1;
if ( (int)v0 - 1 >= 0 )
{
v2 = 16LL * (int)v1;
v3 = 16 * (v0 - v1) - 32;
do
{
v2 -= 16LL;
glVertex2f();
}
while ( v3 != v2 );
}
glEnd();
return glFlush();
}

original_code:
void display(void)
{
  int n = nbPoints;
  glColor3f(0.0, 0.0, 0.0);
  glClear(0x00004000);
  glColor3f(1.0, 1.0, 1.0);
  glBegin(0x0000);
  while (--n >= 0)
   glVertex2f(T[n].coords[0], T[n].coords[1]);
  glEnd();
  glFlush();
}

canonical_original_code:
void display()
{
  int n = nbPoints;
  glColor3f(0.0, 0.0, 0.0);
  glClear(0x00004000);
  glColor3f(1.0, 1.0, 1.0);
  glBegin(0x0000);
  while (--n >= 0)
   glVertex2f(T[n].coords[0], T[n].coords[1]);
  glEnd();
  glFlush();
}

return_type: void


myRandom

decompiled_code:
double __fastcall myRandom(double a1, double a2)
{
return (a2 - a1) / 2147483647.0 * (double)(int)random() + a1;
}

canonical_decompiled_code:
double __fastcall func8(double a1, double a2)
{
return (a2 - a1) / 2147483647.0 * (double)(int)random() + a1;
}

original_code:
double myRandom (double a, double b)
{
  double tmp = random();
  return a+tmp*((b-a)/2147483647);
}

canonical_original_code:
double myRandom(double a, double b)
{
  double tmp = random();
  return a+tmp*((b-a)/2147483647);
}

variable_types: a double

variable_types: b double

variable_types: tmp double

return_type: double


winInit

decompiled_code:
__int64 winInit()
{
return gluOrtho2D();
}

canonical_decompiled_code:
__int64 func9()
{
return gluOrtho2D();
}

original_code:
void winInit()
{
  gluOrtho2D(minX, maxX, minY, maxY);
}


cestDansLaBoite

decompiled_code:
_BOOL8 __fastcall cestDansLaBoite(double *a1, double *a2, double *a3)
{
double v3; // xmm2_8
double v4; // xmm0_8
double v5; // xmm5_8
double v6; // xmm1_8
double v7; // xmm5_8
double v8; // xmm0_8
_BOOL8 result; // rax

v3 = a2[1];
v4 = fmax(*a1, *a2);
v5 = a1[1];
v6 = fmax(v5, v3);
v7 = fmin(v5, v3);
if ( *a3 < fmin(*a1, *a2) || v4 < *a3 || (v8 = a3[1], v8 < v7) )
result = 0LL;
else
result = v6 >= v8;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func11(double *a1, double *a2, double *a3)
{
double v3; // xmm2_8
double v4; // xmm0_8
double v5; // xmm5_8
double v6; // xmm1_8
double v7; // xmm5_8
double v8; // xmm0_8
_BOOL8 result; // rax

v3 = a2[1];
v4 = fmax(*a1, *a2);
v5 = a1[1];
v6 = fmax(v5, v3);
v7 = fmin(v5, v3);
if ( *a3 < fmin(*a1, *a2) || v4 < *a3 || (v8 = a3[1], v8 < v7) )
result = 0LL;
else
result = v6 >= v8;
return result;
}

original_code:
int cestDansLaBoite(vertex *a, vertex *b, vertex *c)
{
    double xMin = (((a->coords[0]) < (b->coords[0])) ? (a->coords[0]) : (b->coords[0])) ;
    double yMin = (((a->coords[1]) < (b->coords[1])) ? (a->coords[1]) : (b->coords[1])) ;
    double xMax = (((a->coords[0]) > (b->coords[0])) ? (a->coords[0]) : (b->coords[0])) ;
    double yMax = (((a->coords[1]) > (b->coords[1])) ? (a->coords[1]) : (b->coords[1])) ;
    if((xMin <= c->coords[0]) && (xMax >= c->coords[0]) && (yMin <= c->coords[1]) && (yMax >= c->coords[1]))
        return 1 ;
    return 0 ;
}

canonical_original_code:
int cestDansLaBoite(struct vertex *a, struct vertex *b, struct vertex *c)
{
    double xMin = (((a->coords[0]) < (b->coords[0])) ? (a->coords[0]) : (b->coords[0]));
    double yMin = (((a->coords[1]) < (b->coords[1])) ? (a->coords[1]) : (b->coords[1]));
    double xMax = (((a->coords[0]) > (b->coords[0])) ? (a->coords[0]) : (b->coords[0]));
    double yMax = (((a->coords[1]) > (b->coords[1])) ? (a->coords[1]) : (b->coords[1]));
    if((xMin <= c->coords[0]) && (xMax >= c->coords[0]) && (yMin <= c->coords[1]) && (yMax >= c->coords[1]))
        return 1 ;
    return 0 ;
}

variable_types:
a
struct vertex { double coords[2]; } *

variable_types:
b
struct vertex *

variable_types:
c
struct vertex *

variable_types: xMin double

variable_types: yMin double

variable_types: xMax double

variable_types: yMax double


cubinit

decompiled_code:
__int64 cubinit()
{
__int64 result; // rax
__int64 v1; // rbx
int v2; // ebp
__int64 v3; // r13
__int64 v4; // r15
int v5; // er12
int v6; // eax
int v7; // eax
int v8; // edx
char *v9; // rdi
char *v10; // rdx
__int64 v11; // [rsp+0h] [rbp-48h]

generation();
result = (unsigned int)nbPoints;
if ( nbPoints > 1 )
{
v1 = 0LL;
do
{
v2 = v1 + 1;
if ( (int)v1 + 1 < (int)result )
{
v11 = 16 * v1;
v3 = 16 * v1 + 16;
do
{
v4 = 0LL;
v5 = 2;
if ( (int)result > 0 )
{
do
{
if ( (_DWORD)v4 != (_DWORD)v1 && v2 != (_DWORD)v4 )
{
v6 = puissance((double *)(v11 + P), (double *)(P + v3), (double *)(P + 16 * v4));
if ( v6 == 2 )
{
if ( !cestDansLaBoite((double *)(v11 + P), (double *)(P + v3), (double *)(P + 16 * v4)) )
goto LABEL_15;
}
else if ( v6 != v5 )
{
if ( v5 != 2 )
goto LABEL_15;
v5 = v6;
}
}
++v4;
}
while ( nbPoints > (int)v4 );
}
v7 = nbSegm;
v8 = nbSegmMax;
v9 = (char *)S;
if ( nbSegm >= nbSegmMax )
{
++nbSegmMax;
S = realloc(S, 8LL * (v8 + 1));
v9 = (char *)S;
v7 = nbSegm;
}
v10 = &v9[8 * v7];
*(_DWORD *)v10 = v1;
*((_DWORD *)v10 + 1) = v2;
nbSegm = v7 + 1;
LABEL_15:
result = (unsigned int)nbPoints;
++v2;
v3 += 16LL;
}
while ( nbPoints > v2 );
}
++v1;
}
while ( (int)result - 1 > (int)v1 );
}
return result;
}

canonical_decompiled_code:
__int64 func13()
{
__int64 result; // rax
__int64 v1; // rbx
int v2; // ebp
__int64 v3; // r13
__int64 v4; // r15
int v5; // er12
int v6; // eax
int v7; // eax
int v8; // edx
char *v9; // rdi
char *v10; // rdx
__int64 v11; // [rsp+0h] [rbp-48h]

func10();
result = (unsigned int)nbPoints;
if ( nbPoints > 1 )
{
v1 = 0LL;
do
{
v2 = v1 + 1;
if ( (int)v1 + 1 < (int)result )
{
v11 = 16 * v1;
v3 = 16 * v1 + 16;
do
{
v4 = 0LL;
v5 = 2;
if ( (int)result > 0 )
{
do
{
if ( (_DWORD)v4 != (_DWORD)v1 && v2 != (_DWORD)v4 )
{
v6 = func12((double *)(v11 + P), (double *)(P + v3), (double *)(P + 16 * v4));
if ( v6 == 2 )
{
if ( !func11((double *)(v11 + P), (double *)(P + v3), (double *)(P + 16 * v4)) )
goto LABEL_15;
}
else if ( v6 != v5 )
{
if ( v5 != 2 )
goto LABEL_15;
v5 = v6;
}
}
++v4;
}
while ( nbPoints > (int)v4 );
}
v7 = nbSegm;
v8 = nbSegmMax;
v9 = (char *)S;
if ( nbSegm >= nbSegmMax )
{
++nbSegmMax;
S = realloc(S, 8LL * (v8 + 1));
v9 = (char *)S;
v7 = nbSegm;
}
v10 = &v9[8 * v7];
*(_DWORD *)v10 = v1;
*((_DWORD *)v10 + 1) = v2;
nbSegm = v7 + 1;
LABEL_15:
result = (unsigned int)nbPoints;
++v2;
v3 += 16LL;
}
while ( nbPoints > v2 );
}
++v1;
}
while ( (int)result - 1 > (int)v1 );
}
return result;
}

original_code:
void cubinit()
{
    int i, j, k ;
    int puiss ;
    int puissEnreg ;
    int unCote ;
    generation() ;
    for(i = 0; i < nbPoints-1; i++)
    {
        for(j = (i + 1); j < nbPoints; j++)
        {
            puissEnreg = 2;
            unCote = 1;
            for(k = 0; k < nbPoints; k++)
            {
                if(k != i && k != j)
                {
                    puiss = puissance(&P[i], &P[j], &P[k]) ;
                    if(puiss == 2)
                    {
                        if(!cestDansLaBoite(&P[i], &P[j], &P[k]))
                        {
                            unCote = 0 ;
                            break;
                        }
                    }
                    else
                    {
                        if(puissEnreg != puiss)
                        {
                            if(puissEnreg != 2)
                            {
                                unCote = 0 ;
                                break;
                            }
                            else
                                puissEnreg = puiss ;
                        }
                    }
                }
            }
            if(unCote)
            {
                if(nbSegm >= nbSegmMax)
                {
                    nbSegmMax++ ;
                    S = realloc (S, nbSegmMax * sizeof(segm)) ;
                }
                S[nbSegm].points[0] = i ;
                S[nbSegm].points[1] = j ;
                nbSegm++ ;
            }
        }
    }
}

canonical_original_code:
void cubinit()
{
    int i; int j; int k;
    int puiss;
    int puissEnreg;
    int unCote;
    generation() ;
    for(i = 0; i < nbPoints-1; i++)
    {
        for(j = (i + 1); j < nbPoints; j++)
        {
            puissEnreg = 2;
            unCote = 1;
            for(k = 0; k < nbPoints; k++)
            {
                if(k != i && k != j)
                {
                    puiss = puissance(&P[i], &P[j], &P[k]) ;
                    if(puiss == 2)
                    {
                        if(!cestDansLaBoite(&P[i], &P[j], &P[k]))
                        {
                            unCote = 0 ;
                            break;
                        }
                    }
                    else
                    {
                        if(puissEnreg != puiss)
                        {
                            if(puissEnreg != 2)
                            {
                                unCote = 0 ;
                                break;
                            }
                            else
                                puissEnreg = puiss ;
                        }
                    }
                }
            }
            if(unCote)
            {
                if(nbSegm >= nbSegmMax)
                {
                    nbSegmMax++ ;
                    S = realloc (S, nbSegmMax * sizeof(segm)) ;
                }
                S[nbSegm].points[0] = i ;
                S[nbSegm].points[1] = j ;
                nbSegm++ ;
            }
        }
    }
}

variable_types: i int

variable_types: j int

variable_types: k int

variable_types: puiss int

variable_types: puissEnreg int

variable_types: unCote int


myRandom

original_code:
double myRandom (double a, double b)
{
    double tmp = random();
    return a+tmp*((b-a)/2147483647);
}

canonical_original_code:
double myRandom(double a, double b)
{
    double tmp = random();
    return a+tmp*((b-a)/2147483647);
}


decompiled_code:
float __fastcall random_float_between(float a1, float a2)
{
return (float)((float)(a2 - a1) * (float)((float)rand() * 4.6566129e-10)) + a1;
}

canonical_decompiled_code:
float __fastcall func0(float a1, float a2)
{
return (float)((float)(a2 - a1) * (float)((float)rand() * 4.6566129e-10)) + a1;
}

original_code:
float random_float_between(float a, float b) {
    float random = ((float) rand()) / (float) 2147483647;
    float diff = b - a;
    float r = random * diff;
    return a + r;
}

variable_types: a float

variable_types: b float

variable_types: random float

variable_types: diff float

variable_types: r float

return_type: float


main

original_code:
int main ( int argc , char* argv[]){
 int method;
 float width = 0.8f;
 float dt;
 float center;
 float ddt;
 int ab_1 = -5;
 int ab_2 = 5;
 int i;
 int mm;
 int flag = 0;
 int flagmin;
 int times = 1;
 float *w;
 float *l;
 float** y;
 srand((int)time(((void *)0)));
 mm = 2 + rand() % ( 5 - 2 );
 dt = 2 + random_float_between( 0.0 , 1.0 );
 center = -4 + 3 * random_float_between( 0.0 , 1.0 ) ;
 w = (float*) malloc( sizeof(float) * mm );
 if( !w ){
  printf("Out of memory..\n");
  return -1;
 }
 for( i = 0 ; i < mm ; i++)
  w[i] = ab_1 + ( ab_2 - ab_1 ) * random_float_between( 0.0 , 1.0 );
 sort(w , 0 , mm - 1 );
 int m = mm;
 l = (float*) malloc( sizeof( float ) * ( m + 1) );
 if( !l ){
  printf("Out of memory..\n");
  return -1;
 }
 l[0] = w[0] - ab_1;
 for( i = 1 ; i < m ; i++)
  l[i] = w[i] - w[i-1];
 l[m] = ab_2 - w[m-1];
 if( dt > 4 || dt < 0 )
  dt = 4;
 method = 1;
 float LL,h;
 float NN;
 float *N;
 LL = ab_2 - ab_1;
 h = 1 / (float) 8;
 NN = ceilf(LL/h);
 N = (float*) malloc(sizeof(float) * (m+1));
 if( !N ){
  printf("Out of memory...\n" );
  return -1;
 }
 for( i = 0 ; i < (m+1) ; i++)
  N[i] = ceilf( (NN * l[i]) /LL );
 ddt = 0.5f;
 if( method == 1 ){
  y = cell_diff_main(ab_1 , ab_2 , w , N , mm , center , times , dt , ddt);
  if( !y ){
   printf("Cell diff main failed\n");
   exit(1);
  }
 }
 else if( method == 2 ){
 }
 else if( method == 3 ){
 }
 else {
  printf("No method specified\n");
  return -1;
 }
 free(l);
 free(w);
 free(N);
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[]){
 int method;
 float width = 0.8f;
 float dt;
 float center;
 float ddt;
 int ab_1 = -5;
 int ab_2 = 5;
 int i;
 int mm;
 int flag = 0;
 int flagmin;
 int times = 1;
 float *w;
 float *l;
 float **y;
 srand((int)time(((void *)0)));
 mm = 2 + rand() % ( 5 - 2 );
 dt = 2 + random_float_between( 0.0 , 1.0 );
 center = -4 + 3 * random_float_between( 0.0 , 1.0 ) ;
 w = (float *) malloc( sizeof(float) * mm );
 if( !w ){
  printf("Out of memory..\n");
  return -1;
 }
 for( i = 0 ; i < mm ; i++)
  w[i] = ab_1 + ( ab_2 - ab_1 ) * random_float_between( 0.0 , 1.0 );
 sort(w , 0 , mm - 1 );
 int m = mm;
 l = (float *) malloc( sizeof( float ) * ( m + 1) );
 if( !l ){
  printf("Out of memory..\n");
  return -1;
 }
 l[0] = w[0] - ab_1;
 for( i = 1 ; i < m ; i++)
  l[i] = w[i] - w[i-1];
 l[m] = ab_2 - w[m-1];
 if( dt > 4 || dt < 0 )
  dt = 4;
 method = 1;
 float LL; float h;
 float NN;
 float *N;
 LL = ab_2 - ab_1;
 h = 1 / (float) 8;
 NN = ceilf(LL/h);
 N = (float *) malloc(sizeof(float) * (m+1));
 if( !N ){
  printf("Out of memory...\n" );
  return -1;
 }
 for( i = 0 ; i < (m+1) ; i++)
  N[i] = ceilf( (NN * l[i]) /LL );
 ddt = 0.5f;
 if( method == 1 ){
  y = cell_diff_main(ab_1 , ab_2 , w , N , mm , center , times , dt , ddt);
  if( !y ){
   printf("Cell diff main failed\n");
   exit(1);
  }
 }
 else if( method == 2 ){
 }
 else if( method == 3 ){
 }
 else {
  printf("No method specified\n");
  return -1;
 }
 free(l);
 free(w);
 free(N);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: method int

variable_types: width float

variable_types: dt float

variable_types: center float

variable_types: ddt float

variable_types: mm int

variable_types: flag int

variable_types: flagmin int

variable_types: times int

variable_types:
w
float *

variable_types:
l
float *

variable_types:
y
float **

variable_types: m int

variable_types: LL float

variable_types: h float

variable_types: NN float

variable_types:
N
float *


decompiled_code:
__int64 __fastcall cell_diff_main(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5)
{
void *v5; // rax

v5 = malloc(4LL * (a5 + 1));
if ( v5 )
free(v5);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5)
{
void *v5; // rax

v5 = malloc(4LL * (a5 + 1));
if ( v5 )
free(v5);
return 0LL;
}

original_code:
float** cell_diff_main(int a , int b , float* w , float *n , int size , int center , int times , float maxt , float dt ){
 float* h;
 float g = 0.5f;
 int i;
 h = (float*) malloc(sizeof(float) * (size + 1) );
 if( !h )
  return ((void *)0);
 h[0] = ( (w[0]-a) / n[0] );
 for( i = 1 ; i < size ; i++)
  h[i] = ( (w[i]-w[i-1])/n[i] );
 h[size+1] = ( (b-w[size]) / n[size+1] );
 free(h);
 return ((void *)0);
}

canonical_original_code:
float **cell_diff_main(int a, int b, float *w, float *n, int size, int center, int times, float maxt, float dt){
 float *h;
 float g = 0.5f;
 int i;
 h = (float *) malloc(sizeof(float) * (size + 1) );
 if( !h )
  return ((void *)0);
 h[0] = ( (w[0]-a) / n[0] );
 for( i = 1 ; i < size ; i++)
  h[i] = ( (w[i]-w[i-1])/n[i] );
 h[size+1] = ( (b-w[size]) / n[size+1] );
 free(h);
 return ((void *)0);
}

variable_types: a int

variable_types: b int

variable_types:
n
float *

variable_types: size int

variable_types: center int

variable_types: maxt float

variable_types:
h
float *

variable_types: g float

variable_types: i int

return_type: float **


hash

original_code:
unsigned int hash(hashtable_t *hashtable,char* key){
 unsigned h = 0;
    int i;
    int len;
    len = strlen(key);
 for ( i = 0; i < len; i++ ) {
     h += key[i];
     h += ( h << 10 );
     h ^= ( h >> 6 );
 }
 h += ( h << 3 );
 h ^= ( h >> 11 );
 h += ( h << 15 );
 return h % hashtable->size ;
}

canonical_original_code:
unsigned int hash(struct hashtable_s *hashtable, char *key){
 unsigned int h = 0;
    int i;
    int len;
    len = strlen(key);
 for ( i = 0; i < len; i++ ) {
     h += key[i];
     h += ( h << 10 );
     h ^= ( h >> 6 );
 }
 h += ( h << 3 );
 h ^= ( h >> 11 );
 h += ( h << 15 );
 return h % hashtable->size ;
}

variable_types: struct hashtable_s { int size; int num_nodes; struct entry_s { char *key; int value; struct entry_s *next; } **table; } *

variable_types:
key
char *

variable_types:
h
unsigned int

variable_types: len int

return_type: unsigned int

user_defined_types: struct hashtable_s { int size; int num_nodes; struct entry_s **table; }


decompiled_code:
__int64 __fastcall ht_insert_pair(__int64 a1, char *a2, int a3)
{
void **v3; // r12
const char ***v4; // rdx
__int64 result; // rax

if ( !a2 )
return 0LL;
if ( !a1 )
return 0LL;
v3 = (void **)ht_create_pair(a2, a3);
if ( !v3 )
return 0LL;
v4 = (const char ***)(*(_QWORD *)(a1 + 8) + 8LL * (int)hash((_DWORD *)a1, a2));
if ( *v4 )
{
if ( !strcmp(**v4, a2) )
free(*v3);
free(v3);
result = 0xFFFFFFFFLL;
}
else
{
*v4 = (const char **)v3;
result = 1LL;
v3[2] = 0LL;
++*(_DWORD *)(a1 + 4);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, char *a2, int a3)
{
void **v3; // r12
const char ***v4; // rdx
__int64 result; // rax

if ( !a2 )
return 0LL;
if ( !a1 )
return 0LL;
v3 = (void **)ht_create_pair(a2, a3);
if ( !v3 )
return 0LL;
v4 = (const char ***)(*(_QWORD *)(a1 + 8) + 8LL * (int)func0((_DWORD *)a1, a2));
if ( *v4 )
{
if ( !strcmp(**v4, a2) )
free(*v3);
free(v3);
result = 0xFFFFFFFFLL;
}
else
{
*v4 = (const char **)v3;
result = 1LL;
v3[2] = 0LL;
++*(_DWORD *)(a1 + 4);
}
return result;
}

original_code:
int ht_insert_pair(hashtable_t *hashtable, char* key, int value ){
 entry_t* newpair = ((void *)0);
 entry_t* curr = ((void *)0);
 entry_t* head = ((void *)0);
 int index;
 if( !key || !hashtable )
  return 0;
 newpair = ht_create_pair(key , value);
 if( !newpair )
  return 0;
 index = hash(hashtable , key );
 head = hashtable->table[index];
 if( head == ((void *)0) ){
  hashtable->table[index] = newpair;
  newpair->next = ((void *)0);
  hashtable->num_nodes = hashtable->num_nodes + 1;
  return 1;
 }
 else{
  for( curr = hashtable->table[index] ; curr ; curr = curr->next){
   if( strcmp(curr->key , key ) == 0 )
    free(newpair->key);
    free(newpair);
    return -1;
  }
  newpair->next = hashtable->table[index];
  hashtable->table[index] = newpair;
  hashtable->num_nodes = hashtable->num_nodes + 1;
  return 1;
 }
 return 0;
}

canonical_original_code:
int ht_insert_pair(struct hashtable_s *hashtable, char *key, int value){
 struct entry_s *newpair = ((void *)0);
 struct entry_s *curr = ((void *)0);
 struct entry_s *head = ((void *)0);
 int index;
 if( !key || !hashtable )
  return 0;
 newpair = ht_create_pair(key , value);
 if( !newpair )
  return 0;
 index = hash(hashtable , key );
 head = hashtable->table[index];
 if( head == ((void *)0) ){
  hashtable->table[index] = newpair;
  newpair->next = ((void *)0);
  hashtable->num_nodes = hashtable->num_nodes + 1;
  return 1;
 }
 else{
  for( curr = hashtable->table[index] ; curr ; curr = curr->next){
   if( strcmp(curr->key , key ) == 0 )
    free(newpair->key);
    free(newpair);
    return -1;
  }
  newpair->next = hashtable->table[index];
  hashtable->table[index] = newpair;
  hashtable->num_nodes = hashtable->num_nodes + 1;
  return 1;
 }
 return 0;
}

variable_types: value int

variable_types: struct entry_s { char *key; int value; struct entry_s *next; } *

variable_types: index int


decompiled_code:
__int64 __fastcall ht_get(__int64 a1, const char *a2, _DWORD *a3)
{
__int64 v4; // rbx

if ( a3 == 0LL || a2 == 0LL )
return 0LL;
if ( !a1 )
return 0LL;
v4 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8LL * (int)hash((_DWORD *)a1, a2));
if ( !v4 )
return 0LL;
while ( strcmp(a2, *(const char **)v4) )
{
v4 = *(_QWORD *)(v4 + 16);
if ( !v4 )
return 0LL;
}
*a3 = *(_DWORD *)(v4 + 8);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, const char *a2, _DWORD *a3)
{
__int64 v4; // rbx

if ( a3 == 0LL || a2 == 0LL )
return 0LL;
if ( !a1 )
return 0LL;
v4 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8LL * (int)func0((_DWORD *)a1, a2));
if ( !v4 )
return 0LL;
while ( strcmp(a2, *(const char **)v4) )
{
v4 = *(_QWORD *)(v4 + 16);
if ( !v4 )
return 0LL;
}
*a3 = *(_DWORD *)(v4 + 8);
return 1LL;
}

original_code:
int ht_get(hashtable_t* hashtable , char* key , int *ret){
 int index;
 entry_t* curr = ((void *)0);
 if( !hashtable || !key || !ret )
  return 0;
 index = hash( hashtable , key );
 for( curr = hashtable->table[index] ; curr; curr = curr->next ){
  if( strcmp( key , curr->key ) == 0 ){
   *ret = curr->value;
   return 1;
  }
 }
 return 0;
}

canonical_original_code:
int ht_get(struct hashtable_s *hashtable, char *key, int *ret){
 int index;
 struct entry_s *curr = ((void *)0);
 if( !hashtable || !key || !ret )
  return 0;
 index = hash( hashtable , key );
 for( curr = hashtable->table[index] ; curr; curr = curr->next ){
  if( strcmp( key , curr->key ) == 0 ){
   *ret = curr->value;
   return 1;
  }
 }
 return 0;
}

variable_types:
ret
int *

user_defined_types: struct entry_s { char *key; int value; struct entry_s *next; }


decompiled_code:
int __fastcall ht_print(__int64 a1)
{
__int64 v1; // rbp
__int64 v2; // rbx
int result; // eax

if ( a1 )
{
puts("------ PRINTING HASH TABLE -----------");
if ( *(int *)a1 > 0 )
{
v1 = 0LL;
do
{
while ( 1 )
{
if ( *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v1) )
{
printf("Hash Table index: %d \n", (unsigned int)v1);
v2 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v1);
if ( v2 )
break;
}
if ( *(_DWORD *)a1 <= (int)++v1 )
goto LABEL_9;
}
do
{
printf("Pair : key = \"%s\" value = %d\n", *(const char **)v2, *(unsigned int *)(v2 + 8));
v2 = *(_QWORD *)(v2 + 16);
}
while ( v2 );
++v1;
}
while ( *(_DWORD *)a1 > (int)v1 );
}
LABEL_9:
result = printf("NUM NODES: %d\n", *(unsigned int *)(a1 + 4));
}
return result;
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1)
{
__int64 v1; // rbp
__int64 v2; // rbx
int result; // eax

if ( a1 )
{
puts("------ PRINTING HASH TABLE -----------");
if ( *(int *)a1 > 0 )
{
v1 = 0LL;
do
{
while ( 1 )
{
if ( *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v1) )
{
printf("Hash Table index: %d \n", (unsigned int)v1);
v2 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v1);
if ( v2 )
break;
}
if ( *(_DWORD *)a1 <= (int)++v1 )
goto LABEL_9;
}
do
{
printf("Pair : key = \"%s\" value = %d\n", *(const char **)v2, *(unsigned int *)(v2 + 8));
v2 = *(_QWORD *)(v2 + 16);
}
while ( v2 );
++v1;
}
while ( *(_DWORD *)a1 > (int)v1 );
}
LABEL_9:
result = printf("NUM NODES: %d\n", *(unsigned int *)(a1 + 4));
}
return result;
}

original_code:
void ht_print(hashtable_t* hashtable){
 int i;
 entry_t* curr;
 if( !hashtable )
  return;
 printf("------ PRINTING HASH TABLE -----------\n");
 for( i = 0 ; i < hashtable->size ; i++){
  if( hashtable->table[i] != ((void *)0) ){
   printf("Hash Table index: %d \n",i);
   for( curr = hashtable->table[i] ; curr ; curr = curr->next){
    printf("Pair : key = \"%s\" value = %d\n",curr->key,curr->value);
   }
  }
 }
 printf("NUM NODES: %d\n", hashtable->num_nodes);
}

canonical_original_code:
void ht_print(struct hashtable_s *hashtable){
 int i;
 struct entry_s *curr;
 if( !hashtable )
  return;
 printf("------ PRINTING HASH TABLE -----------\n");
 for( i = 0 ; i < hashtable->size ; i++){
  if( hashtable->table[i] != ((void *)0) ){
   printf("Hash Table index: %d \n",i);
   for( curr = hashtable->table[i] ; curr ; curr = curr->next){
    printf("Pair : key = \"%s\" value = %d\n",curr->key,curr->value);
   }
  }
 }
 printf("NUM NODES: %d\n", hashtable->num_nodes);
}


decompiled_code:
void __fastcall ht_free(void *ptr)
{
__int64 v1; // r13
int v3; // eax
_QWORD *v4; // rdi
__int64 i; // rbx
void **v6; // rax

if ( ptr )
{
v1 = 0LL;
v3 = *(_DWORD *)ptr;
v4 = (_QWORD *)*((_QWORD *)ptr + 1);
if ( v3 > 0 )
{
do
{
for ( i = v4[v1]; i; v4[v1] = i )
{
v6 = (void **)i;
i = *(_QWORD *)(i + 16);
free(*v6);
free(*(void **)(*((_QWORD *)ptr + 1) + 8 * v1));
v4 = (_QWORD *)*((_QWORD *)ptr + 1);
}
++v1;
}
while ( *(_DWORD *)ptr > (int)v1 );
}
free(v4);
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
__int64 v1; // r13
int v3; // eax
_QWORD *v4; // rdi
__int64 i; // rbx
void **v6; // rax

if ( ptr )
{
v1 = 0LL;
v3 = *(_DWORD *)ptr;
v4 = (_QWORD *)*((_QWORD *)ptr + 1);
if ( v3 > 0 )
{
do
{
for ( i = v4[v1]; i; v4[v1] = i )
{
v6 = (void **)i;
i = *(_QWORD *)(i + 16);
free(*v6);
free(*(void **)(*((_QWORD *)ptr + 1) + 8 * v1));
v4 = (_QWORD *)*((_QWORD *)ptr + 1);
}
++v1;
}
while ( *(_DWORD *)ptr > (int)v1 );
}
free(v4);
free(ptr);
}
}

original_code:
void ht_free(hashtable_t *hashtable){
 entry_t* dummy;
 int i;
 if( !hashtable )
  return;
 for( i = 0 ; i < hashtable->size ; i++){
  while( hashtable->table[i] ){
   dummy = hashtable->table[i]->next;
   free(hashtable->table[i]->key);
   free(hashtable->table[i]);
   hashtable->table[i] = dummy;
  }
 }
 free( hashtable->table );
 free(hashtable);
}

canonical_original_code:
void ht_free(struct hashtable_s *hashtable){
 struct entry_s *dummy;
 int i;
 if( !hashtable )
  return;
 for( i = 0 ; i < hashtable->size ; i++){
  while( hashtable->table[i] ){
   dummy = hashtable->table[i]->next;
   free(hashtable->table[i]->key);
   free(hashtable->table[i]);
   hashtable->table[i] = dummy;
  }
 }
 free( hashtable->table );
 free(hashtable);
}


decompiled_code:
__int64 __fastcall ht_get_num_nodes(__int64 a1)
{
return *(unsigned int *)(a1 + 4);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
return *(unsigned int *)(a1 + 4);
}

original_code:
int ht_get_num_nodes(hashtable_t* hashtable){
 return hashtable->num_nodes;
}

canonical_original_code:
int ht_get_num_nodes(struct hashtable_s *hashtable){
 return hashtable->num_nodes;
}


original_code:
void init_list(LIST* list){
 list->len = 0;
 list->head = ((void *)0);
 list->hashtable = ht_init( 10000 );
 if( !(list->hashtable)){
  printf("No memory for hash table...\n");
  exit(1);
 }
 list->has_reference = 0;
 list->m2 = 0;
 list->solving_method = 1;
 list->dc_sweep.name = ((void *)0);
 list->dc_sweep.node = ((void *)0);
 list->dc_sweep.start_v = 0.0;
 list->dc_sweep.end_v = 0.0;
 list->dc_sweep.inc = 0.0;
 list->dc_sweep.oldval = 0.0;
 list->plot = 0;
 list->itol = 1e-3;
 list->nz = 0;
 list->sparse = 0;
 list->transient_sim = 10;
}

canonical_original_code:
void init_list(struct list *list){
 list->len = 0;
 list->head = ((void *)0);
 list->hashtable = ht_init( 10000 );
 if( !(list->hashtable)){
  printf("No memory for hash table...\n");
  exit(1);
 }
 list->has_reference = 0;
 list->m2 = 0;
 list->solving_method = 1;
 list->dc_sweep.name = ((void *)0);
 list->dc_sweep.node = ((void *)0);
 list->dc_sweep.start_v = 0.0;
 list->dc_sweep.end_v = 0.0;
 list->dc_sweep.inc = 0.0;
 list->dc_sweep.oldval = 0.0;
 list->plot = 0;
 list->itol = 1e-3;
 list->nz = 0;
 list->sparse = 0;
 list->transient_sim = 10;
}

variable_types: struct list { int len; struct list_node { char type; union node { struct bjt { char name[10]; int collector; int base; int emitter; } bjt; struct mos { char name[10]; int drain; int gate; int source; int body; double l; double w; } mosfet; struct source_v { char name[10]; long node1; long node2; int mna_row; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t { struct pwl_pair { double ti; double ii; struct pwl_pair *next; } *head; int n; } *pair_list; } source_v; struct source_i { char name[10]; long node1; long node2; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t *pair_list; } source_i; struct resistance { char name[10]; long node1; long node2; double value; } resistance; struct capacity { char name[10]; long node1; long node2; double value; } capacity; struct inductance { char name[10]; long node1; long node2; double value; } inductance; struct diode { char name[10]; long node1; long node2; } diode; } node; struct list_node *next; } *head; struct hashtable_s { int size; int num_nodes; struct entry_s { char *key; int value; struct entry_s *next; } **table; } *hashtable; char has_reference; int m2; char solving_method; struct dc_sweep { char *name; struct list_node *node; double start_v; double end_v; double inc; double oldval; } dc_sweep; char plot; double itol; unsigned int nz; char sparse; char transient_sim; double time_step; double fin_time; } *

user_defined_types: struct list { int len; struct list_node *head; struct hashtable_s *hashtable; char has_reference; int m2; char solving_method; struct dc_sweep dc_sweep; char plot; double itol; unsigned int nz; char sparse; char transient_sim; double time_step; double fin_time; }

user_defined_types: struct list_node { char type; union node node; struct list_node *next; }

user_defined_types: union node { struct bjt bjt; struct mos mosfet; struct source_v source_v; struct source_i source_i; struct resistance resistance; struct capacity capacity; struct inductance inductance; struct diode diode; }

user_defined_types: struct source_v { char name[10]; long node1; long node2; int mna_row; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t *pair_list; }

user_defined_types: struct pair_list_t { struct pwl_pair *head; int n; }


decompiled_code:
int __fastcall print_list(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, const char *a8)
{
int result; // eax
int i; // ebp

result = puts("------------ PRINTING NODE LIST------------------\n");
if ( a7 > 0 )
{
for ( i = 0; i != a7; ++i )
{
while ( 1 )
{
result = *(unsigned __int8 *)a8;
if ( (_BYTE)result )
break;
++i;
result = printf(
"RESISTANCE : %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
a8 = (const char *)*((_QWORD *)a8 + 24);
if ( a7 == i )
return result;
}
switch ( (_BYTE)result )
{
case 1:
result = printf(
"CAPACITY : %s <%d> <%d> %e \n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
break;
case 2:
result = printf(
"INDUCTANCE : %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
break;
case 3:
result = printf(
"VOLTAGE SOURCE: %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 6));
break;
case 4:
result = printf(
"CURRENT SOURCE: %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
break;
case 5:
result = printf(
"MOSFET TRANSISTOR: %s <%d> <%d> <%d> <%d> %e %e \n",
a8 + 8,
*((unsigned int *)a8 + 5),
*((unsigned int *)a8 + 6),
*((unsigned int *)a8 + 7),
*((unsigned int *)a8 + 8),
*((double *)a8 + 5),
*((double *)a8 + 6));
break;
case 6:
result = printf(
"BJT TRANSISTOR: %s <%d> <%d> <%d> \n",
a8 + 8,
*((unsigned int *)a8 + 5),
*((unsigned int *)a8 + 6),
*((unsigned int *)a8 + 7));
break;
}
a8 = (const char *)*((_QWORD *)a8 + 24);
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, const char *a8)
{
int result; // eax
int i; // ebp

result = puts("------------ PRINTING NODE LIST------------------\n");
if ( a7 > 0 )
{
for ( i = 0; i != a7; ++i )
{
while ( 1 )
{
result = *(unsigned __int8 *)a8;
if ( (_BYTE)result )
break;
++i;
result = printf(
"RESISTANCE : %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
a8 = (const char *)*((_QWORD *)a8 + 24);
if ( a7 == i )
return result;
}
switch ( (_BYTE)result )
{
case 1:
result = printf(
"CAPACITY : %s <%d> <%d> %e \n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
break;
case 2:
result = printf(
"INDUCTANCE : %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
break;
case 3:
result = printf(
"VOLTAGE SOURCE: %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 6));
break;
case 4:
result = printf(
"CURRENT SOURCE: %s <%d> <%d> %f\n",
a8 + 8,
*((_QWORD *)a8 + 3),
*((_QWORD *)a8 + 4),
*((double *)a8 + 5));
break;
case 5:
result = printf(
"MOSFET TRANSISTOR: %s <%d> <%d> <%d> <%d> %e %e \n",
a8 + 8,
*((unsigned int *)a8 + 5),
*((unsigned int *)a8 + 6),
*((unsigned int *)a8 + 7),
*((unsigned int *)a8 + 8),
*((double *)a8 + 5),
*((double *)a8 + 6));
break;
case 6:
result = printf(
"BJT TRANSISTOR: %s <%d> <%d> <%d> \n",
a8 + 8,
*((unsigned int *)a8 + 5),
*((unsigned int *)a8 + 6),
*((unsigned int *)a8 + 7));
break;
}
a8 = (const char *)*((_QWORD *)a8 + 24);
}
}
return result;
}

original_code:
void print_list(LIST list){
 int i;
 printf("------------ PRINTING NODE LIST------------------\n\n");
 for( i = 0 ; i < list.len ; i++ ){
  if( list.head->type == NODE_RESISTANCE_TYPE ){
   printf("RESISTANCE : %s <%d> <%d> %f\n",list.head->node.resistance.name , list.head->node.resistance.node1 , list.head->node.resistance.node2 , list.head->node.resistance.value );
  }
  else if( list.head->type == NODE_CAPACITY_TYPE ){
   printf("CAPACITY : %s <%d> <%d> %e \n",list.head->node.capacity.name , list.head->node.capacity.node1 , list.head->node.capacity.node2 , list.head->node.capacity.value );
  }
  else if( list.head->type == NODE_INDUCTANCE_TYPE ){
   printf("INDUCTANCE : %s <%d> <%d> %f\n",list.head->node.inductance.name , list.head->node.inductance.node1 , list.head->node.inductance.node2 , list.head->node.inductance.value );
  }
  else if( list.head->type == NODE_SOURCE_V_TYPE ){
   printf("VOLTAGE SOURCE: %s <%d> <%d> %f\n",list.head->node.source_v.name , list.head->node.source_v.node1 , list.head->node.source_v.node2 , list.head->node.source_v.value );
  }
  else if( list.head->type == NODE_SOURCE_I_TYPE ){
   printf("CURRENT SOURCE: %s <%d> <%d> %f\n",list.head->node.source_i.name , list.head->node.source_i.node1 , list.head->node.source_i.node2 , list.head->node.source_i.value );
  }
  else if( list.head->type == NODE_MOSFET_TYPE ){
   printf("MOSFET TRANSISTOR: %s <%d> <%d> <%d> <%d> %e %e \n",list.head->node.mosfet.name , list.head->node.mosfet.drain , list.head->node.mosfet.gate, list.head->node.mosfet.source , list.head->node.mosfet.body , list.head->node.mosfet.l , list.head->node.mosfet.w );
  }
  else if( list.head->type == NODE_BJT_TYPE ){
   printf("BJT TRANSISTOR: %s <%d> <%d> <%d> \n",list.head->node.bjt.name , list.head->node.bjt.collector , list.head->node.bjt.base , list.head->node.bjt.emitter );
  }
  list.head = list.head->next;
 }
}

canonical_original_code:
void print_list(struct list list){
 int i;
 printf("------------ PRINTING NODE LIST------------------\n\n");
 for( i = 0 ; i < list.len ; i++ ){
  if( list.head->type == NODE_RESISTANCE_TYPE ){
   printf("RESISTANCE : %s <%d> <%d> %f\n",list.head->node.resistance.name , list.head->node.resistance.node1 , list.head->node.resistance.node2 , list.head->node.resistance.value );
  }
  else if( list.head->type == NODE_CAPACITY_TYPE ){
   printf("CAPACITY : %s <%d> <%d> %e \n",list.head->node.capacity.name , list.head->node.capacity.node1 , list.head->node.capacity.node2 , list.head->node.capacity.value );
  }
  else if( list.head->type == NODE_INDUCTANCE_TYPE ){
   printf("INDUCTANCE : %s <%d> <%d> %f\n",list.head->node.inductance.name , list.head->node.inductance.node1 , list.head->node.inductance.node2 , list.head->node.inductance.value );
  }
  else if( list.head->type == NODE_SOURCE_V_TYPE ){
   printf("VOLTAGE SOURCE: %s <%d> <%d> %f\n",list.head->node.source_v.name , list.head->node.source_v.node1 , list.head->node.source_v.node2 , list.head->node.source_v.value );
  }
  else if( list.head->type == NODE_SOURCE_I_TYPE ){
   printf("CURRENT SOURCE: %s <%d> <%d> %f\n",list.head->node.source_i.name , list.head->node.source_i.node1 , list.head->node.source_i.node2 , list.head->node.source_i.value );
  }
  else if( list.head->type == NODE_MOSFET_TYPE ){
   printf("MOSFET TRANSISTOR: %s <%d> <%d> <%d> <%d> %e %e \n",list.head->node.mosfet.name , list.head->node.mosfet.drain , list.head->node.mosfet.gate, list.head->node.mosfet.source , list.head->node.mosfet.body , list.head->node.mosfet.l , list.head->node.mosfet.w );
  }
  else if( list.head->type == NODE_BJT_TYPE ){
   printf("BJT TRANSISTOR: %s <%d> <%d> <%d> \n",list.head->node.bjt.name , list.head->node.bjt.collector , list.head->node.bjt.base , list.head->node.bjt.emitter );
  }
  list.head = list.head->next;
 }
}

variable_types: struct list { int len; struct list_node { char type; union node { struct bjt { char name[10]; int collector; int base; int emitter; } bjt; struct mos { char name[10]; int drain; int gate; int source; int body; double l; double w; } mosfet; struct source_v { char name[10]; long node1; long node2; int mna_row; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t { struct pwl_pair { double ti; double ii; struct pwl_pair *next; } *head; int n; } *pair_list; } source_v; struct source_i { char name[10]; long node1; long node2; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t *pair_list; } source_i; struct resistance { char name[10]; long node1; long node2; double value; } resistance; struct capacity { char name[10]; long node1; long node2; double value; } capacity; struct inductance { char name[10]; long node1; long node2; double value; } inductance; struct diode { char name[10]; long node1; long node2; } diode; } node; struct list_node *next; } *head; struct hashtable_s { int size; int num_nodes; struct entry_s { char *key; int value; struct entry_s *next; } **table; } *hashtable; char has_reference; int m2; char solving_method; struct dc_sweep { char *name; struct list_node *node; double start_v; double end_v; double inc; double oldval; } dc_sweep; char plot; double itol; unsigned int nz; char sparse; char transient_sim; double time_step; double fin_time; }


decompiled_code:
__int64 __fastcall free_list(__int64 a1)
{
_QWORD *i; // rbx
void *v3; // rdi

for ( i = *(_QWORD **)(a1 + 8); i; *(_QWORD *)(a1 + 8) = i )
{
v3 = i;
i = (_QWORD *)i[24];
free(v3);
}
*(_DWORD *)a1 = 0;
return ht_free(*(_QWORD *)(a1 + 16));
}

original_code:
void free_list(LIST* list){
 LIST_NODE* dummy;
 while( list->head){
  dummy = list->head->next;
  free(list->head);
  list->head = dummy;
 }
 list->len = 0;
 ht_free(list->hashtable);
}

canonical_original_code:
void free_list(struct list *list){
 struct list_node *dummy;
 while( list->head){
  dummy = list->head->next;
  free(list->head);
  list->head = dummy;
 }
 list->len = 0;
 ht_free(list->hashtable);
}

variable_types: struct list_node { char type; union node { struct bjt { char name[10]; int collector; int base; int emitter; } bjt; struct mos { char name[10]; int drain; int gate; int source; int body; double l; double w; } mosfet; struct source_v { char name[10]; long node1; long node2; int mna_row; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t { struct pwl_pair { double ti; double ii; struct pwl_pair *next; } *head; int n; } *pair_list; } source_v; struct source_i { char name[10]; long node1; long node2; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t *pair_list; } source_i; struct resistance { char name[10]; long node1; long node2; double value; } resistance; struct capacity { char name[10]; long node1; long node2; double value; } capacity; struct inductance { char name[10]; long node1; long node2; double value; } inductance; struct diode { char name[10]; long node1; long node2; } diode; } node; struct list_node *next; } *

user_defined_types: struct dc_sweep { char *name; struct list_node *node; double start_v; double end_v; double inc; double oldval; }


original_code:
int add_to_list( LIST* list, int type, void* element, int size ){
 if( size <= 0)
  return 0;
 LIST_NODE* new = (LIST_NODE*) malloc(sizeof(LIST_NODE));
 if(!new)
  return 0;
 new->type = type;
 if( type == NODE_RESISTANCE_TYPE){
  memcpy( &(new->node.resistance) , element , size );
 }
 else if( type == NODE_CAPACITY_TYPE){
  memcpy( &(new->node.capacity) , element , size );
 }
 else if( type == NODE_INDUCTANCE_TYPE){
  memcpy( &(new->node.inductance) , element , size );
 }
 else if( type == NODE_SOURCE_V_TYPE ){
  memcpy( &(new->node.source_v) , element , size );
 }
 else if( type == NODE_SOURCE_I_TYPE ){
  memcpy( &(new->node.source_i) , element , size );
 }
 else if( type == NODE_MOSFET_TYPE ){
  memcpy( &(new->node.mosfet) , element , size );
 }
 else if( type == NODE_BJT_TYPE ){
  memcpy( &(new->node.bjt) , element , size );
 }
 else{
  free(new);
  return 0;
 }
 if( list->len == 0 ){
  list->len = 1 ;
  list->head = new;
  new->next = ((void *)0);
 }
 else{
  list->len = list->len + 1 ;
  new->next = list->head;
  list->head = new;
 }
 return 1;
}

canonical_original_code:
int add_to_list(struct list *list, int type, void *element, int size){
 if( size <= 0)
  return 0;
 struct list_node *new = (LIST_NODE*) malloc(sizeof(LIST_NODE));
 if(!new)
  return 0;
 new->type = type;
 if( type == NODE_RESISTANCE_TYPE){
  memcpy( &(new->node.resistance) , element , size );
 }
 else if( type == NODE_CAPACITY_TYPE){
  memcpy( &(new->node.capacity) , element , size );
 }
 else if( type == NODE_INDUCTANCE_TYPE){
  memcpy( &(new->node.inductance) , element , size );
 }
 else if( type == NODE_SOURCE_V_TYPE ){
  memcpy( &(new->node.source_v) , element , size );
 }
 else if( type == NODE_SOURCE_I_TYPE ){
  memcpy( &(new->node.source_i) , element , size );
 }
 else if( type == NODE_MOSFET_TYPE ){
  memcpy( &(new->node.mosfet) , element , size );
 }
 else if( type == NODE_BJT_TYPE ){
  memcpy( &(new->node.bjt) , element , size );
 }
 else{
  free(new);
  return 0;
 }
 if( list->len == 0 ){
  list->len = 1 ;
  list->head = new;
  new->next = ((void *)0);
 }
 else{
  list->len = list->len + 1 ;
  new->next = list->head;
  list->head = new;
 }
 return 1;
}

variable_types: type int

variable_types:
element
void *

variable_types: size int

user_defined_types: struct bjt { char name[10]; int collector; int base; int emitter; }

user_defined_types: struct mos { char name[10]; int drain; int gate; int source; int body; double l; double w; }

user_defined_types: struct source_i { char name[10]; long node1; long node2; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t *pair_list; }

user_defined_types: struct resistance { char name[10]; long node1; long node2; double value; }

user_defined_types: struct capacity { char name[10]; long node1; long node2; double value; }

user_defined_types: struct inductance { char name[10]; long node1; long node2; double value; }

user_defined_types: struct diode { char name[10]; long node1; long node2; }

user_defined_types: struct pwl_pair { double ti; double ii; struct pwl_pair *next; }


original_code:
int add_node_to_list( LIST* list, NODE* circuit_node , int type){
 if( !list || !circuit_node)
  return 0 ;
 LIST_NODE* new = ((void *)0);
 new = malloc( sizeof(LIST_NODE));
 if( !new )
  return 0;
 new->type = type;
 memcpy( &(new->node) , circuit_node , sizeof(NODE) );
 if( list->len > 0 ){
  list->len = list->len + 1;
  new->next = list->head;
  list->head = new;
 }
 else{
  list->len = 1;
  new->next = ((void *)0);
  list->head = new;
 }
 if( type == NODE_SOURCE_V_TYPE || type == NODE_INDUCTANCE_TYPE ){
  list->m2 = list->m2 + 1 ;
 }
 return 1;
}

canonical_original_code:
int add_node_to_list(struct list *list, union node *circuit_node, int type){
 if( !list || !circuit_node)
  return 0 ;
 struct list_node *new = ((void *)0);
 new = malloc( sizeof(LIST_NODE));
 if( !new )
  return 0;
 new->type = type;
 memcpy( &(new->node) , circuit_node , sizeof(NODE) );
 if( list->len > 0 ){
  list->len = list->len + 1;
  new->next = list->head;
  list->head = new;
 }
 else{
  list->len = 1;
  new->next = ((void *)0);
  list->head = new;
 }
 if( type == NODE_SOURCE_V_TYPE || type == NODE_INDUCTANCE_TYPE ){
  list->m2 = list->m2 + 1 ;
 }
 return 1;
}


decompiled_code:
__int64 __fastcall list_search_by_name(__int64 a1, const char *a2)
{
__int64 i; // r12

if ( !a1 || !a2 )
return 0LL;
for ( i = *(_QWORD *)(a1 + 8); i; i = *(_QWORD *)(i + 192) )
{
if ( !strcmp((const char *)(i + 8), a2) )
break;
}
return i;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, const char *a2)
{
__int64 i; // r12

if ( !a1 || !a2 )
return 0LL;
for ( i = *(_QWORD *)(a1 + 8); i; i = *(_QWORD *)(i + 192) )
{
if ( !strcmp((const char *)(i + 8), a2) )
break;
}
return i;
}

original_code:
LIST_NODE* list_search_by_name( LIST* list , char *name){
 LIST_NODE* curr;
 if( !list || !name )
  return ((void *)0);
 for( curr = list->head ; curr ; curr = curr->next){
  if( strcmp( curr->node.bjt.name , name ) == 0 )
   return curr;
 }
 return ((void *)0);
}

canonical_original_code:
struct list_node *list_search_by_name(struct list *list, char *name){
 struct list_node *curr;
 if( !list || !name )
  return ((void *)0);
 for( curr = list->head ; curr ; curr = curr->next){
  if( strcmp( curr->node.bjt.name , name ) == 0 )
   return curr;
 }
 return ((void *)0);
}

variable_types: struct list { int len; struct list_node *head; struct hashtable_s { int size; int num_nodes; struct entry_s { char *key; int value; struct entry_s *next; } **table; } *hashtable; char has_reference; int m2; char solving_method; struct dc_sweep { char *name; struct list_node *node; double start_v; double end_v; double inc; double oldval; } dc_sweep; char plot; double itol; unsigned int nz; char sparse; char transient_sim; double time_step; double fin_time; } *

variable_types:
name
char *

return_type: struct list_node { char type; union node { struct bjt { char name[10]; int collector; int base; int emitter; } bjt; struct mos { char name[10]; int drain; int gate; int source; int body; double l; double w; } mosfet; struct source_v { char name[10]; long node1; long node2; int mna_row; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t { struct pwl_pair { double ti; double ii; struct pwl_pair *next; } *head; int n; } *pair_list; } source_v; struct source_i { char name[10]; long node1; long node2; double value; char pulse_type; char is_ac; double i1; double i2; double td1; double td2; double tc1; double tc2; double ia; double fr; double td; double df; double ph; double tr; double tf; double pw; double per; struct pair_list_t *pair_list; } source_i; struct resistance { char name[10]; long node1; long node2; double value; } resistance; struct capacity { char name[10]; long node1; long node2; double value; } capacity; struct inductance { char name[10]; long node1; long node2; double value; } inductance; struct diode { char name[10]; long node1; long node2; } diode; } node; struct list_node *next; } *


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

if ( !a1 )
return 0xFFFFFFFFLL;
result = *(_QWORD *)(a1 + 8);
if ( !result )
return 0LL;
while ( *(_QWORD *)(result + 24) != a2 && *(_QWORD *)(result + 32) != a2 )
{
result = *(_QWORD *)(result + 192);
if ( !result )
return result;
}
return 1LL;
}

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

if ( !a1 )
return 0xFFFFFFFFLL;
result = *(_QWORD *)(a1 + 8);
if ( !result )
return 0LL;
while ( *(_QWORD *)(result + 24) != a2 && *(_QWORD *)(result + 32) != a2 )
{
result = *(_QWORD *)(result + 192);
if ( !result )
return result;
}
return 1LL;
}

original_code:
int list_search_plus_node(LIST* list, int plus_node){
 LIST_NODE* curr;
 if( !list)
  return -1;
 for( curr = list->head ; curr ; curr = curr->next){
  if( curr->node.source_v.node1 == plus_node || curr->node.source_v.node2 == plus_node )
   return 1;
  }
 return 0;
}

canonical_original_code:
int list_search_plus_node(struct list *list, int plus_node){
 struct list_node *curr;
 if( !list)
  return -1;
 for( curr = list->head ; curr ; curr = curr->next){
  if( curr->node.source_v.node1 == plus_node || curr->node.source_v.node2 == plus_node )
   return 1;
  }
 return 0;
}


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

if ( !a1 )
return 0xFFFFFFFFLL;
result = *(_QWORD *)(a1 + 8);
if ( !result )
return 0LL;
while ( *(_QWORD *)(result + 32) != a2 && *(_QWORD *)(result + 24) != a2 )
{
result = *(_QWORD *)(result + 192);
if ( !result )
return result;
}
return 1LL;
}

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

if ( !a1 )
return 0xFFFFFFFFLL;
result = *(_QWORD *)(a1 + 8);
if ( !result )
return 0LL;
while ( *(_QWORD *)(result + 32) != a2 && *(_QWORD *)(result + 24) != a2 )
{
result = *(_QWORD *)(result + 192);
if ( !result )
return result;
}
return 1LL;
}

original_code:
int list_search_minus_node(LIST* list, int minus_node){
 LIST_NODE* curr;
 if( !list)
  return -1;
 for( curr = list->head ; curr ; curr = curr->next){
  if( curr->node.source_v.node2 == minus_node || curr->node.source_v.node1 == minus_node )
   return 1;
  }
 return 0;
}

canonical_original_code:
int list_search_minus_node(struct list *list, int minus_node){
 struct list_node *curr;
 if( !list)
  return -1;
 for( curr = list->head ; curr ; curr = curr->next){
  if( curr->node.source_v.node2 == minus_node || curr->node.source_v.node1 == minus_node )
   return 1;
  }
 return 0;
}


decompiled_code:
_DWORD *create_pair_list()
{
_DWORD *result; // rax

result = malloc(0x10uLL);
if ( result )
{
*(_QWORD *)result = 0LL;
result[2] = 0;
}
return result;
}

canonical_decompiled_code:
_DWORD *func8()
{
_DWORD *result; // rax

result = malloc(0x10uLL);
if ( result )
{
*(_QWORD *)result = 0LL;
result[2] = 0;
}
return result;
}

original_code:
PAIR_LIST* create_pair_list(){
 PAIR_LIST* list = ((void *)0);
 list = (PAIR_LIST*) malloc(sizeof(PAIR_LIST));
 if(!list)
  return ((void *)0);
 list->head = ((void *)0);
 list->n = 0;
 return list;
}

canonical_original_code:
struct pair_list_t *create_pair_list(){
 struct pair_list_t *list = ((void *)0);
 list = (struct pair_list_t *) malloc(sizeof(PAIR_LIST));
 if(!list)
  return ((void *)0);
 list->head = ((void *)0);
 list->n = 0;
 return list;
}

variable_types: struct pair_list_t { struct pwl_pair { double ti; double ii; struct pwl_pair *next; } *head; int n; } *


decompiled_code:
__int64 __fastcall add_to_pair_list(double **a1, double a2, double a3)
{
double *v3; // rax
int v4; // edx
double *v5; // rdx
__int64 result; // rax

v3 = (double *)malloc(0x18uLL);
if ( !v3 )
return 0LL;
v4 = *((_DWORD *)a1 + 2);
*v3 = a2;
v3[1] = a3;
v3[2] = 0.0;
if ( v4 )
{
*((_DWORD *)a1 + 2) = v4 + 1;
v5 = *a1;
*a1 = v3;
*((_QWORD *)v3 + 2) = v5;
result = 1LL;
}
else
{
*a1 = v3;
result = 1LL;
*((_DWORD *)a1 + 2) = 1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(double **a1, double a2, double a3)
{
double *v3; // rax
int v4; // edx
double *v5; // rdx
__int64 result; // rax

v3 = (double *)malloc(0x18uLL);
if ( !v3 )
return 0LL;
v4 = *((_DWORD *)a1 + 2);
*v3 = a2;
v3[1] = a3;
v3[2] = 0.0;
if ( v4 )
{
*((_DWORD *)a1 + 2) = v4 + 1;
v5 = *a1;
*a1 = v3;
*((_QWORD *)v3 + 2) = v5;
result = 1LL;
}
else
{
*a1 = v3;
result = 1LL;
*((_DWORD *)a1 + 2) = 1;
}
return result;
}

original_code:
int add_to_pair_list(PAIR_LIST* pair_list, double ti, double ii){
 PWL_PAIR_T* new_pair = ((void *)0);
 new_pair = (PWL_PAIR_T*) malloc(sizeof(PWL_PAIR_T));
 if(!new_pair)
  return 0;
 new_pair->ti = ti;
 new_pair->ii = ii;
 new_pair->next = ((void *)0);
 if( pair_list->n == 0){
  pair_list->n = 1;
  pair_list->head = new_pair;
 }
 else{
  pair_list->n = pair_list->n + 1;
  new_pair->next = pair_list->head;
  pair_list->head = new_pair;
 }
 return 1;
}

canonical_original_code:
int add_to_pair_list(struct pair_list_t *pair_list, double ti, double ii){
 struct pwl_pair *new_pair = ((void *)0);
 new_pair = (struct pwl_pair *) malloc(sizeof(PWL_PAIR_T));
 if(!new_pair)
  return 0;
 new_pair->ti = ti;
 new_pair->ii = ii;
 new_pair->next = ((void *)0);
 if( pair_list->n == 0){
  pair_list->n = 1;
  pair_list->head = new_pair;
 }
 else{
  pair_list->n = pair_list->n + 1;
  new_pair->next = pair_list->head;
  pair_list->head = new_pair;
 }
 return 1;
}

variable_types: ti double

variable_types: ii double

variable_types: struct pwl_pair { double ti; double ii; struct pwl_pair *next; } *


decompiled_code:
__int64 plot_init()
{
__int64 result; // rax

result = 0LL;
num_node_names = 0;
memset(&node_names, 0, 0x320uLL);
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

result = 0LL;
num_node_names = 0;
memset(&node_names, 0, 0x320uLL);
return result;
}

original_code:
void plot_init(){
 int i;
 num_node_names = 0 ;
 for( i = 0 ; i < 100 ; i++ )
  node_names[i] = ((void *)0);
}

variable_types: i int


decompiled_code:
__int64 __fastcall plot_find_size(double a1, double a2, double a3)
{
__int64 result; // rax

LODWORD(result) = 0;
if ( a2 < a1 )
return 0LL;
do
{
a1 = a1 + a3;
result = (unsigned int)(result + 1);
}
while ( a2 >= a1 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(double a1, double a2, double a3)
{
__int64 result; // rax

LODWORD(result) = 0;
if ( a2 < a1 )
return 0LL;
do
{
a1 = a1 + a3;
result = (unsigned int)(result + 1);
}
while ( a2 >= a1 );
return result;
}

original_code:
int plot_find_size( double startv , double endv , double inc ){
 double iter;
 unsigned int num_elements = 0;
 for( iter = startv ; iter <= endv ; iter = iter + inc )
  num_elements++;
 return num_elements;
}

canonical_original_code:
int plot_find_size(double startv, double endv, double inc){
 double iter;
 unsigned int num_elements = 0;
 for( iter = startv ; iter <= endv ; iter = iter + inc )
  num_elements++;
 return num_elements;
}

variable_types: startv double

variable_types: endv double

variable_types: inc double

variable_types: iter double


decompiled_code:
__int64 __fastcall plot_add_node(const char *a1)
{
int v1; // ebx
__int64 result; // rax
char *v3; // rax

v1 = num_node_names;
if ( num_node_names > 100 )
return 0LL;
v3 = strdup(a1);
node_names[v1] = (__int64)v3;
if ( !v3 )
return 0LL;
result = 1LL;
num_node_names = v1 + 1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1)
{
int v1; // ebx
__int64 result; // rax
char *v3; // rax

v1 = num_node_names;
if ( num_node_names > 100 )
return 0LL;
v3 = strdup(a1);
node_names[v1] = (__int64)v3;
if ( !v3 )
return 0LL;
result = 1LL;
num_node_names = v1 + 1;
return result;
}

original_code:
int plot_add_node(char* node_name){
 if( num_node_names > 100 )
  return 0;
 node_names[num_node_names] = strdup(node_name);
 if( !node_names[num_node_names] )
  return 0;
 num_node_names++;
 return 1;
}

canonical_original_code:
int plot_add_node(char *node_name){
 if( num_node_names > 100 )
  return 0;
 node_names[num_node_names] = strdup(node_name);
 if( !node_names[num_node_names] )
  return 0;
 num_node_names++;
 return 1;
}


decompiled_code:
__int64 __fastcall plot_set_vector_index(__int64 a1, __int64 a2, int a3)
{
return gsl_vector_memcpy(*(_QWORD *)(a1 + 8LL * a3));
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2, int a3)
{
return gsl_vector_memcpy(*(_QWORD *)(a1 + 8LL * a3));
}

original_code:
int plot_set_vector_index(gsl_vector** array , gsl_vector* b , int index){
 return gsl_vector_memcpy( array[index] , b);
}

canonical_original_code:
int plot_set_vector_index(struct gsl_vector **array, struct gsl_vector *b, int index){
 return gsl_vector_memcpy( array[index] , b);
}

variable_types: struct gsl_vector { unsigned long size; unsigned long stride; double *data; struct gsl_block_struct { unsigned long size; double *data; } *block; int owner; } **

variable_types:
b
struct gsl_vector *

variable_types: index int

user_defined_types: struct gsl_vector { unsigned long size; unsigned long stride; double *data; struct gsl_block_struct *block; int owner; }


decompiled_code:
void __fastcall plot_free_array(void *ptr, int a2)
{
void *v2; // r12
__int64 *v3; // rbx
char *v4; // rbp
__int64 v5; // rdi

v2 = ptr;
if ( a2 > 0 )
{
v3 = (__int64 *)ptr;
v4 = (char *)ptr + 8 * (unsigned int)(a2 - 1) + 8;
do
{
v5 = *v3++;
gsl_vector_free(v5);
}
while ( v3 != (__int64 *)v4 );
}
free(v2);
}

canonical_decompiled_code:
void __fastcall func5(void *ptr, int a2)
{
void *v2; // r12
__int64 *v3; // rbx
char *v4; // rbp
__int64 v5; // rdi

v2 = ptr;
if ( a2 > 0 )
{
v3 = (__int64 *)ptr;
v4 = (char *)ptr + 8 * (unsigned int)(a2 - 1) + 8;
do
{
v5 = *v3++;
gsl_vector_free(v5);
}
while ( v3 != (__int64 *)v4 );
}
free(v2);
}

original_code:
void plot_free_array(gsl_vector** array , int array_size){
 int i;
 for( i = 0 ; i < array_size ; i ++ ){
  gsl_vector_free(array[i]);
 }
 free( array);
}

canonical_original_code:
void plot_free_array(struct gsl_vector **array, int array_size){
 int i;
 for( i = 0 ; i < array_size ; i ++ ){
  gsl_vector_free(array[i]);
 }
 free( array);
}

user_defined_types: struct gsl_block_struct { unsigned long size; double *data; }


decompiled_code:
int __fastcall plot_to_screen(__int64 a1, _QWORD *a2, int a3, double a4)
{
int result; // eax
int v7; // er12
__int64 v8; // r14
const char *v9; // rsi
int v10[11]; // [rsp+Ch] [rbp-2Ch] BYREF

result = puts("##### SOLUTIONS ######");
if ( a3 > 0 )
{
v7 = 0;
do
{
printf("Solution: %d\n", (unsigned int)++v7);
result = num_node_names;
if ( num_node_names > 0 )
{
v8 = 0LL;
do
{
ht_get(a1, node_names[v8], v10);
gsl_vector_get(*a2, v10[0] - 1);
v9 = (const char *)node_names[v8++];
result = printf("\t%s : %f\n", v9, a4);
}
while ( num_node_names > (int)v8 );
}
++a2;
}
while ( v7 != a3 );
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1, _QWORD *a2, int a3, double a4)
{
int result; // eax
int v7; // er12
__int64 v8; // r14
const char *v9; // rsi
int v10[11]; // [rsp+Ch] [rbp-2Ch] BYREF

result = puts("##### SOLUTIONS ######");
if ( a3 > 0 )
{
v7 = 0;
do
{
printf("Solution: %d\n", (unsigned int)++v7);
result = num_node_names;
if ( num_node_names > 0 )
{
v8 = 0LL;
do
{
ht_get(a1, node_names[v8], v10);
gsl_vector_get(*a2, v10[0] - 1);
v9 = (const char *)node_names[v8++];
result = printf("\t%s : %f\n", v9, a4);
}
while ( num_node_names > (int)v8 );
}
++a2;
}
while ( v7 != a3 );
}
return result;
}

original_code:
void plot_to_screen( hashtable_t* hashtable, gsl_vector** array , int array_size){
 int i,j;
 int node_id;
 printf("##### SOLUTIONS ######\n");
 for( i = 0 ; i < array_size ; i++ ){
  printf("Solution: %d\n",(i+1) );
  for( j = 0 ; j < num_node_names ; j++){
   ht_get(hashtable , node_names[j] , &node_id);
   printf("\t%s : %f\n", node_names[j] , gsl_vector_get( array[i] , node_id - 1 ) );
  }
 }
}

canonical_original_code:
void plot_to_screen(struct hashtable_s *hashtable, struct gsl_vector **array, int array_size){
 int i; int j;
 int node_id;
 printf("##### SOLUTIONS ######\n");
 for( i = 0 ; i < array_size ; i++ ){
  printf("Solution: %d\n",(i+1) );
  for( j = 0 ; j < num_node_names ; j++){
   ht_get(hashtable , node_names[j] , &node_id);
   printf("\t%s : %f\n", node_names[j] , gsl_vector_get( array[i] , node_id - 1 ) );
  }
 }
}

variable_types: struct hashtable_s { int size; int num_nodes; struct entry_s { char *key; int value; struct entry_s *next; } **table; } *

variable_types: j int

user_defined_types: struct hashtable_s { int size; int num_nodes; struct entry_s **table; }


decompiled_code:
void plot_destroy()
{
__int64 v0; // rbx

if ( num_node_names <= 0 )
{
num_node_names = 0;
}
else
{
v0 = 0LL;
do
{
free((void *)node_names[v0]);
node_names[v0++] = 0LL;
}
while ( num_node_names > (int)v0 );
num_node_names = 0;
}
}

canonical_decompiled_code:
void func8()
{
__int64 v0; // rbx

if ( num_node_names <= 0 )
{
num_node_names = 0;
}
else
{
v0 = 0LL;
do
{
free((void *)node_names[v0]);
node_names[v0++] = 0LL;
}
while ( num_node_names > (int)v0 );
num_node_names = 0;
}
}

original_code:
void plot_destroy(){
 int i;
 for(i = 0 ; i < num_node_names ; i++ ){
  free( node_names[i]);
  node_names[i] = ((void *)0);
 }
 num_node_names = 0;
}


strip

decompiled_code:
char *__fastcall strip(const char *a1)
{
char *v1; // rbx
size_t v2; // rax
char *v3; // r8
char v4; // al
char *v5; // rdx

v1 = (char *)a1;
v2 = strlen(a1);
v3 = (char *)malloc(v2 + 1);
if ( v3 )
{
v4 = *a1;
v5 = v3;
if ( *a1 )
{
do
{
++v1;
if ( (unsigned __int8)(v4 - 9) > 1u )
*v5++ = v4;
v4 = *v1;
}
while ( *v1 );
}
*v5 = 0;
}
return v3;
}

canonical_decompiled_code:
char *__fastcall func7(const char *a1)
{
char *v1; // rbx
size_t v2; // rax
char *v3; // r8
char v4; // al
char *v5; // rdx

v1 = (char *)a1;
v2 = strlen(a1);
v3 = (char *)malloc(v2 + 1);
if ( v3 )
{
v4 = *a1;
v5 = v3;
if ( *a1 )
{
do
{
++v1;
if ( (unsigned __int8)(v4 - 9) > 1u )
*v5++ = v4;
v4 = *v1;
}
while ( *v1 );
}
*v5 = 0;
}
return v3;
}

original_code:
char* strip(const char *string) {
 char *res = malloc(strlen(string) + 1);
 if(res) {
  char *temp = res;
  while(*string != '\0') {
   if(*string != '\t' && *string != '\n') {
    *temp++ = *string++;
   } else {
    ++string;
   }
  }
  *temp = '\0';
 }
 return res;
}

canonical_original_code:
char *strip(char *string) {
 char *res = malloc(strlen(string) + 1);
 if(res) {
  char *temp = res;
  while(*string != '\0') {
   if(*string != '\t' && *string != '\n') {
    *temp++ = *string++;
   } else {
    ++string;
   }
  }
  *temp = '\0';
 }
 return res;
}

variable_types:
string
char *

variable_types:
res
char *

variable_types:
temp
char *

return_type: char *


interpret

decompiled_code:
__int64 __fastcall interpret(char *src)
{
int v1; // eax
unsigned int v2; // er12
const char **v4; // rax
int stat_loc[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = fork();
v2 = v1;
if ( !v1 )
{
v4 = (const char **)parse_cmdline(src);
if ( execv(*v4, (char *const *)v4) == -1 )
{
perror("Error");
exit(1);
}
return v2;
}
if ( v1 > 0 )
{
waitpid(v1, stat_loc, 0);
if ( stat_loc[0] < 0 )
{
v2 = 1;
perror("Process error");
}
else
{
if ( new_cmdline )
free(new_cmdline);
if ( result )
free(result);
v2 = 0;
}
return v2;
}
perror("Error creating a new process");
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func9(char *src)
{
int v1; // eax
unsigned int v2; // er12
const char **v4; // rax
int stat_loc[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = fork();
v2 = v1;
if ( !v1 )
{
v4 = (const char **)func8(src);
if ( execv(*v4, (char *const *)v4) == -1 )
{
perror("Error");
exit(1);
}
return v2;
}
if ( v1 > 0 )
{
waitpid(v1, stat_loc, 0);
if ( stat_loc[0] < 0 )
{
v2 = 1;
perror("Process error");
}
else
{
if ( new_cmdline )
free(new_cmdline);
if ( result )
free(result);
v2 = 0;
}
return v2;
}
perror("Error creating a new process");
return 1LL;
}

original_code:
int interpret(char* commands) {
 char** cmdline_buffer;
 pid_t pid = fork();
 if(pid == 0) {
  int i = 0;
  cmdline_buffer = parse_cmdline(commands);
  if(execv(cmdline_buffer[0], cmdline_buffer) == -1) {
   perror("Error");
   exit(1);
  }
 } else if (pid > 0) {
  int status;
  pid_t child = waitpid (pid, &status, 0);
  if(status < 0) {
   perror("Process error");
   return 1;
  }
  if(new_cmdline != ((void *)0))
   free(new_cmdline);
  if(result != ((void *)0))
   free(result);
 } else {
  perror("Error creating a new process");
  return 1;
 }
 return 0;
}

canonical_original_code:
int interpret(char *commands) {
 char **cmdline_buffer;
 int pid = fork();
 if(pid == 0) {
  int i = 0;
  cmdline_buffer = parse_cmdline(commands);
  if(execv(cmdline_buffer[0], cmdline_buffer) == -1) {
   perror("Error");
   exit(1);
  }
 } else if (pid > 0) {
  int status;
  int child = waitpid (pid, &status, 0);
  if(status < 0) {
   perror("Process error");
   return 1;
  }
  if(new_cmdline != ((void *)0))
   free(new_cmdline);
  if(result != ((void *)0))
   free(result);
 } else {
  perror("Error creating a new process");
  return 1;
 }
 return 0;
}

variable_types:
commands
char *

variable_types: pid int

variable_types: status int

variable_types: child int


main

decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
char *v3; // rax
char v4[528]; // [rsp-200h] [rbp-210h] BYREF

while ( 1 )
{
printf("> ");
fgets(v4, 512, _bss_start);
if ( !strcmp((const char *)strip(v4), "exit") )
break;
if ( *(_BYTE *)strip(v4) )
{
v3 = (char *)strip(v4);
interpret(v3);
}
}
puts(">>> I, the Shell, will miss you! Have a nice day!");
exit(0);
}

canonical_decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
char *v3; // rax
char v4[528]; // [rsp-200h] [rbp-210h] BYREF

while ( 1 )
{
printf("> ");
fgets(v4, 512, _bss_start);
if ( !strcmp((const char *)strip(v4), "exit") )
break;
if ( *(_BYTE *)func7(v4) )
{
v3 = (char *)func7(v4);
func9(v3);
}
}
puts(">>> I, the Shell, will miss you! Have a nice day!");
exit(0);
}

original_code:
int main () {
 while(1) {
  printf("> ");
  char current_string[COMMAND_LINE_LENGTH];
  int input_chars = 0;
  fgets(current_string, COMMAND_LINE_LENGTH, stdin);
  if(current_string == ((void *)0)) {
   printf(">>> Something with your input is terribly wrong!\n");
   continue;
  } else if(strcmp(strip(current_string), "exit") == 0) {
   printf(">>> I, the Shell, will miss you! Have a nice day!\n");
   exit(0);
  } else if(strcmp(strip(current_string), "") == 0) {
   continue;
  } else {
   if(interpret(strip(current_string)) == 1) {
    continue;
   }
  }
 }
 return 0;
}

canonical_original_code:
int main() {
 while(1) {
  printf("> ");
  char current_string[-1];
  int input_chars = 0;
  fgets(current_string, COMMAND_LINE_LENGTH, stdin);
  if(current_string == ((void *)0)) {
   printf(">>> Something with your input is terribly wrong!\n");
   continue;
  } else if(strcmp(strip(current_string), "exit") == 0) {
   printf(">>> I, the Shell, will miss you! Have a nice day!\n");
   exit(0);
  } else if(strcmp(strip(current_string), "") == 0) {
   continue;
  } else {
   if(interpret(strip(current_string)) == 1) {
    continue;
   }
  }
 }
 return 0;
}


decompiled_code:
void *__fastcall parse_cmdline(char *src)
{
int v1; // ebx
void *v2; // rbp
void *v3; // rax
char *v4; // rax
char *v5; // rdx
int v6; // eax
void *v7; // r8

v1 = strlen(src);
v2 = malloc(v1);
new_cmdline = v2;
v3 = malloc(v1 + 1);
arguments_count = 0;
result = v3;
strcpy((char *)v2, src);
v4 = strtok((char *)v2, " \t\n");
if ( v4 )
{
v5 = v4;
v6 = arguments_count;
do
{
*((_QWORD *)result + v6) = v5;
v5 = strtok(0LL, " \t\n");
v6 = ++arguments_count;
}
while ( v5 );
}
else
{
v6 = arguments_count;
}
v7 = result;
*((_QWORD *)result + v6) = 0LL;
return v7;
}

canonical_decompiled_code:
void *__fastcall func8(char *src)
{
int v1; // ebx
void *v2; // rbp
void *v3; // rax
char *v4; // rax
char *v5; // rdx
int v6; // eax
void *v7; // r8

v1 = strlen(src);
v2 = malloc(v1);
new_cmdline = v2;
v3 = malloc(v1 + 1);
arguments_count = 0;
result = v3;
strcpy((char *)v2, src);
v4 = strtok((char *)v2, " \t\n");
if ( v4 )
{
v5 = v4;
v6 = arguments_count;
do
{
*((_QWORD *)result + v6) = v5;
v5 = strtok(0LL, " \t\n");
v6 = ++arguments_count;
}
while ( v5 );
}
else
{
v6 = arguments_count;
}
v7 = result;
*((_QWORD *)result + v6) = 0LL;
return v7;
}

original_code:
char** parse_cmdline(const char* cmdline) {
 int line_size = strlen(cmdline);
 new_cmdline = (char*) malloc(line_size*sizeof(char));
 char* lastpointer;
 result = (char**) malloc((line_size+1)*sizeof(char));
 arguments_count = 0;
 strcpy(new_cmdline, cmdline);
 lastpointer = strtok(new_cmdline," \t\n");
 while (lastpointer != ((void *)0)) {
  result[arguments_count] = lastpointer;
  lastpointer = strtok(((void *)0), " \t\n");
  arguments_count++;
 }
 result[arguments_count] = ((void *)0);
 return result;
}

canonical_original_code:
char **parse_cmdline(char *cmdline) {
 int line_size = strlen(cmdline);
 new_cmdline = (char *) malloc(line_size*sizeof(char));
 char *lastpointer;
 result = (char **) malloc((line_size+1)*sizeof(char));
 arguments_count = 0;
 strcpy(new_cmdline, cmdline);
 lastpointer = strtok(new_cmdline," \t\n");
 while (lastpointer != ((void *)0)) {
  result[arguments_count] = lastpointer;
  lastpointer = strtok(((void *)0), " \t\n");
  arguments_count++;
 }
 result[arguments_count] = ((void *)0);
 return result;
}

variable_types:
cmdline
char *

variable_types:
lastpointer
char *

return_type: char **


clean

decompiled_code:
char *__fastcall clean(const char *a1)
{
char *v1; // rbx
size_t v2; // rax
char *v3; // r8
char v4; // al
char *v5; // rdx

v1 = (char *)a1;
v2 = strlen(a1);
v3 = (char *)malloc(v2 + 1);
if ( v3 )
{
v4 = *a1;
v5 = v3;
if ( *a1 )
{
do
{
++v1;
if ( (unsigned __int8)(v4 - 9) > 1u )
*v5++ = v4;
v4 = *v1;
}
while ( *v1 );
}
*v5 = 0;
}
return v3;
}

original_code:
char *clean(const char *string) {
   char *cleaned = malloc(strlen(string) + 1);
 if(cleaned) {
  char *temp = cleaned;
  while(*string != '\0') {
   if(*string != '\t' && *string != '\n') {
    *temp++ = *string++;
   }
   else {
    ++string;
   }
  }
  *temp = '\0';
 }
 return cleaned;
}

canonical_original_code:
char *clean(char *string) {
   char *cleaned = malloc(strlen(string) + 1);
 if(cleaned) {
  char *temp = cleaned;
  while(*string != '\0') {
   if(*string != '\t' && *string != '\n') {
    *temp++ = *string++;
   }
   else {
    ++string;
   }
  }
  *temp = '\0';
 }
 return cleaned;
}

variable_types:
cleaned
char *


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char **v3; // r12
int v4; // eax
char v6[524]; // [rsp-200h] [rbp-230h] BYREF
int stat_loc[9]; // [rsp+Ch] [rbp-24h] BYREF

while ( 1 )
{
fgets(v6, 512, _bss_start);
if ( !strcmp((const char *)clean(v6), "exit") )
exit(0);
v3 = (const char **)parse_cmdline(v6);
v4 = fork();
if ( !v4 )
{
if ( execv(*v3, (char *const *)v3) == -1 )
{
perror(*v3);
exit(1);
}
goto LABEL_4;
}
if ( v4 <= 0 )
{
perror("Process could not be created");
return -3;
}
waitpid(v4, stat_loc, 0);
if ( stat_loc[0] < 0 )
break;
LABEL_4:
free(v3);
}
perror("Child Process Error");
return -2;
}

original_code:
int main () {
 while(1) {
  char input[STDIN_LENGTH];
  int input_chars = 0;
  fgets(input, STDIN_LENGTH, stdin);
  if(input == ((void *)0)) {
   printf("Input error!");
  }
  else if(!strcmp(clean(input), "exit")) {
   exit(0);
  }
  else {
   char **res = parse_cmdline(input);
   pid_t pid = fork();
   if (pid == 0) {
    int err_check = execv(res[0], res);
    if (err_check == -1) {
     perror(res[0]);
     exit(1);
    }
   }
   else if (pid > 0) {
    int status;
    pid_t child = waitpid (pid, &status, 0);
    if(status < 0) {
     perror("Child Process Error");
     return -2;
    }
   }
   else {
    perror("Process could not be created");
    return -3;
   }
   free(res);
  }
 }
 return 0;
}

canonical_original_code:
int main() {
 while(1) {
  char input[-1];
  int input_chars = 0;
  fgets(input, STDIN_LENGTH, stdin);
  if(input == ((void *)0)) {
   printf("Input error!");
  }
  else if(!strcmp(clean(input), "exit")) {
   exit(0);
  }
  else {
   char **res = parse_cmdline(input);
   int pid = fork();
   if (pid == 0) {
    int err_check = execv(res[0], res);
    if (err_check == -1) {
     perror(res[0]);
     exit(1);
    }
   }
   else if (pid > 0) {
    int status;
    int child = waitpid (pid, &status, 0);
    if(status < 0) {
     perror("Child Process Error");
     return -2;
    }
   }
   else {
    perror("Process could not be created");
    return -3;
   }
   free(res);
  }
 }
 return 0;
}

variable_types:
input
char [-1]

variable_types:
res
char **


repo: Chienlung/MyDict

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
struct timeval v5; // [rsp+0h] [rbp-F8h] BYREF
struct timeval tv; // [rsp+10h] [rbp-E8h] BYREF
int v7; // [rsp+20h] [rbp-D8h] BYREF
__int16 v8; // [rsp+24h] [rbp-D4h]
char v9; // [rsp+26h] [rbp-D2h]

gettimeofday(&v5, 0LL);
v3 = CreateDict();
gettimeofday(&tv, 0LL);
printf(
format,
(double)(LODWORD(tv.tv_usec) + 1000000 * (LODWORD(tv.tv_sec) - LODWORD(v5.tv_sec)) - LODWORD(v5.tv_usec))
/ 1000000.0);
puts("*****Input --quit for quiting.*****");
while ( 1 )
{
while ( 1 )
{
printf(">>>>>>>");
__isoc99_scanf();
if ( (unsigned int)TestAndTolower(&v7, &v7) )
break;
printf("Invalid input");
}
if ( v7 == 1970351405 && v8 == 29801 && !v9 )
break;
QueryDict(v3, &v7);
}
system("cd && clear");
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
struct timeval v5; // [rsp+0h] [rbp-F8h] BYREF
struct timeval tv; // [rsp+10h] [rbp-E8h] BYREF
int v7; // [rsp+20h] [rbp-D8h] BYREF
__int16 v8; // [rsp+24h] [rbp-D4h]
char v9; // [rsp+26h] [rbp-D2h]

gettimeofday(&v5, 0LL);
v3 = func8();
gettimeofday(&tv, 0LL);
printf(
format,
(double)(LODWORD(tv.tv_usec) + 1000000 * (LODWORD(tv.tv_sec) - LODWORD(v5.tv_sec)) - LODWORD(v5.tv_usec))
/ 1000000.0);
puts("*****Input --quit for quiting.*****");
while ( 1 )
{
while ( 1 )
{
printf(">>>>>>>");
__isoc99_scanf();
if ( (unsigned int)func10(&v7, &v7) )
break;
printf("Invalid input");
}
if ( v7 == 1970351405 && v8 == 29801 && !v9 )
break;
func9(v3, &v7);
}
system("cd && clear");
return 0;
}

original_code:
int
main(int argc, char *argv[]) {
 char query[200];
 TrieNode *dict;
 struct timeval start, end;
 gettimeofday(&start, ((void *)0));
 dict = CreateDict();
 gettimeofday(&end, ((void *)0));
 printf("*****建立词典耗时 %.4f s.*****\n", 1.0 * (1000000 * (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec)) / 1000000);
 printf("*****Input --quit for quiting.*****\n");
 do {
  printf(">>>>>>>");
  scanf("%s", query);
  if (TestAndTolower(query) == 0) {
   printf("Invalid input");
   continue;
  }
  if(!strcmp("--quit", query))
   break;
  QueryDict(dict, query);
 } while (1);
 system("cd && clear");
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[]) {
 char query[200];
 struct TrieNode *dict;
 struct timeval start; struct timeval end;
 gettimeofday(&start, ((void *)0));
 dict = CreateDict();
 gettimeofday(&end, ((void *)0));
 printf("*****建立词典耗时 %.4f s.*****\n", 1.0 * (1000000 * (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec)) / 1000000);
 printf("*****Input --quit for quiting.*****\n");
 do {
  printf(">>>>>>>");
  scanf("%s", query);
  if (TestAndTolower(query) == 0) {
   printf("Invalid input");
   continue;
  }
  if(!strcmp("--quit", query))
   break;
  QueryDict(dict, query);
 } while (1);
 system("cd && clear");
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types:
query
char [200]

variable_types: struct TrieNode { struct TrieNode *child[128]; char *inter; } *

variable_types: struct timeval { long tv_sec; long tv_usec; }


InsertDict

decompiled_code:
char *__fastcall InsertDict(_QWORD *a1, const char *a2, const char *a3)
{
char *result; // rax
__int64 v7; // rbp
_QWORD *v8; // rax
__int64 v9; // rbx
size_t v10; // rax
char *v11; // rax
_QWORD *v12; // rax
_QWORD *v13; // rbx
size_t v14; // r12
void *v15; // rax

while ( 1 )
{
result = (char *)strlen(a2);
if ( !(_DWORD)result )
return result;
v7 = *a2;
if ( (int)result <= 1 )
break;
v8 = (_QWORD *)a1[v7];
++a2;
if ( !v8 )
{
v8 = calloc(1uLL, 0x408uLL);
a1[v7] = v8;
}
a1 = v8;
}
if ( (_DWORD)result == 1 )
{
v9 = a1[v7];
if ( v9 )
{
if ( *(_QWORD *)(v9 + 1024) )
return result;
v10 = strlen(a3);
v11 = (char *)calloc(v10 + 1, 1uLL);
*(_QWORD *)(v9 + 1024) = v11;
if ( v11 )
return strcpy(v11, a3);
}
else
{
v12 = calloc(1uLL, 0x408uLL);
a1[v7] = v12;
v13 = v12;
if ( !v12 )
{
fwrite("FATAL ERROR: malloc new TrieNode(calloc)\n", 1uLL, 0x29uLL, stderr);
exit(1);
}
v14 = strlen(a3) + 1;
v15 = calloc(v14, 1uLL);
v13[128] = v15;
if ( v15 )
return (char *)memcpy(v15, a3, v14);
}
fwrite("FATAL ERROR: malloc new TrieNode->inter(calloc)\n", 1uLL, 0x30uLL, stderr);
exit(1);
}
return result;
}

canonical_decompiled_code:
char *__fastcall func7(_QWORD *a1, const char *a2, const char *a3)
{
char *result; // rax
__int64 v7; // rbp
_QWORD *v8; // rax
__int64 v9; // rbx
size_t v10; // rax
char *v11; // rax
_QWORD *v12; // rax
_QWORD *v13; // rbx
size_t v14; // r12
void *v15; // rax

while ( 1 )
{
result = (char *)strlen(a2);
if ( !(_DWORD)result )
return result;
v7 = *a2;
if ( (int)result <= 1 )
break;
v8 = (_QWORD *)a1[v7];
++a2;
if ( !v8 )
{
v8 = calloc(1uLL, 0x408uLL);
a1[v7] = v8;
}
a1 = v8;
}
if ( (_DWORD)result == 1 )
{
v9 = a1[v7];
if ( v9 )
{
if ( *(_QWORD *)(v9 + 1024) )
return result;
v10 = strlen(a3);
v11 = (char *)calloc(v10 + 1, 1uLL);
*(_QWORD *)(v9 + 1024) = v11;
if ( v11 )
return strcpy(v11, a3);
}
else
{
v12 = calloc(1uLL, 0x408uLL);
a1[v7] = v12;
v13 = v12;
if ( !v12 )
{
fwrite("FATAL ERROR: malloc new TrieNode(calloc)\n", 1uLL, 0x29uLL, stderr);
exit(1);
}
v14 = strlen(a3) + 1;
v15 = calloc(v14, 1uLL);
v13[128] = v15;
if ( v15 )
return (char *)memcpy(v15, a3, v14);
}
fwrite("FATAL ERROR: malloc new TrieNode->inter(calloc)\n", 1uLL, 0x30uLL, stderr);
exit(1);
}
return result;
}

original_code:
void
InsertDict(TrieNode *root, char *word, char *inter) {
 int wordLen = strlen(word);
 int index;
 if (wordLen == 0) return;
 index = (int)(*word);
 if (wordLen > 1) {
  if (root->child[index] != ((void *)0))
   InsertDict(root->child[index], ++word, inter);
  else {
   root->child[index] = (TrieNode*)calloc(1, sizeof(TrieNode));
   InsertDict(root->child[index], ++word, inter);
  }
 } else if (wordLen == 1){
  if (root->child[index] != ((void *)0)) {
   if (root->child[index]->inter == ((void *)0)) {
    root->child[index]->inter = (char*)calloc(strlen(inter) + 1, sizeof(char));
    if (root->child[index]->inter == ((void *)0)) {
     fprintf(stderr, "FATAL ERROR: malloc new TrieNode->inter(calloc)\n");
     exit(1);
    }
    strcpy(root->child[index]->inter, inter);
    return;
   } else {
    return;
   }
  } else {
   root->child[index] = (TrieNode*)calloc(1, sizeof(TrieNode));
   if (root->child[index] == ((void *)0)) {
    fprintf(stderr, "FATAL ERROR: malloc new TrieNode(calloc)\n");
    exit(1);
   }
   root->child[index]->inter = (char*)calloc(strlen(inter) + 1, sizeof(char));
   if (root->child[index]->inter == ((void *)0)) {
    fprintf(stderr, "FATAL ERROR: malloc new TrieNode->inter(calloc)\n");
    exit(1);
   }
   strcpy(root->child[index]->inter, inter);
  }
 }
}

canonical_original_code:
void InsertDict(struct TrieNode *root, char *word, char *inter) {
 int wordLen = strlen(word);
 int index;
 if (wordLen == 0) return;
 index = (int)(*word);
 if (wordLen > 1) {
  if (root->child[index] != ((void *)0))
   InsertDict(root->child[index], ++word, inter);
  else {
   root->child[index] = (struct TrieNode *)calloc(1, sizeof(TrieNode));
   InsertDict(root->child[index], ++word, inter);
  }
 } else if (wordLen == 1){
  if (root->child[index] != ((void *)0)) {
   if (root->child[index]->inter == ((void *)0)) {
    root->child[index]->inter = (char *)calloc(strlen(inter) + 1, sizeof(char));
    if (root->child[index]->inter == ((void *)0)) {
     fprintf(stderr, "FATAL ERROR: malloc new TrieNode->inter(calloc)\n");
     exit(1);
    }
    strcpy(root->child[index]->inter, inter);
    return;
   } else {
    return;
   }
  } else {
   root->child[index] = (struct TrieNode *)calloc(1, sizeof(TrieNode));
   if (root->child[index] == ((void *)0)) {
    fprintf(stderr, "FATAL ERROR: malloc new TrieNode(calloc)\n");
    exit(1);
   }
   root->child[index]->inter = (char *)calloc(strlen(inter) + 1, sizeof(char));
   if (root->child[index]->inter == ((void *)0)) {
    fprintf(stderr, "FATAL ERROR: malloc new TrieNode->inter(calloc)\n");
    exit(1);
   }
   strcpy(root->child[index]->inter, inter);
  }
 }
}

variable_types:
word
char *

variable_types:
inter
char *

variable_types: wordLen int

variable_types: index int

user_defined_types: struct TrieNode { struct TrieNode *child[128]; char *inter; }


QueryDict

decompiled_code:
int __fastcall QueryDict(__int64 a1, const char *a2)
{
int v4; // eax
const char *v5; // rdx
int result; // eax

while ( 1 )
{
v4 = strlen(a2);
if ( !v4 || !a1 )
return fwrite("The word not exist\n", 1uLL, 0x13uLL, _bss_start);
a1 = *(_QWORD *)(a1 + 8LL * *a2);
if ( v4 == 1 )
break;
++a2;
}
if ( a1 && (v5 = *(const char **)(a1 + 1024)) != 0LL )
result = fprintf(_bss_start, "%s\n", v5);
else
result = fwrite("The word not exist.\n", 1uLL, 0x14uLL, _bss_start);
return result;
}

canonical_decompiled_code:
int __fastcall func9(__int64 a1, const char *a2)
{
int v4; // eax
const char *v5; // rdx
int result; // eax

while ( 1 )
{
v4 = strlen(a2);
if ( !v4 || !a1 )
return fwrite("The word not exist\n", 1uLL, 0x13uLL, _bss_start);
a1 = *(_QWORD *)(a1 + 8LL * *a2);
if ( v4 == 1 )
break;
++a2;
}
if ( a1 && (v5 = *(const char **)(a1 + 1024)) != 0LL )
result = fprintf(_bss_start, "%s\n", v5);
else
result = fwrite("The word not exist.\n", 1uLL, 0x14uLL, _bss_start);
return result;
}

original_code:
void
QueryDict(TrieNode *root, char *word) {
 int index;
 int wordLen = strlen(word);
 if (wordLen == 0 || root == ((void *)0)) {
  fprintf(stdout, "The word not exist\n");
  return;
 }
 index = (int)(*word);
 if (wordLen == 1) {
  if (root->child[index] && root->child[index]->inter)
   fprintf(stdout, "%s\n", root->child[index]->inter);
  else
   fprintf(stdout, "The word not exist.\n");
 } else {
  QueryDict(root->child[index], ++word);
 }
}

canonical_original_code:
void QueryDict(struct TrieNode *root, char *word) {
 int index;
 int wordLen = strlen(word);
 if (wordLen == 0 || root == ((void *)0)) {
  fprintf(stdout, "The word not exist\n");
  return;
 }
 index = (int)(*word);
 if (wordLen == 1) {
  if (root->child[index] && root->child[index]->inter)
   fprintf(stdout, "%s\n", root->child[index]->inter);
  else
   fprintf(stdout, "The word not exist.\n");
 } else {
  QueryDict(root->child[index], ++word);
 }
}


TestAndTolower

decompiled_code:
__int64 __fastcall TestAndTolower(char *a1)
{
char v1; // al

while ( 1 )
{
v1 = *a1;
if ( !*a1 )
return 1LL;
if ( (unsigned __int8)((v1 & 0xDF) - 65) > 0x19u )
break;
if ( (unsigned __int8)(v1 - 65) <= 0x19u )
*a1 = v1 + 32;
LABEL_3:
++a1;
}
if ( v1 == 45 )
goto LABEL_3;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(char *a1)
{
char v1; // al

while ( 1 )
{
v1 = *a1;
if ( !*a1 )
return 1LL;
if ( (unsigned __int8)((v1 & 0xDF) - 65) > 0x19u )
break;
if ( (unsigned __int8)(v1 - 65) <= 0x19u )
*a1 = v1 + 32;
LABEL_3:
++a1;
}
if ( v1 == 45 )
goto LABEL_3;
return 0LL;
}

original_code:
int
TestAndTolower(char *word) {
 while (*word) {
  if ((*word >= 'a' && *word <= 'z') || (*word >= 'A' && *word <= 'Z') || *word == '-') {
   if (*word >= 'A' && *word <= 'Z')
    *word = 'a' + (*word - 'A');
  } else {
   return 0;
  }
  word++;
 }
 return 1;
}


repo: Chingzilla/go-back-n

decompiled_code:
__int64 __fastcall init_net_lib(unsigned int a1, double a2)
{
double v2; // xmm0_8
__int64 result; // rax

if ( a2 < 0.0 || a2 > 1.0 )
{
printf("%f : Error in setting packet lost probability!\n", a2);
exit(1);
}
srand(a1);
v2 = a2 * 1000.0;
result = (unsigned int)(int)v2;
p_threshold = (int)v2;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, double a2)
{
double v2; // xmm0_8
__int64 result; // rax

if ( a2 < 0.0 || a2 > 1.0 )
{
printf("%f : Error in setting packet lost probability!\n", a2);
exit(1);
}
srand(a1);
v2 = a2 * 1000.0;
result = (unsigned int)(int)v2;
p_threshold = (int)v2;
return result;
}

original_code:
void init_net_lib(double probability, unsigned int seed)
{
 if ((probability < 0) || (probability > 1)) {
  printf("%f : Error in setting packet lost probability!\n",probability);
  exit(1);
 }
 else {
  srand(seed);
  p_threshold = (int)(probability * 1000);
 }
}

variable_types: probability double

variable_types:
seed
unsigned int


decompiled_code:
ssize_t __fastcall sendto_(int fd, void *buf, unsigned int a3, int a4, const struct sockaddr *a5, socklen_t a6)
{
if ( p_threshold < (int)((double)rand() / 2147483647.0 * 1000.0) )
return sendto(fd, buf, (int)a3, a4, a5, a6);
puts("Packet 'failed' to send");
return a3;
}

canonical_decompiled_code:
ssize_t __fastcall func1(int fd, void *buf, unsigned int a3, int a4, const struct sockaddr *a5, socklen_t a6)
{
if ( p_threshold < (int)((double)rand() / 2147483647.0 * 1000.0) )
return sendto(fd, buf, (int)a3, a4, a5, a6);
puts("Packet 'failed' to send");
return a3;
}

original_code:
int sendto_(int sock, void* message, int length, int flags, struct sockaddr* sa, int dest_len)
{
 int rnd;
 double rnd_max = (double)2147483647;
 rnd = ((rand() / rnd_max) * 1000);
 if (rnd > p_threshold) {
  return sendto(sock, message, length, flags, sa, dest_len);
 }
    printf("Packet 'failed' to send\n");
 return length;
}

canonical_original_code:
int sendto_(int sock, void *message, int length, int flags, struct sockaddr *sa, int dest_len)
{
 int rnd;
 double rnd_max = (double)2147483647;
 rnd = ((rand() / rnd_max) * 1000);
 if (rnd > p_threshold) {
  return sendto(sock, message, length, flags, sa, dest_len);
 }
    printf("Packet 'failed' to send\n");
 return length;
}

variable_types: sock int

variable_types:
message
void *

variable_types: length int

variable_types: flags int

variable_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; } *

variable_types: rnd int


decompiled_code:
__int64 __fastcall get_seq_num(int a1)
{
return (unsigned int)((a1 + 1000) % 1000);
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
return (unsigned int)((a1 + 1000) % 1000);
}

original_code:
int get_seq_num(int n){
    return (n + 1000) % 1000;
}

variable_types: n int


decompiled_code:
__int64 __fastcall get_seq_diff(int a1, int a2)
{
int v2; // eax

v2 = a2;
if ( a1 > a2 )
v2 = a2 + 1000;
return (unsigned int)(v2 - a1);
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, int a2)
{
int v2; // eax

v2 = a2;
if ( a1 > a2 )
v2 = a2 + 1000;
return (unsigned int)(v2 - a1);
}

original_code:
int get_seq_diff(int n1, int n2){
    if (n1 > n2){
        n2 = n2 + 1000;
    }
    return n2 - n1;
}


decompiled_code:
__int64 __fastcall seq_add(int a1, int a2)
{
return get_seq_num(a2 + a1);
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, int a2)
{
return func0(a2 + a1);
}

original_code:
int seq_add(int n1, int n2){
    return get_seq_num(n1 + n2);
}


writeMemory

repo: ChrisMicro/qrzForth

decompiled_code:
void __fastcall writeMemory(__int64 a1, unsigned __int16 a2, __int16 a3)
{
Memory_u8[a2] = a3;
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1, unsigned __int16 a2, __int16 a3)
{
Memory_u8[a2] = a3;
}

original_code:
void writeMemory(Cpu_t *cpu,uint16_t wordAddress, uint16_t value)
{
   uint16_t * p;
   p=(uint16_t * )Memory_u8;
   p[wordAddress]=value;
   if(wordAddress==0x6000) showScreen(cpu);
}

canonical_original_code:
void writeMemory(struct Cpu_t *cpu, unsigned short wordAddress, unsigned short value)
{
   unsigned short *p;
   p=(unsigned short * )Memory_u8;
   p[wordAddress]=value;
   if(wordAddress==0x6000) showScreen(cpu);
}

variable_types: struct Cpu_t { unsigned short datasp; unsigned short retsp; unsigned short dataStack[16]; unsigned short returnStack[32]; unsigned short regpc; unsigned short regadr; } *

variable_types:
wordAddress
unsigned short

variable_types:
value
unsigned short

variable_types:
p
unsigned short *


readMemory

decompiled_code:
__int64 __fastcall readMemory(__int64 a1, unsigned __int16 a2)
{
return LOBYTE(Memory_u8[a2]) + (HIBYTE(Memory_u8[a2]) << 8);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, unsigned __int16 a2)
{
return LOBYTE(Memory_u8[a2]) + (HIBYTE(Memory_u8[a2]) << 8);
}

original_code:
uint16_t readMemory(Cpu_t *cpu, uint16_t wordAddress)
{
 uint16_t value=0;
 value=(uint16_t)Memory_u8[wordAddress*2];
 value+=(uint16_t)(Memory_u8[wordAddress*2+1]<<8);
 return value;
}

canonical_original_code:
unsigned short readMemory(struct Cpu_t *cpu, unsigned short wordAddress)
{
 unsigned short value = 0;
 value=(unsigned short)Memory_u8[wordAddress*2];
 value+=(unsigned short)(Memory_u8[wordAddress*2+1]<<8);
 return value;
}

return_type: unsigned short

user_defined_types: struct Cpu_t { unsigned short datasp; unsigned short retsp; unsigned short dataStack[16]; unsigned short returnStack[32]; unsigned short regpc; unsigned short regadr; }


showScreen

decompiled_code:
void showScreen()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void showScreen(Cpu_t *cpu)
{
}

canonical_original_code:
void showScreen(struct Cpu_t *cpu)
{
}


qrzPutChar

decompiled_code:
void qrzPutChar()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
void qrzPutChar(char c)
{
}

canonical_original_code:
void qrzPutChar(char c)
{
}

variable_types: c char


resetMessage

decompiled_code:
void resetMessage()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
void resetMessage()
{
}

canonical_original_code:
void resetMessage()
{
}


updateSysCounter

decompiled_code:
__int64 updateSysCounter()
{
time_t v0; // rbp
clock_t v1; // rax
__int64 result; // rax

v0 = start_0;
if ( start_0 )
{
v1 = clock();
result = (unsigned int)(int)difftime(v1, v0);
}
else
{
start_0 = clock();
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 func5()
{
time_t v0; // rbp
clock_t v1; // rax
__int64 result; // rax

v0 = start_0;
if ( start_0 )
{
v1 = clock();
result = (unsigned int)(int)difftime(v1, v0);
}
else
{
start_0 = clock();
result = 0LL;
}
return result;
}

original_code:
uint32_t updateSysCounter() {
    static clock_t start;
    if(start){
        return difftime(clock(),start) ;
    } else {
        start=clock();
        return 0;
    }
 }

canonical_original_code:
unsigned int updateSysCounter() {
    static long start;
    if(start){
        return difftime(clock(),start) ;
    } else {
        start=clock();
        return 0;
    }
 }

variable_types: start long


cpuExternalCall

decompiled_code:
int __fastcall cpuExternalCall(__int64 a1)
{
unsigned __int16 v1; // ax
int result; // eax
unsigned __int16 v3; // ax
unsigned int v4; // eax
unsigned __int16 v5; // ax
__int64 v6; // rsi

switch ( (unsigned __int16)((__int64 (*)(void))pop)() )
{
case 0u:
v5 = pop(a1);
result = putchar(v5);
break;
case 1u:
v6 = (unsigned __int16)pop(a1);
if ( Base == 10 )
result = printf(" %d ", v6);
else
result = printf(" %4x ", v6);
break;
case 2u:
result = pop(a1);
Base = result;
break;
case 3u:
v1 = getchar();
push(a1, v1);
result = push(a1, 0xFFFFLL);
break;
case 4u:
v3 = updateSysCounter();
push(a1, v3);
v4 = updateSysCounter();
result = push(a1, HIWORD(v4));
break;
default:
result = puts("external command not found");
break;
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1)
{
unsigned __int16 v1; // ax
int result; // eax
unsigned __int16 v3; // ax
unsigned int v4; // eax
unsigned __int16 v5; // ax
__int64 v6; // rsi

switch ( (unsigned __int16)((__int64 (*)(void))pop)() )
{
case 0u:
v5 = pop(a1);
result = putchar(v5);
break;
case 1u:
v6 = (unsigned __int16)pop(a1);
if ( Base == 10 )
result = printf(" %d ", v6);
else
result = printf(" %4x ", v6);
break;
case 2u:
result = pop(a1);
Base = result;
break;
case 3u:
v1 = getchar();
push(a1, v1);
result = push(a1, 0xFFFFLL);
break;
case 4u:
v3 = func5();
push(a1, v3);
v4 = func5();
result = push(a1, HIWORD(v4));
break;
default:
result = puts("external command not found");
break;
}
return result;
}

original_code:
void cpuExternalCall(Cpu_t *cpu)
{
 int32_t command=pop(cpu);
 uint16_t value;
 switch(command)
 {
  case 4:
  {
   push(cpu,updateSysCounter()&0xFFFF);
   push(cpu,updateSysCounter()>>16);
  }break;
  case 3:
  {
   push(cpu,getchar());
   push(cpu,0xFFFF);
  }break;
  case 0:
  {
   value=pop(cpu);
   { putchar(value);};;
  }break;
  case 1:
  {
   value=pop(cpu);
   if(Base==10)
   {
    value=(value>0x8000L)? value-(int32_t) 0x10000L:value;
    { printf(" %d ",value);};;
   }
   else { printf(" %4x ",value);};;
  }break;
  case 2:
  {
   value=pop(cpu);
   Base=value;
  }break;
  default: { puts("external command not found");};;break;
 }
}

canonical_original_code:
void cpuExternalCall(struct Cpu_t *cpu)
{
 int command = pop(cpu);
 unsigned short value;
 switch(command)
 {
  case 4:
  {
   push(cpu,updateSysCounter()&0xFFFF);
   push(cpu,updateSysCounter()>>16);
  }break;
  case 3:
  {
   push(cpu,getchar());
   push(cpu,0xFFFF);
  }break;
  case 0:
  {
   value=pop(cpu);
   { putchar(value);};;
  }break;
  case 1:
  {
   value=pop(cpu);
   if(Base==10)
   {
    value=(value>0x8000L)? value-(int) 0x10000L:value;
    { printf(" %d ",value);};;
   }
   else { printf(" %4x ",value);};;
  }break;
  case 2:
  {
   value=pop(cpu);
   Base=value;
  }break;
  default: { puts("external command not found");};;break;
 }
}

variable_types: command int


showCpu

decompiled_code:
int __fastcall showCpu(__int64 a1)
{
printf("%s", "regpc: ");
return printf("%04x ", *(unsigned __int16 *)(a1 + 100));
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1)
{
printf("%s", "regpc: ");
return printf("%04x ", *(unsigned __int16 *)(a1 + 100));
}

original_code:
void showCpu(Cpu_t *cpu)
{
  { printf("%s","regpc: ");printf("%04x ",cpu->regpc);};;
}

canonical_original_code:
void showCpu(struct Cpu_t *cpu)
{
  { printf("%s","regpc: ");printf("%04x ",cpu->regpc);};;
}