decompiled_code:
__int64 __fastcall special_cases(__int64 a1, __int64 a2)
{
__int64 *v2; // rbx
__int64 result; // rax
__int64 v4[13]; // [rsp+0h] [rbp-98h] BYREF
__int64 v5; // [rsp+68h] [rbp-30h] BYREF

v4[0] = (__int64)&pressed_key_up;
v4[1] = (__int64)&pressed_key_down;
v4[2] = (__int64)&pressed_key_delete;
v4[3] = (__int64)&pressed_key_left;
v4[4] = (__int64)&pressed_key_right;
v4[5] = (__int64)&pressed_key_home;
v4[6] = (__int64)&pressed_key_end;
v4[7] = (__int64)&pressed_key_tab;
v4[8] = (__int64)&pressed_key_del;
v4[9] = (__int64)&pressed_shift_left;
v4[10] = (__int64)&pressed_shift_right;
v4[11] = (__int64)&pressed_shift_up;
v4[12] = (__int64)&pressed_shift_down;
v5 = 0LL;
v2 = v4;
while ( 1 )
{
result = ((__int64 (__fastcall *)(__int64, __int64))*v2)(a1, a2);
if ( (_DWORD)result == 1 )
break;
if ( ++v2 == &v5 )
return result;
}
return re_print_line(a2);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
__int64 *v2; // rbx
__int64 result; // rax
__int64 v4[13]; // [rsp+0h] [rbp-98h] BYREF
__int64 v5; // [rsp+68h] [rbp-30h] BYREF

v4[0] = (__int64)&pressed_key_up;
v4[1] = (__int64)&pressed_key_down;
v4[2] = (__int64)&pressed_key_delete;
v4[3] = (__int64)&pressed_key_left;
v4[4] = (__int64)&pressed_key_right;
v4[5] = (__int64)&pressed_key_home;
v4[6] = (__int64)&pressed_key_end;
v4[7] = (__int64)&pressed_key_tab;
v4[8] = (__int64)&pressed_key_del;
v4[9] = (__int64)&pressed_shift_left;
v4[10] = (__int64)&pressed_shift_right;
v4[11] = (__int64)&pressed_shift_up;
v4[12] = (__int64)&pressed_shift_down;
v5 = 0LL;
v2 = v4;
while ( 1 )
{
result = ((__int64 (__fastcall *)(__int64, __int64))*v2)(a1, a2);
if ( (_DWORD)result == 1 )
break;
if ( ++v2 == &v5 )
return result;
}
return re_print_line(a2);
}

original_code:
void special_cases(char *c, t_print *print)
{
 t_keys *keys[14] = {pressed_key_up, pressed_key_down, pressed_key_delete,
      pressed_key_left, pressed_key_right, pressed_key_home,
      pressed_key_end, pressed_key_tab, pressed_key_del,
      pressed_shift_left, pressed_shift_right,
      pressed_shift_up, pressed_shift_down, ((void *)0)};
 int i;
 i = -1;
 while (i++, i < 13)
 {
  if (keys[i](c, print) == 1)
  {
   re_print_line(print);
   return ;
  }
 }
}

canonical_original_code:
void special_cases(char *c, struct s_print *print)
{
 int (*keys[14])(char *, struct s_print *) = {pressed_key_up, pressed_key_down, pressed_key_delete,
      pressed_key_left, pressed_key_right, pressed_key_home,
      pressed_key_end, pressed_key_tab, pressed_key_del,
      pressed_shift_left, pressed_shift_right,
      pressed_shift_up, pressed_shift_down, ((void *)0)};
 int i;
 i = -1;
 while (i++, i < 13)
 {
  if (keys[i](c, print) == 1)
  {
   re_print_line(print);
   return ;
  }
 }
}

variable_types:
c
char *

variable_types: int (*[14])(char *, struct s_print { int pos; int startsel; int endsel; int ins; int length; char *line; char *select; struct s_history { char *line; struct s_history *prev; struct s_history *next; } *histo; } *)


decompiled_code:
__int64 __fastcall ft_fill_word(__int64 a1, int *a2, _DWORD *a3, __int64 a4)
{
__int64 result; // rax

result = a1;
**(_BYTE **)(a1 + 8LL * *a2) = *(_BYTE *)(a4 + (int)(*a3)++);
return result;
}

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

result = a1;
**(_BYTE **)(a1 + 8LL * *a2) = *(_BYTE *)(a4 + (int)(*a3)++);
return result;
}

original_code:
char **ft_fill_word(char **tab, int *i, int *l, const char *s)
{
 int j;
 j = 0;
 tab[*i][j] = s[*l];
 *l += 1;
 return (tab);
}

canonical_original_code:
char **ft_fill_word(char **tab, int *i, int *l, char *s)
{
 int j;
 j = 0;
 tab[*i][j] = s[*l];
 *l += 1;
 return (tab);
}

variable_types:
tab
char **

variable_types:
i
int *

variable_types:
l
int *

variable_types:
s
char *

variable_types: j int

return_type: char **


decompiled_code:
float *__fastcall matrix_sub(float *a1, float *a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = *a1 - *a2;
v2[1] = a1[1] - a2[1];
v2[2] = a1[2] - a2[2];
v2[3] = find_magnitude();
return v2;
}

canonical_decompiled_code:
float *__fastcall func0(float *a1, float *a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = *a1 - *a2;
v2[1] = a1[1] - a2[1];
v2[2] = a1[2] - a2[2];
v2[3] = find_magnitude();
return v2;
}

original_code:
t_vect *matrix_sub(t_vect *v1, t_vect *v2)
{
 t_vect *v3;
 v3 = (t_vect*)malloc(sizeof(t_vect));
 v3->x = v1->x - v2->x;
 v3->y = v1->y - v2->y;
 v3->z = v1->z - v2->z;
 v3->l = find_magnitude(v3->x, v3->y, v3->z);
 return (v3);
}

canonical_original_code:
struct s_vect *matrix_sub(struct s_vect *v1, struct s_vect *v2)
{
 struct s_vect *v3;
 v3 = (struct s_vect *)malloc(sizeof(t_vect));
 v3->x = v1->x - v2->x;
 v3->y = v1->y - v2->y;
 v3->z = v1->z - v2->z;
 v3->l = find_magnitude(v3->x, v3->y, v3->z);
 return (v3);
}

variable_types: struct s_vect { float x; float y; float z; float l; } *


decompiled_code:
float *__fastcall matrix_add(float *a1, float *a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = *a1 + *a2;
v2[1] = a1[1] + a2[1];
v2[2] = a1[2] + a2[2];
v2[3] = find_magnitude();
return v2;
}

canonical_decompiled_code:
float *__fastcall func1(float *a1, float *a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = *a1 + *a2;
v2[1] = a1[1] + a2[1];
v2[2] = a1[2] + a2[2];
v2[3] = find_magnitude();
return v2;
}

original_code:
t_vect *matrix_add(t_vect *v1, t_vect *v2)
{
 t_vect *v3;
 v3 = (t_vect*)malloc(sizeof(t_vect));
 v3->x = v1->x + v2->x;
 v3->y = v1->y + v2->y;
 v3->z = v1->z + v2->z;
 v3->l = find_magnitude(v3->x, v3->y, v3->z);
 return (v3);
}

canonical_original_code:
struct s_vect *matrix_add(struct s_vect *v1, struct s_vect *v2)
{
 struct s_vect *v3;
 v3 = (struct s_vect *)malloc(sizeof(t_vect));
 v3->x = v1->x + v2->x;
 v3->y = v1->y + v2->y;
 v3->z = v1->z + v2->z;
 v3->l = find_magnitude(v3->x, v3->y, v3->z);
 return (v3);
}

return_type: struct s_vect { float x; float y; float z; float l; } *


decompiled_code:
float *__fastcall matrix_mul_by_val(float *a1, float a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = a2 * *a1;
v2[1] = a2 * a1[1];
v2[2] = a2 * a1[2];
v2[3] = find_magnitude();
return v2;
}

canonical_decompiled_code:
float *__fastcall func2(float *a1, float a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = a2 * *a1;
v2[1] = a2 * a1[1];
v2[2] = a2 * a1[2];
v2[3] = find_magnitude();
return v2;
}

original_code:
t_vect *matrix_mul_by_val(t_vect *m1, t_type f)
{
 t_vect *m2;
 m2 = (t_vect*)malloc(sizeof(t_vect));
 m2->x = m1->x * f;
 m2->y = m1->y * f;
 m2->z = m1->z * f;
 m2->l = find_magnitude(m2->x, m2->y, m2->z);
 return (m2);
}

canonical_original_code:
struct s_vect *matrix_mul_by_val(struct s_vect *m1, float f)
{
 struct s_vect *m2;
 m2 = (struct s_vect *)malloc(sizeof(t_vect));
 m2->x = m1->x * f;
 m2->y = m1->y * f;
 m2->z = m1->z * f;
 m2->l = find_magnitude(m2->x, m2->y, m2->z);
 return (m2);
}

variable_types: f float

user_defined_types: struct s_vect { float x; float y; float z; float l; }


decompiled_code:
float *__fastcall matrix_div_by_val(float *a1, float a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = *a1 / a2;
v2[1] = a1[1] / a2;
v2[2] = a1[2] / a2;
v2[3] = find_magnitude();
return v2;
}

canonical_decompiled_code:
float *__fastcall func3(float *a1, float a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = *a1 / a2;
v2[1] = a1[1] / a2;
v2[2] = a1[2] / a2;
v2[3] = find_magnitude();
return v2;
}

original_code:
t_vect *matrix_div_by_val(t_vect *m1, t_type f)
{
 t_vect *m2;
 m2 = (t_vect*)malloc(sizeof(t_vect));
 m2->x = m1->x / f;
 m2->y = m1->y / f;
 m2->z = m1->z / f;
 m2->l = find_magnitude(m2->x, m2->y, m2->z);
 return (m2);
}

canonical_original_code:
struct s_vect *matrix_div_by_val(struct s_vect *m1, float f)
{
 struct s_vect *m2;
 m2 = (struct s_vect *)malloc(sizeof(t_vect));
 m2->x = m1->x / f;
 m2->y = m1->y / f;
 m2->z = m1->z / f;
 m2->l = find_magnitude(m2->x, m2->y, m2->z);
 return (m2);
}


decompiled_code:
float *__fastcall matrix_add_by_val(float *a1, float a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = a2 + *a1;
v2[1] = a2 + a1[1];
v2[2] = a2 + a1[2];
v2[3] = find_magnitude();
return v2;
}

canonical_decompiled_code:
float *__fastcall func4(float *a1, float a2)
{
float *v2; // rbx

v2 = (float *)malloc(0x10uLL);
*v2 = a2 + *a1;
v2[1] = a2 + a1[1];
v2[2] = a2 + a1[2];
v2[3] = find_magnitude();
return v2;
}

original_code:
t_vect *matrix_add_by_val(t_vect *m1, t_type f)
{
 t_vect *m2;
 m2 = (t_vect*)malloc(sizeof(t_vect));
 m2->x = m1->x + f;
 m2->y = m1->y + f;
 m2->z = m1->z + f;
 m2->l = find_magnitude(m2->x, m2->y, m2->z);
 return (m2);
}

canonical_original_code:
struct s_vect *matrix_add_by_val(struct s_vect *m1, float f)
{
 struct s_vect *m2;
 m2 = (struct s_vect *)malloc(sizeof(t_vect));
 m2->x = m1->x + f;
 m2->y = m1->y + f;
 m2->z = m1->z + f;
 m2->l = find_magnitude(m2->x, m2->y, m2->z);
 return (m2);
}


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

result = malloc(0x24uLL);
*result = 0;
result[1] = 0;
result[2] = 0;
result[3] = 0;
result[4] = 0;
result[5] = 0;
result[6] = 0;
result[7] = 0;
result[8] = 0;
return result;
}

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

result = malloc(0x24uLL);
*result = 0;
result[1] = 0;
result[2] = 0;
result[3] = 0;
result[4] = 0;
result[5] = 0;
result[6] = 0;
result[7] = 0;
result[8] = 0;
return result;
}

original_code:
t_sizes *ft_build_sizes_list(t_sizes *sizes)
{
 sizes = (t_sizes*)malloc(sizeof(t_sizes));
 sizes->right = 0;
 sizes->owner = 0;
 sizes->group = 0;
 sizes->name = 0;
 sizes->link = 0;
 sizes->size = 0;
 sizes->major = 0;
 sizes->minor = 0;
 sizes->time = 0;
 return (sizes);
}

canonical_original_code:
struct s_list3 *ft_build_sizes_list(struct s_list3 *sizes)
{
 sizes = (struct s_list3 *)malloc(sizeof(t_sizes));
 sizes->right = 0;
 sizes->owner = 0;
 sizes->group = 0;
 sizes->name = 0;
 sizes->link = 0;
 sizes->size = 0;
 sizes->major = 0;
 sizes->minor = 0;
 sizes->time = 0;
 return (sizes);
}

variable_types:
sizes
struct s_list3 *

return_type: struct s_list3 { int right; int owner; int group; int name; int link; int size; int major; int minor; int time; } *


original_code:
void ft_fill_padding_struct(t_list2 *lnk, t_sizes *sizes)
{
 if (lnk->right && (int)ft_strlen(lnk->right) > sizes->right)
  sizes->right = ft_strlen(lnk->right);
 if (lnk->owner && (int)ft_strlen(lnk->owner) > sizes->owner)
  sizes->owner = ft_strlen(lnk->owner);
 if (lnk->group && (int)ft_strlen(lnk->group) > sizes->group)
  sizes->group = ft_strlen(lnk->group);
 if (lnk->link && (int)ft_strlen(lnk->link) > sizes->link)
  sizes->link = ft_strlen(lnk->link);
 if (lnk->size && (int)ft_strlen(lnk->size) > sizes->size)
  sizes->size = ft_strlen(lnk->size);
 if (lnk->major && (int)ft_strlen(lnk->major) > sizes->major)
  sizes->major = ft_strlen(lnk->major);
 if (lnk->minor && (int)ft_strlen(lnk->minor) > sizes->minor)
  sizes->minor = ft_strlen(lnk->minor);
}

canonical_original_code:
void ft_fill_padding_struct(struct s_list2 *lnk, struct s_list3 *sizes)
{
 if (lnk->right && (int)ft_strlen(lnk->right) > sizes->right)
  sizes->right = ft_strlen(lnk->right);
 if (lnk->owner && (int)ft_strlen(lnk->owner) > sizes->owner)
  sizes->owner = ft_strlen(lnk->owner);
 if (lnk->group && (int)ft_strlen(lnk->group) > sizes->group)
  sizes->group = ft_strlen(lnk->group);
 if (lnk->link && (int)ft_strlen(lnk->link) > sizes->link)
  sizes->link = ft_strlen(lnk->link);
 if (lnk->size && (int)ft_strlen(lnk->size) > sizes->size)
  sizes->size = ft_strlen(lnk->size);
 if (lnk->major && (int)ft_strlen(lnk->major) > sizes->major)
  sizes->major = ft_strlen(lnk->major);
 if (lnk->minor && (int)ft_strlen(lnk->minor) > sizes->minor)
  sizes->minor = ft_strlen(lnk->minor);
}

variable_types: struct s_list2 { char *right; char *owner; char *group; char *name; char *time; char *link; char *size; char *major; char *minor; int blk; long timestamp; struct s_list2 *next; struct s_list2 *prev; } *

variable_types: struct s_list3 { int right; int owner; int group; int name; int link; int size; int major; int minor; int time; } *

return_type: void


original_code:
void ft_padding_elem(t_list2 *lnk, t_sizes *sizes, t_params *p)
{
 t_list2 *save;
 save = lnk;
 while (lnk)
 {
  if (lnk->name[0] == '.' && p->a == 0)
   ;
  else if (p->l == 1)
  {
   if (lnk->right && lnk->owner && lnk->group && lnk->link && lnk->size
    && lnk->major && lnk->minor)
   {
    lnk->right = ft_padding(lnk->right, sizes->right, 1, ' ');
    lnk->link = ft_padding(lnk->link, sizes->link, 0, ' ');
    lnk->owner = ft_padding(lnk->owner, sizes->owner, 1, ' ');
    lnk->group = ft_padding(lnk->group, sizes->group, 1, ' ');
    lnk->size = ft_padding(lnk->size, sizes->size, 0, ' ');
    lnk->major = ft_padding(lnk->major, sizes->major, 0, ' ');
    lnk->minor = ft_padding(lnk->minor, sizes->minor, 0, ' ');
   }
  }
  lnk = lnk->next;
 }
 lnk = save;
}

canonical_original_code:
void ft_padding_elem(struct s_list2 *lnk, struct s_list3 *sizes, struct s_list4 *p)
{
 struct s_list2 *save;
 save = lnk;
 while (lnk)
 {
  if (lnk->name[0] == '.' && p->a == 0)
   ;
  else if (p->l == 1)
  {
   if (lnk->right && lnk->owner && lnk->group && lnk->link && lnk->size
    && lnk->major && lnk->minor)
   {
    lnk->right = ft_padding(lnk->right, sizes->right, 1, ' ');
    lnk->link = ft_padding(lnk->link, sizes->link, 0, ' ');
    lnk->owner = ft_padding(lnk->owner, sizes->owner, 1, ' ');
    lnk->group = ft_padding(lnk->group, sizes->group, 1, ' ');
    lnk->size = ft_padding(lnk->size, sizes->size, 0, ' ');
    lnk->major = ft_padding(lnk->major, sizes->major, 0, ' ');
    lnk->minor = ft_padding(lnk->minor, sizes->minor, 0, ' ');
   }
  }
  lnk = lnk->next;
 }
 lnk = save;
}

variable_types: struct s_list4 { int l; int a; int r; int R; int t; int round; } *

user_defined_types: struct s_list2 { char *right; char *owner; char *group; char *name; char *time; char *link; char *size; char *major; char *minor; int blk; long timestamp; struct s_list2 *next; struct s_list2 *prev; }

user_defined_types: struct s_list3 { int right; int owner; int group; int name; int link; int size; int major; int minor; int time; }


original_code:
t_tok *tok_push_back(t_tok *old, t_tok *new)
{
 t_tok *save;
 save = old;
 if (old == ((void *)0))
  return (new);
 while (old->next != ((void *)0))
  old = old->next;
 old->next = new;
 return (save);
}

canonical_original_code:
struct s_tok *tok_push_back(struct s_tok *old, struct s_tok *new)
{
 struct s_tok *save;
 save = old;
 if (old == ((void *)0))
  return (new);
 while (old->next != ((void *)0))
  old = old->next;
 old->next = new;
 return (save);
}

variable_types:
old
struct s_tok *

variable_types:
new
struct s_tok *

variable_types: struct s_tok { enum e_type { START=0, END=1, COMMENT=2, NAME=3, POS=4, IGNORE=5, ENDLINE=6 } type; char *val; struct s_tok *next; } *

user_defined_types: struct s_tok { enum e_type type; char *val; struct s_tok *next; }


original_code:
t_room *room_push_back(t_room *old, t_room *new)
{
 t_room *save;
 save = old;
 if (old == ((void *)0))
  return (new);
 while (old->next != ((void *)0))
  old = old->next;
 old->next = new;
 return (save);
}

canonical_original_code:
struct s_room *room_push_back(struct s_room *old, struct s_room *new)
{
 struct s_room *save;
 save = old;
 if (old == ((void *)0))
  return (new);
 while (old->next != ((void *)0))
  old = old->next;
 old->next = new;
 return (save);
}

variable_types:
old
struct s_room *

variable_types:
new
struct s_room *

variable_types: struct s_room { char *name; int posx; int posy; struct s_pipe { struct s_room *list; struct s_pipe *next; } *pipe; struct s_room *next; } *

user_defined_types: struct s_room { char *name; int posx; int posy; struct s_pipe *pipe; struct s_room *next; }


decompiled_code:
__int64 __fastcall init_tok_list(__int64 a1, __int64 a2, int a3)
{
_QWORD *v4; // rbx

v4 = malloc(0x18uLL);
*(_DWORD *)v4 = a3;
v4[1] = ft_strdup(a2);
v4[2] = 0LL;
return tok_push_back(a1, (__int64)v4);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, int a3)
{
_QWORD *v4; // rbx

v4 = malloc(0x18uLL);
*(_DWORD *)v4 = a3;
v4[1] = ft_strdup(a2);
v4[2] = 0LL;
return func0(a1, (__int64)v4);
}

original_code:
t_tok *init_tok_list(t_tok *tok, char *line, t_type type)
{
 t_tok *new;
 new = (t_tok*)malloc(sizeof(t_tok));
 new->type = type;
 new->val = ft_strdup(line);
 new->next = ((void *)0);
 tok = tok_push_back(tok, new);
 return (tok);
}

canonical_original_code:
struct s_tok *init_tok_list(struct s_tok *tok, char *line, enum e_type type)
{
 struct s_tok *new;
 new = (struct s_tok *)malloc(sizeof(t_tok));
 new->type = type;
 new->val = ft_strdup(line);
 new->next = ((void *)0);
 tok = tok_push_back(tok, new);
 return (tok);
}

variable_types:
tok
struct s_tok *

variable_types:
line
char *

return_type: struct s_tok { enum e_type { START=0, END=1, COMMENT=2, NAME=3, POS=4, IGNORE=5, ENDLINE=6 } type; char *val; struct s_tok *next; } *


original_code:
t_room *init_room(t_tok **tok, t_room *room)
{
 t_room *new;
 new = (t_room*)malloc(sizeof(t_room));
 while ((*tok)->type != 3)
  (*tok) = (*tok)->next;
 new->name = ft_strdup((*tok)->val);
 (*tok) = (*tok)->next;
 new->posx = ft_atoi((*tok)->val);
 (*tok) = (*tok)->next;
 new->posy = ft_atoi((*tok)->val);
 new->pipe = ((void *)0);
 new->next = ((void *)0);
 room = room_push_back(room, new);
 return (room);
}

canonical_original_code:
struct s_room *init_room(struct s_tok **tok, struct s_room *room)
{
 struct s_room *new;
 new = (struct s_room *)malloc(sizeof(t_room));
 while ((*tok)->type != 3)
  (*tok) = (*tok)->next;
 new->name = ft_strdup((*tok)->val);
 (*tok) = (*tok)->next;
 new->posx = ft_atoi((*tok)->val);
 (*tok) = (*tok)->next;
 new->posy = ft_atoi((*tok)->val);
 new->pipe = ((void *)0);
 new->next = ((void *)0);
 room = room_push_back(room, new);
 return (room);
}

variable_types: struct s_tok { enum e_type { START=0, END=1, COMMENT=2, NAME=3, POS=4, IGNORE=5, ENDLINE=6 } type; char *val; struct s_tok *next; } **

variable_types:
room
struct s_room *

return_type: struct s_room { char *name; int posx; int posy; struct s_pipe { struct s_room *list; struct s_pipe *next; } *pipe; struct s_room *next; } *


decompiled_code:
__int64 __fastcall lex_printlist(unsigned int **a1)
{
unsigned int *i; // rbx

for ( i = *a1; i; i = (unsigned int *)*((_QWORD *)i + 2) )
ft_printf("[%d\t][%s]\n", *i, *((const char **)i + 1));
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int **a1)
{
unsigned int *i; // rbx

for ( i = *a1; i; i = (unsigned int *)*((_QWORD *)i + 2) )
ft_printf("[%d\t][%s]\n", *i, *((const char **)i + 1));
return 1LL;
}

original_code:
int lex_printlist(t_lexer **list)
{
 t_lexer *tmp;
 tmp = *list;
 while (tmp != ((void *)0))
 {
  ft_printf("[%d\t][%s]\n", tmp->token, tmp->value);
  tmp = tmp->next;
 }
 return (1);
}

canonical_original_code:
int lex_printlist(struct s_lexer **list)
{
 struct s_lexer *tmp;
 tmp = *list;
 while (tmp != ((void *)0))
 {
  ft_printf("[%d\t][%s]\n", tmp->token, tmp->value);
  tmp = tmp->next;
 }
 return (1);
}

variable_types: struct s_lexer { enum e_type { NOTHING=0, REG=1, IND=2, DIR=4, LAB=8, OP=16, CMD=32, CMD_NAME=64, CMD_COM=128, DIR_LAB=256, IND_LAB=512, STR=1024, ENDOFLINE=2048, COM=4096, WHIT=8192, SEP=16384 } token; char *value; struct s_lexer *next; } **

return_type: int

user_defined_types: struct s_lexer { enum e_type token; char *value; struct s_lexer *next; }


decompiled_code:
__int64 __fastcall lex_islabelchars(char *a1)
{
char v1; // cl
char *v2; // rsi
const char *v3; // rax
char v4; // dl

v1 = *a1;
if ( !*a1 )
return 0LL;
v2 = a1 + 1;
do
{
v3 = "bcdefghijklmnopqrstuvwxyz_0123456789";
if ( v1 != 97 )
{
do
v4 = *v3++;
while ( v4 != v1 && v4 );
if ( !v4 )
return 0xFFFFFFFFLL;
}
v1 = *v2++;
}
while ( v1 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *a1)
{
char v1; // cl
char *v2; // rsi
const char *v3; // rax
char v4; // dl

v1 = *a1;
if ( !*a1 )
return 0LL;
v2 = a1 + 1;
do
{
v3 = "bcdefghijklmnopqrstuvwxyz_0123456789";
if ( v1 != 97 )
{
do
v4 = *v3++;
while ( v4 != v1 && v4 );
if ( !v4 )
return 0xFFFFFFFFLL;
}
v1 = *v2++;
}
while ( v1 );
return 0LL;
}

original_code:
int lex_islabelchars(char *str)
{
 int i;
 int j;
 i = j = 0;
 while (str[i])
 {
  while ("abcdefghijklmnopqrstuvwxyz_0123456789"[j])
  {
   if (str[i] == "abcdefghijklmnopqrstuvwxyz_0123456789"[j])
    break ;
   j++;
  }
  if (!"abcdefghijklmnopqrstuvwxyz_0123456789"[j])
   return (-1);
  j = 0;
  i++;
 }
 return (0);
}

variable_types:
str
char *

variable_types: i int

variable_types: j int


decompiled_code:
__int64 __fastcall lex_isdirlab(__int64 a1, _BYTE *a2)
{
unsigned int v2; // ebp

if ( *a2 != 37 )
return (unsigned int)-1;
if ( a2[1] != 58 )
return (unsigned int)-1;
v2 = lex_islabelchars(a2 + 2);
if ( v2 )
return (unsigned int)-1;
lex_addlex(a1, a2, 256LL);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, _BYTE *a2)
{
unsigned int v2; // ebp

if ( *a2 != 37 )
return (unsigned int)-1;
if ( a2[1] != 58 )
return (unsigned int)-1;
v2 = func0(a2 + 2);
if ( v2 )
return (unsigned int)-1;
lex_addlex(a1, a2, 256LL);
return v2;
}

original_code:
int lex_isdirlab(t_lexer **list, char *word)
{
 if (word[0] == '%' && word[1] == ':')
 {
  if (lex_islabelchars(word + 2) == 0)
  {
   lex_addlex(list, word, DIR_LAB);
   return (0);
  }
 }
 return (-1);
}

canonical_original_code:
int lex_isdirlab(struct s_lexer **list, char *word)
{
 if (word[0] == '%' && word[1] == ':')
 {
  if (lex_islabelchars(word + 2) == 0)
  {
   lex_addlex(list, word, DIR_LAB);
   return (0);
  }
 }
 return (-1);
}

variable_types:
word
char *

user_defined_types: enum e_type { NOTHING=0, REG=1, IND=2, DIR=4, LAB=8, OP=16, CMD=32, CMD_NAME=64, CMD_COM=128, DIR_LAB=256, IND_LAB=512, STR=1024, ENDOFLINE=2048, COM=4096, WHIT=8192, SEP=16384 }


decompiled_code:
__int64 __fastcall lex_isdir(__int64 a1, _BYTE *a2)
{
unsigned int v2; // ebp

if ( *a2 != 37 )
return (unsigned int)-1;
v2 = lex_strnum(a2 + 1);
if ( v2 )
return (unsigned int)-1;
lex_addlex(a1, a2, 4LL);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, _BYTE *a2)
{
unsigned int v2; // ebp

if ( *a2 != 37 )
return (unsigned int)-1;
v2 = lex_strnum(a2 + 1);
if ( v2 )
return (unsigned int)-1;
lex_addlex(a1, a2, 4LL);
return v2;
}

original_code:
int lex_isdir(t_lexer **list, char *word)
{
 if (word[0] == '%' && lex_strnum(word + 1) == 0)
 {
  lex_addlex(list, word, DIR);
  return (0);
 }
 return (-1);
}

canonical_original_code:
int lex_isdir(struct s_lexer **list, char *word)
{
 if (word[0] == '%' && lex_strnum(word + 1) == 0)
 {
  lex_addlex(list, word, DIR);
  return (0);
 }
 return (-1);
}


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

if ( a2[ft_strlen(a2) - 1] != 58 )
return 0xFFFFFFFFLL;
a2[ft_strlen(a2) - 1] = 0;
result = lex_islabelchars(a2);
if ( (_DWORD)result != -1 )
{
a2[ft_strlen(a2)] = 58;
lex_addlex(a1, a2, 8LL);
result = 0LL;
}
return result;
}

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

if ( a2[ft_strlen(a2) - 1] != 58 )
return 0xFFFFFFFFLL;
a2[ft_strlen(a2) - 1] = 0;
result = func0(a2);
if ( (_DWORD)result != -1 )
{
a2[ft_strlen(a2)] = 58;
lex_addlex(a1, a2, 8LL);
result = 0LL;
}
return result;
}

original_code:
int lex_islab(t_lexer **list, char *word)
{
 if (word[ft_strlen(word) - 1] == ':')
 {
  word[ft_strlen(word) - 1] = '\0';
  if (lex_islabelchars(word) == -1)
   return (-1);
  word[ft_strlen(word)] = ':';
  lex_addlex(list, word, LAB);
  return (0);
 }
 return (-1);
}

canonical_original_code:
int lex_islab(struct s_lexer **list, char *word)
{
 if (word[ft_strlen(word) - 1] == ':')
 {
  word[ft_strlen(word) - 1] = '\0';
  if (lex_islabelchars(word) == -1)
   return (-1);
  word[ft_strlen(word)] = ':';
  lex_addlex(list, word, LAB);
  return (0);
 }
 return (-1);
}


decompiled_code:
__int64 __fastcall lex_isind(__int64 a1, _BYTE *a2)
{
_BOOL8 v3; // rax
_BYTE *v4; // rbp
char v5; // di
__int64 v6; // rbx

v3 = *a2 == 45;
v4 = &a2[v3];
v5 = a2[v3];
if ( v5 )
{
v6 = (__int64)&a2[v3 + 1];
while ( (unsigned int)ft_isdigit((unsigned int)v5) )
{
v4 = (_BYTE *)v6++;
v5 = *(_BYTE *)(v6 - 1);
if ( !v5 )
goto LABEL_5;
}
if ( *v4 )
return 0xFFFFFFFFLL;
}
LABEL_5:
lex_addlex(a1, a2, 2LL);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, _BYTE *a2)
{
_BOOL8 v3; // rax
_BYTE *v4; // rbp
char v5; // di
__int64 v6; // rbx

v3 = *a2 == 45;
v4 = &a2[v3];
v5 = a2[v3];
if ( v5 )
{
v6 = (__int64)&a2[v3 + 1];
while ( (unsigned int)ft_isdigit((unsigned int)v5) )
{
v4 = (_BYTE *)v6++;
v5 = *(_BYTE *)(v6 - 1);
if ( !v5 )
goto LABEL_5;
}
if ( *v4 )
return 0xFFFFFFFFLL;
}
LABEL_5:
lex_addlex(a1, a2, 2LL);
return 0LL;
}

original_code:
int lex_isind(t_lexer **list, char *word)
{
 int i;
 i = 0;
 if (word[i] == '-')
  i++;
 while (word[i] && ft_isdigit(word[i]))
  i++;
 if (!word[i])
 {
  lex_addlex(list, word, IND);
  return (0);
 }
 return (-1);
}

canonical_original_code:
int lex_isind(struct s_lexer **list, char *word)
{
 int i;
 i = 0;
 if (word[i] == '-')
  i++;
 while (word[i] && ft_isdigit(word[i]))
  i++;
 if (!word[i])
 {
  lex_addlex(list, word, IND);
  return (0);
 }
 return (-1);
}


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

result = *(_QWORD *)(a1 + 8);
if ( !result )
return a1;
*(_QWORD *)(a1 + 8) = *(_QWORD *)(result + 8);
*(_QWORD *)(result + 8) = a1;
return result;
}

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

result = *(_QWORD *)(a1 + 8);
if ( !result )
return a1;
*(_QWORD *)(a1 + 8) = *(_QWORD *)(result + 8);
*(_QWORD *)(result + 8) = a1;
return result;
}

original_code:
t_sort *ft_swap_a_and_b(t_sort *lnk)
{
 t_sort *tmp;
 t_sort *tmp2;
 if (lnk->next != ((void *)0))
 {
  tmp = lnk;
  tmp2 = lnk->next;
  tmp->next = lnk->next->next;
  tmp2->next = tmp;
  lnk = tmp2;
 }
 return (lnk);
}

canonical_original_code:
struct s_list_arg *ft_swap_a_and_b(struct s_list_arg *lnk)
{
 struct s_list_arg *tmp;
 struct s_list_arg *tmp2;
 if (lnk->next != ((void *)0))
 {
  tmp = lnk;
  tmp2 = lnk->next;
  tmp->next = lnk->next->next;
  tmp2->next = tmp;
  lnk = tmp2;
 }
 return (lnk);
}

variable_types:
lnk
struct s_list_arg *

variable_types: struct s_list_arg { int val; struct s_list_arg *next; } *


decompiled_code:
_BOOL8 __fastcall ft_swap_both(__int64 *a1, __int64 *a2, __int64 a3)
{
__int64 v5; // rdi

v5 = *a1;
if ( v5 )
*a1 = ft_swap_a_and_b(v5);
if ( *a2 )
*a2 = ft_swap_a_and_b(*a2);
*(_QWORD *)(a3 + 24) = ft_add_operation(*(_QWORD *)(a3 + 24), &unk_80);
return (unsigned int)ft_update_state(a3, *a1, *a2, 8LL) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(__int64 *a1, __int64 *a2, __int64 a3)
{
__int64 v5; // rdi

v5 = *a1;
if ( v5 )
*a1 = func0(v5);
if ( *a2 )
*a2 = func0(*a2);
*(_QWORD *)(a3 + 24) = ft_add_operation(*(_QWORD *)(a3 + 24), &unk_80);
return (unsigned int)ft_update_state(a3, *a1, *a2, 8LL) != 0;
}

original_code:
int ft_swap_both(t_sort **lnk, t_sort **lnk_b, t_state *state)
{
 char *op= "ss";
 if ((*lnk))
  (*lnk) = ft_swap_a_and_b((*lnk));
 if ((*lnk_b))
  (*lnk_b) = ft_swap_a_and_b((*lnk_b));
 state->op = ft_add_operation(state->op, op);
 if (ft_update_state(state, (*lnk), (*lnk_b), 8) == 0)
  return (0);
 return (1);
}

canonical_original_code:
int ft_swap_both(struct s_list_arg **lnk, struct s_list_arg **lnk_b, struct s_state *state)
{
 char *op = "ss";
 if ((*lnk))
  (*lnk) = ft_swap_a_and_b((*lnk));
 if ((*lnk_b))
  (*lnk_b) = ft_swap_a_and_b((*lnk_b));
 state->op = ft_add_operation(state->op, op);
 if (ft_update_state(state, (*lnk), (*lnk_b), 8) == 0)
  return (0);
 return (1);
}

variable_types: struct s_list_arg { int val; struct s_list_arg *next; } **

variable_types: struct s_state { struct s_sort { struct s_list_arg *head; struct s_sort *next; } *list; struct s_sort *list_b; struct s_list_arg *obj; char *op; } *

variable_types:
op
char *

user_defined_types: struct s_state { struct s_sort *list; struct s_sort *list_b; struct s_list_arg *obj; char *op; }


original_code:
void load_instruction(t_dat *d, t_proc *proc)
{
 t_ui wait_cyc[17] = {0, 10, 5, 5, 10, 10, 6, 6, 6, 20, 25, 25, 800
       , 10, 50, 1000, 2};
 if ((d->arena)[proc->pc] == 0 || (d->arena)[proc->pc] > 16)
 {
  proc->cycle_to_exec = 0;
  proc->pc = (proc->pc + 1) % (4*1024);
 }
 else
 {
  proc->cycle_to_exec = wait_cyc[(d->arena)[proc->pc]] - 1;
  proc->instruct = (d->arena)[proc->pc];
  proc->params = (d->arena)[proc->pc + 1];
 }
}

canonical_original_code:
void load_instruction(struct s_dat *d, struct s_proc *proc)
{
 unsigned int wait_cyc[17] = {0, 10, 5, 5, 10, 10, 6, 6, 6, 20, 25, 25, 800
       , 10, 50, 1000, 2};
 if ((d->arena)[proc->pc] == 0 || (d->arena)[proc->pc] > 16)
 {
  proc->cycle_to_exec = 0;
  proc->pc = (proc->pc + 1) % (4*1024);
 }
 else
 {
  proc->cycle_to_exec = wait_cyc[(d->arena)[proc->pc]] - 1;
  proc->instruct = (d->arena)[proc->pc];
  proc->params = (d->arena)[proc->pc + 1];
 }
}

variable_types: struct s_dat { unsigned char arena[-1]; struct s_proc { unsigned char reg[-1]; int pc; int carry; unsigned char instruct; unsigned char params; int cycle_to_exec; int nbr_live; struct s_proc *next; } **bgn_lst; struct s_hero { unsigned char *buf; char *name; int hero_num; struct s_hero *next; } *hero_lst; int cycle_to_die; int do_we_check; int nb_checks; int current_cycle; int dump; int last_player_alive; int verbose; } *

variable_types:
proc
struct s_proc *

user_defined_types: struct s_dat { unsigned char arena[-1]; struct s_proc **bgn_lst; struct s_hero *hero_lst; int cycle_to_die; int do_we_check; int nb_checks; int current_cycle; int dump; int last_player_alive; int verbose; }


original_code:
int process_cycle(t_dat *d)
{
 ft_inst *tab[17] = {((void *)0), f_live, f_ld, f_st, f_add, f_sub, f_and, f_or, f_xor, f_zjmp, f_ldi, f_sti, f_fork, f_lld, f_lldi, f_lfork, f_aff};
 t_proc *tmp;
 tmp = *(d->bgn_lst);
 while (tmp)
 {
  if (tmp->cycle_to_exec == -1)
   load_instruction(d, tmp);
  else if (tmp->cycle_to_exec == 0)
   (tab[tmp->instruct])(d, tmp);
  (tmp->cycle_to_exec)--;
  tmp = tmp->next;
 }
 return (0);
}

canonical_original_code:
int process_cycle(struct s_dat *d)
{
 void (*tab[17])(struct s_dat *dat, struct s_proc *proc) = {((void *)0), f_live, f_ld, f_st, f_add, f_sub, f_and, f_or, f_xor, f_zjmp, f_ldi, f_sti, f_fork, f_lld, f_lldi, f_lfork, f_aff};
 struct s_proc *tmp;
 tmp = *(d->bgn_lst);
 while (tmp)
 {
  if (tmp->cycle_to_exec == -1)
   load_instruction(d, tmp);
  else if (tmp->cycle_to_exec == 0)
   (tab[tmp->instruct])(d, tmp);
  (tmp->cycle_to_exec)--;
  tmp = tmp->next;
 }
 return (0);
}

variable_types: void (*[17])(struct s_dat { unsigned char arena[-1]; struct s_proc { unsigned char reg[-1]; int pc; int carry; unsigned char instruct; unsigned char params; int cycle_to_exec; int nbr_live; struct s_proc *next; } **bgn_lst; struct s_hero { unsigned char *buf; char *name; int hero_num; struct s_hero *next; } *hero_lst; int cycle_to_die; int do_we_check; int nb_checks; int current_cycle; int dump; int last_player_alive; int verbose; } *dat, struct s_proc *proc)


original_code:
int check_champions(t_dat *d, t_proc **bgn_lst)
{
 t_proc *tmp;
 int proc[2] = {0, 0};
 change_cycle_to_die(d, *bgn_lst);
 while (*bgn_lst)
 {
  proc[0] += 1;
  if ((*bgn_lst)->nbr_live == 0)
  {
   tmp = *bgn_lst;
   *bgn_lst = (*bgn_lst)->next;
   proc[1] += 1;
   free(tmp);
  }
  else
  {
   (*bgn_lst)->nbr_live = 0;
   bgn_lst = &((*bgn_lst)->next);
  }
 }
 if (d->verbose)
  ft_printf("Process killed: %d (%d alive)\n\n", proc[1], proc[0] - proc[1]);
 if (*(d->bgn_lst) == ((void *)0))
  return (-1);
 return (0);
}

canonical_original_code:
int check_champions(struct s_dat *d, struct s_proc **bgn_lst)
{
 struct s_proc *tmp;
 int proc[2] = {0, 0};
 change_cycle_to_die(d, *bgn_lst);
 while (*bgn_lst)
 {
  proc[0] += 1;
  if ((*bgn_lst)->nbr_live == 0)
  {
   tmp = *bgn_lst;
   *bgn_lst = (*bgn_lst)->next;
   proc[1] += 1;
   free(tmp);
  }
  else
  {
   (*bgn_lst)->nbr_live = 0;
   bgn_lst = &((*bgn_lst)->next);
  }
 }
 if (d->verbose)
  ft_printf("Process killed: %d (%d alive)\n\n", proc[1], proc[0] - proc[1]);
 if (*(d->bgn_lst) == ((void *)0))
  return (-1);
 return (0);
}

variable_types: struct s_proc { unsigned char reg[-1]; int pc; int carry; unsigned char instruct; unsigned char params; int cycle_to_exec; int nbr_live; struct s_proc *next; } *

variable_types:
proc
int [2]

user_defined_types: struct s_hero { unsigned char *buf; char *name; int hero_num; struct s_hero *next; }


decompiled_code:
__int64 __fastcall cycling_machine(__int64 a1)
{
int v1; // er12
int v2; // ebp
int v4; // eax

v1 = 0;
v2 = 0;
do
{
v4 = *(_DWORD *)(a1 + 4128);
*(_DWORD *)(a1 + 4128) = v4 - 1;
if ( !v4 )
return dump(a1);
process_cycle(a1);
if ( *(_DWORD *)(a1 + 4116) == v2 )
v1 = check_champions(a1, *(__int64 **)(a1 + 4096));
++v2;
}
while ( v1 != -1 );
display_winner(a1);
free_data(a1);
return 0LL;
}

original_code:
int cycling_machine(t_dat *d)
{
 int counter;
 int end;
 counter = end = 0;
 while (end != -1)
 {
  if ((d->dump)-- == 0)
   return (dump(d));
  process_cycle(d);
  if (counter == d->do_we_check)
   end = check_champions(d, d->bgn_lst);
  counter++;
 }
 display_winner(d);
 free_data(d);
 return (0);
}

canonical_original_code:
int cycling_machine(struct s_dat *d)
{
 int counter;
 int end;
 counter = end = 0;
 while (end != -1)
 {
  if ((d->dump)-- == 0)
   return (dump(d));
  process_cycle(d);
  if (counter == d->do_we_check)
   end = check_champions(d, d->bgn_lst);
  counter++;
 }
 display_winner(d);
 free_data(d);
 return (0);
}

variable_types: counter int

variable_types: end int

user_defined_types: struct s_proc { unsigned char reg[-1]; int pc; int carry; unsigned char instruct; unsigned char params; int cycle_to_exec; int nbr_live; struct s_proc *next; }


decompiled_code:
__int64 __fastcall lab_create(__int64 a1, int a2)
{
__int64 v2; // rbx

v2 = ft_memalloc(24LL);
if ( !v2 )
impossible_malloc("t_label in lab_create");
*(_QWORD *)v2 = ft_strdup(*(_QWORD *)(a1 + 8));
*(_DWORD *)(v2 + 8) = a2;
*(_QWORD *)(v2 + 16) = 0LL;
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, int a2)
{
__int64 v2; // rbx

v2 = ft_memalloc(24LL);
if ( !v2 )
impossible_malloc("t_label in lab_create");
*(_QWORD *)v2 = ft_strdup(*(_QWORD *)(a1 + 8));
*(_DWORD *)(v2 + 8) = a2;
*(_QWORD *)(v2 + 16) = 0LL;
return v2;
}

original_code:
t_label *lab_create(t_lexer *lex, int cur_pos)
{
 t_label *out;
 if ((out = (t_label *)ft_memalloc(sizeof(t_label))) == ((void *)0))
  impossible_malloc("t_label in lab_create");
 out->name = ft_strdup(lex->value);
 out->address = cur_pos;
 out->next = ((void *)0);
 return (out);
}

canonical_original_code:
struct s_label *lab_create(struct s_lexer *lex, int cur_pos)
{
 struct s_label *out;
 if ((out = (struct s_label *)ft_memalloc(sizeof(t_label))) == ((void *)0))
  impossible_malloc("t_label in lab_create");
 out->name = ft_strdup(lex->value);
 out->address = cur_pos;
 out->next = ((void *)0);
 return (out);
}

variable_types: struct s_lexer { enum e_type { NOTHING=0, REG=1, IND=2, DIR=4, LAB=8, OP=16, CMD=32, CMD_NAME=64, CMD_COM=128, DIR_LAB=256, IND_LAB=512, STR=1024, ENDOFLINE=2048, COM=4096, WHIT=8192, SEP=16384 } token; char *value; struct s_lexer *next; } *

variable_types: struct s_label { char *name; int address; struct s_label *next; } *


original_code:
int lab_addlabel(t_label **lb, t_lexer *lex, int cur_pos)
{
 t_label *new;
 t_label *save;
 new = lab_create(lex, cur_pos);
 if (*lb == ((void *)0))
  *lb = new;
 else
 {
  save = *lb;
  while ((*lb)->next != ((void *)0))
   *lb = (*lb)->next;
  (*lb)->next = new;
  *lb = save;
 }
 return (cur_pos);
}

canonical_original_code:
int lab_addlabel(struct s_label **lb, struct s_lexer *lex, int cur_pos)
{
 struct s_label *new;
 struct s_label *save;
 new = lab_create(lex, cur_pos);
 if (*lb == ((void *)0))
  *lb = new;
 else
 {
  save = *lb;
  while ((*lb)->next != ((void *)0))
   *lb = (*lb)->next;
  (*lb)->next = new;
  *lb = save;
 }
 return (cur_pos);
}

variable_types: struct s_label { char *name; int address; struct s_label *next; } **


decompiled_code:
__int64 __fastcall lab_getsizebytype(__int64 a1)
{
__int64 v1; // rbx
unsigned int v2; // er12

v1 = cmd_getcmd(*(_QWORD *)(*(_QWORD *)a1 + 8LL));
if ( !v1 )
{
ft_putstr_fd(*(_QWORD *)(*(_QWORD *)a1 + 8LL), 2LL);
ft_putchar_fd(10LL, 2LL);
kill_me("Oups... command is not define");
}
v2 = *(_DWORD *)(v1 + 12);
if ( v2 == -1 )
return (unsigned int)cmd_findsize(v1, a1);
cmd_movelexer(a1);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
__int64 v1; // rbx
unsigned int v2; // er12

v1 = cmd_getcmd(*(_QWORD *)(*(_QWORD *)a1 + 8LL));
if ( !v1 )
{
ft_putstr_fd(*(_QWORD *)(*(_QWORD *)a1 + 8LL), 2LL);
ft_putchar_fd(10LL, 2LL);
kill_me("Oups... command is not define");
}
v2 = *(_DWORD *)(v1 + 12);
if ( v2 == -1 )
return (unsigned int)cmd_findsize(v1, a1);
cmd_movelexer(a1);
return v2;
}

original_code:
int lab_getsizebytype(t_lexer **lexed)
{
 int out;
 t_cmd *cmd;
 if ((cmd = cmd_getcmd((*lexed)->value)) == ((void *)0))
 {
  ft_putstr_fd((*lexed)->value, 2);
  ft_putchar_fd('\n', 2);
  kill_me("Oups... command is not define");
 }
 if (cmd->size != -1)
 {
  out = cmd->size;
  cmd_movelexer(lexed);
 }
 else
  out = cmd_findsize(cmd, lexed);
 return (out);
}

canonical_original_code:
int lab_getsizebytype(struct s_lexer **lexed)
{
 int out;
 struct s_cmd *cmd;
 if ((cmd = cmd_getcmd((*lexed)->value)) == ((void *)0))
 {
  ft_putstr_fd((*lexed)->value, 2);
  ft_putchar_fd('\n', 2);
  kill_me("Oups... command is not define");
 }
 if (cmd->size != -1)
 {
  out = cmd->size;
  cmd_movelexer(lexed);
 }
 else
  out = cmd_findsize(cmd, lexed);
 return (out);
}

variable_types: struct s_lexer { enum e_type { NOTHING=0, REG=1, IND=2, DIR=4, LAB=8, OP=16, CMD=32, CMD_NAME=64, CMD_COM=128, DIR_LAB=256, IND_LAB=512, STR=1024, ENDOFLINE=2048, COM=4096, WHIT=8192, SEP=16384 } token; char *value; struct s_lexer *next; } **

variable_types: out int

variable_types: struct s_cmd { char *cmd; char nb_arg; char has_encoding; char is_idx; int size; struct s_cmd *next; } *


decompiled_code:
__int64 __fastcall lab_getelemsize(int **a1, __int64 a2)
{
int *v2; // rdx
int v3; // eax
__int64 result; // rax

v2 = *a1;
v3 = **a1;
if ( v3 == 64 )
{
*(_QWORD *)(*(_QWORD *)a2 + 8LL) = *(_QWORD *)(*((_QWORD *)v2 + 2) + 8LL);
cmd_movelexer(a1);
result = 0LL;
}
else if ( v3 == 128 )
{
*(_QWORD *)(*(_QWORD *)a2 + 16LL) = *(_QWORD *)(*((_QWORD *)v2 + 2) + 8LL);
cmd_movelexer(a1);
result = 0LL;
}
else
{
result = lab_getsizebytype((__int64)a1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(int **a1, __int64 a2)
{
int *v2; // rdx
int v3; // eax
__int64 result; // rax

v2 = *a1;
v3 = **a1;
if ( v3 == 64 )
{
*(_QWORD *)(*(_QWORD *)a2 + 8LL) = *(_QWORD *)(*((_QWORD *)v2 + 2) + 8LL);
cmd_movelexer(a1);
result = 0LL;
}
else if ( v3 == 128 )
{
*(_QWORD *)(*(_QWORD *)a2 + 16LL) = *(_QWORD *)(*((_QWORD *)v2 + 2) + 8LL);
cmd_movelexer(a1);
result = 0LL;
}
else
{
result = func2((__int64)a1);
}
return result;
}

original_code:
int lab_getelemsize(t_lexer **lexed, t_start **st)
{
 if ((*lexed)->token == CMD_NAME)
 {
  (*st)->name = (*lexed)->next->value;
  cmd_movelexer(lexed);
 }
 else if ((*lexed)->token == CMD_COM)
 {
  (*st)->comment = (*lexed)->next->value;
  cmd_movelexer(lexed);
 }
 else
  return (lab_getsizebytype(lexed));
 return (0);
}

canonical_original_code:
int lab_getelemsize(struct s_lexer **lexed, struct s_start **st)
{
 if ((*lexed)->token == CMD_NAME)
 {
  (*st)->name = (*lexed)->next->value;
  cmd_movelexer(lexed);
 }
 else if ((*lexed)->token == CMD_COM)
 {
  (*st)->comment = (*lexed)->next->value;
  cmd_movelexer(lexed);
 }
 else
  return (lab_getsizebytype(lexed));
 return (0);
}

variable_types: struct s_start { char *filename; char *name; char *comment; int prog_size; struct s_lexer *lexer; } **


decompiled_code:
__int64 __fastcall lab_firstpass(__int64 a1, int *a2, __int64 a3, __int64 *a4)
{
unsigned int v6; // ebx
int *v7; // rsi
__int64 result; // rax
int *v9; // [rsp+8h] [rbp-20h] BYREF

v9 = a2;
if ( (unsigned int)sta_init(a3, a1) )
return 0xFFFFFFFFLL;
v6 = 0;
v7 = v9;
for ( *(_QWORD *)(*(_QWORD *)a3 + 32LL) = v9; v7; v9 = v7 )
{
if ( *v7 != 2048 )
{
if ( *v7 == 8 )
v6 = lab_addlabel(a4, (__int64)v7, v6);
else
v6 += lab_getelemsize(&v9, a3);
}
if ( !v9 )
break;
v7 = (int *)*((_QWORD *)v9 + 2);
}
result = lab_check(*(_QWORD *)(*(_QWORD *)a3 + 32LL), *a4);
if ( (_DWORD)result )
return 0xFFFFFFFFLL;
*(_DWORD *)(*(_QWORD *)a3 + 24LL) = v6;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, int *a2, __int64 a3, __int64 *a4)
{
unsigned int v6; // ebx
int *v7; // rsi
__int64 result; // rax
int *v9; // [rsp+8h] [rbp-20h] BYREF

v9 = a2;
if ( (unsigned int)sta_init(a3, a1) )
return 0xFFFFFFFFLL;
v6 = 0;
v7 = v9;
for ( *(_QWORD *)(*(_QWORD *)a3 + 32LL) = v9; v7; v9 = v7 )
{
if ( *v7 != 2048 )
{
if ( *v7 == 8 )
v6 = func1(a4, (__int64)v7, v6);
else
v6 += func3(&v9, a3);
}
if ( !v9 )
break;
v7 = (int *)*((_QWORD *)v9 + 2);
}
result = lab_check(*(_QWORD *)(*(_QWORD *)a3 + 32LL), *a4);
if ( (_DWORD)result )
return 0xFFFFFFFFLL;
*(_DWORD *)(*(_QWORD *)a3 + 24LL) = v6;
return result;
}

original_code:
int lab_firstpass(char *file, t_lexer *lexed, t_start **st, t_label **lb)
{
 int current_pos;
 if (sta_init(st, file) != 0)
  return (-1);
 (*st)->lexer = lexed;
 current_pos = 0;
 while (lexed)
 {
  if (lexed->token != ENDOFLINE)
  {
   if (lexed->token == LAB)
    current_pos = lab_addlabel(lb, lexed, current_pos);
   else
    current_pos += lab_getelemsize(&lexed, st);
  }
  if (!lexed)
   break ;
  lexed = lexed->next;
 }
 if (lab_check((*st)->lexer, *lb) != 0)
  return (-1);
 (*st)->prog_size = current_pos;
 return (0);
}

canonical_original_code:
int lab_firstpass(char *file, struct s_lexer *lexed, struct s_start **st, struct s_label **lb)
{
 int current_pos;
 if (sta_init(st, file) != 0)
  return (-1);
 (*st)->lexer = lexed;
 current_pos = 0;
 while (lexed)
 {
  if (lexed->token != ENDOFLINE)
  {
   if (lexed->token == LAB)
    current_pos = lab_addlabel(lb, lexed, current_pos);
   else
    current_pos += lab_getelemsize(&lexed, st);
  }
  if (!lexed)
   break ;
  lexed = lexed->next;
 }
 if (lab_check((*st)->lexer, *lb) != 0)
  return (-1);
 (*st)->prog_size = current_pos;
 return (0);
}

variable_types:
file
char *

user_defined_types: struct s_start { char *filename; char *name; char *comment; int prog_size; struct s_lexer *lexer; }

user_defined_types: struct s_label { char *name; int address; struct s_label *next; }


decompiled_code:
void __fastcall free_one(void *a1)
{
if ( a1 )
free(a1);
}

canonical_decompiled_code:
void __fastcall func0(void *a1)
{
if ( a1 )
free(a1);
}

original_code:
void free_one(void *any)
{
 if (any != ((void *)0))
 {
  free(any);
  any = ((void *)0);
 }
}

variable_types:
any
void *


decompiled_code:
void __fastcall free_char_tab(void *ptr)
{
void *v2; // rdi
void **v3; // rbx

if ( ptr )
{
v2 = *(void **)ptr;
if ( v2 )
{
v3 = (void **)ptr;
do
{
free(v2);
*v3++ = 0LL;
v2 = *v3;
}
while ( *v3 );
}
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func1(void *ptr)
{
void *v2; // rdi
void **v3; // rbx

if ( ptr )
{
v2 = *(void **)ptr;
if ( v2 )
{
v3 = (void **)ptr;
do
{
free(v2);
*v3++ = 0LL;
v2 = *v3;
}
while ( *v3 );
}
free(ptr);
}
}

original_code:
void free_char_tab(char **tab)
{
 int i;
 i = 0;
 if (tab != ((void *)0))
 {
  while (tab[i] != ((void *)0))
  {
   free(tab[i]);
   tab[i] = ((void *)0);
   i++;
  }
  free(tab);
  tab = ((void *)0);
 }
}

variable_types:
tab
char **

variable_types: i int


original_code:
void f_lld(t_dat *dat, t_proc *proc)
{
 long param_val[3];
 t_uc *dest;
 int dest2;
 get_long_params(dat, proc, param_val, 4);
 if (param_val[1] > 0 && param_val[1] < 16 + 1)
 {
  dest = proc->reg + ((param_val[1]) * 4) - 1;
  if (dat->verbose)
   ft_printf("lld: value %ld -> reg%ld\n", param_val[0], param_val[1]);
  write_long_to_mem(param_val[0], dest, 4);
  dest2 = (proc->pc + param_val[0]) % (4*1024);
  proc->carry = (get_val(dat->arena, dest2, 4) == 0 ? 1 : 0);
 }
 move_pc(proc, 4);
}

canonical_original_code:
void f_lld(struct s_dat *dat, struct s_proc *proc)
{
 long param_val[3];
 unsigned char *dest;
 int dest2;
 get_long_params(dat, proc, param_val, 4);
 if (param_val[1] > 0 && param_val[1] < 16 + 1)
 {
  dest = proc->reg + ((param_val[1]) * 4) - 1;
  if (dat->verbose)
   ft_printf("lld: value %ld -> reg%ld\n", param_val[0], param_val[1]);
  write_long_to_mem(param_val[0], dest, 4);
  dest2 = (proc->pc + param_val[0]) % (4*1024);
  proc->carry = (get_val(dat->arena, dest2, 4) == 0 ? 1 : 0);
 }
 move_pc(proc, 4);
}

variable_types: struct s_dat { unsigned char arena[-1]; struct s_proc { unsigned char reg[-1]; int pc; int carry; unsigned char instruct; unsigned char params; int cycle_to_exec; int nbr_live; struct s_proc *next; } **bgn_lst; struct s_hero { unsigned char *buf; char *name; int hero_num; struct s_hero *next; } *hero_lst; int cycle_to_die; int do_we_check; int nb_checks; int current_cycle; int dump; int last_player_alive; int verbose; } *

variable_types:
proc
struct s_proc *

variable_types:
dest
unsigned char *


decompiled_code:
__int64 __fastcall handle_space(_BYTE **a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v4; // rdi
__int64 v5; // rax

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 12) )
{
if ( !*(_DWORD *)(result + 16) )
{
v4 = *a1;
if ( v4 )
{
if ( *v4 != 45 )
{
v5 = ft_strlen();
result = ft_strpad2(a1, v5 + 1, 0LL, 32LL);
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE **a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v4; // rdi
__int64 v5; // rax

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 12) )
{
if ( !*(_DWORD *)(result + 16) )
{
v4 = *a1;
if ( v4 )
{
if ( *v4 != 45 )
{
v5 = ft_strlen();
result = ft_strpad2(a1, v5 + 1, 0LL, 32LL);
}
}
}
}
return result;
}

original_code:
void handle_space(char **s, t_format *format)
{
 if (format->f_list->has_space && !format->f_list->has_plus)
 {
  if (*s && ((*s)[0] != '-'))
   ft_strpad2(s, ft_strlen(*s) + 1, PAD_LEFT, ' ');
 }
}

canonical_original_code:
void handle_space(char **s, struct s_format *format)
{
 if (format->f_list->has_space && !format->f_list->has_plus)
 {
  if (*s && ((*s)[0] != '-'))
   ft_strpad2(s, ft_strlen(*s) + 1, PAD_LEFT, ' ');
 }
}

variable_types:
s
char **

variable_types: struct s_format { int start; int arg_nb; struct s_flags { int has_hashtag; int has_zero; int has_minus; int has_space; int has_plus; } *f_list; int m_width; int preci; char *l_mod; char conv; unsigned long length; char *format; int has_star; struct s_format *next; } *

user_defined_types: struct s_format { int start; int arg_nb; struct s_flags *f_list; int m_width; int preci; char *l_mod; char conv; unsigned long length; char *format; int has_star; struct s_format *next; }


decompiled_code:
__int64 __fastcall handle_zero(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // esi

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 4) && !*(_DWORD *)(result + 8) && *(_DWORD *)(a2 + 20) == -1 )
{
v3 = *(_DWORD *)(a2 + 16);
if ( v3 )
result = ft_strpad2(a1, v3, 0LL, 48LL);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // esi

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 4) && !*(_DWORD *)(result + 8) && *(_DWORD *)(a2 + 20) == -1 )
{
v3 = *(_DWORD *)(a2 + 16);
if ( v3 )
result = ft_strpad2(a1, v3, 0LL, 48LL);
}
return result;
}

original_code:
void handle_zero(char **s, t_format *format)
{
 if (format->f_list->has_zero)
 {
  if ((!format->f_list->has_minus) && (format->preci == -1))
   if (format->m_width != 0)
    ft_strpad2(s, format->m_width, PAD_LEFT, '0');
 }
}

canonical_original_code:
void handle_zero(char **s, struct s_format *format)
{
 if (format->f_list->has_zero)
 {
  if ((!format->f_list->has_minus) && (format->preci == -1))
   if (format->m_width != 0)
    ft_strpad2(s, format->m_width, PAD_LEFT, '0');
 }
}

user_defined_types: struct s_flags { int has_hashtag; int has_zero; int has_minus; int has_space; int has_plus; }


decompiled_code:
__int64 __fastcall handle_minus(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // esi

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 8) )
{
v3 = *(_DWORD *)(a2 + 16);
if ( v3 )
result = ft_strpad2(a1, v3, 1LL, 32LL);
}
return result;
}

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

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 8) )
{
v3 = *(_DWORD *)(a2 + 16);
if ( v3 )
result = ft_strpad2(a1, v3, 1LL, 32LL);
}
return result;
}

original_code:
void handle_minus(char **s, t_format *format)
{
 if (format->f_list->has_minus && (format->m_width != 0))
  ft_strpad2(s, format->m_width, PAD_RIGHT, ' ');
}

canonical_original_code:
void handle_minus(char **s, struct s_format *format)
{
 if (format->f_list->has_minus && (format->m_width != 0))
  ft_strpad2(s, format->m_width, PAD_RIGHT, ' ');
}


decompiled_code:
__int64 __fastcall handle_plus(_BYTE **a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v4; // rdi
__int64 v5; // rax

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 16) )
{
v4 = *a1;
if ( v4 )
{
if ( *v4 != 45 )
{
v5 = ft_strlen();
result = ft_strpad2(a1, v5 + 1, 0LL, 43LL);
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(_BYTE **a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v4; // rdi
__int64 v5; // rax

result = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(result + 16) )
{
v4 = *a1;
if ( v4 )
{
if ( *v4 != 45 )
{
v5 = ft_strlen();
result = ft_strpad2(a1, v5 + 1, 0LL, 43LL);
}
}
}
return result;
}

original_code:
void handle_plus(char **s, t_format *format)
{
 if (format->f_list->has_plus)
  if (*s && ((*s)[0] != '-'))
   ft_strpad2(s, ft_strlen(*s) + 1, PAD_LEFT, '+');
}

canonical_original_code:
void handle_plus(char **s, struct s_format *format)
{
 if (format->f_list->has_plus)
  if (*s && ((*s)[0] != '-'))
   ft_strpad2(s, ft_strlen(*s) + 1, PAD_LEFT, '+');
}


decompiled_code:
__int64 __fastcall handle_flags_for_d(_BYTE **a1, __int64 a2)
{
handle_zero((__int64)a1, a2);
handle_minus((__int64)a1, a2);
handle_space(a1, a2);
return handle_plus(a1, a2);
}

original_code:
void handle_flags_for_d(char **s, t_format *format)
{
 handle_zero(s, format);
 handle_minus(s, format);
 handle_space(s, format);
 handle_plus(s, format);
}

canonical_original_code:
void handle_flags_for_d(char **s, struct s_format *format)
{
 handle_zero(s, format);
 handle_minus(s, format);
 handle_space(s, format);
 handle_plus(s, format);
}


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

result = 1LL;
if ( a1 )
result = power_256((unsigned int)(a1 - 1)) << 8;
return result;
}

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

result = 1LL;
if ( a1 )
result = func1((unsigned int)(a1 - 1)) << 8;
return result;
}

original_code:
long power_256(int coef)
{
 if (coef == 0)
  return (1);
 return (256 * power_256(--coef));
}

variable_types: coef int

return_type: long


original_code:
long get_val(t_uc *mem, int addr, int size)
{
 long ret;
 int i;
 ret = 0;
 i = 0;
 size--;
 while (i <= size)
 {
  ret += (mem[(addr + i) % (4*1024)] * power_256(size - i));
  i++;
 }
 return (ret);
}

canonical_original_code:
long get_val(unsigned char *mem, int addr, int size)
{
 long ret;
 int i;
 ret = 0;
 i = 0;
 size--;
 while (i <= size)
 {
  ret += (mem[(addr + i) % (4*1024)] * power_256(size - i));
  i++;
 }
 return (ret);
}

variable_types:
mem
unsigned char *

variable_types: addr int

variable_types: size int

variable_types: ret long


decompiled_code:
__int64 __fastcall get_params(__int64 a1, __int64 a2, __int64 *a3, int a4)
{
int v4; // er13
int v6; // ebx
int v7; // er12
__int64 result; // rax
int v9; // eax
int v10; // eax

v4 = *(_DWORD *)(a2 + 64) + 2;
v6 = 6;
do
{
result = ((int)*(unsigned __int8 *)(a2 + 73) >> v6) & 3;
v7 = result;
if ( (unsigned int)(result - 1) <= 1 )
{
if ( (_DWORD)result != 1 )
v7 = a4;
result = get_val(a1, v4, v7);
*a3 = result;
v4 += v7;
}
else if ( (_DWORD)result == 3 )
{
v9 = get_val(a1, v4, 2);
v10 = get_true_val(v9, 1LL, 2LL);
result = get_val(a1, *(_DWORD *)(a2 + 64) + v10, 4);
*a3 = result;
v4 += 2;
}
++a3;
v6 -= 2;
}
while ( v6 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 *a3, int a4)
{
int v4; // er13
int v6; // ebx
int v7; // er12
__int64 result; // rax
int v9; // eax
int v10; // eax

v4 = *(_DWORD *)(a2 + 64) + 2;
v6 = 6;
do
{
result = ((int)*(unsigned __int8 *)(a2 + 73) >> v6) & 3;
v7 = result;
if ( (unsigned int)(result - 1) <= 1 )
{
if ( (_DWORD)result != 1 )
v7 = a4;
result = func2(a1, v4, v7);
*a3 = result;
v4 += v7;
}
else if ( (_DWORD)result == 3 )
{
v9 = func2(a1, v4, 2);
v10 = get_true_val(v9, 1LL, 2LL);
result = func2(a1, *(_DWORD *)(a2 + 64) + v10, 4);
*a3 = result;
v4 += 2;
}
++a3;
v6 -= 2;
}
while ( v6 );
return result;
}

original_code:
void get_params(t_dat *d, t_proc *p, long param_val[3], int dir_s)
{
 int i;
 int addr;
 int tmp;
 int type;
 i = -1;
 addr = p->pc + 2;
 while (++i < 3)
 {
  type = ((p->params >> ((3 - i) * 2)) % 4);
  if (type == 1 || type == 2)
  {
   tmp = (type == 1 ? ((16 / 256) + 1) : dir_s);
   param_val[i] = get_val(d->arena, addr, tmp);
   addr += tmp;
  }
  else if (type == 3)
  {
   type = get_val(d->arena, addr, 2);
   type = get_true_val(type, 1, 2);
   param_val[i] = get_val(d->arena
    , p->pc + type, 4);
   addr += 2;
  }
 }
}

canonical_original_code:
void get_params(struct s_dat *d, struct s_proc *p, long param_val[3], int dir_s)
{
 int i;
 int addr;
 int tmp;
 int type;
 i = -1;
 addr = p->pc + 2;
 while (++i < 3)
 {
  type = ((p->params >> ((3 - i) * 2)) % 4);
  if (type == 1 || type == 2)
  {
   tmp = (type == 1 ? ((16 / 256) + 1) : dir_s);
   param_val[i] = get_val(d->arena, addr, tmp);
   addr += tmp;
  }
  else if (type == 3)
  {
   type = get_val(d->arena, addr, 2);
   type = get_true_val(type, 1, 2);
   param_val[i] = get_val(d->arena
    , p->pc + type, 4);
   addr += 2;
  }
 }
}

variable_types:
p
struct s_proc *

variable_types: tmp int

variable_types: type int


decompiled_code:
__int64 __fastcall move_pc(__int64 a1, int a2)
{
int v2; // ecx
int v3; // edx
int v4; // eax
int v5; // edx
__int64 result; // rax

v2 = 6;
v3 = 2;
do
{
v4 = ((int)*(unsigned __int8 *)(a1 + 73) >> v2) % 4;
switch ( v4 )
{
case 1:
++v3;
break;
case 2:
v3 += a2;
break;
case 3:
v3 += 2;
break;
}
v2 -= 2;
}
while ( v2 );
v5 = *(_DWORD *)(a1 + 64) + v3;
result = (unsigned int)(v5 >> 31) >> 20;
*(_DWORD *)(a1 + 64) = v5 % 4096;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, int a2)
{
int v2; // ecx
int v3; // edx
int v4; // eax
int v5; // edx
__int64 result; // rax

v2 = 6;
v3 = 2;
do
{
v4 = ((int)*(unsigned __int8 *)(a1 + 73) >> v2) % 4;
switch ( v4 )
{
case 1:
++v3;
break;
case 2:
v3 += a2;
break;
case 3:
v3 += 2;
break;
}
v2 -= 2;
}
while ( v2 );
v5 = *(_DWORD *)(a1 + 64) + v3;
result = (unsigned int)(v5 >> 31) >> 20;
*(_DWORD *)(a1 + 64) = v5 % 4096;
return result;
}

original_code:
void move_pc(t_proc *proc, int dir_s)
{
 int i;
 int nb_byte_to_move;
 int type;
 i = type = 0;
 nb_byte_to_move = 2;
 while (i < 3)
 {
  type = ((proc->params >> ((3 - i) * 2)) % 4);
  if (type == 1)
   nb_byte_to_move += ((16 / 256) + 1);
  else if (type == 2)
   nb_byte_to_move += dir_s;
  else if (type == 3)
   nb_byte_to_move += 2;
  ++i;
 }
 proc->pc = (proc->pc + nb_byte_to_move) % (4*1024);
}

canonical_original_code:
void move_pc(struct s_proc *proc, int dir_s)
{
 int i;
 int nb_byte_to_move;
 int type;
 i = type = 0;
 nb_byte_to_move = 2;
 while (i < 3)
 {
  type = ((proc->params >> ((3 - i) * 2)) % 4);
  if (type == 1)
   nb_byte_to_move += ((16 / 256) + 1);
  else if (type == 2)
   nb_byte_to_move += dir_s;
  else if (type == 3)
   nb_byte_to_move += 2;
  ++i;
 }
 proc->pc = (proc->pc + nb_byte_to_move) % (4*1024);
}

variable_types: struct s_proc { unsigned char reg[-1]; int pc; int carry; unsigned char instruct; unsigned char params; int cycle_to_exec; int nbr_live; struct s_proc *next; } *


repo: kimtang/qml

decompiled_code:
void __fastcall d_asin(double *a1)
{
asin(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
asin(*a1);
}

original_code:
double d_asin(doublereal *x)
{
return( asin(*x) );
}

canonical_original_code:
double d_asin(double *x)
{
return( asin(*x) );
}

variable_types:
x
double *

return_type: double


decompiled_code:
_BOOL8 x_wSL()
{
int v0; // eax

v0 = f__putbuf(10LL);
f__cursor = 0LL;
f__recpos = 0;
f__hiwater = 0LL;
return v0 == 0;
}

canonical_decompiled_code:
_BOOL8 func0()
{
int v0; // eax

v0 = f__putbuf(10LL);
f__cursor = 0LL;
f__recpos = 0;
f__hiwater = 0LL;
return v0 == 0;
}

original_code:
int
x_wSL(void)
{
 int n = f__putbuf('\n');
 f__hiwater = f__recpos = f__cursor = 0;
 return(n == 0);
}

canonical_original_code:
int x_wSL()
{
 int n = f__putbuf('\n');
 f__hiwater = f__recpos = f__cursor = 0;
 return(n == 0);
}

variable_types: n int


decompiled_code:
__int64 __fastcall s_wsfe(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

if ( !f__init )
f_init();
f__reading = 0LL;
f__sequential = 1LL;
f__formatted = 1LL;
f__external = 1LL;
LODWORD(result) = c_sfe(a1);
if ( (_DWORD)result )
return (int)result;
f__elist = a1;
f__recpos = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
f__nonl = 0LL;
f__scale = 0;
f__fmtbuf = a1[3];
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( (int)pars_f() < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startio");
result = 100LL;
}
else
{
f__putn = &x_putc;
f__doed = &w_ed;
f__doned = &w_ned;
f__doend = sub_A2;
f__dorevert = sub_44;
f__donewrec = x_wSL;
fmt_bg();
f__cplus = 0LL;
f__cblank = f__curunit[7];
result = 0LL;
if ( f__curunit[9] != 1LL )
{
v2 = f__nowwriting();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "write start");
}
result = *_errno_location();
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1)
{
__int64 result; // rax
int v2; // edx
int *v3; // rax

if ( !f__init )
f_init();
f__reading = 0LL;
f__sequential = 1LL;
f__formatted = 1LL;
f__external = 1LL;
LODWORD(result) = c_sfe(a1);
if ( (_DWORD)result )
return (int)result;
f__elist = a1;
f__recpos = 0;
f__cursor = 0LL;
f__hiwater = 0LL;
f__nonl = 0LL;
f__scale = 0;
f__fmtbuf = a1[3];
f = (_QWORD (__fastcall *)(char, float))*f__curunit;
if ( (int)pars_f() < 0 )
{
if ( *a1 )
*_errno_location() = 100;
else
f__fatal(100LL, "startio");
result = 100LL;
}
else
{
f__putn = &x_putc;
f__doed = &w_ed;
f__doned = &w_ned;
f__doend = sub_A2;
f__dorevert = sub_44;
f__donewrec = x_wSL;
fmt_bg();
f__cplus = 0LL;
f__cblank = f__curunit[7];
result = 0LL;
if ( f__curunit[9] != 1LL )
{
v2 = f__nowwriting();
result = 0LL;
if ( v2 )
{
if ( !*a1 )
{
v3 = _errno_location();
f__fatal((unsigned int)*v3, "write start");
}
result = *_errno_location();
}
}
}
return result;
}

original_code:
integer s_wsfe(cilist *a)
{ int n;
 if(!f__init) f_init();
 f__reading=0;
 f__sequential=1;
 f__formatted=1;
 f__external=1;
 if(n=c_sfe(a)) return(n);
 f__elist=a;
 f__hiwater = f__cursor=f__recpos=0;
 f__nonl = 0;
 f__scale=0;
 f__fmtbuf=a->cifmt;
 f__cf=f__curunit->ufd;
 if(pars_f(f__fmtbuf)<0) {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"startio"); return(100);};
 f__putn= x_putc;
 f__doed= w_ed;
 f__doned= w_ned;
 f__doend=xw_end;
 f__dorevert=xw_rev;
 f__donewrec=x_wSL;
 fmt_bg();
 f__cplus=0;
 f__cblank=f__curunit->ublnk;
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"write start"); return((*__errno_location ()));};
 return(0);
}

canonical_original_code:
long s_wsfe(struct cilist *a)
{ int n;
 if(!f__init) f_init();
 f__reading=0;
 f__sequential=1;
 f__formatted=1;
 f__external=1;
 if(n=c_sfe(a)) return(n);
 f__elist=a;
 f__hiwater = f__cursor=f__recpos=0;
 f__nonl = 0;
 f__scale=0;
 f__fmtbuf=a->cifmt;
 f__cf=f__curunit->ufd;
 if(pars_f(f__fmtbuf)<0) {if(a->cierr) (*__errno_location ())= 100; else f__fatal(100,"startio"); return(100);};
 f__putn= x_putc;
 f__doed= w_ed;
 f__doned= w_ned;
 f__doend=xw_end;
 f__dorevert=xw_rev;
 f__donewrec=x_wSL;
 fmt_bg();
 f__cplus=0;
 f__cblank=f__curunit->ublnk;
 if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
  {if(a->cierr) (*__errno_location ())= (*__errno_location ()); else f__fatal((*__errno_location ()),"write start"); return((*__errno_location ()));};
 return(0);
}

variable_types: struct cilist { long cierr; long ciunit; long ciend; char *cifmt; long cirec; } *


decompiled_code:
void __fastcall r_exp(float *a1)
{
exp(*a1);
}

canonical_decompiled_code:
void __fastcall func0(float *a1)
{
exp(*a1);
}

original_code:
double r_exp(real *x)
{
return( exp(*x) );
}

canonical_original_code:
double r_exp(float *x)
{
return( exp(*x) );
}

variable_types:
x
float *


decompiled_code:
void __fastcall d_exp(double *a1)
{
exp(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
exp(*a1);
}

original_code:
double d_exp(doublereal *x)
{
return( exp(*x) );
}

canonical_original_code:
double d_exp(double *x)
{
return( exp(*x) );
}


decompiled_code:
unsigned __int64 hl_lt()
{
return (unsigned __int64)s_cmp() >> 63;
}

canonical_decompiled_code:
unsigned __int64 func0()
{
return (unsigned __int64)s_cmp() >> 63;
}

original_code:
shortlogical hl_lt(char *a, char *b, ftnlen la, ftnlen lb)
{
return(s_cmp(a,b,la,lb) < 0);
}

canonical_original_code:
short hl_lt(char *a, char *b, long la, long lb)
{
return(s_cmp(a,b,la,lb) < 0);
}

variable_types:
a
char *

variable_types:
b
char *

variable_types: la long

variable_types: lb long

return_type: short


decompiled_code:
void __fastcall erf_(float *a1)
{
erf(*a1);
}

canonical_decompiled_code:
void __fastcall func0(float *a1)
{
erf(*a1);
}

original_code:
double erf_(real *x)
{
return( erf((double)*x) );
}

canonical_original_code:
double erf_(float *x)
{
return( erf((double)*x) );
}


decompiled_code:
double __fastcall d_dim(double *a1, double *a2)
{
double v3; // [rsp+0h] [rbp-18h]

if ( *a1 <= *a2 )
v3 = 0.0;
else
v3 = *a1 - *a2;
return v3;
}

canonical_decompiled_code:
double __fastcall func0(double *a1, double *a2)
{
double v3; // [rsp+0h] [rbp-18h]

if ( *a1 <= *a2 )
v3 = 0.0;
else
v3 = *a1 - *a2;
return v3;
}

original_code:
double d_dim(doublereal *a, doublereal *b)
{
return( *a > *b ? *a - *b : 0);
}

canonical_original_code:
double d_dim(double *a, double *b)
{
return( *a > *b ? *a - *b : 0);
}

variable_types:
a
double *

variable_types:
b
double *


original_code:
char *f__icvt(long value, int *ndigit, int *sign, int base)
{
 static char buf[23 +1];
 register int i;
 unsigned long uvalue;
 if(value > 0) {
  uvalue = value;
  *sign = 0;
  }
 else if (value < 0) {
  uvalue = -value;
  *sign = 1;
  }
 else {
  *sign = 0;
  *ndigit = 1;
  buf[23 -1] = '0';
  return &buf[23 -1];
  }
 i = 23;
 do {
  buf[--i] = (uvalue%base) + '0';
  uvalue /= base;
  }
  while(uvalue > 0);
 *ndigit = 23 - i;
 return &buf[i];
 }

canonical_original_code:
char *f__icvt(long value, int *ndigit, int *sign, int base)
{
 static char buf[-1];
 register int i;
 unsigned long uvalue;
 if(value > 0) {
  uvalue = value;
  *sign = 0;
  }
 else if (value < 0) {
  uvalue = -value;
  *sign = 1;
  }
 else {
  *sign = 0;
  *ndigit = 1;
  buf[23 -1] = '0';
  return &buf[23 -1];
  }
 i = 23;
 do {
  buf[--i] = (uvalue%base) + '0';
  uvalue /= base;
  }
  while(uvalue > 0);
 *ndigit = 23 - i;
 return &buf[i];
 }

variable_types: value long

variable_types:
ndigit
int *

variable_types:
sign
int *

variable_types: base int

variable_types:
buf
char [-1]

variable_types: i int

variable_types:
uvalue
unsigned long

return_type: char *


decompiled_code:
void __fastcall d_sinh(double *a1)
{
sinh(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
sinh(*a1);
}

original_code:
double d_sinh(doublereal *x)
{
return( sinh(*x) );
}

canonical_original_code:
double d_sinh(double *x)
{
return( sinh(*x) );
}

variable_types:
x
double *


decompiled_code:
__int64 __fastcall h_len(__int64 a1, __int64 a2)
{
return a2;
}

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

original_code:
shortint h_len(char *s, ftnlen n)
{
return(n);
}

canonical_original_code:
short h_len(char *s, long n)
{
return(n);
}

variable_types:
s
char *

variable_types: n long


decompiled_code:
void __fastcall d_atan(double *a1)
{
atan(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
atan(*a1);
}

original_code:
double d_atan(doublereal *x)
{
return( atan(*x) );
}

canonical_original_code:
double d_atan(double *x)
{
return( atan(*x) );
}


decompiled_code:
__int64 __fastcall h_sign(_WORD *a1, __int16 *a2)
{
int v2; // edx
__int64 result; // rax
unsigned int v4; // edx

v2 = (unsigned __int16)*a1;
LOWORD(v2) = (__int16)v2 >> 15;
result = (unsigned int)(unsigned __int16)(*a1 ^ v2) - v2;
v4 = v2 - (unsigned __int16)(*a1 ^ v2);
if ( *a2 < 0 )
result = v4;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_WORD *a1, __int16 *a2)
{
int v2; // edx
__int64 result; // rax
unsigned int v4; // edx

v2 = (unsigned __int16)*a1;
LOWORD(v2) = (__int16)v2 >> 15;
result = (unsigned int)(unsigned __int16)(*a1 ^ v2) - v2;
v4 = v2 - (unsigned __int16)(*a1 ^ v2);
if ( *a2 < 0 )
result = v4;
return result;
}

original_code:
shortint h_sign(shortint *a, shortint *b)
{
shortint x;
x = (*a >= 0 ? *a : - *a);
return( *b >= 0 ? x : -x);
}

canonical_original_code:
short h_sign(short *a, short *b)
{
short x;
x = (*a >= 0 ? *a : - *a);
return( *b >= 0 ? x : -x);
}

variable_types:
a
short *

variable_types:
b
short *

variable_types: x short


original_code:
shortint h_indx(char *a, char *b, ftnlen la, ftnlen lb)
{
ftnlen i, n;
char *s, *t, *bend;
n = la - lb + 1;
bend = b + lb;
for(i = 0 ; i < n ; ++i)
 {
 s = a + i;
 t = b;
 while(t < bend)
  if(*s++ != *t++)
   goto no;
 return((shortint)i+1);
 no: ;
 }
return(0);
}

canonical_original_code:
short h_indx(char *a, char *b, long la, long lb)
{
long i; long n;
char *s; char *t; char *bend;
n = la - lb + 1;
bend = b + lb;
for(i = 0 ; i < n ; ++i)
 {
 s = a + i;
 t = b;
 while(t < bend)
  if(*s++ != *t++)
   goto no;
 return((short)i+1);
 no: ;
 }
return(0);
}

variable_types:
a
char *

variable_types:
b
char *

variable_types: la long

variable_types: i long

variable_types:
t
char *

variable_types:
bend
char *


decompiled_code:
__int64 __fastcall h_mod(__int16 *a1, __int16 *a2)
{
return (unsigned int)(*a1 % *a2);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int16 *a1, __int16 *a2)
{
return (unsigned int)(*a1 % *a2);
}

original_code:
shortint h_mod(short *a, short *b)
{
return( *a % *b);
}

canonical_original_code:
short h_mod(short *a, short *b)
{
return( *a % *b);
}


decompiled_code:
void __noreturn abort_()
{
sig_die("Fortran abort routine called", 1LL);
}

canonical_decompiled_code:
void __noreturn func0()
{
sig_die("Fortran abort routine called", 1LL);
}

original_code:
int abort_(void)
{
sig_die("Fortran abort routine called", 1);
return 0;
}

canonical_original_code:
int abort_()
{
sig_die("Fortran abort routine called", 1);
return 0;
}


decompiled_code:
void __fastcall c_log(float *a1, float *a2)
{
float v2; // xmm0_4
float v3; // xmm0_4
double y; // [rsp+0h] [rbp-48h]
double x; // [rsp+8h] [rbp-40h]
double v6; // [rsp+20h] [rbp-28h]

x = *a2;
y = a2[1];
v2 = atan2(y, x);
a1[1] = v2;
v6 = f__cabs(x, y);
v3 = log(v6);
*a1 = v3;
}

canonical_decompiled_code:
void __fastcall func0(float *a1, float *a2)
{
float v2; // xmm0_4
float v3; // xmm0_4
double y; // [rsp+0h] [rbp-48h]
double x; // [rsp+8h] [rbp-40h]
double v6; // [rsp+20h] [rbp-28h]

x = *a2;
y = a2[1];
v2 = atan2(y, x);
a1[1] = v2;
v6 = f__cabs(x, y);
v3 = log(v6);
*a1 = v3;
}

original_code:
void c_log(complex *r, complex *z)
{
 double zi, zr;
 r->i = atan2(zi = z->i, zr = z->r);
 r->r = log( f__cabs(zr, zi) );
 }

canonical_original_code:
void c_log(struct complex *r, struct complex *z)
{
 double zi; double zr;
 r->i = atan2(zi = z->i, zr = z->r);
 r->r = log( f__cabs(zr, zi) );
 }

variable_types:
r
struct complex { float r; } *

variable_types:
z
struct complex *

variable_types: zi double

variable_types: zr double


decompiled_code:
void __fastcall r_log(float *a1)
{
log(*a1);
}

canonical_decompiled_code:
void __fastcall func0(float *a1)
{
log(*a1);
}

original_code:
double r_log(real *x)
{
return( log(*x) );
}

canonical_original_code:
double r_log(float *x)
{
return( log(*x) );
}

variable_types:
x
float *


decompiled_code:
__int64 __fastcall do_lio(_QWORD *a1, __int64 a2, __int64 a3, __int64 a4)
{
return (int)f__lioproc(a2, a3, a4, *a1);
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1, __int64 a2, __int64 a3, __int64 a4)
{
return (int)f__lioproc(a2, a3, a4, *a1);
}

original_code:
integer do_lio(ftnint *type, ftnint *number, char *ptr, ftnlen len)
{
 return((*f__lioproc)(number,ptr,len,*type));
}

canonical_original_code:
long do_lio(long *type, long *number, char *ptr, long len)
{
 return((*f__lioproc)(number,ptr,len,*type));
}

variable_types:
type
long *

variable_types:
number
long *

variable_types:
ptr
char *

variable_types: len long


decompiled_code:
void __fastcall d_cos(double *a1)
{
cos(*a1);
}

canonical_decompiled_code:
void __fastcall func0(double *a1)
{
cos(*a1);
}

original_code:
double d_cos(doublereal *x)
{
return( cos(*x) );
}

canonical_original_code:
double d_cos(double *x)
{
return( cos(*x) );
}

variable_types:
x
double *


original_code:
shortint h_dnnt(doublereal *x)
{
return (shortint)(*x >= 0. ? floor(*x + .5) : -floor(.5 - *x));
}

canonical_original_code:
short h_dnnt(double *x)
{
return (shortint)(*x >= 0. ? floor(*x + .5) : -floor(.5 - *x));
}


NewtonInt

repo: kique/mn-curses

original_code:
void NewtonInt(double *pX, double *pY, int n, double xi, double *ptrYint, double *ptrEa)
{
 int i,j,orden;
 double **fdd, xterm, yint2;
 fdd = (double **) malloc(n*sizeof(double));
 for(i=0;i<n;i++)
 {
  fdd[i] = (double *) malloc (n * sizeof(double));
 }
 for(i=0; i<n; i++)
 {
  fdd[i][0] = pY[i];
 }
 for(j=1;j<n;j++)
 {
  for(i=0;i<n-j;i++)
  {
   fdd[i][j]=(fdd[i+1][j-1] - fdd[i][j-1])/(pX[i+j]-pX[i]);
  }
 }
 xterm = 1;
 ptrYint[0] = fdd[0][0];
 for(orden=1;orden<=n;orden++)
 {
  xterm = xterm * (xi - pX[orden-1]);
  yint2 = ptrYint[orden-1] + fdd[0][orden]*xterm;
  ptrEa[orden-1] = yint2 - ptrYint[orden-1];
  ptrYint[orden] = yint2;
 }
 for(i=0;i<n;i++)
 {
  free(fdd[i]);
 }
 free(fdd);
}

canonical_original_code:
void NewtonInt(double *pX, double *pY, int n, double xi, double *ptrYint, double *ptrEa)
{
 int i; int j; int orden;
 double **fdd; double xterm; double yint2;
 fdd = (double **) malloc(n*sizeof(double));
 for(i=0;i<n;i++)
 {
  fdd[i] = (double *) malloc (n * sizeof(double));
 }
 for(i=0; i<n; i++)
 {
  fdd[i][0] = pY[i];
 }
 for(j=1;j<n;j++)
 {
  for(i=0;i<n-j;i++)
  {
   fdd[i][j]=(fdd[i+1][j-1] - fdd[i][j-1])/(pX[i+j]-pX[i]);
  }
 }
 xterm = 1;
 ptrYint[0] = fdd[0][0];
 for(orden=1;orden<=n;orden++)
 {
  xterm = xterm * (xi - pX[orden-1]);
  yint2 = ptrYint[orden-1] + fdd[0][orden]*xterm;
  ptrEa[orden-1] = yint2 - ptrYint[orden-1];
  ptrYint[orden] = yint2;
 }
 for(i=0;i<n;i++)
 {
  free(fdd[i]);
 }
 free(fdd);
}

variable_types:
pX
double *

variable_types:
pY
double *

variable_types: n int

variable_types: xi double

variable_types:
ptrYint
double *

variable_types:
ptrEa
double *

variable_types: i int

variable_types: j int

variable_types: orden int

variable_types:
fdd
double **

variable_types: xterm double


decompiled_code:
int __fastcall entrada_difdivnewton(double a1, double a2)
{
size_t v2; // rbx
double *v3; // r14
double *v4; // r13
double *v5; // r15
double *v6; // r12
double *v7; // rbp
int i; // ebx
double *v9; // rsi
__int64 v10; // rbx
__int64 v11; // rbx
double *ptr; // [rsp+8h] [rbp-50h]
int v14; // [rsp+14h] [rbp-44h] BYREF
double v15; // [rsp+18h] [rbp-40h]

initscr();
wmove(stdscr, 1, 5);
printw("\nCuantos puntos desea trabajar: ");
scanw("%d", &v14);
v2 = 8LL * v14;
v3 = (double *)malloc(v2);
v4 = (double *)malloc(v2);
v5 = (double *)malloc(v2);
ptr = (double *)malloc(v2);
wmove(stdscr, 3, 5);
if ( v14 > 0 )
{
v6 = v3;
v7 = v4;
for ( i = 0; i < v14; ++i )
{
printw("Dar el punto %d (x y): ", (unsigned int)i);
v9 = v6;
scanw("%lf %lf", a1, a2);
++v6;
++v7;
}
if ( v14 > 0 )
{
v10 = 0LL;
do
{
a1 = v3[v10];
printw("\n(%9.5lf , %9.5lf)", v9, a1, v4[v10++]);
}
while ( v14 > (int)v10 );
}
}
printw("\nQue valor de x deseas interpolar?");
scanw("%lf", a1);
NewtonInt(v3, (__int64)v4, v14, v5, ptr, v15);
printw("\n\nLa interpolacion en x = %lf es:", v15);
printw("\n\nGrado | f(x) | Error");
if ( v14 > 0 )
{
v11 = 0LL;
do
{
printw("\n%3d |%9.6lf | %9.6lf ", (unsigned int)v11, v5[v11], ptr[v11]);
++v11;
}
while ( v14 > (int)v11 );
}
free(v3);
free(v4);
free(v5);
free(ptr);
wgetch(stdscr);
return endwin();
}

canonical_decompiled_code:
int __fastcall func1(double a1, double a2)
{
size_t v2; // rbx
double *v3; // r14
double *v4; // r13
double *v5; // r15
double *v6; // r12
double *v7; // rbp
int i; // ebx
double *v9; // rsi
__int64 v10; // rbx
__int64 v11; // rbx
double *ptr; // [rsp+8h] [rbp-50h]
int v14; // [rsp+14h] [rbp-44h] BYREF
double v15; // [rsp+18h] [rbp-40h]

initscr();
wmove(stdscr, 1, 5);
printw("\nCuantos puntos desea trabajar: ");
scanw("%d", &v14);
v2 = 8LL * v14;
v3 = (double *)malloc(v2);
v4 = (double *)malloc(v2);
v5 = (double *)malloc(v2);
ptr = (double *)malloc(v2);
wmove(stdscr, 3, 5);
if ( v14 > 0 )
{
v6 = v3;
v7 = v4;
for ( i = 0; i < v14; ++i )
{
printw("Dar el punto %d (x y): ", (unsigned int)i);
v9 = v6;
scanw("%lf %lf", a1, a2);
++v6;
++v7;
}
if ( v14 > 0 )
{
v10 = 0LL;
do
{
a1 = v3[v10];
printw("\n(%9.5lf , %9.5lf)", v9, a1, v4[v10++]);
}
while ( v14 > (int)v10 );
}
}
printw("\nQue valor de x deseas interpolar?");
scanw("%lf", a1);
func0(v3, (__int64)v4, v14, v5, ptr, v15);
printw("\n\nLa interpolacion en x = %lf es:", v15);
printw("\n\nGrado | f(x) | Error");
if ( v14 > 0 )
{
v11 = 0LL;
do
{
printw("\n%3d |%9.6lf | %9.6lf ", (unsigned int)v11, v5[v11], ptr[v11]);
++v11;
}
while ( v14 > (int)v11 );
}
free(v3);
free(v4);
free(v5);
free(ptr);
wgetch(stdscr);
return endwin();
}

original_code:
void entrada_difdivnewton(void)
{
 double *px, *py, xi, *yint, *ea;
 int n,i;
 initscr();
 wmove(stdscr,(1),(5));
 printw("\nCuantos puntos desea trabajar: ");
 scanw("%d",&n);
 px = (double *) malloc(n*sizeof(double));
 py = (double *) malloc(n*sizeof(double));
 yint = (double *) malloc(n*sizeof(double));
 ea = (double *) malloc(n*sizeof(double));
 wmove(stdscr,(3),(5));
 for (i=0; i<n; i++)
 {
  printw("Dar el punto %d (x y): ",i);
  scanw("%lf %lf",&px[i],&py[i]);
 }
 for(i=0;i<n;i++)
 {
  printw("\n(%9.5lf , %9.5lf)",px[i],py[i]);
 }
 printw("\nQue valor de x deseas interpolar?");
 scanw("%lf",&xi);
 NewtonInt(px,py,n,xi,yint,ea);
 printw("\n\nLa interpolacion en x = %lf es:",xi);
 printw("\n\nGrado |   f(x)   |   Error");
 for(i=0;i<n;i++)
 {
  printw("\n%3d   |%9.6lf | %9.6lf ",i,yint[i],ea[i]);
 }
 free(px);
 free(py);
 free(yint);
 free(ea);
 wgetch(stdscr);
 endwin();
}

canonical_original_code:
void entrada_difdivnewton()
{
 double *px; double *py; double xi; double *yint; double *ea;
 int n; int i;
 initscr();
 wmove(stdscr,(1),(5));
 printw("\nCuantos puntos desea trabajar: ");
 scanw("%d",&n);
 px = (double *) malloc(n*sizeof(double));
 py = (double *) malloc(n*sizeof(double));
 yint = (double *) malloc(n*sizeof(double));
 ea = (double *) malloc(n*sizeof(double));
 wmove(stdscr,(3),(5));
 for (i=0; i<n; i++)
 {
  printw("Dar el punto %d (x y): ",i);
  scanw("%lf %lf",&px[i],&py[i]);
 }
 for(i=0;i<n;i++)
 {
  printw("\n(%9.5lf , %9.5lf)",px[i],py[i]);
 }
 printw("\nQue valor de x deseas interpolar?");
 scanw("%lf",&xi);
 NewtonInt(px,py,n,xi,yint,ea);
 printw("\n\nLa interpolacion en x = %lf es:",xi);
 printw("\n\nGrado |   f(x)   |   Error");
 for(i=0;i<n;i++)
 {
  printw("\n%3d   |%9.6lf | %9.6lf ",i,yint[i],ea[i]);
 }
 free(px);
 free(py);
 free(yint);
 free(ea);
 wgetch(stdscr);
 endwin();
}

variable_types:
px
double *

variable_types:
py
double *

variable_types:
yint
double *

variable_types:
ea
double *


verify

original_code:
int verify(double* x, double* y) {
 double *z_v_add = (double*) malloc(10000000*sizeof(double));
 double *z_oracle = (double*) malloc(10000000*sizeof(double));
 v_add(x, y, z_v_add);
 for(int i=0; i<10000000; i++)
  z_oracle[i] = x[i] + y[i];
 for(int i=0; i<10000000; i++)
  if(z_oracle[i] != z_v_add[i])
   return 0;
 return 1;
}

canonical_original_code:
int verify(double *x, double *y) {
 double *z_v_add = (double*) malloc(10000000*sizeof(double));
 double *z_oracle = (double*) malloc(10000000*sizeof(double));
 v_add(x, y, z_v_add);
 for(int i = 0; i<10000000; i++)
  z_oracle[i] = x[i] + y[i];
 for(int i = 0; i<10000000; i++)
  if(z_oracle[i] != z_v_add[i])
   return 0;
 return 1;
}

variable_types:
y
double *


repo: kiterunner-t/krt

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

g_internal = 11;
result = &g_extern;
g_extern = 12;
return result;
}

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

g_internal = 11;
result = &g_extern;
g_extern = 12;
return result;
}

original_code:
static void
foo_static(void)
{
  g_static = 10;
  g_internal = 11;
  g_extern = 12;
}

canonical_original_code:
static void foo_static()
{
  g_static = 10;
  g_internal = 11;
  g_extern = 12;
}


decompiled_code:
void foo_internal()
{
a = 2;
}

canonical_decompiled_code:
void func7()
{
a = 2;
}

original_code:
void
foo_internal()
{
  *p = 2;
}

canonical_original_code:
void foo_internal()
{
  *p = 2;
}


decompiled_code:
__int64 call_foo()
{
foo_static();
foo_internal();
return foo_extern();
}

canonical_decompiled_code:
__int64 func8()
{
func6();
func7();
return foo_extern();
}

original_code:
void
call_foo()
{
  foo_static();
  foo_internal();
  foo_extern();
}


test

decompiled_code:
int __fastcall test(int a1, const char *a2)
{
if ( a1 )
printf("\x1B[32m -- SUCCESS! -- \x1B[m");
else
printf("\x1B[31m -- FAIL! -- \x1B[m");
return printf("TEST: %s\n", a2);
}

canonical_decompiled_code:
int __fastcall func0(int a1, const char *a2)
{
if ( a1 )
printf("\x1B[32m -- SUCCESS! -- \x1B[m");
else
printf("\x1B[31m -- FAIL! -- \x1B[m");
return printf("TEST: %s\n", a2);
}

original_code:
static
void test(int success, char msg[]){
    if(success){
        printf("\033[32m -- SUCCESS! -- \033[m");
    }else{
        printf("\033[31m -- FAIL! -- \033[m");
    }
    printf("TEST: %s\n", msg);
}

variable_types: success int

variable_types:
msg
char []


decompiled_code:
__int64 __fastcall test_create_and_delete(__int64 (*a1)(void))
{
void (__fastcall **v1)(_QWORD, _QWORD, _QWORD); // rax

v1 = (void (__fastcall **)(_QWORD, _QWORD, _QWORD))a1();
(*v1)(v1, 0LL, 0LL);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 (*a1)(void))
{
void (__fastcall **v1)(_QWORD, _QWORD, _QWORD); // rax

v1 = (void (__fastcall **)(_QWORD, _QWORD, _QWORD))a1();
(*v1)(v1, 0LL, 0LL);
return 1LL;
}

original_code:
int test_create_and_delete(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return 1;
}

canonical_original_code:
int test_create_and_delete(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return 1;
}

variable_types: struct kv_set { struct kv_set_functions { void (*delete_table)(struct kv_set *kv_set, void (*element_free_function)(void *context, void *element), void *context); void *(*put)(struct kv_set *set, void *key_value); int (*put_new)(struct kv_set *set, void *key_value); void *(*remove)(struct kv_set *set, void *key); void *(*lookup)(struct kv_set *set, void *key); int (*member)(struct kv_set *set, void *key); void *(*first)(struct kv_set *set); void *(*last)(struct kv_set *set); void *(*next)(struct kv_set *set, void *key); void *(*previous)(struct kv_set *set, void *key); } funs; unsigned int key_offset; void *type_specific_data; } *(*)()

user_defined_types: struct kv_set { struct kv_set_functions funs; unsigned int key_offset; void *type_specific_data; }


original_code:
int test_insert(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    void * el = skiplist->funs.put(skiplist, (void *)(10));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == ((void *)0);
}

canonical_original_code:
int test_insert(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    void *el = skiplist->funs.put(skiplist, (void *)(10));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == ((void *)0);
}

variable_types: struct kv_set { struct kv_set_functions { void (*delete_table)(struct kv_set *kv_set, void (*element_free_function)(void *context, void *element), void *context); void *(*put)(struct kv_set *set, void *key_value); int (*put_new)(struct kv_set *set, void *key_value); void *(*remove)(struct kv_set *set, void *key); void *(*lookup)(struct kv_set *set, void *key); int (*member)(struct kv_set *set, void *key); void *(*first)(struct kv_set *set); void *(*last)(struct kv_set *set); void *(*next)(struct kv_set *set, void *key); void *(*previous)(struct kv_set *set, void *key); } funs; unsigned int key_offset; void *type_specific_data; } *

variable_types:
el
void *


original_code:
int test_insert_new(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    int el1 = skiplist->funs.put_new(skiplist, (void *)(10));
    ((void) sizeof ((skiplist->funs.lookup(skiplist, (void *)(10)) == (void *)(10)) ? 1 : 0), __extension__ ({ if (skiplist->funs.lookup(skiplist, (void *)(10)) == (void *)(10)) ; else __assert_fail ("skiplist->funs.lookup(skiplist, TO_VP(10)) == TO_VP(10)", "test_kvset.c", 55, __extension__ __PRETTY_FUNCTION__); }));
    int el2 = skiplist->funs.put_new(skiplist, (void *)(10));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return (el1 == 1) && (el2 == 0);
}

canonical_original_code:
int test_insert_new(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    int el1 = skiplist->funs.put_new(skiplist, (void *)(10));
    ((void) sizeof ((skiplist->funs.lookup(skiplist, (void *)(10)) == (void *)(10)) ? 1 : 0), __extension__ ({ if (skiplist->funs.lookup(skiplist, (void *)(10)) == (void *)(10)) ; else __assert_fail ("skiplist->funs.lookup(skiplist, TO_VP(10)) == TO_VP(10)", "test_kvset.c", 55, __extension__ __PRETTY_FUNCTION__); }));
    int el2 = skiplist->funs.put_new(skiplist, (void *)(10));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return (el1 == 1) && (el2 == 0);
}

user_defined_types: struct kv_set_functions { void (*delete_table)(struct kv_set *kv_set, void (*element_free_function)(void *context, void *element), void *context); void *(*put)(struct kv_set *set, void *key_value); int (*put_new)(struct kv_set *set, void *key_value); void *(*remove)(struct kv_set *set, void *key); void *(*lookup)(struct kv_set *set, void *key); int (*member)(struct kv_set *set, void *key); void *(*first)(struct kv_set *set); void *(*last)(struct kv_set *set); void *(*next)(struct kv_set *set, void *key); void *(*previous)(struct kv_set *set, void *key); }


original_code:
int test_insert_write_over(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    void * el = skiplist->funs.put(skiplist, (void *)(10));
    skiplist->funs.put(skiplist, (void *)(5));
    skiplist->funs.put(skiplist, (void *)(15));
    el = skiplist->funs.put(skiplist, (void *)(10));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(10);
}

canonical_original_code:
int test_insert_write_over(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    void *el = skiplist->funs.put(skiplist, (void *)(10));
    skiplist->funs.put(skiplist, (void *)(5));
    skiplist->funs.put(skiplist, (void *)(15));
    el = skiplist->funs.put(skiplist, (void *)(10));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(10);
}


original_code:
int test_lookup(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    void * el;
    skiplist->funs.put(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(42));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(42);
}

canonical_original_code:
int test_lookup(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    void *el;
    skiplist->funs.put(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(42));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(42);
}


original_code:
int test_lookup_not_exsisting(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    void * el;
    skiplist->funs.put(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(43));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == ((void *)0);
}

canonical_original_code:
int test_lookup_not_exsisting(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    void *el;
    skiplist->funs.put(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(43));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == ((void *)0);
}


original_code:
int test_remove(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    void * el;
    skiplist->funs.put(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(42));
    ((void) sizeof ((el == (void *)(42)) ? 1 : 0), __extension__ ({ if (el == (void *)(42)) ; else __assert_fail ("el == TO_VP(42)", "test_kvset.c", 117, __extension__ __PRETTY_FUNCTION__); }));
    skiplist->funs.remove(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(42));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == ((void *)0);
}

canonical_original_code:
int test_remove(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    void *el;
    skiplist->funs.put(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(42));
    ((void) sizeof ((el == (void *)(42)) ? 1 : 0), __extension__ ({ if (el == (void *)(42)) ; else __assert_fail ("el == TO_VP(42)", "test_kvset.c", 117, __extension__ __PRETTY_FUNCTION__); }));
    skiplist->funs.remove(skiplist, (void *)(42));
    el = skiplist->funs.lookup(skiplist, (void *)(42));
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == ((void *)0);
}


decompiled_code:
__int64 __fastcall test_insert_lookup_delete_lookup_many(__int64 (*a1)(void))
{
__int64 v1; // rbx
__int64 *v2; // r13
unsigned int v3; // eax
__int64 *v4; // r14
__int64 *v5; // r13
__int64 *v6; // r13
__int64 v7; // r15
__int64 *v8; // r13
__int64 v9; // r15
__int64 *v10; // r13
__int64 v11; // r15
_BYTE v13[8192]; // [rsp-2000h] [rbp-2040h] BYREF
__int64 v14; // [rsp+0h] [rbp-40h] BYREF
__int64 *v15; // [rsp+8h] [rbp-38h]

v1 = a1();
v2 = (__int64 *)v13;
v15 = (__int64 *)v13;
v3 = time(0LL);
srand(v3);
v4 = (__int64 *)v13;
do
*v2++ = rand();
while ( v2 != &v14 );
v5 = v15;
do
(*(void (__fastcall **)(__int64, _QWORD))(v1 + 8))(v1, *v5++);
while ( v5 != &v14 );
v6 = v15;
do
{
v7 = *v6;
if ( v7 != (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 8))(v1, *v6) )
_assert_fail(
"TO_VP(elements[i]) == skiplist->funs.put(skiplist, elements[i])",
"test_kvset.c",
0x9Au,
"test_insert_lookup_delete_lookup_many");
++v6;
}
while ( v6 != &v14 );
v8 = v15;
do
{
v9 = *v8;
if ( v9 != (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 32))(v1, *v8) )
_assert_fail(
"TO_VP(elements[i]) == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))",
"test_kvset.c",
0xA1u,
"test_insert_lookup_delete_lookup_many");
++v8;
}
while ( v8 != &v14 );
v10 = v15;
do
{
v11 = *v10;
if ( v11 != (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 24))(v1, *v10) )
_assert_fail(
"TO_VP(elements[i]) == skiplist->funs.remove(skiplist, TO_VP(elements[i]))",
"test_kvset.c",
0xA6u,
"test_insert_lookup_delete_lookup_many");
++v10;
}
while ( v10 != &v14 );
do
{
if ( (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 32))(v1, *v4) )
_assert_fail(
"NULL == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))",
"test_kvset.c",
0xABu,
"test_insert_lookup_delete_lookup_many");
++v4;
}
while ( v4 != &v14 );
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))v1)(v1, 0LL, 0LL);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 (*a1)(void))
{
__int64 v1; // rbx
__int64 *v2; // r13
unsigned int v3; // eax
__int64 *v4; // r14
__int64 *v5; // r13
__int64 *v6; // r13
__int64 v7; // r15
__int64 *v8; // r13
__int64 v9; // r15
__int64 *v10; // r13
__int64 v11; // r15
_BYTE v13[8192]; // [rsp-2000h] [rbp-2040h] BYREF
__int64 v14; // [rsp+0h] [rbp-40h] BYREF
__int64 *v15; // [rsp+8h] [rbp-38h]

v1 = a1();
v2 = (__int64 *)v13;
v15 = (__int64 *)v13;
v3 = time(0LL);
srand(v3);
v4 = (__int64 *)v13;
do
*v2++ = rand();
while ( v2 != &v14 );
v5 = v15;
do
(*(void (__fastcall **)(__int64, _QWORD))(v1 + 8))(v1, *v5++);
while ( v5 != &v14 );
v6 = v15;
do
{
v7 = *v6;
if ( v7 != (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 8))(v1, *v6) )
_assert_fail(
"TO_VP(elements[i]) == skiplist->funs.put(skiplist, elements[i])",
"test_kvset.c",
0x9Au,
"test_insert_lookup_delete_lookup_many");
++v6;
}
while ( v6 != &v14 );
v8 = v15;
do
{
v9 = *v8;
if ( v9 != (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 32))(v1, *v8) )
_assert_fail(
"TO_VP(elements[i]) == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))",
"test_kvset.c",
0xA1u,
"test_insert_lookup_delete_lookup_many");
++v8;
}
while ( v8 != &v14 );
v10 = v15;
do
{
v11 = *v10;
if ( v11 != (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 24))(v1, *v10) )
_assert_fail(
"TO_VP(elements[i]) == skiplist->funs.remove(skiplist, TO_VP(elements[i]))",
"test_kvset.c",
0xA6u,
"test_insert_lookup_delete_lookup_many");
++v10;
}
while ( v10 != &v14 );
do
{
if ( (*(__int64 (__fastcall **)(__int64, __int64))(v1 + 32))(v1, *v4) )
_assert_fail(
"NULL == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))",
"test_kvset.c",
0xABu,
"test_insert_lookup_delete_lookup_many");
++v4;
}
while ( v4 != &v14 );
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))v1)(v1, 0LL, 0LL);
return 1LL;
}

original_code:
int test_insert_lookup_delete_lookup_many(KVSet * (*create_kvset_fun)()){
    int i;
    int nr_of_ops_of_each_type = 1024;
    KVSet* skiplist = create_kvset_fun();
    void * elements[nr_of_ops_of_each_type];
    srand((unsigned)time(0));
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        elements[i] = (void *)(0xFFFFFFFFFFFFFFFF & rand());
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        skiplist->funs.put(skiplist, elements[i]);
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof (((void *)(elements[i]) == skiplist->funs.put(skiplist, elements[i])) ? 1 : 0), __extension__ ({ if ((void *)(elements[i]) == skiplist->funs.put(skiplist, elements[i])) ; else __assert_fail ("TO_VP(elements[i]) == skiplist->funs.put(skiplist, elements[i])", "test_kvset.c", 154, __extension__ __PRETTY_FUNCTION__); }));
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof (((void *)(elements[i]) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ? 1 : 0), __extension__ ({ if ((void *)(elements[i]) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ; else __assert_fail ("TO_VP(elements[i]) == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))", "test_kvset.c", 161, __extension__ __PRETTY_FUNCTION__); }));
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof (((void *)(elements[i]) == skiplist->funs.remove(skiplist, (void *)(elements[i]))) ? 1 : 0), __extension__ ({ if ((void *)(elements[i]) == skiplist->funs.remove(skiplist, (void *)(elements[i]))) ; else __assert_fail ("TO_VP(elements[i]) == skiplist->funs.remove(skiplist, TO_VP(elements[i]))", "test_kvset.c", 166, __extension__ __PRETTY_FUNCTION__); }));
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof ((((void *)0) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ? 1 : 0), __extension__ ({ if (((void *)0) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ; else __assert_fail ("NULL == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))", "test_kvset.c", 171, __extension__ __PRETTY_FUNCTION__); }));
    }
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return 1;
}

canonical_original_code:
int test_insert_lookup_delete_lookup_many(struct kv_set *(*create_kvset_fun)()){
    int i;
    int nr_of_ops_of_each_type = 1024;
    struct kv_set *skiplist = create_kvset_fun();
    void *elements[-1];
    srand((unsigned int)time(0));
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        elements[i] = (void *)(0xFFFFFFFFFFFFFFFF & rand());
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        skiplist->funs.put(skiplist, elements[i]);
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof (((void *)(elements[i]) == skiplist->funs.put(skiplist, elements[i])) ? 1 : 0), __extension__ ({ if ((void *)(elements[i]) == skiplist->funs.put(skiplist, elements[i])) ; else __assert_fail ("TO_VP(elements[i]) == skiplist->funs.put(skiplist, elements[i])", "test_kvset.c", 154, __extension__ __PRETTY_FUNCTION__); }));
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof (((void *)(elements[i]) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ? 1 : 0), __extension__ ({ if ((void *)(elements[i]) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ; else __assert_fail ("TO_VP(elements[i]) == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))", "test_kvset.c", 161, __extension__ __PRETTY_FUNCTION__); }));
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof (((void *)(elements[i]) == skiplist->funs.remove(skiplist, (void *)(elements[i]))) ? 1 : 0), __extension__ ({ if ((void *)(elements[i]) == skiplist->funs.remove(skiplist, (void *)(elements[i]))) ; else __assert_fail ("TO_VP(elements[i]) == skiplist->funs.remove(skiplist, TO_VP(elements[i]))", "test_kvset.c", 166, __extension__ __PRETTY_FUNCTION__); }));
    }
    for(i = 0; i < nr_of_ops_of_each_type; i++){
        ((void) sizeof ((((void *)0) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ? 1 : 0), __extension__ ({ if (((void *)0) == skiplist->funs.lookup(skiplist, (void *)(elements[i]))) ; else __assert_fail ("NULL == skiplist->funs.lookup(skiplist, TO_VP(elements[i]))", "test_kvset.c", 171, __extension__ __PRETTY_FUNCTION__); }));
    }
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return 1;
}

variable_types:
elements
void *[-1]


original_code:
int test_first(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    void * el;
    ((void) sizeof ((skiplist->funs.first(skiplist) == ((void *)0)) ? 1 : 0), __extension__ ({ if (skiplist->funs.first(skiplist) == ((void *)0)) ; else __assert_fail ("skiplist->funs.first(skiplist) == NULL", "test_kvset.c", 185, __extension__ __PRETTY_FUNCTION__); }));
    skiplist->funs.put(skiplist, (void *)(5));
    skiplist->funs.put(skiplist, (void *)(3));
    skiplist->funs.put(skiplist, (void *)(6));
    el = skiplist->funs.first(skiplist);
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(3);
}

canonical_original_code:
int test_first(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    void *el;
    ((void) sizeof ((skiplist->funs.first(skiplist) == ((void *)0)) ? 1 : 0), __extension__ ({ if (skiplist->funs.first(skiplist) == ((void *)0)) ; else __assert_fail ("skiplist->funs.first(skiplist) == NULL", "test_kvset.c", 185, __extension__ __PRETTY_FUNCTION__); }));
    skiplist->funs.put(skiplist, (void *)(5));
    skiplist->funs.put(skiplist, (void *)(3));
    skiplist->funs.put(skiplist, (void *)(6));
    el = skiplist->funs.first(skiplist);
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(3);
}


original_code:
int test_last(KVSet * (*create_kvset_fun)()){
    KVSet* skiplist = create_kvset_fun();
    void * el;
    ((void) sizeof ((skiplist->funs.last(skiplist) == ((void *)0)) ? 1 : 0), __extension__ ({ if (skiplist->funs.last(skiplist) == ((void *)0)) ; else __assert_fail ("skiplist->funs.last(skiplist) == NULL", "test_kvset.c", 205, __extension__ __PRETTY_FUNCTION__); }));
    skiplist->funs.put(skiplist, (void *)(3));
    skiplist->funs.put(skiplist, (void *)(6));
    skiplist->funs.put(skiplist, (void *)(4));
    el = skiplist->funs.last(skiplist);
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(6);
}

canonical_original_code:
int test_last(struct kv_set *(*create_kvset_fun)()){
    struct kv_set *skiplist = create_kvset_fun();
    void *el;
    ((void) sizeof ((skiplist->funs.last(skiplist) == ((void *)0)) ? 1 : 0), __extension__ ({ if (skiplist->funs.last(skiplist) == ((void *)0)) ; else __assert_fail ("skiplist->funs.last(skiplist) == NULL", "test_kvset.c", 205, __extension__ __PRETTY_FUNCTION__); }));
    skiplist->funs.put(skiplist, (void *)(3));
    skiplist->funs.put(skiplist, (void *)(6));
    skiplist->funs.put(skiplist, (void *)(4));
    el = skiplist->funs.last(skiplist);
    skiplist->funs.delete_table(skiplist, ((void *)0), ((void *)0));
    return el == (void *)(6);
}