decompiled_code:
__int64 OP_mkPrecMax()
{
strdup("MAX");
return 1LL;
}

canonical_decompiled_code:
__int64 func3()
{
strdup("MAX");
return 1LL;
}

original_code:
OP_Prec OP_mkPrecMax()
{
    OP_Prec prec;
    prec.cat = OP_PREC_NAME;
    prec.data.name = strdup("MAX");
    return prec;
}

canonical_original_code:
struct OP_Prec OP_mkPrecMax()
{
    struct OP_Prec prec;
    prec.cat = OP_PREC_NAME;
    prec.data.name = strdup("MAX");
    return prec;
}


repo: jpraher/teyjus

decompiled_code:
_BOOL8 __fastcall OP_precIsMax(int a1, const char *a2)
{
_BOOL8 result; // rax

result = 0LL;
if ( a1 == 1 )
result = strcmp(a2, "MAX") == 0;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(int a1, const char *a2)
{
_BOOL8 result; // rax

result = 0LL;
if ( a1 == 1 )
result = strcmp(a2, "MAX") == 0;
return result;
}

original_code:
int OP_precIsMax(OP_Prec prec)
{
    if ((prec.cat == OP_PREC_NAME) && (strcmp(prec.data.name, "MAX") == 0))
        return 1;
    return 0;
}

canonical_original_code:
int OP_precIsMax(struct OP_Prec prec)
{
    if ((prec.cat == OP_PREC_NAME) && (strcmp(prec.data.name, "MAX") == 0))
        return 1;
    return 0;
}

variable_types: struct OP_Prec { enum OP_PrecTypeCat { OP_PREC=0, OP_PREC_NAME=1 } cat; union { int prec; char *name; } data; }

return_type: int

user_defined_types: struct OP_Prec { enum OP_PrecTypeCat cat; union { int prec; char *name; } data; }


decompiled_code:
__int64 OP_mkCodeInfoNone()
{
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func5()
{
return 0xFFFFFFFFLL;
}

original_code:
OP_Code OP_mkCodeInfoNone()
{
    return -1;
}

canonical_original_code:
int OP_mkCodeInfoNone()
{
    return -1;
}


decompiled_code:
__int64 __fastcall OP_mkCodeInfo(unsigned int a1)
{
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func6(unsigned int a1)
{
return a1;
}

original_code:
OP_Code OP_mkCodeInfo(int ind)
{
    return ind;
}

canonical_original_code:
int OP_mkCodeInfo(int ind)
{
    return ind;
}

variable_types: ind int


decompiled_code:
__int64 __fastcall OP_codeInfoIsNone(unsigned int a1)
{
return a1 >> 31;
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned int a1)
{
return a1 >> 31;
}

original_code:
int OP_codeInfoIsNone(OP_Code code)
{
    return (code < 0);
}

canonical_original_code:
int OP_codeInfoIsNone(int code)
{
    return (code < 0);
}

variable_types: code int


mkSortType

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 0;
*(_QWORD *)(result + 8) = a1;
return result;
}

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 0;
*(_QWORD *)(result + 8) = a1;
return result;
}

original_code:
Type mkSortType(char* name)
{
    Type rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = SORT;
    rtPtr -> data.sort = name;
    return rtPtr;
}

canonical_original_code:
struct Type_ *mkSortType(char *name)
{
    struct Type_ *rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = SORT;
    rtPtr -> data.sort = name;
    return rtPtr;
}

variable_types:
name
char *

variable_types: struct Type_ { enum TypeCats { SORT=0, SKVAR=1, ARROW=2, STR=3, FUNC=4 } tag; union { char *sort; char *skvar; struct FuncInfo { char *name; char *arity; } func; struct ArrowInfo { struct Type_ *lop; struct Type_ *rop; } arrow; struct StrInfo { struct Type_ *functor; int arity; struct TypeList_ { struct Type_ *oneType; struct TypeList_ *next; } *args; } str; } data; } *

user_defined_types: struct Type_ { enum TypeCats tag; union { char *sort; char *skvar; struct FuncInfo func; struct ArrowInfo arrow; struct StrInfo str; } data; }

user_defined_types: struct StrInfo { struct Type_ *functor; int arity; struct TypeList_ *args; }


mkSkVarType

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 1;
*(_QWORD *)(result + 8) = a1;
return result;
}

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 1;
*(_QWORD *)(result + 8) = a1;
return result;
}

original_code:
Type mkSkVarType(char* index)
{
    Type rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = SKVAR;
    rtPtr -> data.skvar = index;
    return rtPtr;
}

canonical_original_code:
struct Type_ *mkSkVarType(char *index)
{
    struct Type_ *rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = SKVAR;
    rtPtr -> data.skvar = index;
    return rtPtr;
}

variable_types:
index
char *

return_type: struct Type_ { enum TypeCats { SORT=0, SKVAR=1, ARROW=2, STR=3, FUNC=4 } tag; union { char *sort; char *skvar; struct FuncInfo { char *name; char *arity; } func; struct ArrowInfo { struct Type_ *lop; struct Type_ *rop; } arrow; struct StrInfo { struct Type_ *functor; int arity; struct TypeList_ { struct Type_ *oneType; struct TypeList_ *next; } *args; } str; } data; } *


mkStrFuncType

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 4;
*(_QWORD *)(result + 8) = a1;
*(_QWORD *)(result + 16) = a2;
return result;
}

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 4;
*(_QWORD *)(result + 8) = a1;
*(_QWORD *)(result + 16) = a2;
return result;
}

original_code:
Type mkStrFuncType(char* name, char* arity)
{
    Type rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = FUNC;
    rtPtr -> data.func.name = name;
    rtPtr -> data.func.arity = arity;
    return rtPtr;
}

canonical_original_code:
struct Type_ *mkStrFuncType(char *name, char *arity)
{
    struct Type_ *rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = FUNC;
    rtPtr -> data.func.name = name;
    rtPtr -> data.func.arity = arity;
    return rtPtr;
}

variable_types:
arity
char *

user_defined_types: enum TypeCats { SORT=0, SKVAR=1, ARROW=2, STR=3, FUNC=4 }

user_defined_types: struct FuncInfo { char *name; char *arity; }

user_defined_types: struct ArrowInfo { struct Type_ *lop; struct Type_ *rop; }

user_defined_types: struct TypeList_ { struct Type_ *oneType; struct TypeList_ *next; }


mkStrType

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 3;
*(_QWORD *)(result + 8) = a1;
*(_DWORD *)(result + 16) = a2;
*(_QWORD *)(result + 24) = a3;
return result;
}

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 3;
*(_QWORD *)(result + 8) = a1;
*(_DWORD *)(result + 16) = a2;
*(_QWORD *)(result + 24) = a3;
return result;
}

original_code:
Type mkStrType(Type func, int arity, TypeList args)
{
    Type rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = STR;
    rtPtr -> data.str.functor = func;
    rtPtr -> data.str.arity = arity;
    rtPtr -> data.str.args = args;
    return rtPtr;
}

canonical_original_code:
struct Type_ *mkStrType(struct Type_ *func, int arity, struct TypeList_ *args)
{
    struct Type_ *rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = STR;
    rtPtr -> data.str.functor = func;
    rtPtr -> data.str.arity = arity;
    rtPtr -> data.str.args = args;
    return rtPtr;
}

variable_types:
func
struct Type_ *

variable_types: arity int

variable_types:
args
struct TypeList_ *


mkArrowType

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 2;
*(_QWORD *)(result + 8) = a1;
*(_QWORD *)(result + 16) = a2;
return result;
}

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

result = UTIL_malloc(32LL);
*(_DWORD *)result = 2;
*(_QWORD *)(result + 8) = a1;
*(_QWORD *)(result + 16) = a2;
return result;
}

original_code:
Type mkArrowType(Type lop, Type rop)
{
    Type rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = ARROW;
    rtPtr -> data.arrow.lop = lop;
    rtPtr -> data.arrow.rop = rop;
    return rtPtr;
}

canonical_original_code:
struct Type_ *mkArrowType(struct Type_ *lop, struct Type_ *rop)
{
    struct Type_ *rtPtr = (Type)UTIL_malloc(sizeof(Type_));
    rtPtr -> tag = ARROW;
    rtPtr -> data.arrow.lop = lop;
    rtPtr -> data.arrow.rop = rop;
    return rtPtr;
}

variable_types:
lop
struct Type_ *

variable_types:
rop
struct Type_ *


freeType

decompiled_code:
void __fastcall freeType(void *ptr)
{
int v1; // eax

v1 = *(_DWORD *)ptr;
if ( !*(_DWORD *)ptr || v1 == 1 )
{
free(*((void **)ptr + 1));
free(ptr);
}
else
{
if ( v1 == 4 )
{
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
}
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func5(void *ptr)
{
int v1; // eax

v1 = *(_DWORD *)ptr;
if ( !*(_DWORD *)ptr || v1 == 1 )
{
free(*((void **)ptr + 1));
free(ptr);
}
else
{
if ( v1 == 4 )
{
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
}
free(ptr);
}
}

original_code:
void freeType(Type ty)
{
    if (ty -> tag == SORT) free(ty->data.sort);
    else if (ty -> tag == SKVAR) free(ty->data.skvar);
    else if (ty -> tag == FUNC) {
        free(ty->data.func.name);
        free(ty->data.func.arity);
    }
    free(ty);
}

canonical_original_code:
void freeType(struct Type_ *ty)
{
    if (ty -> tag == SORT) free(ty->data.sort);
    else if (ty -> tag == SKVAR) free(ty->data.skvar);
    else if (ty -> tag == FUNC) {
        free(ty->data.func.name);
        free(ty->data.func.arity);
    }
    free(ty);
}

return_type: void


append

decompiled_code:
__int64 __fastcall append(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rdx

result = a2;
if ( a1 )
{
v3 = a1;
do
{
v4 = v3;
v3 = *(_QWORD *)(v3 + 8);
}
while ( v3 );
*(_QWORD *)(v4 + 8) = a2;
result = a1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rdx

result = a2;
if ( a1 )
{
v3 = a1;
do
{
v4 = v3;
v3 = *(_QWORD *)(v3 + 8);
}
while ( v3 );
*(_QWORD *)(v4 + 8) = a2;
result = a1;
}
return result;
}

original_code:
TypeList append(TypeList typeList1, TypeList typeList2)
{
    if (typeList1) {
        TypeList temp = typeList1;
        while (temp -> next) temp = temp -> next;
        temp -> next = typeList2;
    } else typeList1 = typeList2;
    return typeList1;
}

canonical_original_code:
struct TypeList_ *append(struct TypeList_ *typeList1, struct TypeList_ *typeList2)
{
    if (typeList1) {
        struct TypeList_ *temp = typeList1;
        while (temp -> next) temp = temp -> next;
        temp -> next = typeList2;
    } else typeList1 = typeList2;
    return typeList1;
}

variable_types: struct TypeList_ { struct Type_ { enum TypeCats { SORT=0, SKVAR=1, ARROW=2, STR=3, FUNC=4 } tag; union { char *sort; char *skvar; struct FuncInfo { char *name; char *arity; } func; struct ArrowInfo { struct Type_ *lop; struct Type_ *rop; } arrow; struct StrInfo { struct Type_ *functor; int arity; struct TypeList_ *args; } str; } data; } *oneType; struct TypeList_ *next; } *


repo: jptettamanti/fiuba-ese-rtos

decompiled_code:
__int64 __fastcall fixedpt_mul(int a1, int a2)
{
return (a2 * (__int64)a1) >> 24;
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1, int a2)
{
return (a2 * (__int64)a1) >> 24;
}

original_code:
static inline fixedpt fixedpt_mul(fixedpt A, fixedpt B)
{
 return (((fixedptd)A * (fixedptd)B) >> (32 - 8));
}

canonical_original_code:
static inline int fixedpt_mul(int A, int B)
{
 return (((long)A * (long)B) >> (32 - 8));
}

variable_types: A int

variable_types: B int


decompiled_code:
__int64 __fastcall fixedpt_div(int a1, int a2)
{
return ((__int64)a1 << 24) / a2;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, int a2)
{
return ((__int64)a1 << 24) / a2;
}

original_code:
static inline fixedpt fixedpt_div(fixedpt A, fixedpt B)
{
 return (((fixedptd)A << (32 - 8)) / (fixedptd)B);
}

canonical_original_code:
static inline int fixedpt_div(int A, int B)
{
 return (((long)A << (32 - 8)) / (long)B);
}


decompiled_code:
__int64 __fastcall fixedpt_sqrt(int a1)
{
int v1; // ecx
int v2; // eax
unsigned int v3; // er8
int v4; // eax
int v5; // er8
int v6; // ecx
int v7; // er9

v1 = a1;
v2 = 0;
do
{
v1 >>= 2;
++v2;
}
while ( v1 );
v3 = (a1 >> 1) + 1;
do
{
v4 = fixedpt_div(a1, v3);
v3 = (v4 + v5) >> 1;
}
while ( v6 != v7 );
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func9(int a1)
{
int v1; // ecx
int v2; // eax
unsigned int v3; // er8
int v4; // eax
int v5; // er8
int v6; // ecx
int v7; // er9

v1 = a1;
v2 = 0;
do
{
v1 >>= 2;
++v2;
}
while ( v1 );
v3 = (a1 >> 1) + 1;
do
{
v4 = func8(a1, v3);
v3 = (v4 + v5) >> 1;
}
while ( v6 != v7 );
return v3;
}

original_code:
static inline fixedpt fixedpt_sqrt(fixedpt A)
{
 int invert = 0;
 int iter = (32 - 8);
 int l, i;
 if (A < 0)
  return (-1);
 if (A == 0 || A == ((fixedpt)((fixedpt)1 << (32 - 8))))
  return (A);
 if (A < ((fixedpt)((fixedpt)1 << (32 - 8))) && A > 6) {
  invert = 1;
  A = fixedpt_div(((fixedpt)((fixedpt)1 << (32 - 8))), A);
 }
 if (A > ((fixedpt)((fixedpt)1 << (32 - 8)))) {
  int s = A;
  iter = 0;
  while (s > 0) {
   s >>= 2;
   iter++;
  }
 }
 l = (A >> 1) + 1;
 for (i = 0; i < iter; i++)
  l = (l + fixedpt_div(A, l)) >> 1;
 if (invert)
  return (fixedpt_div(((fixedpt)((fixedpt)1 << (32 - 8))), l));
 return (l);
}

canonical_original_code:
static inline int fixedpt_sqrt(int A)
{
 int invert = 0;
 int iter = (32 - 8);
 int l; int i;
 if (A < 0)
  return (-1);
 if (A == 0 || A == ((fixedpt)((int)1 << (32 - 8))))
  return (A);
 if (A < ((fixedpt)((int)1 << (32 - 8))) && A > 6) {
  invert = 1;
  A = fixedpt_div(((fixedpt)((int)1 << (32 - 8))), A);
 }
 if (A > ((fixedpt)((int)1 << (32 - 8)))) {
  int s = A;
  iter = 0;
  while (s > 0) {
   s >>= 2;
   iter++;
  }
 }
 l = (A >> 1) + 1;
 for (i = 0; i < iter; i++)
  l = (l + fixedpt_div(A, l)) >> 1;
 if (invert)
  return (fixedpt_div(((fixedpt)((int)1 << (32 - 8))), l));
 return (l);
}

variable_types: invert int

variable_types: iter int

variable_types: l int

variable_types: i int

variable_types: s int


variable_types: fp int

variable_types: sign int

variable_types: sqr int

variable_types: result int

variable_types:
SK
int [2]


variable_types: xabs int

variable_types: k int

variable_types: z int

variable_types: R int

variable_types: xp int


decompiled_code:
int __fastcall fixedpt_print(int a1)
{
char v2[40]; // [rsp+0h] [rbp-28h] BYREF

fixedpt_str_constprop_0(a1, v2);
return puts(v2);
}

canonical_decompiled_code:
int __fastcall func15(int a1)
{
char v2[40]; // [rsp+0h] [rbp-28h] BYREF

func12(a1, v2);
return puts(v2);
}

original_code:
void
fixedpt_print(fixedpt A)
{
 char num[20];
 fixedpt_str(A, num, -2);
 puts(num);
}

canonical_original_code:
void fixedpt_print(int A)
{
 char num[20];
 fixedpt_str(A, num, -2);
 puts(num);
}

variable_types: A int

variable_types:
num
char [20]


canonical_decompiled_code:
__int64 __fastcall func13(int a1, int a2)
{
return (a2 * (__int64)a1) >> 24;
}

variable_types: B int


canonical_decompiled_code:
__int64 __fastcall func14(int a1, int a2)
{
return ((__int64)a1 << 24) / a2;
}


decompiled_code:
__int64 __fastcall fixedpt_exp(int a1)
{
int v1; // ecx
int v2; // er8
int v3; // eax
int v4; // er8
int v5; // eax
int v6; // eax
int v7; // er9
int v8; // eax
int v9; // er9
int v10; // eax
int v11; // er9
int v12; // eax
int v13; // er9
int v14; // er8
int v15; // eax
int v16; // er8
int v17; // er9
int v18; // ecx
int v19; // esi
__int64 result; // rax

if ( !a1 )
return 0x1000000LL;
v1 = (fixedpt_mul(abs32(a1), 24204406) + 0x800000) & 0xFF000000;
if ( v2 < 0 )
v1 = -v1;
v3 = fixedpt_mul(v1, 11629080);
v5 = fixedpt_mul(v4 - v3, v4 - v3);
v6 = fixedpt_mul(v5, 1);
v8 = fixedpt_mul(v7, v6 - 28);
v10 = fixedpt_mul(v9, v8 + 1110);
v12 = fixedpt_mul(v11, v10 - 46603);
fixedpt_mul(v13, v12 + 2796203);
v15 = fixedpt_mul(v14, 0x2000000);
v19 = fixedpt_div(v15, v17 - v16) + 0x1000000;
if ( v18 < 0 )
result = fixedpt_mul(0x1000000 >> ((unsigned int)-v18 >> 24), v19);
else
result = fixedpt_mul(0x1000000 << SHIBYTE(v18), v19);
return result;
}


original_code:
static inline fixedpt fixedpt_sign(fixedpt fp)
{
 return (fp < 0) ? -((fixedpt)((fixedpt)1 << (32 - 8))) : ((fixedpt)((fixedpt)1 << (32 - 8)));
}

canonical_original_code:
static inline int fixedpt_sign(int fp)
{
 return (fp < 0) ? -((fixedpt)((int)1 << (32 - 8))) : ((fixedpt)((int)1 << (32 - 8)));
}


original_code:
static inline fixedpt fixedpt_tri(fixedpt fp)
{
 fp %= (((fixedpt)((fixedpt)1 << (32 - 8))) + ((fixedpt)((fixedpt)1 << (32 - 8))));
 fp -= ((fixedpt)((fixedpt)1 << (32 - 8)));
 if(fp > (((fixedpt)((fixedpt)1 << (32 - 8))) >> 1))
  fp = -fp + ((fixedpt)((fixedpt)1 << (32 - 8)));
 else if(fp < -(((fixedpt)((fixedpt)1 << (32 - 8))) >> 1))
  fp = -fp - ((fixedpt)((fixedpt)1 << (32 - 8)));
 else
  fp = +fp;
 return fixedpt_mul((((fixedpt)((fixedpt)1 << (32 - 8))) + ((fixedpt)((fixedpt)1 << (32 - 8)))), fp);
}


repo: jpvi/UnixProgramming

decompiled_code:
__int64 __fastcall get_user_by_uid(char *s2)
{
unsigned int v1; // er12
int v3; // eax
int v4; // ebp
char *i; // rdi
char *v6; // rax
char v8[552]; // [rsp+0h] [rbp-228h] BYREF

v3 = open("/etc/passwd", 0);
if ( v3 < 0 )
{
perror("Get UID error");
exit(-1);
}
v4 = v3;
memset(v8, 0, 0x200uLL);
read(v3, v8, 0x200uLL);
for ( i = strtok(v8, ":\n"); i; i = strtok(0LL, ":\n") )
{
if ( !strcmp(i, s2) )
{
strtok(0LL, ":\n");
v6 = strtok(0LL, ":\n");
v1 = atoi(v6);
}
}
close(v4);
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *s2)
{
unsigned int v1; // er12
int v3; // eax
int v4; // ebp
char *i; // rdi
char *v6; // rax
char v8[552]; // [rsp+0h] [rbp-228h] BYREF

v3 = open("/etc/passwd", 0);
if ( v3 < 0 )
{
perror("Get UID error");
exit(-1);
}
v4 = v3;
memset(v8, 0, 0x200uLL);
read(v3, v8, 0x200uLL);
for ( i = strtok(v8, ":\n"); i; i = strtok(0LL, ":\n") )
{
if ( !strcmp(i, s2) )
{
strtok(0LL, ":\n");
v6 = strtok(0LL, ":\n");
v1 = atoi(v6);
}
}
close(v4);
return v1;
}

original_code:
int get_user_by_uid(char* username) {
    char buffer[512];
    char* token;
    int passwd;
    int uid;
    passwd = open("/etc/passwd", 00);
    if(passwd < 0) {
        perror("Get UID error");
        exit(-1);
    }
    memset(buffer, 0, sizeof(buffer));
    read(passwd, buffer, sizeof(buffer));
    token = strtok(buffer, ":\n");
    while(token != ((void *)0)) {
        if(strcmp(token, username) == 0) {
            token = strtok(((void *)0), ":\n");
            token = strtok(((void *)0), ":\n");
            uid = atoi(token);
        }
        token = strtok(((void *)0), ":\n");
    }
    close(passwd);
    return uid;
}

canonical_original_code:
int get_user_by_uid(char *username) {
    char buffer[512];
    char *token;
    int passwd;
    int uid;
    passwd = open("/etc/passwd", 00);
    if(passwd < 0) {
        perror("Get UID error");
        exit(-1);
    }
    memset(buffer, 0, sizeof(buffer));
    read(passwd, buffer, sizeof(buffer));
    token = strtok(buffer, ":\n");
    while(token != ((void *)0)) {
        if(strcmp(token, username) == 0) {
            token = strtok(((void *)0), ":\n");
            token = strtok(((void *)0), ":\n");
            uid = atoi(token);
        }
        token = strtok(((void *)0), ":\n");
    }
    close(passwd);
    return uid;
}

variable_types:
username
char *

variable_types:
buffer
char [512]

variable_types:
token
char *

variable_types: passwd int

variable_types: uid int


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax
int longind[7]; // [rsp+Ch] [rbp-1Ch] BYREF

longind[0] = 0;
while ( 1 )
{
v3 = getopt_long(argc, (char *const *)argv, "hul", &long_options_0, longind);
switch ( v3 )
{
case -1:
return 0;
case 108:
if ( argc != 3 )
goto LABEL_13;
goto LABEL_8;
case 117:
if ( argc != 3 )
{
LABEL_13:
perror("Not enough arguments");
exit(-1);
}
LABEL_8:
get_user_proc((char *)argv[2]);
break;
case 104:
puts("Usage: mystats [OPTION]...\n");
printf("-l or --long: Displays the complete command line argument.");
puts(aUOrUserDisplay);
break;
default:
puts("Incorrect option!");
break;
}
}
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax
int longind[7]; // [rsp+Ch] [rbp-1Ch] BYREF

longind[0] = 0;
while ( 1 )
{
v3 = getopt_long(argc, (char *const *)argv, "hul", &long_options_0, longind);
switch ( v3 )
{
case -1:
return 0;
case 108:
if ( argc != 3 )
goto LABEL_13;
goto LABEL_8;
case 117:
if ( argc != 3 )
{
LABEL_13:
perror("Not enough arguments");
exit(-1);
}
LABEL_8:
func8((char *)argv[2]);
break;
case 104:
puts("Usage: mystats [OPTION]...\n");
printf("-l or --long: Displays the complete command line argument.");
puts(aUOrUserDisplay);
break;
default:
puts("Incorrect option!");
break;
}
}
}

original_code:
int main(int argc, char **argv) {
    static struct option long_options[] = {
        { "long", 1, 0, 'l' },
        { "user", 1, 0, 'u' },
    };
    int option_index = 0;
    int args;
    while((args = getopt_long(argc, argv, "hul", long_options, &option_index)) != -1) {
        switch(args) {
            case 'h':
                printf("Usage: mystats [OPTION]...\n\n");
                printf("-l or --long: Displays the complete command line argument.");
                printf("-u or --user: Displays the Process ID and command name for all processes being run by the user named in the program’s command-line argument.\n");
                break;
            case 'l':
                if(argc == 3) {
                    get_user_proc(argv[2], 0);
                }
                else {
                    perror("Not enough arguments");
                    exit(-1);
                }
                break;
            case 'u':
                if(argc == 3) {
                    get_user_proc(argv[2], 1);
                }
                else {
                    perror("Not enough arguments");
                    exit(-1);
                }
                break;
            default:
                printf("Incorrect option!\n");
                break;
        }
    }
    return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: struct option { char *name; int has_arg; int *flag; int val; } []

variable_types: args int


timeout

decompiled_code:
void timeout()
{
done = 1;
}

canonical_decompiled_code:
void func7()
{
done = 1;
}

original_code:
void timeout(int arg) {
    done = 1;
}

canonical_original_code:
void timeout(int arg) {
    done = 1;
}

variable_types: arg int


freeNumNeurons

decompiled_code:
void __fastcall freeNumNeurons(__int64 a1)
{
free(*(void **)(a1 + 8));
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1)
{
free(*(void **)(a1 + 8));
}

original_code:
void freeNumNeurons(Settings* settings){
 free(settings->numNeurons);
}

canonical_original_code:
void freeNumNeurons(struct argStruct *settings){
 free(settings->numNeurons);
}

variable_types: struct argStruct { int numHiddenLayers; int *numNeurons; float learningRate; char *trainingFile; char *testingFile; char *validationFile; int numEpochs; int numInputs; int numOutputs; char *testOutputFile; char *validationOutputFile; } *


displaySettings

decompiled_code:
int __fastcall displaySettings(unsigned int *a1)
{
__int64 v1; // rbx
__int64 v2; // rsi
__int64 v3; // rdx

puts("=======\n Neural Network Options \n");
printf("NumHiddenLayers:%i\n", *a1);
if ( (int)*a1 > 0 )
{
v1 = 0LL;
do
{
v2 = (unsigned int)v1;
v3 = *(unsigned int *)(*((_QWORD *)a1 + 1) + 4 * v1++);
printf("HiddenLayer %i: %i\n", v2, v3);
}
while ( (int)*a1 > (int)v1 );
}
printf("LearningRate: %.3f\n", *((float *)a1 + 4));
printf("NumEpochs: %i\n", a1[12]);
printf("NumInputs: %i\n", a1[13]);
printf("NumOutputs: %i\n", a1[14]);
printf("Training File: %s \n", *((const char **)a1 + 3));
printf("Testing File: %s \n", *((const char **)a1 + 4));
printf("Validation File: %s\n", *((const char **)a1 + 5));
printf("Testing Output File: %s\n", *((const char **)a1 + 8));
printf("Validation Output File: %s\n", *((const char **)a1 + 9));
return puts("=========");
}

canonical_decompiled_code:
int __fastcall func2(unsigned int *a1)
{
__int64 v1; // rbx
__int64 v2; // rsi
__int64 v3; // rdx

puts("=======\n Neural Network Options \n");
printf("NumHiddenLayers:%i\n", *a1);
if ( (int)*a1 > 0 )
{
v1 = 0LL;
do
{
v2 = (unsigned int)v1;
v3 = *(unsigned int *)(*((_QWORD *)a1 + 1) + 4 * v1++);
printf("HiddenLayer %i: %i\n", v2, v3);
}
while ( (int)*a1 > (int)v1 );
}
printf("LearningRate: %.3f\n", *((float *)a1 + 4));
printf("NumEpochs: %i\n", a1[12]);
printf("NumInputs: %i\n", a1[13]);
printf("NumOutputs: %i\n", a1[14]);
printf("Training File: %s \n", *((const char **)a1 + 3));
printf("Testing File: %s \n", *((const char **)a1 + 4));
printf("Validation File: %s\n", *((const char **)a1 + 5));
printf("Testing Output File: %s\n", *((const char **)a1 + 8));
printf("Validation Output File: %s\n", *((const char **)a1 + 9));
return puts("=========");
}

original_code:
void displaySettings(Settings* settings){
 printf("=======\n Neural Network Options \n\n");
 printf("NumHiddenLayers:%i\n",settings->numHiddenLayers);
 int i = 0;
 for(;i<settings->numHiddenLayers;i++){
  printf("HiddenLayer %i: %i\n",i,settings->numNeurons[i]);
 }
 printf("LearningRate: %.3f\n",settings->learningRate);
 printf("NumEpochs: %i\n",settings->numEpochs);
 printf("NumInputs: %i\n",settings->numInputs);
 printf("NumOutputs: %i\n",settings->numOutputs);
 printf("Training File: %s \n",settings->trainingFile);
 printf("Testing File: %s \n",settings->testingFile);
 printf("Validation File: %s\n",settings->validationFile);
 printf("Testing Output File: %s\n",settings->testOutputFile);
 printf("Validation Output File: %s\n",
  settings->validationOutputFile);
 printf("=========\n");
}

canonical_original_code:
void displaySettings(struct argStruct *settings){
 printf("=======\n Neural Network Options \n\n");
 printf("NumHiddenLayers:%i\n",settings->numHiddenLayers);
 int i = 0;
 for(;i<settings->numHiddenLayers;i++){
  printf("HiddenLayer %i: %i\n",i,settings->numNeurons[i]);
 }
 printf("LearningRate: %.3f\n",settings->learningRate);
 printf("NumEpochs: %i\n",settings->numEpochs);
 printf("NumInputs: %i\n",settings->numInputs);
 printf("NumOutputs: %i\n",settings->numOutputs);
 printf("Training File: %s \n",settings->trainingFile);
 printf("Testing File: %s \n",settings->testingFile);
 printf("Validation File: %s\n",settings->validationFile);
 printf("Testing Output File: %s\n",settings->testOutputFile);
 printf("Validation Output File: %s\n",
  settings->validationOutputFile);
 printf("=========\n");
}

variable_types: i int

user_defined_types: struct argStruct { int numHiddenLayers; int *numNeurons; float learningRate; char *trainingFile; char *testingFile; char *validationFile; int numEpochs; int numInputs; int numOutputs; char *testOutputFile; char *validationOutputFile; }


getValueSpecified

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

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

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

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

original_code:
char* getValueSpecified(char** arguments,int numArg,char* value){
 int i =0;
 for(;i<numArg;i++){
  if(strcmp(arguments[i],value)==0 && i!=(numArg-1)){
   return arguments[i+1];
  }
 }
 return 0;
}

canonical_original_code:
char *getValueSpecified(char **arguments, int numArg, char *value){
 int i = 0;
 for(;i<numArg;i++){
  if(strcmp(arguments[i],value)==0 && i!=(numArg-1)){
   return arguments[i+1];
  }
 }
 return 0;
}

variable_types:
arguments
char **

variable_types: numArg int

variable_types:
value
char *

return_type: char *


wasArgSpecified

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

if ( a2 <= 0 )
return 0LL;
v4 = a1;
do
{
if ( !strcmp(*v4, a3) )
return 1LL;
++v4;
}
while ( v4 != &a1[(unsigned int)(a2 - 1) + 1] );
return 0LL;
}

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

if ( a2 <= 0 )
return 0LL;
v4 = a1;
do
{
if ( !strcmp(*v4, a3) )
return 1LL;
++v4;
}
while ( v4 != &a1[(unsigned int)(a2 - 1) + 1] );
return 0LL;
}

original_code:
int wasArgSpecified(char** arguments,int numArg,char* value){
 int i =0;
 for(;i<numArg;i++){
  if(strcmp(arguments[i],value)==0){
   return 1;
  }
 }
 return 0;
}

canonical_original_code:
int wasArgSpecified(char **arguments, int numArg, char *value){
 int i = 0;
 for(;i<numArg;i++){
  if(strcmp(arguments[i],value)==0){
   return 1;
  }
 }
 return 0;
}


displayHelp

decompiled_code:
int displayHelp()
{
puts("--hiddenLayers [num] The number of hidden layers ");
puts("--numNeurons [num,num,...] Neurons in a hidden layer");
puts("--learningRate [float] The learning rate");
puts("--numEpochs [num] The number of epochs");
puts("--numInputs [num] The number of inputs ");
printf("--numOutputs [num] The number of outputs \n ");
puts("--trainingFile [file] The training file ");
puts("--testingFile [file] The testing file ");
puts("--validationFile [file] The validation file");
puts("--testOutputFile [file] The output file ");
return puts("--validationOutputFile [file] The val file ");
}

canonical_decompiled_code:
int func5()
{
puts("--hiddenLayers [num] The number of hidden layers ");
puts("--numNeurons [num,num,...] Neurons in a hidden layer");
puts("--learningRate [float] The learning rate");
puts("--numEpochs [num] The number of epochs");
puts("--numInputs [num] The number of inputs ");
printf("--numOutputs [num] The number of outputs \n ");
puts("--trainingFile [file] The training file ");
puts("--testingFile [file] The testing file ");
puts("--validationFile [file] The validation file");
puts("--testOutputFile [file] The output file ");
return puts("--validationOutputFile [file] The val file ");
}

original_code:
void displayHelp(){
 printf("--hiddenLayers [num] The number of hidden layers \n");
 printf("--numNeurons [num,num,...] Neurons in a hidden layer\n");
 printf("--learningRate [float] The learning rate\n");
 printf("--numEpochs [num] The number of epochs\n");
 printf("--numInputs [num] The number of inputs \n");
 printf("--numOutputs [num] The number of outputs \n ");
 printf("--trainingFile [file] The training file \n");
 printf("--testingFile [file] The testing file \n");
 printf("--validationFile [file] The validation file\n");
 printf("--testOutputFile [file] The output file \n");
 printf("--validationOutputFile [file] The val file \n");
}


parseArguments

decompiled_code:
int __fastcall parseArguments(int *a1, __int64 a2, int a3)
{
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
const char *v10; // rdi
const char *v11; // rdi
const char *v12; // rdi
float v13; // xmm0_4
const char *v14; // rdi
const char *v15; // rdi
int v16; // eax
void *v17; // rdi
char *v18; // rax
__int64 v19; // rbp
char *v20; // rdi
int *v21; // r12

v5 = getValueSpecified(a2, a3, "--validationFile");
if ( v5 )
*((_QWORD *)a1 + 5) = v5;
v6 = getValueSpecified(a2, a3, "--testOutputFile");
if ( v6 )
*((_QWORD *)a1 + 8) = v6;
v7 = getValueSpecified(a2, a3, "--validationOutputFile");
if ( v7 )
*((_QWORD *)a1 + 9) = v7;
v8 = getValueSpecified(a2, a3, "--testingFile");
if ( v8 )
*((_QWORD *)a1 + 4) = v8;
v9 = getValueSpecified(a2, a3, "--trainingFile");
if ( v9 )
*((_QWORD *)a1 + 3) = v9;
v10 = (const char *)getValueSpecified(a2, a3, "--numInputs");
if ( v10 )
a1[13] = atoi(v10);
v11 = (const char *)getValueSpecified(a2, a3, "--numEpochs");
if ( v11 )
a1[12] = atoi(v11);
v12 = (const char *)getValueSpecified(a2, a3, "--learningRate");
if ( v12 )
{
v13 = atof(v12);
*((float *)a1 + 4) = v13;
}
v14 = (const char *)getValueSpecified(a2, a3, "--numOutputs");
if ( v14 )
a1[14] = (int)atof(v14);
v15 = (const char *)getValueSpecified(a2, a3, "--hiddenLayers");
if ( v15 )
{
v16 = atoi(v15);
v17 = (void *)*((_QWORD *)a1 + 1);
*a1 = v16;
realloc(v17, 4LL * v16);
memset(*((void **)a1 + 1), 0, 4LL * *a1);
}
v18 = (char *)getValueSpecified(a2, a3, "--numNeurons");
if ( v18 )
{
v19 = 0LL;
v20 = strtok(v18, ",");
if ( v20 )
{
while ( *a1 >= (int)v19 )
{
v21 = (int *)(*((_QWORD *)a1 + 1) + 4 * v19++);
*v21 = atoi(v20);
v18 = strtok(0LL, ",");
v20 = v18;
if ( !v18 )
return (int)v18;
}
LODWORD(v18) = puts("Numbers of hidden layers do not match specification");
}
else
{
LODWORD(v18) = puts("Invalid format ");
}
}
return (int)v18;
}

canonical_decompiled_code:
int __fastcall func6(int *a1, __int64 a2, int a3)
{
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
const char *v10; // rdi
const char *v11; // rdi
const char *v12; // rdi
float v13; // xmm0_4
const char *v14; // rdi
const char *v15; // rdi
int v16; // eax
void *v17; // rdi
char *v18; // rax
__int64 v19; // rbp
char *v20; // rdi
int *v21; // r12

v5 = func3(a2, a3, "--validationFile");
if ( v5 )
*((_QWORD *)a1 + 5) = v5;
v6 = func3(a2, a3, "--testOutputFile");
if ( v6 )
*((_QWORD *)a1 + 8) = v6;
v7 = func3(a2, a3, "--validationOutputFile");
if ( v7 )
*((_QWORD *)a1 + 9) = v7;
v8 = func3(a2, a3, "--testingFile");
if ( v8 )
*((_QWORD *)a1 + 4) = v8;
v9 = func3(a2, a3, "--trainingFile");
if ( v9 )
*((_QWORD *)a1 + 3) = v9;
v10 = (const char *)func3(a2, a3, "--numInputs");
if ( v10 )
a1[13] = atoi(v10);
v11 = (const char *)func3(a2, a3, "--numEpochs");
if ( v11 )
a1[12] = atoi(v11);
v12 = (const char *)func3(a2, a3, "--learningRate");
if ( v12 )
{
v13 = atof(v12);
*((float *)a1 + 4) = v13;
}
v14 = (const char *)func3(a2, a3, "--numOutputs");
if ( v14 )
a1[14] = (int)atof(v14);
v15 = (const char *)func3(a2, a3, "--hiddenLayers");
if ( v15 )
{
v16 = atoi(v15);
v17 = (void *)*((_QWORD *)a1 + 1);
*a1 = v16;
realloc(v17, 4LL * v16);
memset(*((void **)a1 + 1), 0, 4LL * *a1);
}
v18 = (char *)func3(a2, a3, "--numNeurons");
if ( v18 )
{
v19 = 0LL;
v20 = strtok(v18, ",");
if ( v20 )
{
while ( *a1 >= (int)v19 )
{
v21 = (int *)(*((_QWORD *)a1 + 1) + 4 * v19++);
*v21 = atoi(v20);
v18 = strtok(0LL, ",");
v20 = v18;
if ( !v18 )
return (int)v18;
}
LODWORD(v18) = puts("Numbers of hidden layers do not match specification");
}
else
{
LODWORD(v18) = puts("Invalid format ");
}
}
return (int)v18;
}

original_code:
void parseArguments(Settings* settings,char** args,int numArg){
 char* value = getValueSpecified(args,numArg,(char*)"--validationFile");
 if(value!=0){
  settings->validationFile = value;
 }
 value = getValueSpecified(args,numArg,(char*)"--testOutputFile");
 if(value){
  settings->testOutputFile = value;
 }
 value = getValueSpecified(args,numArg,
  (char*)"--validationOutputFile");
 if(value){
  settings->validationOutputFile= value;
 }
 value = getValueSpecified(args,numArg,(char*)"--testingFile");
 if(value!=0){
  settings->testingFile = value;
 }
 value = getValueSpecified(args,numArg,(char*)"--trainingFile");
 if(value!=0){
  settings->trainingFile = value;
 }
 value = getValueSpecified(args,numArg,(char*)"--numInputs");
 if(value!=0){
  settings->numInputs = atoi(value);
 }
 value = getValueSpecified(args,numArg,(char*)"--numEpochs");
 if(value!=0){
  settings->numEpochs = atoi(value);
 }
 value = getValueSpecified(args,numArg,(char*)"--learningRate");
 if(value!=0){
   settings->learningRate = atof(value);
 }
 value = getValueSpecified(args,numArg,(char*)"--numOutputs");
 if(value!=0){
   settings->numOutputs = atof(value);
 }
 value = getValueSpecified(args,numArg,(char*)"--hiddenLayers");
 if(value!=0){
  settings->numHiddenLayers=atoi(value);
  realloc(settings->numNeurons,sizeof(int)*settings->numHiddenLayers);
  memset(settings->numNeurons,0,sizeof(int)*settings->numHiddenLayers);
 }
 value = getValueSpecified(args,numArg,(char*)"--numNeurons");
 if(value!=0){
  char* firstValue = strtok(value,",");
  if(!firstValue){
   printf("Invalid format \n");
   return;
  }
  int count = 0;
  while(firstValue){
   if(count>settings->numHiddenLayers){
    printf("Numbers of hidden layers do not match specification\n");
    return;
   }
   settings->numNeurons[count] = atoi(firstValue);
   firstValue = strtok(0,",");
   count++;
  }
 }
}

canonical_original_code:
void parseArguments(struct argStruct *settings, char **args, int numArg){
 char *value = getValueSpecified(args,numArg,(char*)"--validationFile");
 if(value!=0){
  settings->validationFile = value;
 }
 value = getValueSpecified(args,numArg,(char *)"--testOutputFile");
 if(value){
  settings->testOutputFile = value;
 }
 value = getValueSpecified(args,numArg,
  (char *)"--validationOutputFile");
 if(value){
  settings->validationOutputFile= value;
 }
 value = getValueSpecified(args,numArg,(char *)"--testingFile");
 if(value!=0){
  settings->testingFile = value;
 }
 value = getValueSpecified(args,numArg,(char *)"--trainingFile");
 if(value!=0){
  settings->trainingFile = value;
 }
 value = getValueSpecified(args,numArg,(char *)"--numInputs");
 if(value!=0){
  settings->numInputs = atoi(value);
 }
 value = getValueSpecified(args,numArg,(char *)"--numEpochs");
 if(value!=0){
  settings->numEpochs = atoi(value);
 }
 value = getValueSpecified(args,numArg,(char *)"--learningRate");
 if(value!=0){
   settings->learningRate = atof(value);
 }
 value = getValueSpecified(args,numArg,(char *)"--numOutputs");
 if(value!=0){
   settings->numOutputs = atof(value);
 }
 value = getValueSpecified(args,numArg,(char *)"--hiddenLayers");
 if(value!=0){
  settings->numHiddenLayers=atoi(value);
  realloc(settings->numNeurons,sizeof(int)*settings->numHiddenLayers);
  memset(settings->numNeurons,0,sizeof(int)*settings->numHiddenLayers);
 }
 value = getValueSpecified(args,numArg,(char *)"--numNeurons");
 if(value!=0){
  char *firstValue = strtok(value,",");
  if(!firstValue){
   printf("Invalid format \n");
   return;
  }
  int count = 0;
  while(firstValue){
   if(count>settings->numHiddenLayers){
    printf("Numbers of hidden layers do not match specification\n");
    return;
   }
   settings->numNeurons[count] = atoi(firstValue);
   firstValue = strtok(0,",");
   count++;
  }
 }
}

variable_types:
args
char **

variable_types:
firstValue
char *

variable_types: count int


freeLayer

decompiled_code:
void __fastcall freeLayer(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi
__int64 v4; // rbx
void *v5; // rdi

if ( *(int *)ptr > 0 )
{
v2 = 0LL;
do
{
v3 = *(void **)(*((_QWORD *)ptr + 1) + 8 * v2++);
free(v3);
}
while ( *(_DWORD *)ptr > (int)v2 );
}
free(*((void **)ptr + 1));
if ( *(int *)ptr > 0 )
{
v4 = 0LL;
do
{
v5 = *(void **)(*((_QWORD *)ptr + 2) + 8 * v4++);
free(v5);
}
while ( *(_DWORD *)ptr > (int)v4 );
}
free(*((void **)ptr + 2));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func0(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi
__int64 v4; // rbx
void *v5; // rdi

if ( *(int *)ptr > 0 )
{
v2 = 0LL;
do
{
v3 = *(void **)(*((_QWORD *)ptr + 1) + 8 * v2++);
free(v3);
}
while ( *(_DWORD *)ptr > (int)v2 );
}
free(*((void **)ptr + 1));
if ( *(int *)ptr > 0 )
{
v4 = 0LL;
do
{
v5 = *(void **)(*((_QWORD *)ptr + 2) + 8 * v4++);
free(v5);
}
while ( *(_DWORD *)ptr > (int)v4 );
}
free(*((void **)ptr + 2));
free(ptr);
}

original_code:
void freeLayer(Layer* layer){
 int i = 0;
 for(;i<layer->numNeurons;i++){
  free(layer->neurons[i]);
 }
 free(layer->neurons);
 i = 0;
 for(;i<layer->numNeurons;i++){
  free(layer->weights[i]);
 }
 free(layer->weights);
 free(layer);
}

canonical_original_code:
void freeLayer(struct nodeLayer *layer){
 int i = 0;
 for(;i<layer->numNeurons;i++){
  free(layer->neurons[i]);
 }
 free(layer->neurons);
 i = 0;
 for(;i<layer->numNeurons;i++){
  free(layer->weights[i]);
 }
 free(layer->weights);
 free(layer);
}

variable_types: struct nodeLayer { int numNeurons; struct node { float biasWeight; float h; float sigma; float delta; } **neurons; float **weights; int numWeightsPerNode; struct nodeLayer *prevLayer; struct nodeLayer *nextLayer; } *

user_defined_types: struct nodeLayer { int numNeurons; struct node **neurons; float **weights; int numWeightsPerNode; struct nodeLayer *prevLayer; struct nodeLayer *nextLayer; }


freeNeuralNetwork

decompiled_code:
void __fastcall freeNeuralNetwork(__int64 a1)
{
__int64 v2; // rbx
void *v3; // rdi

if ( *(int *)(a1 + 8) > 0 )
{
v2 = 0LL;
do
{
v3 = *(void **)(*(_QWORD *)(a1 + 16) + 8 * v2++);
freeLayer(v3);
}
while ( *(_DWORD *)(a1 + 8) > (int)v2 );
}
}

original_code:
void freeNeuralNetwork(NeuralNetwork* neuralNetwork){
 int i = 0;
 for(;i<neuralNetwork->numLayers;i++){
  freeLayer(neuralNetwork->layers[i]);
 }
}

canonical_original_code:
void freeNeuralNetwork(struct network *neuralNetwork){
 int i = 0;
 for(;i<neuralNetwork->numLayers;i++){
  freeLayer(neuralNetwork->layers[i]);
 }
}

variable_types: struct network { int numInputs; int numOutputs; int numLayers; struct nodeLayer { int numNeurons; struct node { float biasWeight; float h; float sigma; float delta; } **neurons; float **weights; int numWeightsPerNode; struct nodeLayer *prevLayer; struct nodeLayer *nextLayer; } **layers; } *

user_defined_types: struct network { int numInputs; int numOutputs; int numLayers; struct nodeLayer **layers; }


initializeNeuron

decompiled_code:
float *initializeNeuron()
{
float *v0; // rax
float *v1; // r12
float v2; // xmm0_4
float *result; // rax

v0 = (float *)malloc(0x10uLL);
v0[1] = 0.0;
v1 = v0;
*((_QWORD *)v0 + 1) = 0LL;
v2 = generateRandomFloat(-0.1, 0.1);
result = v1;
*v1 = v2;
return result;
}

canonical_decompiled_code:
float *func2()
{
float *v0; // rax
float *v1; // r12
float v2; // xmm0_4
float *result; // rax

v0 = (float *)malloc(0x10uLL);
v0[1] = 0.0;
v1 = v0;
*((_QWORD *)v0 + 1) = 0LL;
v2 = generateRandomFloat(-0.1, 0.1);
result = v1;
*v1 = v2;
return result;
}

original_code:
Neuron* initializeNeuron(){
 Neuron* neuron = (Neuron*)malloc(sizeof(Neuron));
 neuron->sigma = 0.0f;
 neuron->delta = 0.0f;
 neuron->h = 0.0f;
 neuron->biasWeight = generateRandomFloat(-.1,.1);
 return neuron;
}

canonical_original_code:
struct node *initializeNeuron(){
 struct node *neuron = (Neuron*)malloc(sizeof(Neuron));
 neuron->sigma = 0.0f;
 neuron->delta = 0.0f;
 neuron->h = 0.0f;
 neuron->biasWeight = generateRandomFloat(-.1,.1);
 return neuron;
}

variable_types: struct node { float biasWeight; float h; float sigma; float delta; } *


displayNeuron

decompiled_code:
int __fastcall displayNeuron(float *a1)
{
printf("Sigma:%.6f\n", a1[2]);
printf("Delta:%.6f\n", a1[3]);
printf("h:%.6f\n", a1[1]);
return printf("weightBias:%.6f\n", *a1);
}

canonical_decompiled_code:
int __fastcall func3(float *a1)
{
printf("Sigma:%.6f\n", a1[2]);
printf("Delta:%.6f\n", a1[3]);
printf("h:%.6f\n", a1[1]);
return printf("weightBias:%.6f\n", *a1);
}

original_code:
void displayNeuron(Neuron* neuron){
 printf("Sigma:%.6f\n",neuron->sigma);
 printf("Delta:%.6f\n",neuron->delta);
 printf("h:%.6f\n",neuron->h);
 printf("weightBias:%.6f\n",neuron->biasWeight);
}

canonical_original_code:
void displayNeuron(struct node *neuron){
 printf("Sigma:%.6f\n",neuron->sigma);
 printf("Delta:%.6f\n",neuron->delta);
 printf("h:%.6f\n",neuron->h);
 printf("weightBias:%.6f\n",neuron->biasWeight);
}

user_defined_types: struct node { float biasWeight; float h; float sigma; float delta; }


displayLayer

decompiled_code:
int __fastcall displayLayer(unsigned int *a1)
{
int result; // eax
__int64 v2; // r13
__int64 v3; // rbx
double v4; // xmm0_8

printf("NumNeurons: %i\n", *a1);
result = printf("NumInputWeights %i\n", a1[6]);
if ( (int)*a1 > 0 )
{
v2 = 0LL;
do
{
displayNeuron(*(float **)(*((_QWORD *)a1 + 1) + 8 * v2));
if ( (int)a1[6] > 0 )
{
v3 = 0LL;
do
{
v4 = *(float *)(*(_QWORD *)(*((_QWORD *)a1 + 2) + 8 * v2) + 4 * v3++);
printf("%.6f,", v4);
}
while ( (int)a1[6] > (int)v3 );
}
++v2;
result = puts("\n");
}
while ( (int)*a1 > (int)v2 );
}
return result;
}

canonical_decompiled_code:
int __fastcall func4(unsigned int *a1)
{
int result; // eax
__int64 v2; // r13
__int64 v3; // rbx
double v4; // xmm0_8

printf("NumNeurons: %i\n", *a1);
result = printf("NumInputWeights %i\n", a1[6]);
if ( (int)*a1 > 0 )
{
v2 = 0LL;
do
{
func3(*(float **)(*((_QWORD *)a1 + 1) + 8 * v2));
if ( (int)a1[6] > 0 )
{
v3 = 0LL;
do
{
v4 = *(float *)(*(_QWORD *)(*((_QWORD *)a1 + 2) + 8 * v2) + 4 * v3++);
printf("%.6f,", v4);
}
while ( (int)a1[6] > (int)v3 );
}
++v2;
result = puts("\n");
}
while ( (int)*a1 > (int)v2 );
}
return result;
}

original_code:
void displayLayer(Layer* layer){
 int i = 0;
 printf("NumNeurons: %i\n",layer->numNeurons);
 printf("NumInputWeights %i\n",layer->numWeightsPerNode);
 for(;i<layer->numNeurons;i++){
  displayNeuron(layer->neurons[i]);
  int x = 0;
  for(;x<layer->numWeightsPerNode;x++){
   printf("%.6f,",layer->weights[i][x]);
  }
  printf("\n\n");
 }
}

canonical_original_code:
void displayLayer(struct nodeLayer *layer){
 int i = 0;
 printf("NumNeurons: %i\n",layer->numNeurons);
 printf("NumInputWeights %i\n",layer->numWeightsPerNode);
 for(;i<layer->numNeurons;i++){
  displayNeuron(layer->neurons[i]);
  int x = 0;
  for(;x<layer->numWeightsPerNode;x++){
   printf("%.6f,",layer->weights[i][x]);
  }
  printf("\n\n");
 }
}

variable_types: x int


displayNeuralNetwork

decompiled_code:
int __fastcall displayNeuralNetwork(unsigned int *a1)
{
__int64 v2; // rbx
unsigned int *v3; // rdi

puts("Displaying neural network\n");
printf("Num Inputs:%i\n", *a1);
printf("Num Outputs%i\n", a1[1]);
printf("Num Layers%i\n", a1[2]);
if ( (int)a1[2] > 0 )
{
v2 = 0LL;
do
{
puts("\n======");
v3 = *(unsigned int **)(*((_QWORD *)a1 + 2) + 8 * v2++);
displayLayer(v3);
puts("\n======");
}
while ( (int)a1[2] > (int)v2 );
}
return puts("Done displaying neuralnetwork \n");
}

canonical_decompiled_code:
int __fastcall func5(unsigned int *a1)
{
__int64 v2; // rbx
unsigned int *v3; // rdi

puts("Displaying neural network\n");
printf("Num Inputs:%i\n", *a1);
printf("Num Outputs%i\n", a1[1]);
printf("Num Layers%i\n", a1[2]);
if ( (int)a1[2] > 0 )
{
v2 = 0LL;
do
{
puts("\n======");
v3 = *(unsigned int **)(*((_QWORD *)a1 + 2) + 8 * v2++);
func4(v3);
puts("\n======");
}
while ( (int)a1[2] > (int)v2 );
}
return puts("Done displaying neuralnetwork \n");
}

original_code:
void displayNeuralNetwork(NeuralNetwork* neuralNetwork){
 printf("Displaying neural network\n\n");
 printf("Num Inputs:%i\n",neuralNetwork->numInputs);
 printf("Num Outputs%i\n",neuralNetwork->numOutputs);
 printf("Num Layers%i\n",neuralNetwork->numLayers);
 int i = 0;
 for(;i<neuralNetwork->numLayers;i++){
  printf("\n======\n");
  displayLayer(neuralNetwork->layers[i]);
  printf("\n======\n");
 }
 printf("Done displaying neuralnetwork \n\n");
}

canonical_original_code:
void displayNeuralNetwork(struct network *neuralNetwork){
 printf("Displaying neural network\n\n");
 printf("Num Inputs:%i\n",neuralNetwork->numInputs);
 printf("Num Outputs%i\n",neuralNetwork->numOutputs);
 printf("Num Layers%i\n",neuralNetwork->numLayers);
 int i = 0;
 for(;i<neuralNetwork->numLayers;i++){
  printf("\n======\n");
  displayLayer(neuralNetwork->layers[i]);
  printf("\n======\n");
 }
 printf("Done displaying neuralnetwork \n\n");
}


freeNeuron

decompiled_code:
// attributes: thunk
void freeNeuron(void *ptr)
{
free(ptr);
}

canonical_decompiled_code:
void func6(void *ptr)
{
free(ptr);
}

original_code:
void freeNeuron(Neuron* neuron){
 free(neuron);
}

canonical_original_code:
void freeNeuron(struct node *neuron){
 free(neuron);
}


seedRandom

decompiled_code:
void seedRandom()
{
unsigned int v0; // eax

v0 = time(0LL);
srand(v0);
}

canonical_decompiled_code:
void func0()
{
unsigned int v0; // eax

v0 = time(0LL);
srand(v0);
}

original_code:
void seedRandom(){
 srand(time(0));
}

canonical_original_code:
void seedRandom(){
 srand(time(0));
}


generateRandomFloat

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

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

original_code:
float generateRandomFloat(float min,float max){
 float random = ((float) rand())/((float)2147483647);
 float diff = max - min;
 float r = random*diff;
 return min+r;
}

canonical_original_code:
float generateRandomFloat(float min, float max){
 float random = ((float) rand())/((float)2147483647);
 float diff = max - min;
 float r = random*diff;
 return min+r;
}

variable_types: min float

variable_types: max float

variable_types: random float

variable_types: diff float

variable_types: r float

return_type: float


repo: jrahm/lightpager

decompiled_code:
int __fastcall set_timer(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD *v4; // rax
pthread_t newthread[4]; // [rsp+8h] [rbp-20h] BYREF

v4 = malloc(0x18uLL);
*v4 = a2;
v4[1] = a3;
v4[2] = a1;
return pthread_create(newthread, 0LL, (void *(*)(void *))timer_main, v4);
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD *v4; // rax
pthread_t newthread[4]; // [rsp+8h] [rbp-20h] BYREF

v4 = malloc(0x18uLL);
*v4 = a2;
v4[1] = a3;
v4[2] = a1;
return pthread_create(newthread, 0LL, (void *(*)(void *))timer_main, v4);
}

original_code:
void set_timer( void (*cb)(void*), void* arg, long t ) {
 struct timer* timer_str = malloc( sizeof (struct timer) );
 timer_str->data = arg;
 timer_str->n = t;
 timer_str->callback = cb;
 pthread_t thread;
 pthread_create( &thread, ((void *)0), _timer_main, timer_str );
}

canonical_original_code:
void set_timer(void (*cb)(void *), void *arg, long t) {
 struct timer *timer_str = malloc( sizeof (struct timer) );
 timer_str->data = arg;
 timer_str->n = t;
 timer_str->callback = cb;
 unsigned long thread;
 pthread_create( &thread, ((void *)0), _timer_main, timer_str );
}

variable_types:
cb
void (*)(void *)

variable_types:
arg
void *

variable_types: t long

variable_types: struct timer { void *data; long n; void (*callback)(void *data); } *

variable_types:
thread
unsigned long


original_code:
int parse_line( const char* line, char** key, char** val ) {
 const char* cursor = line;
 char key_buf[1024];
 char val_buf[1024];
 int i = 0;
 while( *cursor && ((*__ctype_b_loc ())[(int) ((*cursor))] & (unsigned short int) _ISspace) ) cursor++;
 if( !*cursor || *cursor == '#' ) return 1;
 while( i < 1024 && *cursor && !((*__ctype_b_loc ())[(int) ((*cursor))] & (unsigned short int) _ISspace) ) { key_buf[i++] = *cursor; cursor++; }
 key_buf[i] = 0;
 i = 0;
 while( *cursor && ((*__ctype_b_loc ())[(int) ((*cursor))] & (unsigned short int) _ISspace) ) cursor ++;
 if( ! *cursor ) return -1;
 while( i < 1024 && *cursor ) {val_buf[i++] = *cursor; cursor ++;}
 val_buf[i] = 0;
 *key = strdup(key_buf);
 *val = strdup(val_buf);
 return 0;
}

canonical_original_code:
int parse_line(char *line, char **key, char **val) {
 char *cursor = line;
 char key_buf[1024];
 char val_buf[1024];
 int i = 0;
 while( *cursor && ((*__ctype_b_loc ())[(int) ((*cursor))] & (unsigned short) _ISspace) ) cursor++;
 if( !*cursor || *cursor == '#' ) return 1;
 while( i < 1024 && *cursor && !((*__ctype_b_loc ())[(int) ((*cursor))] & (unsigned short) _ISspace) ) { key_buf[i++] = *cursor; cursor++; }
 key_buf[i] = 0;
 i = 0;
 while( *cursor && ((*__ctype_b_loc ())[(int) ((*cursor))] & (unsigned short) _ISspace) ) cursor ++;
 if( ! *cursor ) return -1;
 while( i < 1024 && *cursor ) {val_buf[i++] = *cursor; cursor ++;}
 val_buf[i] = 0;
 *key = strdup(key_buf);
 *val = strdup(val_buf);
 return 0;
}

variable_types:
line
char *

variable_types:
key
char **

variable_types:
val
char **

variable_types:
cursor
char *

variable_types: i int


repo: jrbarrio/FundamentosProgramacionI

decompiled_code:
int __fastcall lee_cadena(__int64 a1, _DWORD *a2)
{
__int64 v2; // rbx
int result; // eax

v2 = 0LL;
puts("INTRODUCE UNA CADENA (-ENTER- PARA ACABAR)\n\n");
do
{
result = getchar();
if ( (_BYTE)result == 13 )
{
*a2 = v2;
return result;
}
*(_BYTE *)(a1 + v2++) = result;
}
while ( v2 != 20 );
*a2 = 20;
return result;
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1, _DWORD *a2)
{
__int64 v2; // rbx
int result; // eax

v2 = 0LL;
puts("INTRODUCE UNA CADENA (-ENTER- PARA ACABAR)\n\n");
do
{
result = getchar();
if ( (_BYTE)result == 13 )
{
*a2 = v2;
return result;
}
*(_BYTE *)(a1 + v2++) = result;
}
while ( v2 != 20 );
*a2 = 20;
return result;
}

original_code:
void lee_cadena(char cadena[], int *num_elem) {
    int indice = 0;
    char caracter;
    puts("INTRODUCE UNA CADENA (-ENTER- PARA ACABAR)\n\n");
    while (indice < 20 && (caracter = getchar()) != '\r') {
        cadena[indice++] = caracter;
    }
    *num_elem = indice++;
}

variable_types:
cadena
char []

variable_types: indice int

variable_types: caracter char


original_code:
void cuenta_caracteres(char cadena[], int contador[], int num_elem) {
    int indice_1, indice_2;
    for (indice_1 = 0; indice_1 < num_elem; indice_1++) {
        for (indice_2 = indice_1; indice_2 < num_elem; indice_2++) {
            if (cadena[indice_2] == cadena[indice_1]) {
                contador[indice_1]++;
            }
        }
    }
}

canonical_original_code:
void cuenta_caracteres(char cadena[], int contador[], int num_elem) {
    int indice_1; int indice_2;
    for (indice_1 = 0; indice_1 < num_elem; indice_1++) {
        for (indice_2 = indice_1; indice_2 < num_elem; indice_2++) {
            if (cadena[indice_2] == cadena[indice_1]) {
                contador[indice_1]++;
            }
        }
    }
}

variable_types:
contador
int []


decompiled_code:
__int64 __fastcall mayor_frecuencia(unsigned int *a1, int a2)
{
__int64 result; // rax
int *v3; // rdi
int *v4; // rcx
int i; // edx

result = *a1;
if ( a2 > 0 )
{
v3 = (int *)(a1 + 1);
v4 = &v3[a2 - 1];
for ( i = result; ; i = *v3++ )
{
if ( (int)result < i )
result = (unsigned int)i;
if ( v4 == v3 )
break;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned int *a1, int a2)
{
__int64 result; // rax
int *v3; // rdi
int *v4; // rcx
int i; // edx

result = *a1;
if ( a2 > 0 )
{
v3 = (int *)(a1 + 1);
v4 = &v3[a2 - 1];
for ( i = result; ; i = *v3++ )
{
if ( (int)result < i )
result = (unsigned int)i;
if ( v4 == v3 )
break;
}
}
return result;
}

original_code:
int mayor_frecuencia(int contador[], int num_elem) {
    int indice, indice_max;
    for (indice = 0, indice_max = 0; indice < num_elem; indice++) {
        if (contador[indice] > contador[indice_max]) {
            indice_max = indice;
        }
    }
    return (contador[indice_max]);
}

canonical_original_code:
int mayor_frecuencia(int contador[], int num_elem) {
    int indice; int indice_max;
    for (indice = 0, indice_max = 0; indice < num_elem; indice++) {
        if (contador[indice] > contador[indice_max]) {
            indice_max = indice;
        }
    }
    return (contador[indice_max]);
}


decompiled_code:
int __fastcall visualiza_moda(__int64 a1, __int64 a2, int a3, unsigned int a4)
{
__int64 v6; // rbp
int result; // eax
__int64 i; // rbx
__int64 v9; // rsi

v6 = a3;
result = printf("\n\nLOS SIGUIENTES CARACTERES APARECEN %d VECES\n", a4);
if ( (int)v6 > 0 )
{
for ( i = 0LL; i != v6; ++i )
{
while ( *(_DWORD *)(a2 + 4 * i) != a4 )
{
if ( v6 == ++i )
return result;
}
v9 = (unsigned int)*(char *)(a1 + i);
result = printf("%c\n", v9);
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func10(__int64 a1, __int64 a2, int a3, unsigned int a4)
{
__int64 v6; // rbp
int result; // eax
__int64 i; // rbx
__int64 v9; // rsi

v6 = a3;
result = printf("\n\nLOS SIGUIENTES CARACTERES APARECEN %d VECES\n", a4);
if ( (int)v6 > 0 )
{
for ( i = 0LL; i != v6; ++i )
{
while ( *(_DWORD *)(a2 + 4 * i) != a4 )
{
if ( v6 == ++i )
return result;
}
v9 = (unsigned int)*(char *)(a1 + i);
result = printf("%c\n", v9);
}
}
return result;
}

original_code:
void visualiza_moda(char cadena[], int contador[], int num_elem, int frecuencia) {
    int indice;
    printf("\n\nLOS SIGUIENTES CARACTERES APARECEN %d VECES\n", frecuencia);
    for (indice = 0; indice < num_elem; indice++) {
        if (contador[indice] == frecuencia) {
            printf("%c\n", cadena[indice]);
        }
    }
}

variable_types: frecuencia int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
unsigned int v4; // er8
unsigned int v6; // [rsp+Ch] [rbp-2Ch] BYREF
char v7[40]; // [rsp+10h] [rbp-28h] BYREF

lee_cadena(v7, &v6, envp);
cuenta_caracteres(v7, &contador_0, v6);
v3 = mayor_frecuencia(&contador_0, v6);
return visualiza_moda(v7, &contador_0, v4, v3);
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
unsigned int v4; // er8
unsigned int v6; // [rsp+Ch] [rbp-2Ch] BYREF
char v7[40]; // [rsp+10h] [rbp-28h] BYREF

func7(v7, &v6, envp);
func8(v7, &contador_0, v6);
v3 = func9(&contador_0, v6);
return func10(v7, &contador_0, v4, v3);
}

original_code:
void main(void) {
    char cadena[20];
    static int contador[20];
    int num_elem;
    int frecuencia;
    lee_cadena(cadena, &num_elem);
    cuenta_caracteres(cadena, contador, num_elem);
    frecuencia = mayor_frecuencia(contador, num_elem);
    visualiza_moda(cadena, contador, num_elem, frecuencia);
}

canonical_original_code:
void main() {
    char cadena[20];
    static int contador[20];
    int num_elem;
    int frecuencia;
    lee_cadena(cadena, &num_elem);
    cuenta_caracteres(cadena, contador, num_elem);
    frecuencia = mayor_frecuencia(contador, num_elem);
    visualiza_moda(cadena, contador, num_elem, frecuencia);
}

variable_types:
cadena
char [20]

variable_types:
contador
int [20]


original_code:
void add_stand (struct stand stands [], int *elementos, struct pabellon pabellones [])
{
char caracter;
struct stand nuevo;
int posicion, indice;
int principio=0;
int final=*elementos;
int mitad=(principio+final)/2;
printf ("\nNUEVO STAND.\n\n\n");
printf ("NOMBRE --->");
fflush (stdin);
gets (nuevo.nombre);
printf("PABELLON NUMERO --->");
scanf ("%d", &nuevo.numero);
printf ("DIAS --->");
scanf ("%d", &nuevo.dias);
printf ("METROS DEL STAND --->");
scanf ("%d", &nuevo.metros_stand);
nuevo.precio= nuevo.metros_stand * pabellones [nuevo.numero-1].tarifa;
if ( pabellones [nuevo.numero-1].metros_pabellon>( pabellones [nuevo.numero-1].metros_alquilados + nuevo.metros_stand))
 {
 pabellones [nuevo.numero].metros_alquilados += nuevo.metros_stand;
 while (strcmp (stands [mitad].nombre, nuevo.nombre)!=0 && principio<final)
  {
  if (strcmp (stands [mitad].nombre, nuevo.nombre)>0)
   final=mitad-1;
  else
   principio=mitad+1;
                mitad=(principio+final)/2;
  }
 if ( strcmp (stands [mitad].nombre, nuevo.nombre)==0)
  posicion=mitad;
 else
  posicion=principio;
 for (indice=*elementos; indice>=posicion; indice--)
  {
  strcpy (stands [indice+1].nombre, stands [indice].nombre);
  stands [indice+1].numero=stands [indice].numero;
  stands [indice+1].dias=stands [indice].dias;
  stands [indice+1].metros_stand=stands [indice].metros_stand;
  stands [indice+1].precio=stands [indice].precio;
                }
 strcpy (stands [posicion].nombre,nuevo.nombre);
 stands [posicion].numero=nuevo.dias;
 stands [posicion].dias=nuevo.dias;
 stands [posicion].metros_stand=nuevo.metros_stand;
 stands [posicion].precio=nuevo.precio;
 *elementos+=1;
        }
else
 {
 printf ("\n\nNO HAY METROS DISPONIBLES EN ESTE PABELLON.");
 printf ("\n\nPULSE UNA TECLA PARA CONTINUAR");
 caracter=getchar ();
        }
}

canonical_original_code:
void add_stand(struct stand stands[], int *elementos, struct pabellon pabellones[])
{
char caracter;
struct stand nuevo;
int posicion; int indice;
int principio = 0;
int final = *elementos;
int mitad = (principio+final)/2;
printf ("\nNUEVO STAND.\n\n\n");
printf ("NOMBRE --->");
fflush (stdin);
gets (nuevo.nombre);
printf("PABELLON NUMERO --->");
scanf ("%d", &nuevo.numero);
printf ("DIAS --->");
scanf ("%d", &nuevo.dias);
printf ("METROS DEL STAND --->");
scanf ("%d", &nuevo.metros_stand);
nuevo.precio= nuevo.metros_stand * pabellones [nuevo.numero-1].tarifa;
if ( pabellones [nuevo.numero-1].metros_pabellon>( pabellones [nuevo.numero-1].metros_alquilados + nuevo.metros_stand))
 {
 pabellones [nuevo.numero].metros_alquilados += nuevo.metros_stand;
 while (strcmp (stands [mitad].nombre, nuevo.nombre)!=0 && principio<final)
  {
  if (strcmp (stands [mitad].nombre, nuevo.nombre)>0)
   final=mitad-1;
  else
   principio=mitad+1;
                mitad=(principio+final)/2;
  }
 if ( strcmp (stands [mitad].nombre, nuevo.nombre)==0)
  posicion=mitad;
 else
  posicion=principio;
 for (indice=*elementos; indice>=posicion; indice--)
  {
  strcpy (stands [indice+1].nombre, stands [indice].nombre);
  stands [indice+1].numero=stands [indice].numero;
  stands [indice+1].dias=stands [indice].dias;
  stands [indice+1].metros_stand=stands [indice].metros_stand;
  stands [indice+1].precio=stands [indice].precio;
                }
 strcpy (stands [posicion].nombre,nuevo.nombre);
 stands [posicion].numero=nuevo.dias;
 stands [posicion].dias=nuevo.dias;
 stands [posicion].metros_stand=nuevo.metros_stand;
 stands [posicion].precio=nuevo.precio;
 *elementos+=1;
        }
else
 {
 printf ("\n\nNO HAY METROS DISPONIBLES EN ESTE PABELLON.");
 printf ("\n\nPULSE UNA TECLA PARA CONTINUAR");
 caracter=getchar ();
        }
}

variable_types: struct stand { char nombre[30]; int numero; int dias; int metros_stand; int precio; } []

variable_types:
elementos
int *

variable_types: struct pabellon { int tarifa; int metros_pabellon; int metros_alquilados; } []

variable_types: posicion int

variable_types: principio int

variable_types: final int

variable_types: mitad int


decompiled_code:
__int64 modifica_tarifa()
{
printf("\nNUMERO DEL PABELLON");
__isoc99_scanf();
printf("\nNUEVA TARIFA --->");
return __isoc99_scanf();
}

canonical_decompiled_code:
__int64 func11()
{
printf("\nNUMERO DEL PABELLON");
__isoc99_scanf();
printf("\nNUEVA TARIFA --->");
return __isoc99_scanf();
}

original_code:
void modifica_tarifa (struct pabellon pabellones [])
{
int indice;
printf ("\nNUMERO DEL PABELLON");
scanf ("%d", &indice);
printf ("\nNUEVA TARIFA --->");
scanf ("%d", &pabellones [indice].tarifa);
}

canonical_original_code:
void modifica_tarifa(struct pabellon pabellones[])
{
int indice;
printf ("\nNUMERO DEL PABELLON");
scanf ("%d", &indice);
printf ("\nNUEVA TARIFA --->");
scanf ("%d", &pabellones [indice].tarifa);
}

user_defined_types: struct pabellon { int tarifa; int metros_pabellon; int metros_alquilados; }


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v3; // rbx
unsigned int *v4; // rsi
int v5; // eax
int v7; // [rsp+8h] [rbp-60h] BYREF
unsigned int v8; // [rsp+Ch] [rbp-5Ch] BYREF
char v9[60]; // [rsp+10h] [rbp-58h] BYREF
char v10; // [rsp+4Ch] [rbp-1Ch] BYREF

v8 = 0;
v3 = v9;
do
{
printf("TARIFA DEL PABELLON (EN PTAS/M2) --->");
__isoc99_scanf();
printf("METROS CUADRADOS DEL PABELLON --->");
__isoc99_scanf();
printf("METROS ALQUILADOS --->");
v4 = (unsigned int *)(v3 + 8);
__isoc99_scanf();
v3 += 12;
}
while ( &v10 != v3 );
do
{
while ( 1 )
{
opciones(&v7, v4);
v5 = v7;
if ( v7 == 3 )
{
modifica_tarifa(v9);
v5 = v7;
goto LABEL_6;
}
if ( v7 > 3 )
{
if ( v7 == 4 )
{
v4 = (unsigned int *)v8;
visualiza(&stands_0, v8, v9);
v5 = v7;
}
goto LABEL_6;
}
if ( v7 == 1 )
break;
if ( v7 == 2 )
{
v4 = &v8;
elimina(&stands_0, &v8, v9);
v5 = v7;
LABEL_6:
if ( v5 == 5 )
return printf("FIN DEL PROGRAMA");
}
}
v4 = &v8;
add_stand(&stands_0, &v8, v9);
}
while ( v7 != 5 );
return printf("FIN DEL PROGRAMA");
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v3; // rbx
unsigned int *v4; // rsi
int v5; // eax
int v7; // [rsp+8h] [rbp-60h] BYREF
unsigned int v8; // [rsp+Ch] [rbp-5Ch] BYREF
char v9[60]; // [rsp+10h] [rbp-58h] BYREF
char v10; // [rsp+4Ch] [rbp-1Ch] BYREF

v8 = 0;
v3 = v9;
do
{
printf("TARIFA DEL PABELLON (EN PTAS/M2) --->");
__isoc99_scanf();
printf("METROS CUADRADOS DEL PABELLON --->");
__isoc99_scanf();
printf("METROS ALQUILADOS --->");
v4 = (unsigned int *)(v3 + 8);
__isoc99_scanf();
v3 += 12;
}
while ( &v10 != v3 );
do
{
while ( 1 )
{
func10(&v7, v4);
v5 = v7;
if ( v7 == 3 )
{
func11(v9);
v5 = v7;
goto LABEL_6;
}
if ( v7 > 3 )
{
if ( v7 == 4 )
{
v4 = (unsigned int *)v8;
func9(&stands_0, v8, v9);
v5 = v7;
}
goto LABEL_6;
}
if ( v7 == 1 )
break;
if ( v7 == 2 )
{
v4 = &v8;
func7(&stands_0, &v8, v9);
v5 = v7;
LABEL_6:
if ( v5 == 5 )
return printf("FIN DEL PROGRAMA");
}
}
v4 = &v8;
func8(&stands_0, &v8, v9);
}
while ( v7 != 5 );
return printf("FIN DEL PROGRAMA");
}

original_code:
void main (void)
{
static struct stand stands [100];
struct pabellon pabellones [5];
int indice, opcion, elementos=0;
for (indice=0; indice<5; indice++)
 {
 printf ("TARIFA DEL PABELLON (EN PTAS/M2) --->");
 scanf ("%d", &pabellones [indice].tarifa);
 printf ("METROS CUADRADOS DEL PABELLON --->");
 scanf ("%d", &pabellones [indice].metros_pabellon);
 printf ("METROS ALQUILADOS --->");
 scanf ("%d", &pabellones [indice].metros_alquilados);
 }
do
 {
 opciones (&opcion);
 switch (opcion)
  {
  case 1:
   add_stand (stands, &elementos, pabellones);
   break;
  case 2:
   elimina (stands, &elementos, pabellones);
                        break;
  case 3:
   modifica_tarifa (pabellones);
                        break;
  case 4:
   visualiza (stands, elementos, pabellones);
                        break;
  }
 }
while (opcion!=5);
printf ("FIN DEL PROGRAMA");
}

canonical_original_code:
void main()
{
static struct stand stands[100];
struct pabellon pabellones[5];
int indice; int opcion; int elementos = 0;
for (indice=0; indice<5; indice++)
 {
 printf ("TARIFA DEL PABELLON (EN PTAS/M2) --->");
 scanf ("%d", &pabellones [indice].tarifa);
 printf ("METROS CUADRADOS DEL PABELLON --->");
 scanf ("%d", &pabellones [indice].metros_pabellon);
 printf ("METROS ALQUILADOS --->");
 scanf ("%d", &pabellones [indice].metros_alquilados);
 }
do
 {
 opciones (&opcion);
 switch (opcion)
  {
  case 1:
   add_stand (stands, &elementos, pabellones);
   break;
  case 2:
   elimina (stands, &elementos, pabellones);
                        break;
  case 3:
   modifica_tarifa (pabellones);
                        break;
  case 4:
   visualiza (stands, elementos, pabellones);
                        break;
  }
 }
while (opcion!=5);
printf ("FIN DEL PROGRAMA");
}

variable_types: struct stand { char nombre[30]; int numero; int dias; int metros_stand; int precio; } [100]

variable_types: struct pabellon { int tarifa; int metros_pabellon; int metros_alquilados; } [5]

variable_types: opcion int

variable_types: elementos int


elimina

decompiled_code:
int __fastcall elimina(__int64 a1, int *a2, __int64 a3)
{
int v3; // ebx
int v4; // er15
int i; // er13
__int64 v6; // rbp
int v7; // eax
int v8; // eax
__int64 j; // rbx
__int64 v10; // r12
int result; // eax
char s2[88]; // [rsp+10h] [rbp-58h] BYREF

v3 = 0;
v4 = *a2;
printf("\n\nINTRODUZCA EL NUMBRE DE LA EMPRESA --->");
fflush(stdin);
gets();
for ( i = v4 / 2; ; i = (v3 + v4) / 2 )
{
v6 = a1 + 48LL * i;
v7 = strcmp((const char *)v6, s2);
if ( !v7 )
break;
if ( v3 >= v4 )
return printf("\n\nNO HAY NINGUNA EMPRESA CON ESTE NOMBRE.");
if ( v7 > 0 )
v4 = i - 1;
else
v3 = i + 1;
}
*(_DWORD *)(a3 + 12LL * *(int *)(v6 + 32) + 8) -= *(_DWORD *)(v6 + 40);
v8 = *a2;
if ( *a2 > i )
{
for ( j = a1 + 48LL * (i + 1); ; j += 48LL )
{
v10 = j;
strcpy((char *)v6, (const char *)j);
*(_DWORD *)(j - 16) = *(_DWORD *)(j + 32);
*(_DWORD *)(j - 12) = *(_DWORD *)(j + 36);
*(_DWORD *)(j - 8) = *(_DWORD *)(j + 40);
*(_DWORD *)(j - 4) = *(_DWORD *)(j + 44);
v8 = *a2;
if ( *a2 <= i )
break;
v6 = v10;
}
}
result = v8 - 1;
*a2 = result;
return result;
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1, int *a2, __int64 a3)
{
int v3; // ebx
int v4; // er15
int i; // er13
__int64 v6; // rbp
int v7; // eax
int v8; // eax
__int64 j; // rbx
__int64 v10; // r12
int result; // eax
char s2[88]; // [rsp+10h] [rbp-58h] BYREF

v3 = 0;
v4 = *a2;
printf("\n\nINTRODUZCA EL NUMBRE DE LA EMPRESA --->");
fflush(stdin);
gets();
for ( i = v4 / 2; ; i = (v3 + v4) / 2 )
{
v6 = a1 + 48LL * i;
v7 = strcmp((const char *)v6, s2);
if ( !v7 )
break;
if ( v3 >= v4 )
return printf("\n\nNO HAY NINGUNA EMPRESA CON ESTE NOMBRE.");
if ( v7 > 0 )
v4 = i - 1;
else
v3 = i + 1;
}
*(_DWORD *)(a3 + 12LL * *(int *)(v6 + 32) + 8) -= *(_DWORD *)(v6 + 40);
v8 = *a2;
if ( *a2 > i )
{
for ( j = a1 + 48LL * (i + 1); ; j += 48LL )
{
v10 = j;
strcpy((char *)v6, (const char *)j);
*(_DWORD *)(j - 16) = *(_DWORD *)(j + 32);
*(_DWORD *)(j - 12) = *(_DWORD *)(j + 36);
*(_DWORD *)(j - 8) = *(_DWORD *)(j + 40);
*(_DWORD *)(j - 4) = *(_DWORD *)(j + 44);
v8 = *a2;
if ( *a2 <= i )
break;
v6 = v10;
}
}
result = v8 - 1;
*a2 = result;
return result;
}

original_code:
void elimina (struct stand stands [], int *elementos, struct pabellon pabellones [])
{
int posicion, indice;
int principio=0;
int final=*elementos;
int mitad=(principio+final)/2;
char empresa [30];
printf ("\n\nINTRODUZCA EL NUMBRE DE LA EMPRESA --->");
fflush (stdin);
gets (empresa);
while (strcmp (stands [mitad].nombre, empresa)!=0 && principio<final)
 {
 if (strcmp (stands [mitad].nombre, empresa)>0)
  final=mitad-1;
 else
  principio=mitad+1;
         mitad=(principio+final)/2;
 }
if ( strcmp (stands [mitad].nombre, empresa)==0)
        {
 posicion=mitad;
        pabellones [ stands [posicion].numero ].metros_alquilados -= stands [posicion].metros_stand;
 for (indice=posicion; posicion+1<=*elementos; indice++)
  {
  strcpy ( stands [indice].nombre, stands [indice+1].nombre);
  stands [indice].numero= stands [indice+1].numero;
  stands [indice].dias= stands [indice+1].dias;
  stands [indice].metros_stand= stands [indice+1].metros_stand;
  stands [indice].precio= stands [indice+1].precio;
  }
 *elementos-=1;
 }
else
 printf ("\n\nNO HAY NINGUNA EMPRESA CON ESTE NOMBRE.");
}

canonical_original_code:
void elimina(struct stand stands[], int *elementos, struct pabellon pabellones[])
{
int posicion; int indice;
int principio = 0;
int final = *elementos;
int mitad = (principio+final)/2;
char empresa[30];
printf ("\n\nINTRODUZCA EL NUMBRE DE LA EMPRESA --->");
fflush (stdin);
gets (empresa);
while (strcmp (stands [mitad].nombre, empresa)!=0 && principio<final)
 {
 if (strcmp (stands [mitad].nombre, empresa)>0)
  final=mitad-1;
 else
  principio=mitad+1;
         mitad=(principio+final)/2;
 }
if ( strcmp (stands [mitad].nombre, empresa)==0)
        {
 posicion=mitad;
        pabellones [ stands [posicion].numero ].metros_alquilados -= stands [posicion].metros_stand;
 for (indice=posicion; posicion+1<=*elementos; indice++)
  {
  strcpy ( stands [indice].nombre, stands [indice+1].nombre);
  stands [indice].numero= stands [indice+1].numero;
  stands [indice].dias= stands [indice+1].dias;
  stands [indice].metros_stand= stands [indice+1].metros_stand;
  stands [indice].precio= stands [indice+1].precio;
  }
 *elementos-=1;
 }
else
 printf ("\n\nNO HAY NINGUNA EMPRESA CON ESTE NOMBRE.");
}

variable_types: indice int

variable_types:
empresa
char [30]

user_defined_types: struct stand { char nombre[30]; int numero; int dias; int metros_stand; int precio; }


visualiza

decompiled_code:
int __fastcall visualiza(__int64 a1, int a2, __int64 a3)
{
int v6; // er12
__int64 v7; // rsi
__int64 v8; // rbx
unsigned int v9; // ebp
int result; // eax

if ( a2 )
{
v6 = 0;
if ( a2 > 0 )
{
do
{
printf("\n\n\nSTAND NUMERO %d.\n\n\n", (unsigned int)++v6);
printf("EMPRESA - %s.\n", (const char *)a1);
v7 = *(unsigned int *)(a1 + 32);
a1 += 48LL;
printf("PABELLON NUMERO - %d.\n", v7);
printf("DIAS DE ALQUILER - %d.\n", *(unsigned int *)(a1 - 12));
printf("METROS DEL STAND - %d.\n", *(unsigned int *)(a1 - 8));
printf("PRECIO - %d pts.\n\n\n", *(unsigned int *)(a1 - 4));
printf("\nPULSE UNA TECLA PARA CONTINUAR.");
getchar();
}
while ( v6 != a2 );
}
}
else
{
puts("\n\nNO HAY NINGUN STAND ALQUILADO.");
}
v8 = a3;
v9 = 0;
do
{
++v9;
v8 += 12LL;
printf("\nPABELLON NUMERO %d.\n\n\n", v9);
printf("TARIFA - %d pts.\n", *(unsigned int *)(v8 - 12));
printf("METROS CUADRADOS DEL PABELLON - %d.\n", *(unsigned int *)(v8 - 8));
printf("METROS ALQUILADOS DEL PABELLON - %d.\n\n\n", *(unsigned int *)(v8 - 4));
printf("\nPULSE UNA TECLA PARA CONTINUAR.");
result = getchar();
}
while ( v9 != 5 );
return result;
}

canonical_decompiled_code:
int __fastcall func9(__int64 a1, int a2, __int64 a3)
{
int v6; // er12
__int64 v7; // rsi
__int64 v8; // rbx
unsigned int v9; // ebp
int result; // eax

if ( a2 )
{
v6 = 0;
if ( a2 > 0 )
{
do
{
printf("\n\n\nSTAND NUMERO %d.\n\n\n", (unsigned int)++v6);
printf("EMPRESA - %s.\n", (const char *)a1);
v7 = *(unsigned int *)(a1 + 32);
a1 += 48LL;
printf("PABELLON NUMERO - %d.\n", v7);
printf("DIAS DE ALQUILER - %d.\n", *(unsigned int *)(a1 - 12));
printf("METROS DEL STAND - %d.\n", *(unsigned int *)(a1 - 8));
printf("PRECIO - %d pts.\n\n\n", *(unsigned int *)(a1 - 4));
printf("\nPULSE UNA TECLA PARA CONTINUAR.");
getchar();
}
while ( v6 != a2 );
}
}
else
{
puts("\n\nNO HAY NINGUN STAND ALQUILADO.");
}
v8 = a3;
v9 = 0;
do
{
++v9;
v8 += 12LL;
printf("\nPABELLON NUMERO %d.\n\n\n", v9);
printf("TARIFA - %d pts.\n", *(unsigned int *)(v8 - 12));
printf("METROS CUADRADOS DEL PABELLON - %d.\n", *(unsigned int *)(v8 - 8));
printf("METROS ALQUILADOS DEL PABELLON - %d.\n\n\n", *(unsigned int *)(v8 - 4));
printf("\nPULSE UNA TECLA PARA CONTINUAR.");
result = getchar();
}
while ( v9 != 5 );
return result;
}

original_code:
void visualiza (struct stand stands [], int elementos, struct pabellon pabellones [])
{
char caracter;
int indice;
if (elementos==0)
 printf ("\n\nNO HAY NINGUN STAND ALQUILADO.\n");
else
        {
 for (indice=0; indice<elementos; indice++)
  {
  printf ("\n\n\nSTAND NUMERO %d.\n\n\n",indice+1);
  printf ("EMPRESA - %s.\n", stands [indice].nombre);
  printf ("PABELLON NUMERO - %d.\n", stands [indice].numero);
  printf ("DIAS DE ALQUILER - %d.\n", stands [indice].dias);
  printf ("METROS DEL STAND - %d.\n", stands [indice].metros_stand);
                printf ("PRECIO - %d pts.\n\n\n", stands [indice].precio);
  printf ("\nPULSE UNA TECLA PARA CONTINUAR.");
  caracter=getchar ();
                }
 }
for (indice=0; indice<5; indice++)
 {
 printf ("\nPABELLON NUMERO %d.\n\n\n", indice+1);
 printf ("TARIFA - %d pts.\n", pabellones [indice].tarifa);
 printf ("METROS CUADRADOS DEL PABELLON - %d.\n", pabellones [indice].metros_pabellon);
 printf ("METROS ALQUILADOS DEL PABELLON - %d.\n\n\n", pabellones [indice].metros_alquilados);
 printf ("\nPULSE UNA TECLA PARA CONTINUAR.");
 caracter=getchar ();
        }
}

canonical_original_code:
void visualiza(struct stand stands[], int elementos, struct pabellon pabellones[])
{
char caracter;
int indice;
if (elementos==0)
 printf ("\n\nNO HAY NINGUN STAND ALQUILADO.\n");
else
        {
 for (indice=0; indice<elementos; indice++)
  {
  printf ("\n\n\nSTAND NUMERO %d.\n\n\n",indice+1);
  printf ("EMPRESA - %s.\n", stands [indice].nombre);
  printf ("PABELLON NUMERO - %d.\n", stands [indice].numero);
  printf ("DIAS DE ALQUILER - %d.\n", stands [indice].dias);
  printf ("METROS DEL STAND - %d.\n", stands [indice].metros_stand);
                printf ("PRECIO - %d pts.\n\n\n", stands [indice].precio);
  printf ("\nPULSE UNA TECLA PARA CONTINUAR.");
  caracter=getchar ();
                }
 }
for (indice=0; indice<5; indice++)
 {
 printf ("\nPABELLON NUMERO %d.\n\n\n", indice+1);
 printf ("TARIFA - %d pts.\n", pabellones [indice].tarifa);
 printf ("METROS CUADRADOS DEL PABELLON - %d.\n", pabellones [indice].metros_pabellon);
 printf ("METROS ALQUILADOS DEL PABELLON - %d.\n\n\n", pabellones [indice].metros_alquilados);
 printf ("\nPULSE UNA TECLA PARA CONTINUAR.");
 caracter=getchar ();
        }
}

variable_types: caracter char


imprimir

decompiled_code:
int __fastcall imprimir(unsigned int *a1)
{
unsigned int *v1; // rbx
__int64 v2; // rsi

v1 = a1;
do
{
v2 = *v1++;
printf("%3d", v2);
}
while ( v1 != a1 + 20 );
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func7(unsigned int *a1)
{
unsigned int *v1; // rbx
__int64 v2; // rsi

v1 = a1;
do
{
v2 = *v1++;
printf("%3d", v2);
}
while ( v1 != a1 + 20 );
return putchar(10);
}

original_code:
void imprimir(int* elemento) {
  int i;
  for (i = 0; i < 20; i++) {
    printf("%3d", elemento[i]);
  }
  printf("\n");
}

canonical_original_code:
void imprimir(int *elemento) {
  int i;
  for (i = 0; i < 20; i++) {
    printf("%3d", elemento[i]);
  }
  printf("\n");
}

variable_types:
elemento
int *

variable_types: i int


quicksort

original_code:
int quicksort(int* elemento, int principio, int final) {
  int auxiliar, banderin, medio;
  banderin = 1;
  medio = principio;
  while (principio < final) {
    if (banderin) {
      while (elemento[medio] <= elemento[final]
        && medio < final) {
        final = final - 1;
      }
      if (medio < final) {
        auxiliar = elemento[medio];
        elemento[medio] = elemento[final];
        elemento[final] = auxiliar;
        medio = final;
      }
      banderin = 0;
    } else {
      while (elemento[principio] <= elemento[medio]
        && principio < medio) {
        principio = principio + 1;
      }
      if (principio < medio) {
        auxiliar = elemento[medio];
        elemento[medio] = elemento[principio];
        elemento[principio] = auxiliar;
        medio = principio;
      }
      banderin = 1;
    }
  }
  return medio;
}

canonical_original_code:
int quicksort(int *elemento, int principio, int final) {
  int auxiliar; int banderin; int medio;
  banderin = 1;
  medio = principio;
  while (principio < final) {
    if (banderin) {
      while (elemento[medio] <= elemento[final]
        && medio < final) {
        final = final - 1;
      }
      if (medio < final) {
        auxiliar = elemento[medio];
        elemento[medio] = elemento[final];
        elemento[final] = auxiliar;
        medio = final;
      }
      banderin = 0;
    } else {
      while (elemento[principio] <= elemento[medio]
        && principio < medio) {
        principio = principio + 1;
      }
      if (principio < medio) {
        auxiliar = elemento[medio];
        elemento[medio] = elemento[principio];
        elemento[principio] = auxiliar;
        medio = principio;
      }
      banderin = 1;
    }
  }
  return medio;
}

variable_types: auxiliar int

variable_types: banderin int

variable_types: medio int


burbuja

original_code:
void burbuja(int* elemento, int principio, int final) {
  int contador, indice;
  int auxiliar;
  int sinCambio;
  for (contador = principio; contador < final; contador++) {
    sinCambio = 1;
    for (indice = principio; indice < final - contador; indice++) {
      if (elemento[indice] > elemento[indice + 1]) {
        auxiliar = elemento[indice];
        elemento[indice] = elemento[indice + 1];
        elemento[indice + 1] = auxiliar;
        sinCambio = 0;
      }
    }
    if (sinCambio) {
      break;
    }
  }
}

canonical_original_code:
void burbuja(int *elemento, int principio, int final) {
  int contador; int indice;
  int auxiliar;
  int sinCambio;
  for (contador = principio; contador < final; contador++) {
    sinCambio = 1;
    for (indice = principio; indice < final - contador; indice++) {
      if (elemento[indice] > elemento[indice + 1]) {
        auxiliar = elemento[indice];
        elemento[indice] = elemento[indice + 1];
        elemento[indice + 1] = auxiliar;
        sinCambio = 0;
      }
    }
    if (sinCambio) {
      break;
    }
  }
}

variable_types: contador int

variable_types: sinCambio int


inic

decompiled_code:
char *__fastcall inic(char *src)
{
char *v1; // rax
char *v2; // rsi

if ( *src == 32 )
{
v1 = src + 1;
do
v2 = v1++;
while ( *(v1 - 1) == 32 );
}
else
{
v2 = src;
}
return strcpy(src, v2);
}

canonical_decompiled_code:
char *__fastcall func8(char *src)
{
char *v1; // rax
char *v2; // rsi

if ( *src == 32 )
{
v1 = src + 1;
do
v2 = v1++;
while ( *(v1 - 1) == 32 );
}
else
{
v2 = src;
}
return strcpy(src, v2);
}

original_code:
void inic(char cadena[]) {
  int indice = 0;
  while (cadena[indice] == ' ') {
    indice++;
  }
  strcpy(&cadena[0], &cadena[indice]);
}

variable_types:
cadena
char []


fin

decompiled_code:
size_t __fastcall fin(const char *a1)
{
size_t result; // rax
size_t v2; // rdx

result = strlen(a1);
v2 = (int)result;
if ( a1[(int)result - 1] == 32 )
{
result = (int)result - 1;
do
v2 = result--;
while ( a1[result] == 32 );
}
a1[v2] = 0;
return result;
}

canonical_decompiled_code:
size_t __fastcall func9(const char *a1)
{
size_t result; // rax
size_t v2; // rdx

result = strlen(a1);
v2 = (int)result;
if ( a1[(int)result - 1] == 32 )
{
result = (int)result - 1;
do
v2 = result--;
while ( a1[result] == 32 );
}
a1[v2] = 0;
return result;
}

original_code:
void fin(char cadena[]) {
  int indice ;
  indice = strlen(cadena);
  while(cadena[indice - 1] == ' ') {
    indice--;
  }
  cadena[indice] = '\0';
}

canonical_original_code:
void fin(char cadena[]) {
  int indice;
  indice = strlen(cadena);
  while(cadena[indice - 1] == ' ') {
    indice--;
  }
  cadena[indice] = '\0';
}


inter

original_code:
void inter(char cadena[]) {
  int indice_1, indice_2;
  for (indice_1 = 0; cadena[indice_1] != '\0'; indice_1++) {
   for (indice_2 = indice_1; cadena[indice_2] == ' '; indice_2++) {
      ;
    }
   if (indice_2 != indice_1) {
    strcpy(&cadena [indice_1], &cadena [indice_2 - 1]);
   }
  }
}

canonical_original_code:
void inter(char cadena[]) {
  int indice_1; int indice_2;
  for (indice_1 = 0; cadena[indice_1] != '\0'; indice_1++) {
   for (indice_2 = indice_1; cadena[indice_2] == ' '; indice_2++) {
      ;
    }
   if (indice_2 != indice_1) {
    strcpy(&cadena [indice_1], &cadena [indice_2 - 1]);
   }
  }
}


contar

decompiled_code:
__int64 __fastcall contar(char *a1)
{
char v1; // al
_BYTE *v2; // rdi
int v3; // edx

v1 = *a1;
if ( !*a1 )
return 1LL;
v2 = a1 + 1;
v3 = 0;
do
{
++v2;
v3 += v1 == 32;
v1 = *(v2 - 1);
}
while ( v1 );
return (unsigned int)(v3 + 1);
}

canonical_decompiled_code:
__int64 __fastcall func11(char *a1)
{
char v1; // al
_BYTE *v2; // rdi
int v3; // edx

v1 = *a1;
if ( !*a1 )
return 1LL;
v2 = a1 + 1;
v3 = 0;
do
{
++v2;
v3 += v1 == 32;
v1 = *(v2 - 1);
}
while ( v1 );
return (unsigned int)(v3 + 1);
}

original_code:
int contar(char cadena []) {
  int palabras = 0, indice;
  for (indice = 0; cadena[indice] != '\0'; indice++) {
   if (cadena [indice] == ' ') {
      palabras ++;
    }
  }
  return (palabras+1);
}

canonical_original_code:
int contar(char cadena[]) {
  int palabras = 0; int indice;
  for (indice = 0; cadena[indice] != '\0'; indice++) {
   if (cadena [indice] == ' ') {
      palabras ++;
    }
  }
  return (palabras+1);
}

variable_types: palabras int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
char v5[120]; // [rsp+0h] [rbp-78h] BYREF

introduce(v5, argv, envp);
inic(v5);
fin(v5);
inter(v5);
puts(v5);
v3 = contar(v5);
return printf("\nLA CADENA TIENE %d PALABRAS", v3);
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
char v5[120]; // [rsp+0h] [rbp-78h] BYREF

func7(v5, argv, envp);
func8(v5);
func9(v5);
func10(v5);
puts(v5);
v3 = func11(v5);
return printf("\nLA CADENA TIENE %d PALABRAS", v3);
}

original_code:
void main(void) {
  char cadena[100];
  introduce(cadena);
  inic(cadena);
  fin(cadena);
  inter(cadena);
  puts(cadena);
  printf("\nLA CADENA TIENE %d PALABRAS", contar(cadena));
}

canonical_original_code:
void main() {
  char cadena[100];
  introduce(cadena);
  inic(cadena);
  fin(cadena);
  inter(cadena);
  puts(cadena);
  printf("\nLA CADENA TIENE %d PALABRAS", contar(cadena));
}

variable_types:
cadena
char [100]


media

decompiled_code:
float __fastcall media(__int64 a1, int a2)
{
float v2; // xmm0_4
__int64 v3; // rax

if ( a2 <= 0 )
{
v2 = 0.0;
}
else
{
v2 = 0.0;
v3 = a1 + 4LL * (unsigned int)(a2 - 1) + 4;
do
{
a1 += 4LL;
v2 = v2 + (float)*(int *)(a1 - 4);
}
while ( v3 != a1 );
}
printf("\nLA MEDIA ES %.3f", (float)(v2 / (float)a2));
return v2 / (float)a2;
}

canonical_decompiled_code:
float __fastcall func0(__int64 a1, int a2)
{
float v2; // xmm0_4
__int64 v3; // rax

if ( a2 <= 0 )
{
v2 = 0.0;
}
else
{
v2 = 0.0;
v3 = a1 + 4LL * (unsigned int)(a2 - 1) + 4;
do
{
a1 += 4LL;
v2 = v2 + (float)*(int *)(a1 - 4);
}
while ( v3 != a1 );
}
printf("\nLA MEDIA ES %.3f", (float)(v2 / (float)a2));
return v2 / (float)a2;
}

original_code:
float media (int array [50],int elementos)
{
float media=0;
int ind;
for (ind=0; ind<elementos; ind++)
 media=array [ind] + media;
media=media/elementos;
printf ("\nLA MEDIA ES %.3f",media);
return (media);
}

canonical_original_code:
float media(int array[50], int elementos)
{
float media = 0;
int ind;
for (ind=0; ind<elementos; ind++)
 media=array [ind] + media;
media=media/elementos;
printf ("\nLA MEDIA ES %.3f",media);
return (media);
}

variable_types:
array
int [50]

variable_types: media float

variable_types: ind int


moda

decompiled_code:
int __fastcall moda(_DWORD *a1, int a2)
{
__int64 v2; // r12
_DWORD *v3; // r13
int *v4; // r8
__int64 v5; // rsi
__int64 v6; // rdi
int v7; // ecx
int *v8; // rax
int i; // edx
__int64 v10; // rax
int v11; // ebp
__int64 v12; // rbx
int result; // eax
__int64 v14; // rsi

v2 = (unsigned int)a2;
if ( a2 <= 0 )
return puts("\n\nEL/LOS NUMERO/S QUE MAS SE REPITE/N ES/SON:");
v3 = a1;
v4 = a1;
v5 = (__int64)&a1[a2 - 1 + 1];
v6 = 0LL;
do
{
v7 = *v4;
v8 = v4;
for ( i = *v4; ; i = *v8 )
{
if ( v7 == i )
++contador_0[v6];
if ( ++v8 == (int *)v5 )
break;
}
++v6;
++v4;
v5 = (__int64)(v8 + 1);
}
while ( v6 != v2 );
v10 = 0LL;
v11 = 0;
do
{
if ( v11 < contador_0[v10] )
v11 = contador_0[v10];
++v10;
}
while ( v10 != v2 );
v12 = 0LL;
result = puts("\n\nEL/LOS NUMERO/S QUE MAS SE REPITE/N ES/SON:");
do
{
while ( contador_0[v12] != v11 )
{
if ( ++v12 == v2 )
return result;
}
v14 = (unsigned int)v3[v12++];
result = printf(" %d ", v14);
}
while ( v12 != v2 );
return result;
}

canonical_decompiled_code:
int __fastcall func1(_DWORD *a1, int a2)
{
__int64 v2; // r12
_DWORD *v3; // r13
int *v4; // r8
__int64 v5; // rsi
__int64 v6; // rdi
int v7; // ecx
int *v8; // rax
int i; // edx
__int64 v10; // rax
int v11; // ebp
__int64 v12; // rbx
int result; // eax
__int64 v14; // rsi

v2 = (unsigned int)a2;
if ( a2 <= 0 )
return puts("\n\nEL/LOS NUMERO/S QUE MAS SE REPITE/N ES/SON:");
v3 = a1;
v4 = a1;
v5 = (__int64)&a1[a2 - 1 + 1];
v6 = 0LL;
do
{
v7 = *v4;
v8 = v4;
for ( i = *v4; ; i = *v8 )
{
if ( v7 == i )
++contador_0[v6];
if ( ++v8 == (int *)v5 )
break;
}
++v6;
++v4;
v5 = (__int64)(v8 + 1);
}
while ( v6 != v2 );
v10 = 0LL;
v11 = 0;
do
{
if ( v11 < contador_0[v10] )
v11 = contador_0[v10];
++v10;
}
while ( v10 != v2 );
v12 = 0LL;
result = puts("\n\nEL/LOS NUMERO/S QUE MAS SE REPITE/N ES/SON:");
do
{
while ( contador_0[v12] != v11 )
{
if ( ++v12 == v2 )
return result;
}
v14 = (unsigned int)v3[v12++];
result = printf(" %d ", v14);
}
while ( v12 != v2 );
return result;
}

original_code:
void moda (int array [], int elementos)
{
static int contador [50];
int indi, cuenta, maximo;
for (indi=0; indi<elementos; indi++)
 {
 for (cuenta=0; cuenta<elementos; cuenta++)
  {
  if (array [indi]==array [indi+cuenta])
   contador [indi]++;
  }
 }
for (indi=0, maximo=0;indi<elementos; indi++)
 {
 if (contador [indi]>maximo)
  maximo=contador [indi];
 }
printf ("\n\nEL/LOS NUMERO/S QUE MAS SE REPITE/N ES/SON:\n");
for (indi=0; indi<elementos; indi++)
 {
 if (contador [indi]== maximo)
  printf (" %d ", array [indi]);
 }
}

canonical_original_code:
void moda(int array[], int elementos)
{
static int contador[50];
int indi; int cuenta; int maximo;
for (indi=0; indi<elementos; indi++)
 {
 for (cuenta=0; cuenta<elementos; cuenta++)
  {
  if (array [indi]==array [indi+cuenta])
   contador [indi]++;
  }
 }
for (indi=0, maximo=0;indi<elementos; indi++)
 {
 if (contador [indi]>maximo)
  maximo=contador [indi];
 }
printf ("\n\nEL/LOS NUMERO/S QUE MAS SE REPITE/N ES/SON:\n");
for (indi=0; indi<elementos; indi++)
 {
 if (contador [indi]== maximo)
  printf (" %d ", array [indi]);
 }
}

variable_types:
array
int []

variable_types: elementos int

variable_types:
contador
int [50]

variable_types: indi int

variable_types: cuenta int

variable_types: maximo int


desviacion

decompiled_code:
int __fastcall desviacion(_DWORD *a1, int a2, int a3)
{
float v4; // xmm1_4
__int64 v5; // rdx
int v6; // eax
double v7; // xmm1_8
float v8; // xmm0_4

if ( a3 <= 0 )
{
v7 = 0.0;
}
else
{
v4 = 0.0;
v5 = (__int64)&a1[a3 - 1 + 1];
do
{
v6 = a2 - *a1++;
v4 = v4 + (float)((float)v6 * (float)v6);
}
while ( (_DWORD *)v5 != a1 );
v7 = v4;
if ( v7 < 0.0 )
{
sqrt(v7);
goto LABEL_6;
}
}
v7 = sqrt(v7);
LABEL_6:
v8 = v7 / (double)a3;
return printf("\n\nLA DESVIACION TIPICA ES : %.3f", v8);
}

canonical_decompiled_code:
int __fastcall func2(_DWORD *a1, int a2, int a3)
{
float v4; // xmm1_4
__int64 v5; // rdx
int v6; // eax
double v7; // xmm1_8
float v8; // xmm0_4

if ( a3 <= 0 )
{
v7 = 0.0;
}
else
{
v4 = 0.0;
v5 = (__int64)&a1[a3 - 1 + 1];
do
{
v6 = a2 - *a1++;
v4 = v4 + (float)((float)v6 * (float)v6);
}
while ( (_DWORD *)v5 != a1 );
v7 = v4;
if ( v7 < 0.0 )
{
sqrt(v7);
goto LABEL_6;
}
}
v7 = sqrt(v7);
LABEL_6:
v8 = v7 / (double)a3;
return printf("\n\nLA DESVIACION TIPICA ES : %.3f", v8);
}

original_code:
void desviacion (int array [],int num1, int elementos)
{
float potencia, suma, desviacion;
int indi;
for (indi=0, suma=0; indi<elementos; indi++)
    {
 potencia= num1 - array [indi];
 potencia=potencia*potencia;
 suma=suma+potencia;
 }
desviacion= sqrt (suma)/elementos;
printf ("\n\nLA DESVIACION TIPICA ES : %.3f",desviacion);
}

canonical_original_code:
void desviacion(int array[], int num1, int elementos)
{
float potencia; float suma; float desviacion;
int indi;
for (indi=0, suma=0; indi<elementos; indi++)
    {
 potencia= num1 - array [indi];
 potencia=potencia*potencia;
 suma=suma+potencia;
 }
desviacion= sqrt (suma)/elementos;
printf ("\n\nLA DESVIACION TIPICA ES : %.3f",desviacion);
}

variable_types: potencia float

variable_types: suma float

variable_types: desviacion float


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v4; // esi
_DWORD *v5; // rbp
float v7; // [rsp+Ch] [rbp-FCh]
int v8; // [rsp+1Ch] [rbp-ECh] BYREF
_DWORD v9[58]; // [rsp+20h] [rbp-E8h] BYREF

do
{
printf("NUMERO DE ELEMENTOS (MAXIMO %d) --->", 50LL);
_isoc99_scanf("%d", &v8);
}
while ( v8 > 50 );
v3 = 0;
puts("\nINTRODUZCA LOS ELEMENTOS.");
v4 = v8;
v5 = v9;
if ( v8 > 0 )
{
do
{
++v3;
_isoc99_scanf("%d", v5);
v4 = v8;
++v5;
}
while ( v8 > v3 );
}
v7 = media((__int64)v9, v4);
moda(v9, v8);
return desviacion(v9, (int)v7, v8);
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v4; // esi
_DWORD *v5; // rbp
float v7; // [rsp+Ch] [rbp-FCh]
int v8; // [rsp+1Ch] [rbp-ECh] BYREF
_DWORD v9[58]; // [rsp+20h] [rbp-E8h] BYREF

do
{
printf("NUMERO DE ELEMENTOS (MAXIMO %d) --->", 50LL);
_isoc99_scanf("%d", &v8);
}
while ( v8 > 50 );
v3 = 0;
puts("\nINTRODUZCA LOS ELEMENTOS.");
v4 = v8;
v5 = v9;
if ( v8 > 0 )
{
do
{
++v3;
_isoc99_scanf("%d", v5);
v4 = v8;
++v5;
}
while ( v8 > v3 );
}
v7 = func0((__int64)v9, v4);
func1(v9, v8);
return func2(v9, (int)v7, v8);
}

original_code:
void main (void)
{
int array [50];
int elementos;
float num1;
int indice;
do
 {
 printf ("NUMERO DE ELEMENTOS (MAXIMO %d) --->",50);
 scanf ("%d",&elementos);
        }
while (elementos>50);
printf ("\nINTRODUZCA LOS ELEMENTOS.\n");
for (indice=0; indice<elementos; indice++)
 scanf ("%d",&array [indice]);
num1= media (array,elementos);
moda (array, elementos);
desviacion (array, num1, elementos);
}

canonical_original_code:
void main()
{
int array[50];
int elementos;
float num1;
int indice;
do
 {
 printf ("NUMERO DE ELEMENTOS (MAXIMO %d) --->",50);
 scanf ("%d",&elementos);
        }
while (elementos>50);
printf ("\nINTRODUZCA LOS ELEMENTOS.\n");
for (indice=0; indice<elementos; indice++)
 scanf ("%d",&array [indice]);
num1= media (array,elementos);
moda (array, elementos);
desviacion (array, num1, elementos);
}

variable_types: indice int


mostrar

decompiled_code:
int mostrar()
{
return printf("Mostrar valor: %d", (unsigned int)valor);
}

canonical_decompiled_code:
int func7()
{
return printf("Mostrar valor: %d", (unsigned int)valor);
}

original_code:
void mostrar() {
  extern int valor;
  printf("Mostrar valor: %d", valor);
}

variable_types: valor int


decompiled_code:
int incrementar_valor()
{
return printf("\nEl numero es: %d", (unsigned int)++numero);
}

canonical_decompiled_code:
int func8()
{
return printf("\nEl numero es: %d", (unsigned int)++numero);
}

original_code:
void incrementar_valor() {
  extern int numero;
  printf("\nEl numero es: %d", ++numero);
}

variable_types: numero int


decompiled_code:
int doblar_valor()
{
numero *= 2;
return printf("\nEl numero es: %d", (unsigned int)numero);
}

canonical_decompiled_code:
int func9()
{
numero *= 2;
return printf("\nEl numero es: %d", (unsigned int)numero);
}

original_code:
void doblar_valor() {
  extern int numero;
  numero *= 2;
  printf("\nEl numero es: %d", numero);
}


main

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

v3 = 10;
valor = 1;
mostrar(argc, argv, envp);
do
{
incrementar_valor();
result = doblar_valor();
--v3;
}
while ( v3 );
return result;
}

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

v3 = 10;
valor = 1;
func7(argc, argv, envp);
do
{
func8();
result = func9();
--v3;
}
while ( v3 );
return result;
}

original_code:
void main(void) {
  int i;
  extern int valor;
  valor = 1;
  mostrar();
  for (i = 0; i < 10; i++) {
    incrementar_valor();
    doblar_valor();
  }
}

canonical_original_code:
void main() {
  int i;
  extern int valor;
  valor = 1;
  mostrar();
  for (i = 0; i < 10; i++) {
    incrementar_valor();
    doblar_valor();
  }
}

variable_types: i int


minimofil

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

v2 = (int *)(a1 + 4LL * a2);
result = (unsigned int)v2[3];
if ( *v2 <= (int)result )
result = (unsigned int)*v2;
if ( v2[6] <= (int)result )
result = (unsigned int)v2[6];
return result;
}

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

v2 = (int *)(a1 + 4LL * a2);
result = (unsigned int)v2[3];
if ( *v2 <= (int)result )
result = (unsigned int)*v2;
if ( v2[6] <= (int)result )
result = (unsigned int)v2[6];
return result;
}

original_code:
int minimofil (int array [] [3], int columnas)
{
int filas=0;
int minimo=array [filas] [columnas];
for (; filas<3; filas++)
 {
 if (minimo>array [filas] [columnas])
  minimo=array [filas] [columnas];
 }
return (minimo);
}

canonical_original_code:
int minimofil(int array[][3], int columnas)
{
int filas = 0;
int minimo = array [filas] [columnas];
for (; filas<3; filas++)
 {
 if (minimo>array [filas] [columnas])
  minimo=array [filas] [columnas];
 }
return (minimo);
}

variable_types:
array
int [][3]

variable_types: columnas int

variable_types: filas int

variable_types: minimo int


minimocol

decompiled_code:
__int64 __fastcall minimocol(__int64 a1, int a2)
{
unsigned int *v2; // rdx
__int64 result; // rax

v2 = (unsigned int *)(a1 + 12LL * a2);
result = *v2;
if ( (int)v2[1] <= (int)result )
result = v2[1];
if ( (int)v2[2] <= (int)result )
result = v2[2];
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, int a2)
{
unsigned int *v2; // rdx
__int64 result; // rax

v2 = (unsigned int *)(a1 + 12LL * a2);
result = *v2;
if ( (int)v2[1] <= (int)result )
result = v2[1];
if ( (int)v2[2] <= (int)result )
result = v2[2];
return result;
}

original_code:
int minimocol (int array [] [3], int filas)
{
int columnas=0;
int minimo=array [filas] [columnas];
for (; columnas<3; columnas++)
 {
 if (minimo>array [filas] [columnas])
  minimo=array [filas] [columnas];
 }
return (minimo);
}

canonical_original_code:
int minimocol(int array[][3], int filas)
{
int columnas = 0;
int minimo = array [filas] [columnas];
for (; columnas<3; columnas++)
 {
 if (minimo>array [filas] [columnas])
  minimo=array [filas] [columnas];
 }
return (minimo);
}


maximofil

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

v2 = (int *)(a1 + 4LL * a2);
result = (unsigned int)v2[3];
if ( *v2 >= (int)result )
result = (unsigned int)*v2;
if ( (int)result < 0 )
result = 0LL;
if ( v2[6] >= (int)result )
result = (unsigned int)v2[6];
return result;
}

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

v2 = (int *)(a1 + 4LL * a2);
result = (unsigned int)v2[3];
if ( *v2 >= (int)result )
result = (unsigned int)*v2;
if ( (int)result < 0 )
result = 0LL;
if ( v2[6] >= (int)result )
result = (unsigned int)v2[6];
return result;
}

original_code:
int maximofil (int array [] [3], int columnas)
{
int filas=0;
int maximo;
for (maximo=0; filas<3; filas++)
 {
 if (maximo<array [filas] [columnas])
  maximo=array [filas] [columnas];
 }
return (maximo);
}

canonical_original_code:
int maximofil(int array[][3], int columnas)
{
int filas = 0;
int maximo;
for (maximo=0; filas<3; filas++)
 {
 if (maximo<array [filas] [columnas])
  maximo=array [filas] [columnas];
 }
return (maximo);
}


maximocol

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

v2 = (int *)(a1 + 12LL * a2);
result = (unsigned int)v2[1];
if ( *v2 >= (int)result )
result = (unsigned int)*v2;
if ( (int)result < 0 )
result = 0LL;
if ( v2[2] >= (int)result )
result = (unsigned int)v2[2];
return result;
}

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

v2 = (int *)(a1 + 12LL * a2);
result = (unsigned int)v2[1];
if ( *v2 >= (int)result )
result = (unsigned int)*v2;
if ( (int)result < 0 )
result = 0LL;
if ( v2[2] >= (int)result )
result = (unsigned int)v2[2];
return result;
}

original_code:
int maximocol (int array [] [3], int filas)
{
int columnas=0;
int maximo;
for (maximo=0; columnas<3; columnas++)
 {
 if (maximo<array [filas] [columnas])
  maximo=array [filas] [columnas];
 }
return (maximo);
}

canonical_original_code:
int maximocol(int array[][3], int filas)
{
int columnas = 0;
int maximo;
for (maximo=0; columnas<3; columnas++)
 {
 if (maximo<array [filas] [columnas])
  maximo=array [filas] [columnas];
 }
return (maximo);
}