ocamlGenKinds

decompiled_code:
void ocamlGenKinds()
{
char *v0; // rbp
size_t v1; // r13
size_t v2; // r12
size_t v3; // rbx
size_t v4; // rax
char *v5; // rbx
char *v6; // r13
char *v7; // r12
char *v8; // r14
size_t v9; // rbp
size_t v10; // rbx
size_t v11; // rax
void *v12; // rbx
char *v13; // rbp
char *v14; // r12
char *v15; // r13

v0 = (char *)OC_mkBuildKTabFunc(buildPervKindBody);
v1 = strlen(kindVarList);
v2 = strlen(v0);
v3 = strlen(isKindFuncDefs);
v4 = strlen(numKindsML);
v5 = (char *)UTIL_mallocStr(v4 + v3 + v1 + v2 + 4);
kindML = v5;
v6 = kindVarList;
strcpy(v5, kindVarList);
*(_WORD *)&v5[strlen(v5)] = 10;
v7 = numKindsML;
strcat(v5, numKindsML);
strcat(v5, "\n\n");
strcat(v5, v0);
*(_WORD *)&v5[strlen(v5)] = 10;
v8 = isKindFuncDefs;
strcat(v5, isKindFuncDefs);
free(buildPervKindBody);
free(v0);
free(v6);
free(v8);
free(v7);
v9 = strlen(kindVarDecs);
v10 = strlen(isKindFuncDecs);
v11 = strlen(numKindsMLI);
v12 = (void *)UTIL_mallocStr(v11 + v9 + v10 + 4);
kindMLI = v12;
v13 = kindVarDecs;
strcpy((char *)v12, kindVarDecs);
strcat((char *)v12, "\n\n");
v14 = numKindsMLI;
strcat((char *)v12, numKindsMLI);
strcat((char *)v12, "\n\n");
v15 = isKindFuncDecs;
strcat((char *)v12, isKindFuncDecs);
free(v13);
free(v15);
free(v14);
}

canonical_decompiled_code:
void func6()
{
char *v0; // rbp
size_t v1; // r13
size_t v2; // r12
size_t v3; // rbx
size_t v4; // rax
char *v5; // rbx
char *v6; // r13
char *v7; // r12
char *v8; // r14
size_t v9; // rbp
size_t v10; // rbx
size_t v11; // rax
void *v12; // rbx
char *v13; // rbp
char *v14; // r12
char *v15; // r13

v0 = (char *)OC_mkBuildKTabFunc(buildPervKindBody);
v1 = strlen(kindVarList);
v2 = strlen(v0);
v3 = strlen(isKindFuncDefs);
v4 = strlen(numKindsML);
v5 = (char *)UTIL_mallocStr(v4 + v3 + v1 + v2 + 4);
kindML = v5;
v6 = kindVarList;
strcpy(v5, kindVarList);
*(_WORD *)&v5[strlen(v5)] = 10;
v7 = numKindsML;
strcat(v5, numKindsML);
strcat(v5, "\n\n");
strcat(v5, v0);
*(_WORD *)&v5[strlen(v5)] = 10;
v8 = isKindFuncDefs;
strcat(v5, isKindFuncDefs);
free(buildPervKindBody);
free(v0);
free(v6);
free(v8);
free(v7);
v9 = strlen(kindVarDecs);
v10 = strlen(isKindFuncDecs);
v11 = strlen(numKindsMLI);
v12 = (void *)UTIL_mallocStr(v11 + v9 + v10 + 4);
kindMLI = v12;
v13 = kindVarDecs;
strcpy((char *)v12, kindVarDecs);
strcat((char *)v12, "\n\n");
v14 = numKindsMLI;
strcat((char *)v12, numKindsMLI);
strcat((char *)v12, "\n\n");
v15 = isKindFuncDecs;
strcat((char *)v12, isKindFuncDecs);
free(v13);
free(v15);
free(v14);
}

original_code:
void ocamlGenKinds()
{
    char* buildTabFunc = OC_mkBuildKTabFunc(buildPervKindBody);
    size_t length = strlen(kindVarList) + strlen(buildTabFunc) +
        strlen(isKindFuncDefs) + strlen(numKindsML) + 4;
    kindML = UTIL_mallocStr(length);
    strcpy(kindML, kindVarList);
    strcat(kindML, "\n");
    strcat(kindML, numKindsML);
    strcat(kindML, "\n\n");
    strcat(kindML, buildTabFunc);
    strcat(kindML, "\n");
    strcat(kindML, isKindFuncDefs);
    free(buildPervKindBody); free(buildTabFunc); free(kindVarList);
    free(isKindFuncDefs); free(numKindsML);
    length = strlen(kindVarDecs) + strlen(isKindFuncDecs) +
        strlen(numKindsMLI) + 4;
    kindMLI = UTIL_mallocStr(length);
    strcpy(kindMLI, kindVarDecs);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, numKindsMLI);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, isKindFuncDecs);
    free(kindVarDecs); free(isKindFuncDecs); free(numKindsMLI);
}

canonical_original_code:
void ocamlGenKinds()
{
    char *buildTabFunc = OC_mkBuildKTabFunc(buildPervKindBody);
    unsigned long length = strlen(kindVarList) + strlen(buildTabFunc) +
        strlen(isKindFuncDefs) + strlen(numKindsML) + 4;
    kindML = UTIL_mallocStr(length);
    strcpy(kindML, kindVarList);
    strcat(kindML, "\n");
    strcat(kindML, numKindsML);
    strcat(kindML, "\n\n");
    strcat(kindML, buildTabFunc);
    strcat(kindML, "\n");
    strcat(kindML, isKindFuncDefs);
    free(buildPervKindBody); free(buildTabFunc); free(kindVarList);
    free(isKindFuncDefs); free(numKindsML);
    length = strlen(kindVarDecs) + strlen(isKindFuncDecs) +
        strlen(numKindsMLI) + 4;
    kindMLI = UTIL_mallocStr(length);
    strcpy(kindMLI, kindVarDecs);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, numKindsMLI);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, isKindFuncDecs);
    free(kindVarDecs); free(isKindFuncDecs); free(numKindsMLI);
}

variable_types:
buildTabFunc
char *

variable_types:
length
unsigned long


ocamlGenTySkel

repo: jpraher/teyjus

decompiled_code:
void __fastcall ocamlGenTySkel(__int64 a1, __int64 a2)
{
void *v2; // r12
void *v3; // rbp
char *v4; // rbx
size_t v5; // r13
size_t v6; // rax
char *v7; // rbp

v2 = (void *)OC_mkTySkelVarName();
v3 = (void *)OC_genTySkel(a2);
v4 = (char *)OC_mkTYSkelVar(v2, v3);
v5 = 0LL;
if ( tySkelVarList )
v5 = strlen(tySkelVarList);
v6 = strlen(v4);
UTIL_mallocStr(v5 + v6 + 2);
free(v2);
free(v3);
v7 = addLine(tySkelVarList, v4);
free(tySkelVarList);
free(v4);
tySkelVarList = v7;
}

canonical_decompiled_code:
void __fastcall func7(__int64 a1, __int64 a2)
{
void *v2; // r12
void *v3; // rbp
char *v4; // rbx
size_t v5; // r13
size_t v6; // rax
char *v7; // rbp

v2 = (void *)OC_mkTySkelVarName();
v3 = (void *)OC_genTySkel(a2);
v4 = (char *)OC_mkTYSkelVar(v2, v3);
v5 = 0LL;
if ( tySkelVarList )
v5 = strlen(tySkelVarList);
v6 = strlen(v4);
UTIL_mallocStr(v5 + v6 + 2);
free(v2);
free(v3);
v7 = func1(tySkelVarList, v4);
free(tySkelVarList);
free(v4);
tySkelVarList = v7;
}

original_code:
void ocamlGenTySkel(char* ind, Type tySkel)
{
    char* varName = OC_mkTySkelVarName(ind);
    char* tySkelText = OC_genTySkel(tySkel);
    char* tySkelVarDef = OC_mkTYSkelVar(varName, tySkelText);
    size_t length = (tySkelVarList ? strlen(tySkelVarList) : 0) +
        strlen(tySkelVarDef) + 1;
    char* mytySkelVarList = UTIL_mallocStr(length + 1);
    free(varName); free(tySkelText);
    mytySkelVarList = addLine(tySkelVarList, tySkelVarDef);
    free(tySkelVarList); free(tySkelVarDef);
    tySkelVarList = mytySkelVarList;
}

canonical_original_code:
void ocamlGenTySkel(char *ind, struct Type_ *tySkel)
{
    char *varName = OC_mkTySkelVarName(ind);
    char *tySkelText = OC_genTySkel(tySkel);
    char *tySkelVarDef = OC_mkTYSkelVar(varName, tySkelText);
    unsigned long length = (tySkelVarList ? strlen(tySkelVarList) : 0) +
        strlen(tySkelVarDef) + 1;
    char *mytySkelVarList = UTIL_mallocStr(length + 1);
    free(varName); free(tySkelText);
    mytySkelVarList = addLine(tySkelVarList, tySkelVarDef);
    free(tySkelVarList); free(tySkelVarDef);
    tySkelVarList = mytySkelVarList;
}

variable_types:
ind
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; } *

variable_types:
varName
char *

variable_types:
tySkelText
char *

variable_types:
tySkelVarDef
char *

variable_types:
mytySkelVarList
char *

return_type: void

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; }


ocamlGenNumConsts

decompiled_code:
char *__fastcall ocamlGenNumConsts(char *a1)
{
char *result; // rax

numConstsMLI = strdup("val numberPervasiveConstants : int");
result = addStr("let numberPervasiveConstants = ", a1);
numConstsML = result;
return result;
}

canonical_decompiled_code:
char *__fastcall func8(char *a1)
{
char *result; // rax

numConstsMLI = strdup("val numberPervasiveConstants : int");
result = func0("let numberPervasiveConstants = ", a1);
numConstsML = result;
return result;
}

original_code:
void ocamlGenNumConsts(char* number)
{
    numConstsMLI = strdup("val numberPervasiveConstants : int");
    numConstsML = addStr("let numberPervasiveConstants = ", number);
}

canonical_original_code:
void ocamlGenNumConsts(char *number)
{
    numConstsMLI = strdup("val numberPervasiveConstants : int");
    numConstsML = addStr("let numberPervasiveConstants = ", number);
}

variable_types:
number
char *


ocamlGenConst

decompiled_code:
void __fastcall ocamlGenConst(__int64 a1, __int64 a2, __int64 a3, unsigned int a4, unsigned int a5, __int64 a6, unsigned int a7, unsigned int a8, unsigned int a9, unsigned int a10, unsigned int a11, unsigned int a12, __int64 a13, __int64 a14)
{
void *v15; // rbx
void *v16; // rbp
void *v17; // r14
void *v18; // r15
char *v19; // r13
char *v20; // r12
char *v21; // rbx
char *v22; // rbx
char *v23; // rbx
char *v24; // rbx
char *v25; // rbx
char *ptra; // [rsp+8h] [rbp-50h]
char *v29; // [rsp+10h] [rbp-48h]
char *v30; // [rsp+18h] [rbp-40h]

v15 = (void *)OC_mkCVarName(a3);
v16 = (void *)OC_mkIsConstFuncName(v15);
v17 = (void *)UTIL_itoa(a10);
v18 = (void *)OC_mkTySkelVarName(v17);
v19 = (char *)OC_mkConstVar(a2, a4, a5, a6, a7, v18, a9, a11, a12, a8, v15, a13, a14);
v20 = (char *)OC_mkTabEntry(a2, v15);
ptra = (char *)OC_mkConstVarDec(v15);
v29 = (char *)OC_mkIsConstFuncDec(v16);
v30 = (char *)OC_mkIsConstFuncDef(v16, v15);
free(v15);
free(v16);
free(v18);
free(v17);
v21 = addLine(constVarList, v19);
free(constVarList);
free(v19);
constVarList = v21;
v22 = addStr(buildPervConstBody, v20);
free(buildPervConstBody);
free(v20);
buildPervConstBody = v22;
v23 = addStr(constVarDecs, ptra);
free(constVarDecs);
free(ptra);
constVarDecs = v23;
v24 = addStr(isConstFuncDecs, v29);
free(isConstFuncDecs);
free(v29);
isConstFuncDecs = v24;
v25 = addLine(isConstFuncDefs, v30);
free(isConstFuncDefs);
free(v30);
isConstFuncDefs = v25;
}

canonical_decompiled_code:
void __fastcall func9(__int64 a1, __int64 a2, __int64 a3, unsigned int a4, unsigned int a5, __int64 a6, unsigned int a7, unsigned int a8, unsigned int a9, unsigned int a10, unsigned int a11, unsigned int a12, __int64 a13, __int64 a14)
{
void *v15; // rbx
void *v16; // rbp
void *v17; // r14
void *v18; // r15
char *v19; // r13
char *v20; // r12
char *v21; // rbx
char *v22; // rbx
char *v23; // rbx
char *v24; // rbx
char *v25; // rbx
char *ptra; // [rsp+8h] [rbp-50h]
char *v29; // [rsp+10h] [rbp-48h]
char *v30; // [rsp+18h] [rbp-40h]

v15 = (void *)OC_mkCVarName(a3);
v16 = (void *)OC_mkIsConstFuncName(v15);
v17 = (void *)UTIL_itoa(a10);
v18 = (void *)OC_mkTySkelVarName(v17);
v19 = (char *)OC_mkConstVar(a2, a4, a5, a6, a7, v18, a9, a11, a12, a8, v15, a13, a14);
v20 = (char *)OC_mkTabEntry(a2, v15);
ptra = (char *)OC_mkConstVarDec(v15);
v29 = (char *)OC_mkIsConstFuncDec(v16);
v30 = (char *)OC_mkIsConstFuncDef(v16, v15);
free(v15);
free(v16);
free(v18);
free(v17);
v21 = func1(constVarList, v19);
free(constVarList);
free(v19);
constVarList = v21;
v22 = func0(buildPervConstBody, v20);
free(buildPervConstBody);
free(v20);
buildPervConstBody = v22;
v23 = func0(constVarDecs, ptra);
free(constVarDecs);
free(ptra);
constVarDecs = v23;
v24 = func0(isConstFuncDecs, v29);
free(isConstFuncDecs);
free(v29);
isConstFuncDecs = v24;
v25 = func1(isConstFuncDefs, v30);
free(isConstFuncDefs);
free(v30);
isConstFuncDefs = v25;
}

original_code:
void ocamlGenConst(char* ind, char* name, char* cVarName, OP_Fixity fixity,
                   OP_Prec prec, UTIL_Bool tyPrev, UTIL_Bool redef, int tesize,
                   int tyskelInd, int neededness, OP_Code codeInfo,
                   char* offset, char *printName)
{
    char* constVarName = OC_mkCVarName(cVarName);
    char* funcName = OC_mkIsConstFuncName(constVarName);
    char* tyskelText = UTIL_itoa(tyskelInd);
    char* tyskelName = OC_mkTySkelVarName(tyskelText);
    char* constVar = OC_mkConstVar(name, fixity, prec, tyPrev, tyskelName,
                                       tesize, neededness, codeInfo, redef,
                                       constVarName, offset, printName);
    char* constTabEntry = OC_mkTabEntry(name, constVarName);
    char* constVarDec = OC_mkConstVarDec(constVarName);
    char* funcDec = OC_mkIsConstFuncDec(funcName);
    char* funcDef = OC_mkIsConstFuncDef(funcName, constVarName);
    char *myConstVarList, *myBuildPervConstBody, *myConstVarDecs,
        *myisConstFuncDecs, *myisConstFuncDefs;
    free(constVarName); free(funcName); free(tyskelName); free(tyskelText);
    myConstVarList = addLine(constVarList, constVar);
    free(constVarList); free(constVar);
    constVarList = myConstVarList;
    myBuildPervConstBody = addStr(buildPervConstBody, constTabEntry);
    free(buildPervConstBody); free(constTabEntry);
    buildPervConstBody = myBuildPervConstBody;
    myConstVarDecs = addStr(constVarDecs, constVarDec);
    free(constVarDecs); free(constVarDec);
    constVarDecs = myConstVarDecs;
    myisConstFuncDecs = addStr(isConstFuncDecs, funcDec);
    free(isConstFuncDecs); free(funcDec);
    isConstFuncDecs = myisConstFuncDecs;
    myisConstFuncDefs = addLine(isConstFuncDefs, funcDef);
    free(isConstFuncDefs); free(funcDef);
    isConstFuncDefs = myisConstFuncDefs;
}

canonical_original_code:
void ocamlGenConst(char *ind, char *name, char *cVarName, enum OP_Fixity fixity, struct OP_Prec prec, enum UTIL_Bool tyPrev, enum UTIL_Bool redef, int tesize, int tyskelInd, int neededness, int codeInfo, char *offset, char *printName)
{
    char *constVarName = OC_mkCVarName(cVarName);
    char *funcName = OC_mkIsConstFuncName(constVarName);
    char *tyskelText = UTIL_itoa(tyskelInd);
    char *tyskelName = OC_mkTySkelVarName(tyskelText);
    char *constVar = OC_mkConstVar(name, fixity, prec, tyPrev, tyskelName,
                                       tesize, neededness, codeInfo, redef,
                                       constVarName, offset, printName);
    char *constTabEntry = OC_mkTabEntry(name, constVarName);
    char *constVarDec = OC_mkConstVarDec(constVarName);
    char *funcDec = OC_mkIsConstFuncDec(funcName);
    char *funcDef = OC_mkIsConstFuncDef(funcName, constVarName);
    char *myConstVarList; char *myBuildPervConstBody; char *myConstVarDecs; char *myisConstFuncDecs; char *myisConstFuncDefs;
    free(constVarName); free(funcName); free(tyskelName); free(tyskelText);
    myConstVarList = addLine(constVarList, constVar);
    free(constVarList); free(constVar);
    constVarList = myConstVarList;
    myBuildPervConstBody = addStr(buildPervConstBody, constTabEntry);
    free(buildPervConstBody); free(constTabEntry);
    buildPervConstBody = myBuildPervConstBody;
    myConstVarDecs = addStr(constVarDecs, constVarDec);
    free(constVarDecs); free(constVarDec);
    constVarDecs = myConstVarDecs;
    myisConstFuncDecs = addStr(isConstFuncDecs, funcDec);
    free(isConstFuncDecs); free(funcDec);
    isConstFuncDecs = myisConstFuncDecs;
    myisConstFuncDefs = addLine(isConstFuncDefs, funcDef);
    free(isConstFuncDefs); free(funcDef);
    isConstFuncDefs = myisConstFuncDefs;
}

variable_types:
name
char *

variable_types:
cVarName
char *

variable_types: enum OP_Fixity { OP_INFIX=0, OP_INFIXL=1, OP_INFIXR=2, OP_PREFIX=3, OP_PREFIXR=4, OP_POSTFIX=5, OP_POSTFIXL=6, OP_NONE=7 }

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

variable_types: enum UTIL_Bool { UTIL_FALSE=0, UTIL_TRUE=1 }

variable_types: tesize int

variable_types: tyskelInd int

variable_types: neededness int

variable_types: codeInfo int

variable_types:
offset
char *

variable_types:
printName
char *

variable_types:
constVarName
char *

variable_types:
funcName
char *

variable_types:
tyskelText
char *

variable_types:
tyskelName
char *

variable_types:
constVar
char *

variable_types:
constTabEntry
char *

variable_types:
constVarDec
char *

variable_types:
funcDec
char *

variable_types:
funcDef
char *

variable_types:
myConstVarList
char *

variable_types:
myBuildPervConstBody
char *

variable_types:
myConstVarDecs
char *

variable_types:
myisConstFuncDecs
char *

variable_types:
myisConstFuncDefs
char *

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


ocamlGenConsts

decompiled_code:
void ocamlGenConsts()
{
char *v0; // rbx
char *v1; // r15
char *v2; // r12
char *v3; // r14
char *v4; // r13
char *v5; // rbp
size_t v6; // rax
char *v7; // rbx
char *v8; // r15
size_t v9; // r13
size_t v10; // rbx
size_t v11; // rax
void *v12; // rbx
char *v13; // r12
void *ptr; // [rsp+0h] [rbp-58h]
size_t v15; // [rsp+8h] [rbp-50h]
size_t v16; // [rsp+10h] [rbp-48h]
size_t v17; // [rsp+18h] [rbp-40h]

v0 = (char *)OC_mkFixedTySkels(tySkelVarList);
v1 = (char *)OC_mkGenericConstVar(constVarList);
v2 = (char *)OC_mkGenericConstVarDec(constVarDecs);
ptr = (void *)OC_mkGenericConstTabEntry(buildPervConstBody);
v3 = (char *)OC_mkBuildCTabFunc(ptr);
v4 = (char *)OC_mkGenericConstFuncDefs(isConstFuncDefs);
v5 = (char *)OC_mkGenericConstFuncDecs(isConstFuncDecs);
v15 = strlen(v1);
v16 = strlen(v3);
v17 = strlen(v4);
v6 = strlen(numConstsML);
tySkelVarList = v0;
v7 = (char *)UTIL_mallocStr(v17 + v15 + v16 + 4 + v6);
constML = v7;
strcpy(v7, v1);
free(v1);
*(_WORD *)&v7[strlen(v7)] = 10;
v8 = numConstsML;
strcat(v7, numConstsML);
free(v8);
strcat(v7, "\n\n");
strcat(v7, v3);
free(v3);
free(ptr);
*(_WORD *)&v7[strlen(v7)] = 10;
strcat(v7, v4);
free(v4);
v9 = strlen(v2);
v10 = strlen(v5);
v11 = strlen(numConstsMLI);
v12 = (void *)UTIL_mallocStr(v11 + v9 + v10 + 4);
constMLI = v12;
strcpy((char *)v12, v2);
free(v2);
strcat((char *)v12, "\n\n");
v13 = numConstsMLI;
strcat((char *)v12, numConstsMLI);
free(v13);
strcat((char *)v12, "\n\n");
strcat((char *)v12, v5);
free(v5);
}

canonical_decompiled_code:
void func10()
{
char *v0; // rbx
char *v1; // r15
char *v2; // r12
char *v3; // r14
char *v4; // r13
char *v5; // rbp
size_t v6; // rax
char *v7; // rbx
char *v8; // r15
size_t v9; // r13
size_t v10; // rbx
size_t v11; // rax
void *v12; // rbx
char *v13; // r12
void *ptr; // [rsp+0h] [rbp-58h]
size_t v15; // [rsp+8h] [rbp-50h]
size_t v16; // [rsp+10h] [rbp-48h]
size_t v17; // [rsp+18h] [rbp-40h]

v0 = (char *)OC_mkFixedTySkels(tySkelVarList);
v1 = (char *)OC_mkGenericConstVar(constVarList);
v2 = (char *)OC_mkGenericConstVarDec(constVarDecs);
ptr = (void *)OC_mkGenericConstTabEntry(buildPervConstBody);
v3 = (char *)OC_mkBuildCTabFunc(ptr);
v4 = (char *)OC_mkGenericConstFuncDefs(isConstFuncDefs);
v5 = (char *)OC_mkGenericConstFuncDecs(isConstFuncDecs);
v15 = strlen(v1);
v16 = strlen(v3);
v17 = strlen(v4);
v6 = strlen(numConstsML);
tySkelVarList = v0;
v7 = (char *)UTIL_mallocStr(v17 + v15 + v16 + 4 + v6);
constML = v7;
strcpy(v7, v1);
free(v1);
*(_WORD *)&v7[strlen(v7)] = 10;
v8 = numConstsML;
strcat(v7, numConstsML);
free(v8);
strcat(v7, "\n\n");
strcat(v7, v3);
free(v3);
free(ptr);
*(_WORD *)&v7[strlen(v7)] = 10;
strcat(v7, v4);
free(v4);
v9 = strlen(v2);
v10 = strlen(v5);
v11 = strlen(numConstsMLI);
v12 = (void *)UTIL_mallocStr(v11 + v9 + v10 + 4);
constMLI = v12;
strcpy((char *)v12, v2);
free(v2);
strcat((char *)v12, "\n\n");
v13 = numConstsMLI;
strcat((char *)v12, numConstsMLI);
free(v13);
strcat((char *)v12, "\n\n");
strcat((char *)v12, v5);
free(v5);
}

original_code:
void ocamlGenConsts()
{
    char* tyskels = OC_mkFixedTySkels(tySkelVarList);
    char* varDefs = OC_mkGenericConstVar(constVarList);
    char* varDecs = OC_mkGenericConstVarDec(constVarDecs);
    char* buildFuncBody = OC_mkGenericConstTabEntry(buildPervConstBody);
    char* buildTabFunc = OC_mkBuildCTabFunc(buildFuncBody);
    char* funcDefs = OC_mkGenericConstFuncDefs(isConstFuncDefs);
    char* funcDecs = OC_mkGenericConstFuncDecs(isConstFuncDecs);
    size_t length = strlen(varDefs) + strlen(buildTabFunc) + strlen(funcDefs)
        + strlen(numConstsML) + 4;
    tySkelVarList = tyskels;
    constML = UTIL_mallocStr(length);
    strcpy(constML, varDefs); free(varDefs);
    strcat(constML, "\n");
    strcat(constML, numConstsML); free(numConstsML);
    strcat(constML, "\n\n");
    strcat(constML, buildTabFunc); free(buildTabFunc); free(buildFuncBody);
    strcat(constML, "\n");
    strcat(constML, funcDefs); free(funcDefs);
    length = strlen(varDecs) + strlen(funcDecs) + strlen(numConstsMLI) + 4;
    constMLI = UTIL_mallocStr(length);
    strcpy(constMLI, varDecs); free(varDecs);
    strcat(constMLI, "\n\n");
    strcat(constMLI, numConstsMLI); free(numConstsMLI);
    strcat(constMLI, "\n\n");
    strcat(constMLI, funcDecs); free(funcDecs);
}

canonical_original_code:
void ocamlGenConsts()
{
    char *tyskels = OC_mkFixedTySkels(tySkelVarList);
    char *varDefs = OC_mkGenericConstVar(constVarList);
    char *varDecs = OC_mkGenericConstVarDec(constVarDecs);
    char *buildFuncBody = OC_mkGenericConstTabEntry(buildPervConstBody);
    char *buildTabFunc = OC_mkBuildCTabFunc(buildFuncBody);
    char *funcDefs = OC_mkGenericConstFuncDefs(isConstFuncDefs);
    char *funcDecs = OC_mkGenericConstFuncDecs(isConstFuncDecs);
    unsigned long length = strlen(varDefs) + strlen(buildTabFunc) + strlen(funcDefs)
        + strlen(numConstsML) + 4;
    tySkelVarList = tyskels;
    constML = UTIL_mallocStr(length);
    strcpy(constML, varDefs); free(varDefs);
    strcat(constML, "\n");
    strcat(constML, numConstsML); free(numConstsML);
    strcat(constML, "\n\n");
    strcat(constML, buildTabFunc); free(buildTabFunc); free(buildFuncBody);
    strcat(constML, "\n");
    strcat(constML, funcDefs); free(funcDefs);
    length = strlen(varDecs) + strlen(funcDecs) + strlen(numConstsMLI) + 4;
    constMLI = UTIL_mallocStr(length);
    strcpy(constMLI, varDecs); free(varDecs);
    strcat(constMLI, "\n\n");
    strcat(constMLI, numConstsMLI); free(numConstsMLI);
    strcat(constMLI, "\n\n");
    strcat(constMLI, funcDecs); free(funcDecs);
}

variable_types:
tyskels
char *

variable_types:
varDefs
char *

variable_types:
varDecs
char *

variable_types:
buildFuncBody
char *

variable_types:
buildTabFunc
char *

variable_types:
funcDefs
char *

variable_types:
funcDecs
char *

variable_types:
length
unsigned long


ocamlCollectConsts

decompiled_code:
void __fastcall ocamlCollectConsts(__int64 a1, int a2)
{
void *v2; // rbx
void *v3; // rbp
__int64 v4; // rbx

v2 = (void *)OC_mkCVarName(a1);
v3 = (void *)OC_mkCompare(v2);
free(v2);
if ( !a2 && constProperty )
{
v4 = OC_mkOr(v3);
free(constProperty);
free(v3);
v3 = (void *)v4;
}
constProperty = v3;
}

canonical_decompiled_code:
void __fastcall func11(__int64 a1, int a2)
{
void *v2; // rbx
void *v3; // rbp
__int64 v4; // rbx

v2 = (void *)OC_mkCVarName(a1);
v3 = (void *)OC_mkCompare(v2);
free(v2);
if ( !a2 && constProperty )
{
v4 = OC_mkOr(v3);
free(constProperty);
free(v3);
v3 = (void *)v4;
}
constProperty = v3;
}

original_code:
void ocamlCollectConsts(char* name, int last)
{
    char* constName = OC_mkCVarName(name);
    char* cond = OC_mkCompare(constName);
    char* body;
    free(constName);
    if (last) body = cond;
    else {
        if (constProperty) {
            body = OC_mkOr(cond, constProperty);
            free(constProperty);
            free(cond);
        } else body = cond;
    }
    constProperty = body;
}

canonical_original_code:
void ocamlCollectConsts(char *name, int last)
{
    char *constName = OC_mkCVarName(name);
    char *cond = OC_mkCompare(constName);
    char *body;
    free(constName);
    if (last) body = cond;
    else {
        if (constProperty) {
            body = OC_mkOr(cond, constProperty);
            free(constProperty);
            free(cond);
        } else body = cond;
    }
    constProperty = body;
}

variable_types:
name
char *

variable_types: last int

variable_types:
constName
char *

variable_types:
cond
char *

variable_types:
body
char *


ocamlGenRC

decompiled_code:
void ocamlGenRC()
{
regClob = (void *)OC_mkRegClobFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

canonical_decompiled_code:
void func12()
{
regClob = (void *)OC_mkRegClobFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

original_code:
void ocamlGenRC()
{
    regClob = OC_mkRegClobFunc(constProperty);
    free(constProperty);
    constProperty = ((void *)0);
}


ocamlGenBC

decompiled_code:
void ocamlGenBC()
{
backTrack = (void *)OC_mkBackTrackFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

canonical_decompiled_code:
void func13()
{
backTrack = (void *)OC_mkBackTrackFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

original_code:
void ocamlGenBC()
{
    backTrack = OC_mkBackTrackFunc(constProperty);
    free(constProperty);
    constProperty = ((void *)0);
}


arrayInit

decompiled_code:
void __fastcall arrayInit(_QWORD *a1, int a2)
{
_QWORD *v2; // rax

if ( a2 > 0 )
{
v2 = a1;
do
*v2++ = 0LL;
while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] );
}
}

canonical_decompiled_code:
void __fastcall func0(_QWORD *a1, int a2)
{
_QWORD *v2; // rax

if ( a2 > 0 )
{
v2 = a1;
do
*v2++ = 0LL;
while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] );
}
}

original_code:
static void arrayInit(char **array, int size)
{
    int i ;
    for (i =0; i < size; i++) array[i] = ((void *)0);
}

canonical_original_code:
static void arrayInit(char **array, int size)
{
    int i;
    for (i =0; i < size; i++) array[i] = ((void *)0);
}

variable_types:
array
char **

variable_types: size int

variable_types: i int


cgenTySkelTabInit

decompiled_code:
__int64 cgenTySkelTabInit()
{
char *v0; // rbx
__int64 v1; // rbp

v0 = collectStringArray((void **)tySkels, qword_CD8, (const char *)&unk_D38);
v1 = C_mkTySkelTabInit(v0, C_totalSpace);
free(v0);
return v1;
}

canonical_decompiled_code:
__int64 func2()
{
char *v0; // rbx
__int64 v1; // rbp

v0 = func1((void **)tySkels, qword_CD8, (const char *)&unk_D38);
v1 = C_mkTySkelTabInit(v0, C_totalSpace);
free(v0);
return v1;
}

original_code:
static char* cgenTySkelTabInit()
{
    char* body = collectStringArray(tySkels, "");
    char* text = C_mkTySkelTabInit(body, C_totalSpace);
    free(body);
    return text;
}

canonical_original_code:
static char *cgenTySkelTabInit()
{
    char *body = collectStringArray(tySkels, "");
    char *text = C_mkTySkelTabInit(body, C_totalSpace);
    free(body);
    return text;
}

variable_types:
text
char *

return_type: char *


cgenFixedH

decompiled_code:
void *cgenFixedH()
{
void *result; // rax

pervBegH = (void *)C_mkFixedBegH();
result = (void *)C_mkFixedEndH();
pervEndH = result;
return result;
}

canonical_decompiled_code:
void *func3()
{
void *result; // rax

pervBegH = (void *)C_mkFixedBegH();
result = (void *)C_mkFixedEndH();
pervEndH = result;
return result;
}

original_code:
static void cgenFixedH()
{
    pervBegH = C_mkFixedBegH();
    pervEndH = C_mkFixedEndH();
}


cgenFixedC

decompiled_code:
void *cgenFixedC()
{
void *result; // rax

pervBegC = (void *)C_mkFixedBegC();
result = (void *)C_mkFixedEndC();
pervEndC = result;
return result;
}

canonical_decompiled_code:
void *func4()
{
void *result; // rax

pervBegC = (void *)C_mkFixedBegC();
result = (void *)C_mkFixedEndC();
pervEndC = result;
return result;
}

original_code:
static void cgenFixedC()
{
    pervBegC = C_mkFixedBegC();
    pervEndC = C_mkFixedEndC();
}


cgenNumKinds

decompiled_code:
void *cgenNumKinds()
{
void *result; // rax

result = (void *)C_mkNumKinds();
numKinds = result;
return result;
}

canonical_decompiled_code:
void *func5()
{
void *result; // rax

result = (void *)C_mkNumKinds();
numKinds = result;
return result;
}

original_code:
void cgenNumKinds(char* num)
{
    numKinds = C_mkNumKinds(num);
}

canonical_original_code:
void cgenNumKinds(char *num)
{
    numKinds = C_mkNumKinds(num);
}

variable_types:
num
char *


cgenKindIndex

decompiled_code:
__int64 __fastcall cgenKindIndex(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( (int)qword_D28 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( (_DWORD)qword_D28 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindIndices;
*(_QWORD *)(kindIndices + 8LL * a1) = v6;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( (int)qword_D28 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( (_DWORD)qword_D28 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindIndices;
*(_QWORD *)(kindIndices + 8LL * a1) = v6;
return result;
}

original_code:
void cgenKindIndex(int index, char* name, char* indexT, char* comments)
{
    char* kindIndex;
    char* kindIndexText;
    if (index >= kindIndices.length) {
        fprintf(stderr, "kind index exceed total number of kinds\n");
        exit(1);
    }
    kindIndex = C_mkIndex(name, indexT, comments);
    kindIndexText = UTIL_mallocStr(strlen(kindIndex) + 2);
    strcpy(kindIndexText, kindIndex); free(kindIndex);
    if (index != (kindIndices.length - 1)) strcat(kindIndexText, ",");
    strcat(kindIndexText, "\n");
    kindIndices.array[index] = kindIndexText;
}

canonical_original_code:
void cgenKindIndex(int index, char *name, char *indexT, char *comments)
{
    char *kindIndex;
    char *kindIndexText;
    if (index >= kindIndices.length) {
        fprintf(stderr, "kind index exceed total number of kinds\n");
        exit(1);
    }
    kindIndex = C_mkIndex(name, indexT, comments);
    kindIndexText = UTIL_mallocStr(strlen(kindIndex) + 2);
    strcpy(kindIndexText, kindIndex); free(kindIndex);
    if (index != (kindIndices.length - 1)) strcat(kindIndexText, ",");
    strcat(kindIndexText, "\n");
    kindIndices.array[index] = kindIndexText;
}

variable_types: index int

variable_types:
indexT
char *

variable_types:
comments
char *

variable_types:
kindIndex
char *

variable_types:
kindIndexText
char *


cgenKindH

decompiled_code:
void cgenKindH()
{
char *v0; // rbx
char *v1; // r12
void *v2; // rbp

v0 = (char *)C_mkEmptyComments();
v1 = collectStringArray((void **)kindIndices, qword_D28, v0);
v2 = (void *)C_mkKindIndexType(v1);
kindH = (void *)C_mkKindH(v2, numKinds);
free(v1);
free(v2);
free(numKinds);
free(v0);
}

canonical_decompiled_code:
void func7()
{
char *v0; // rbx
char *v1; // r12
void *v2; // rbp

v0 = (char *)C_mkEmptyComments();
v1 = func1((void **)kindIndices, qword_D28, v0);
v2 = (void *)C_mkKindIndexType(v1);
kindH = (void *)C_mkKindH(v2, numKinds);
free(v1);
free(v2);
free(numKinds);
free(v0);
}

original_code:
void cgenKindH()
{
    char* emptyText = C_mkEmptyComments();
    char* kindIndexBody = collectStringArray(kindIndices, emptyText);
    char* kindIndexTypeDef = C_mkKindIndexType(kindIndexBody);
    kindH = C_mkKindH(kindIndexTypeDef, numKinds);
    free(kindIndexBody); free(kindIndexTypeDef); free(numKinds);
    free(emptyText);
}

canonical_original_code:
void cgenKindH()
{
    char *emptyText = C_mkEmptyComments();
    char *kindIndexBody = collectStringArray(kindIndices, emptyText);
    char *kindIndexTypeDef = C_mkKindIndexType(kindIndexBody);
    kindH = C_mkKindH(kindIndexTypeDef, numKinds);
    free(kindIndexBody); free(kindIndexTypeDef); free(numKinds);
    free(emptyText);
}

variable_types:
emptyText
char *

variable_types:
kindIndexBody
char *

variable_types:
kindIndexTypeDef
char *


cgenKindData

decompiled_code:
__int64 __fastcall cgenKindData(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( (int)qword_D08 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkKindTabEntry(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( (_DWORD)qword_D08 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindData;
*(_QWORD *)(kindData + 8LL * a1) = v6;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( (int)qword_D08 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkKindTabEntry(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( (_DWORD)qword_D08 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindData;
*(_QWORD *)(kindData + 8LL * a1) = v6;
return result;
}

original_code:
void cgenKindData(int index, char* name, char* arity, char* comments)
{
    char* oneKindData;
    char* kindDataText;
    if (index >= kindData.length) {
      fprintf(stderr, "kind index exceed total number of kinds\n");
      exit(1);
    }
    oneKindData = C_mkKindTabEntry(name, arity, comments);
    kindDataText = UTIL_mallocStr(strlen(oneKindData) + 2);
    strcpy(kindDataText, oneKindData); free(oneKindData);
    if (index != kindData.length - 1) strcat(kindDataText, ",");
    strcat(kindDataText, "\n");
    kindData.array[index] = kindDataText;
}

canonical_original_code:
void cgenKindData(int index, char *name, char *arity, char *comments)
{
    char *oneKindData;
    char *kindDataText;
    if (index >= kindData.length) {
      fprintf(stderr, "kind index exceed total number of kinds\n");
      exit(1);
    }
    oneKindData = C_mkKindTabEntry(name, arity, comments);
    kindDataText = UTIL_mallocStr(strlen(oneKindData) + 2);
    strcpy(kindDataText, oneKindData); free(oneKindData);
    if (index != kindData.length - 1) strcat(kindDataText, ",");
    strcat(kindDataText, "\n");
    kindData.array[index] = kindDataText;
}

variable_types:
name
char *

variable_types:
arity
char *

variable_types:
oneKindData
char *

variable_types:
kindDataText
char *


cgenKindC

decompiled_code:
void cgenKindC()
{
char *v0; // rbp
void *v1; // rbx

v0 = collectStringArray((void **)kindData, qword_D08, " //nothing \n {NULL, 0},\n");
v1 = (void *)C_mkKindTab(v0);
kindC = (void *)C_mkKindC(v1);
free(v0);
free(v1);
}

canonical_decompiled_code:
void func9()
{
char *v0; // rbp
void *v1; // rbx

v0 = func1((void **)kindData, qword_D08, " //nothing \n {NULL, 0},\n");
v1 = (void *)C_mkKindTab(v0);
kindC = (void *)C_mkKindC(v1);
free(v0);
free(v1);
}

original_code:
void cgenKindC()
{
    char* kindTabBody = collectStringArray(kindData, "    //nothing \n    {NULL,    0},\n");
    char* kindTab = C_mkKindTab(kindTabBody);
    kindC = C_mkKindC(kindTab);
    free(kindTabBody); free(kindTab);
}

canonical_original_code:
void cgenKindC()
{
    char *kindTabBody = collectStringArray(kindData, "    //nothing \n    {NULL,    0},\n");
    char *kindTab = C_mkKindTab(kindTabBody);
    kindC = C_mkKindC(kindTab);
    free(kindTabBody); free(kindTab);
}

variable_types:
kindTabBody
char *

variable_types:
kindTab
char *


cgenKindInit

decompiled_code:
void __fastcall cgenKindInit(int a1)
{
LODWORD(qword_D28) = a1;
kindIndices = UTIL_malloc(8LL * a1);
arrayInit((_QWORD *)kindIndices, a1);
LODWORD(qword_D08) = a1;
kindData = UTIL_malloc(8LL * a1);
arrayInit((_QWORD *)kindData, a1);
}

canonical_decompiled_code:
void __fastcall func10(int a1)
{
LODWORD(qword_D28) = a1;
kindIndices = UTIL_malloc(8LL * a1);
func0((_QWORD *)kindIndices, a1);
LODWORD(qword_D08) = a1;
kindData = UTIL_malloc(8LL * a1);
func0((_QWORD *)kindData, a1);
}

original_code:
void cgenKindInit(int length)
{
    kindIndices.length = length;
    kindIndices.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(kindIndices.array, length);
    kindData.length = length;
    kindData.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(kindData.array, length);
}

canonical_original_code:
void cgenKindInit(int length)
{
    kindIndices.length = length;
    kindIndices.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(kindIndices.array, length);
    kindData.length = length;
    kindData.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(kindData.array, length);
}

variable_types: length int


cgenNumTySkels

decompiled_code:
void *cgenNumTySkels()
{
void *result; // rax

result = (void *)C_mkNumTySkels();
numTySkels = result;
return result;
}

canonical_decompiled_code:
void *func11()
{
void *result; // rax

result = (void *)C_mkNumTySkels();
numTySkels = result;
return result;
}

original_code:
void cgenNumTySkels(char* num)
{
    numTySkels = C_mkNumTySkels(num);
}

canonical_original_code:
void cgenNumTySkels(char *num)
{
    numTySkels = C_mkNumTySkels(num);
}


cgenTySkelsH

decompiled_code:
void cgenTySkelsH()
{
tySkelsH = (void *)C_mkTySkelsH(numTySkels);
free(numTySkels);
}

canonical_decompiled_code:
void func12()
{
tySkelsH = (void *)C_mkTySkelsH(numTySkels);
free(numTySkels);
}

original_code:
void cgenTySkelsH()
{
    tySkelsH = C_mkTySkelsH(numTySkels);
    free(numTySkels);
}


cgenTySkelTab

decompiled_code:
__int64 __fastcall cgenTySkelTab(int a1, __int64 a2, __int64 a3)
{
__int64 *v3; // rbx
__int64 result; // rax

if ( (int)qword_CD8 <= a1 )
{
fwrite("type skeleton index exceed total number of type skeletons\n", 1uLL, 0x3AuLL, stderr);
exit(1);
}
v3 = (__int64 *)(tySkels + 8LL * a1);
result = C_genTySkel(a2, a3);
*v3 = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(int a1, __int64 a2, __int64 a3)
{
__int64 *v3; // rbx
__int64 result; // rax

if ( (int)qword_CD8 <= a1 )
{
fwrite("type skeleton index exceed total number of type skeletons\n", 1uLL, 0x3AuLL, stderr);
exit(1);
}
v3 = (__int64 *)(tySkels + 8LL * a1);
result = C_genTySkel(a2, a3);
*v3 = result;
return result;
}

original_code:
void cgenTySkelTab(int index, Type tyskel, char* comments)
{
    if (index >= tySkels.length){
        fprintf(stderr,
                "type skeleton index exceed total number of type skeletons\n");
        exit(1);
    }
    tySkels.array[index] = C_genTySkel(tyskel, comments);
}

canonical_original_code:
void cgenTySkelTab(int index, struct Type_ *tyskel, char *comments)
{
    if (index >= tySkels.length){
        fprintf(stderr,
                "type skeleton index exceed total number of type skeletons\n");
        exit(1);
    }
    tySkels.array[index] = C_genTySkel(tyskel, comments);
}

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; } *


cgenTySkelInit

decompiled_code:
void __fastcall cgenTySkelInit(int a1)
{
if ( !a1 )
{
fwrite("The number of type skeletons cannot be 0\n", 1uLL, 0x29uLL, stderr);
exit(1);
}
LODWORD(qword_CD8) = a1;
tySkels = UTIL_malloc(8LL * a1);
arrayInit((_QWORD *)tySkels, a1);
}

canonical_decompiled_code:
void __fastcall func14(int a1)
{
if ( !a1 )
{
fwrite("The number of type skeletons cannot be 0\n", 1uLL, 0x29uLL, stderr);
exit(1);
}
LODWORD(qword_CD8) = a1;
tySkels = UTIL_malloc(8LL * a1);
func0((_QWORD *)tySkels, a1);
}

original_code:
void cgenTySkelInit(int length)
{
    if (length == 0) {
        fprintf(stderr, "The number of type skeletons cannot be 0\n");
        exit(1);
    }
    tySkels.length = length;
    tySkels.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(tySkels.array, length);
}

canonical_original_code:
void cgenTySkelInit(int length)
{
    if (length == 0) {
        fprintf(stderr, "The number of type skeletons cannot be 0\n");
        exit(1);
    }
    tySkels.length = length;
    tySkels.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(tySkels.array, length);
}


cgenTySkelsC

decompiled_code:
void cgenTySkelsC()
{
void *v0; // rbx

v0 = (void *)cgenTySkelTabInit();
tySkelsC = (void *)C_mkTySkelsC(v0);
free(v0);
}

canonical_decompiled_code:
void func15()
{
void *v0; // rbx

v0 = (void *)func2();
tySkelsC = (void *)C_mkTySkelsC(v0);
free(v0);
}

original_code:
void cgenTySkelsC()
{
    char* tySkelTab = cgenTySkelTabInit();
    tySkelsC = C_mkTySkelsC(tySkelTab); free(tySkelTab);
}

canonical_original_code:
void cgenTySkelsC()
{
    char *tySkelTab = cgenTySkelTabInit();
    tySkelsC = C_mkTySkelsC(tySkelTab); free(tySkelTab);
}

variable_types:
tySkelTab
char *


cgenNumConsts

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

result = C_mkNumConsts();
numConsts = result;
return result;
}

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

result = C_mkNumConsts();
numConsts = result;
return result;
}

original_code:
void cgenNumConsts(char* num)
{
    numConsts = C_mkNumConsts(num);
}

canonical_original_code:
void cgenNumConsts(char *num)
{
    numConsts = C_mkNumConsts(num);
}

variable_types:
num
char *


cgenConstIndex

decompiled_code:
__int64 __fastcall cgenConstIndex(int a1, __int64 a2, __int64 a3, __int64 a4)
{
const char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( (int)qword_CB8 <= a1 )
{
fwrite("constant index exceed total number of constants\n", 1uLL, 0x30uLL, stderr);
exit(1);
}
v4 = (const char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
if ( (_DWORD)qword_CB8 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = constIndices;
*(_QWORD *)(constIndices + 8LL * a1) = v6;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(int a1, __int64 a2, __int64 a3, __int64 a4)
{
const char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( (int)qword_CB8 <= a1 )
{
fwrite("constant index exceed total number of constants\n", 1uLL, 0x30uLL, stderr);
exit(1);
}
v4 = (const char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
if ( (_DWORD)qword_CB8 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = constIndices;
*(_QWORD *)(constIndices + 8LL * a1) = v6;
return result;
}

original_code:
void cgenConstIndex(int index, char* name, char* indexT, char* comments)
{
    char* constIndex;
    char* constIndexText;
    if (index >= constIndices.length) {
        fprintf(stderr, "constant index exceed total number of constants\n");
        exit(1);
    }
    constIndex = C_mkIndex(name, indexT, comments);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    constIndices.array[index] = constIndexText;
}

canonical_original_code:
void cgenConstIndex(int index, char *name, char *indexT, char *comments)
{
    char *constIndex;
    char *constIndexText;
    if (index >= constIndices.length) {
        fprintf(stderr, "constant index exceed total number of constants\n");
        exit(1);
    }
    constIndex = C_mkIndex(name, indexT, comments);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    constIndices.array[index] = constIndexText;
}

variable_types: index int

variable_types:
indexT
char *

variable_types:
constIndex
char *

variable_types:
constIndexText
char *


cgenLogicSymbolInit

decompiled_code:
void __fastcall cgenLogicSymbolInit(int a1)
{
LODWORD(qword_CA8) = a1;
logicSymbTypes = UTIL_malloc(8LL * a1);
arrayInit((_QWORD *)logicSymbTypes, a1);
}

canonical_decompiled_code:
void __fastcall func18(int a1)
{
LODWORD(qword_CA8) = a1;
logicSymbTypes = UTIL_malloc(8LL * a1);
func0((_QWORD *)logicSymbTypes, a1);
}

original_code:
void cgenLogicSymbolInit(int length)
{
    logicSymbTypes.length = length;
    logicSymbTypes.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(logicSymbTypes.array, length);
}

canonical_original_code:
void cgenLogicSymbolInit(int length)
{
    logicSymbTypes.length = length;
    logicSymbTypes.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(logicSymbTypes.array, length);
}


cgenLogicSymbType

decompiled_code:
__int64 __fastcall cgenLogicSymbType(int a1, __int64 a2, __int64 a3)
{
const char *v3; // r12
size_t v4; // rax
char *v5; // rbp
__int64 result; // rax

if ( (int)qword_CA8 <= a1 )
{
fwrite("logic symbol type index exceed the total number of logic symbols\n", 1uLL, 0x41uLL, stderr);
exit(1);
}
v3 = (const char *)C_mkIndex2(a2, a3);
v4 = strlen(v3);
v5 = (char *)UTIL_mallocStr(v4 + 2);
strcpy(v5, v3);
if ( (_DWORD)qword_CB8 - 1 != a1 )
*(_WORD *)&v5[strlen(v5)] = 44;
*(_WORD *)&v5[strlen(v5)] = 10;
result = logicSymbTypes;
*(_QWORD *)(logicSymbTypes + 8LL * a1) = v5;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func19(int a1, __int64 a2, __int64 a3)
{
const char *v3; // r12
size_t v4; // rax
char *v5; // rbp
__int64 result; // rax

if ( (int)qword_CA8 <= a1 )
{
fwrite("logic symbol type index exceed the total number of logic symbols\n", 1uLL, 0x41uLL, stderr);
exit(1);
}
v3 = (const char *)C_mkIndex2(a2, a3);
v4 = strlen(v3);
v5 = (char *)UTIL_mallocStr(v4 + 2);
strcpy(v5, v3);
if ( (_DWORD)qword_CB8 - 1 != a1 )
*(_WORD *)&v5[strlen(v5)] = 44;
*(_WORD *)&v5[strlen(v5)] = 10;
result = logicSymbTypes;
*(_QWORD *)(logicSymbTypes + 8LL * a1) = v5;
return result;
}

original_code:
void cgenLogicSymbType(int index, char* name, char* indexT)
{
    char* constIndex;
    char* constIndexText;
    if (index >= logicSymbTypes.length) {
         fprintf(stderr, "logic symbol type index exceed the total number of logic symbols\n");
         exit(1);
    }
    constIndex = C_mkIndex2(name, indexT);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    logicSymbTypes.array[index] = constIndexText;
}

canonical_original_code:
void cgenLogicSymbType(int index, char *name, char *indexT)
{
    char *constIndex;
    char *constIndexText;
    if (index >= logicSymbTypes.length) {
         fprintf(stderr, "logic symbol type index exceed the total number of logic symbols\n");
         exit(1);
    }
    constIndex = C_mkIndex2(name, indexT);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    logicSymbTypes.array[index] = constIndexText;
}


cgenLSRange

decompiled_code:
char *cgenLSRange()
{
char *result; // rax

result = (char *)C_mkLSRange();
lsRange = result;
return result;
}

canonical_decompiled_code:
char *func20()
{
char *result; // rax

result = (char *)C_mkLSRange();
lsRange = result;
return result;
}

original_code:
void cgenLSRange(char* start, char* end)
{
    lsRange = C_mkLSRange(start, end);
}

canonical_original_code:
void cgenLSRange(char *start, char *end)
{
    lsRange = C_mkLSRange(start, end);
}

variable_types:
start
char *

variable_types:
end
char *


cgenPREDRange

decompiled_code:
char *cgenPREDRange()
{
char *result; // rax

result = (char *)C_mkPredRange();
predRange = result;
return result;
}

canonical_decompiled_code:
char *func21()
{
char *result; // rax

result = (char *)C_mkPredRange();
predRange = result;
return result;
}

original_code:
void cgenPREDRange(char* start, char* end)
{
    predRange = C_mkPredRange(start, end);
}

canonical_original_code:
void cgenPREDRange(char *start, char *end)
{
    predRange = C_mkPredRange(start, end);
}


cgenConstProperty

decompiled_code:
void cgenConstProperty()
{
char *v0; // r13
char *v1; // r12
char *v2; // rbp
size_t v3; // rbx
size_t v4; // r14
size_t v5; // rax
void *v6; // rbx
char *v7; // r15
char *v8; // r14

v0 = (char *)C_mkEmptyComments();
v1 = collectStringArray((void **)logicSymbTypes, qword_CA8, v0);
v2 = (char *)C_mkLSTypeDec(v1);
v3 = strlen(v2);
v4 = strlen(lsRange);
v5 = strlen(predRange);
v6 = (void *)UTIL_mallocStr(v4 + v3 + v5);
constProperty = v6;
v7 = lsRange;
strcpy((char *)v6, lsRange);
v8 = predRange;
strcat((char *)v6, predRange);
strcat((char *)v6, v2);
free(v0);
free(v1);
free(v2);
free(v7);
free(v8);
}

canonical_decompiled_code:
void func22()
{
char *v0; // r13
char *v1; // r12
char *v2; // rbp
size_t v3; // rbx
size_t v4; // r14
size_t v5; // rax
void *v6; // rbx
char *v7; // r15
char *v8; // r14

v0 = (char *)C_mkEmptyComments();
v1 = func1((void **)logicSymbTypes, qword_CA8, v0);
v2 = (char *)C_mkLSTypeDec(v1);
v3 = strlen(v2);
v4 = strlen(lsRange);
v5 = strlen(predRange);
v6 = (void *)UTIL_mallocStr(v4 + v3 + v5);
constProperty = v6;
v7 = lsRange;
strcpy((char *)v6, lsRange);
v8 = predRange;
strcat((char *)v6, predRange);
strcat((char *)v6, v2);
free(v0);
free(v1);
free(v2);
free(v7);
free(v8);
}

original_code:
void cgenConstProperty()
{
    char* emptyText = C_mkEmptyComments();
    char* logicSymbTypeBody = collectStringArray(logicSymbTypes, emptyText);
    char* logicSymbTypeDec = C_mkLSTypeDec(logicSymbTypeBody);
    constProperty = UTIL_mallocStr(strlen(logicSymbTypeDec) + strlen(lsRange)
                                   + strlen(predRange));
    strcpy(constProperty, lsRange);
    strcat(constProperty, predRange);
    strcat(constProperty , logicSymbTypeDec);
    free(emptyText); free(logicSymbTypeBody); free(logicSymbTypeDec);
    free(lsRange); free(predRange);
}

canonical_original_code:
void cgenConstProperty()
{
    char *emptyText = C_mkEmptyComments();
    char *logicSymbTypeBody = collectStringArray(logicSymbTypes, emptyText);
    char *logicSymbTypeDec = C_mkLSTypeDec(logicSymbTypeBody);
    constProperty = UTIL_mallocStr(strlen(logicSymbTypeDec) + strlen(lsRange)
                                   + strlen(predRange));
    strcpy(constProperty, lsRange);
    strcat(constProperty, predRange);
    strcat(constProperty , logicSymbTypeDec);
    free(emptyText); free(logicSymbTypeBody); free(logicSymbTypeDec);
    free(lsRange); free(predRange);
}

variable_types:
emptyText
char *

variable_types:
logicSymbTypeBody
char *

variable_types:
logicSymbTypeDec
char *


cgenConstH

decompiled_code:
void cgenConstH()
{
char *v0; // rbx
char *v1; // r12
void *v2; // rbp

v0 = (char *)C_mkEmptyComments();
v1 = collectStringArray((void **)constIndices, qword_CB8, v0);
v2 = (void *)C_mkConstIndexType(v1);
constH = (void *)C_mkConstH(v2, numConsts, constProperty);
free(v1);
free(v2);
free(v0);
free(constProperty);
}

canonical_decompiled_code:
void func23()
{
char *v0; // rbx
char *v1; // r12
void *v2; // rbp

v0 = (char *)C_mkEmptyComments();
v1 = func1((void **)constIndices, qword_CB8, v0);
v2 = (void *)C_mkConstIndexType(v1);
constH = (void *)C_mkConstH(v2, numConsts, constProperty);
free(v1);
free(v2);
free(v0);
free(constProperty);
}

original_code:
void cgenConstH()
{
    char* emptyText = C_mkEmptyComments();
    char* constIndexBody = collectStringArray(constIndices, emptyText);
    char* constIndexTypeDef = C_mkConstIndexType(constIndexBody);
    constH = C_mkConstH(constIndexTypeDef, numConsts, constProperty);
    free(constIndexBody); free(constIndexTypeDef);
    free(emptyText); free(constProperty);
}

canonical_original_code:
void cgenConstH()
{
    char *emptyText = C_mkEmptyComments();
    char *constIndexBody = collectStringArray(constIndices, emptyText);
    char *constIndexTypeDef = C_mkConstIndexType(constIndexBody);
    constH = C_mkConstH(constIndexTypeDef, numConsts, constProperty);
    free(constIndexBody); free(constIndexTypeDef);
    free(emptyText); free(constProperty);
}

variable_types:
constIndexBody
char *

variable_types:
constIndexTypeDef
char *


cgenConstData

decompiled_code:
__int64 __fastcall cgenConstData(int a1, __int64 a2, __int64 a3, unsigned int a4, __int64 a5, unsigned int a6, unsigned int a7, __int64 a8, __int64 a9)
{
__int64 v13; // rax
void *v14; // rbp
char *v15; // r12
size_t v16; // rax
char *v17; // rbp
__int64 result; // rax

v13 = UTIL_itoa(a7);
if ( (int)qword_C78 <= a1 )
{
fwrite("const index exceed total number of consts\n", 1uLL, 0x2AuLL, stderr);
exit(1);
}
v14 = (void *)v13;
v15 = (char *)C_mkConstTabEntry(a2, a3, a4, a5, a6, v13, a8, a9);
free(v14);
v16 = strlen(v15);
v17 = (char *)UTIL_mallocStr(v16 + 2);
strcpy(v17, v15);
free(v15);
if ( (_DWORD)qword_C78 - 1 != a1 )
*(_WORD *)&v17[strlen(v17)] = 44;
*(_WORD *)&v17[strlen(v17)] = 10;
result = constData;
*(_QWORD *)(constData + 8LL * a1) = v17;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func24(int a1, __int64 a2, __int64 a3, unsigned int a4, __int64 a5, unsigned int a6, unsigned int a7, __int64 a8, __int64 a9)
{
__int64 v13; // rax
void *v14; // rbp
char *v15; // r12
size_t v16; // rax
char *v17; // rbp
__int64 result; // rax

v13 = UTIL_itoa(a7);
if ( (int)qword_C78 <= a1 )
{
fwrite("const index exceed total number of consts\n", 1uLL, 0x2AuLL, stderr);
exit(1);
}
v14 = (void *)v13;
v15 = (char *)C_mkConstTabEntry(a2, a3, a4, a5, a6, v13, a8, a9);
free(v14);
v16 = strlen(v15);
v17 = (char *)UTIL_mallocStr(v16 + 2);
strcpy(v17, v15);
free(v15);
if ( (_DWORD)qword_C78 - 1 != a1 )
*(_WORD *)&v17[strlen(v17)] = 44;
*(_WORD *)&v17[strlen(v17)] = 10;
result = constData;
*(_QWORD *)(constData + 8LL * a1) = v17;
return result;
}

original_code:
void cgenConstData(int index, char* name, char* tesize, OP_Prec prec,
                   OP_Fixity fixity, int tySkelInd, char* neededness,
                   char* comments)
{
    char* oneConstData;
    char* constDataText;
    char* tySkelIndText = UTIL_itoa(tySkelInd);
    if (index >= constData.length) {
        fprintf(stderr, "const index exceed total number of consts\n");
        exit(1);
    }
    oneConstData = C_mkConstTabEntry(name, tesize, prec, fixity, tySkelIndText,
                                     neededness, comments);
    free(tySkelIndText);
    constDataText = UTIL_mallocStr(strlen(oneConstData) + 2);
    strcpy(constDataText, oneConstData); free(oneConstData);
    if (index != constData.length - 1) strcat(constDataText, ",");
    strcat(constDataText, "\n");
    constData.array[index] = constDataText;
}

canonical_original_code:
void cgenConstData(int index, char *name, char *tesize, struct OP_Prec prec, enum OP_Fixity fixity, int tySkelInd, char *neededness, char *comments)
{
    char *oneConstData;
    char *constDataText;
    char *tySkelIndText = UTIL_itoa(tySkelInd);
    if (index >= constData.length) {
        fprintf(stderr, "const index exceed total number of consts\n");
        exit(1);
    }
    oneConstData = C_mkConstTabEntry(name, tesize, prec, fixity, tySkelIndText,
                                     neededness, comments);
    free(tySkelIndText);
    constDataText = UTIL_mallocStr(strlen(oneConstData) + 2);
    strcpy(constDataText, oneConstData); free(oneConstData);
    if (index != constData.length - 1) strcat(constDataText, ",");
    strcat(constDataText, "\n");
    constData.array[index] = constDataText;
}

variable_types:
name
char *

variable_types:
tesize
char *

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

variable_types: enum OP_Fixity { OP_INFIX=0, OP_INFIXL=1, OP_INFIXR=2, OP_PREFIX=3, OP_PREFIXR=4, OP_POSTFIX=5, OP_POSTFIXL=6, OP_NONE=7 }

variable_types: tySkelInd int

variable_types:
neededness
char *

variable_types:
comments
char *

variable_types:
oneConstData
char *

variable_types:
constDataText
char *

variable_types:
tySkelIndText
char *


cgenConstC

decompiled_code:
void cgenConstC()
{
char *v0; // rbp
void *v1; // rbx

v0 = collectStringArray(
(void **)constData,
qword_C78,
" //nothing\n {NULL, 0, 0, 0, 0, OP_NONE },\n");
v1 = (void *)C_mkConstTab(v0);
constC = (void *)C_mkConstC(v1);
free(v0);
free(v1);
}

canonical_decompiled_code:
void func25()
{
char *v0; // rbp
void *v1; // rbx

v0 = func1(
(void **)constData,
qword_C78,
" //nothing\n {NULL, 0, 0, 0, 0, OP_NONE },\n");
v1 = (void *)C_mkConstTab(v0);
constC = (void *)C_mkConstC(v1);
free(v0);
free(v1);
}

original_code:
void cgenConstC()
{
    char* constTabBody = collectStringArray(constData, "    //nothing\n    {NULL,   0,     0,     0,     0,   OP_NONE  },\n");
    char* constTab = C_mkConstTab(constTabBody);
    constC = C_mkConstC(constTab);
    free(constTabBody); free(constTab);
}

canonical_original_code:
void cgenConstC()
{
    char *constTabBody = collectStringArray(constData, "    //nothing\n    {NULL,   0,     0,     0,     0,   OP_NONE  },\n");
    char *constTab = C_mkConstTab(constTabBody);
    constC = C_mkConstC(constTab);
    free(constTabBody); free(constTab);
}

variable_types:
constTabBody
char *

variable_types:
constTab
char *


cgenConstInit

decompiled_code:
void __fastcall cgenConstInit(int a1)
{
LODWORD(qword_CB8) = a1;
constIndices = UTIL_malloc(8LL * a1);
arrayInit((_QWORD *)constIndices, a1);
LODWORD(qword_C78) = a1;
constData = UTIL_malloc(8LL * a1);
arrayInit((_QWORD *)constData, a1);
}

canonical_decompiled_code:
void __fastcall func26(int a1)
{
LODWORD(qword_CB8) = a1;
constIndices = UTIL_malloc(8LL * a1);
func0((_QWORD *)constIndices, a1);
LODWORD(qword_C78) = a1;
constData = UTIL_malloc(8LL * a1);
func0((_QWORD *)constData, a1);
}

original_code:
void cgenConstInit(int length)
{
    constIndices.length = length;
    constIndices.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(constIndices.array, length);
    constData.length = length;
    constData.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(constData.array, length);
}

canonical_original_code:
void cgenConstInit(int length)
{
    constIndices.length = length;
    constIndices.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(constIndices.array, length);
    constData.length = length;
    constData.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(constData.array, length);
}

variable_types: length int


decompiled_code:
__int64 OP_mkPrecMin1()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 0LL;
}

original_code:
OP_Prec OP_mkPrecMin1()
{
    OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -1;
    return prec;
}

canonical_original_code:
struct OP_Prec OP_mkPrecMin1()
{
    struct OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -1;
    return prec;
}

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


decompiled_code:
__int64 OP_mkPrecMin2()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
return 0LL;
}

original_code:
OP_Prec OP_mkPrecMin2()
{
    OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -2;
    return prec;
}

canonical_original_code:
struct OP_Prec OP_mkPrecMin2()
{
    struct OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -2;
    return prec;
}

user_defined_types: enum OP_PrecTypeCat { OP_PREC=0, OP_PREC_NAME=1 }


decompiled_code:
__int64 OP_mkPrec()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
return 0LL;
}

original_code:
OP_Prec OP_mkPrec(int precedence)
{
    OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = precedence ;
    return prec;
}

canonical_original_code:
struct OP_Prec OP_mkPrec(int precedence)
{
    struct OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = precedence ;
    return prec;
}

variable_types: precedence int


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;
}


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;
}

return_type: int


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: 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; } *


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:
name
char *

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));
}
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));
}
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);
}


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);
}


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(a1, v2, -2);
return puts(v2);
}

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

func14(a1, v2, -2);
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;
}


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; // ebp
int v3; // eax
int v4; // er12
char *i; // rdi
char *v7; // 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");
v7 = strtok(0LL, ":\n");
v1 = atoi(v7);
}
}
close(v4);
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *s2)
{
unsigned int v1; // ebp
int v3; // eax
int v4; // er12
char *i; // rdi
char *v7; // 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");
v7 = strtok(0LL, ":\n");
v1 = atoi(v7);
}
}
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);
if ( v3 == -1 )
break;
switch ( v3 )
{
case 'l':
if ( argc != 3 )
{
perror("Not enough arguments");
exit(-1);
}
get_user_proc((char *)argv[2], 0);
break;
case 'u':
if ( argc != 3 )
{
perror("Not enough arguments");
exit(-1);
}
get_user_proc((char *)argv[2], 1);
break;
case 'h':
puts("Usage: mystats [OPTION]...\n");
printf("-l or --long: Displays the complete command line argument.");
puts(aUOrUserDisplay);
break;
default:
puts("Incorrect option!");
break;
}
}
return 0;
}

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);
if ( v3 == -1 )
break;
switch ( v3 )
{
case 'l':
if ( argc != 3 )
{
perror("Not enough arguments");
exit(-1);
}
func8((char *)argv[2], 0);
break;
case 'u':
if ( argc != 3 )
{
perror("Not enough arguments");
exit(-1);
}
func8((char *)argv[2], 1);
break;
case 'h':
puts("Usage: mystats [OPTION]...\n");
printf("-l or --long: Displays the complete command line argument.");
puts(aUOrUserDisplay);
break;
default:
puts("Incorrect option!");
break;
}
}
return 0;
}

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 func0(__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

puts("=======\n Neural Network Options \n");
printf("NumHiddenLayers:%i\n", *a1);
if ( (int)*a1 > 0 )
{
v1 = 0LL;
do
{
printf("HiddenLayer %i: %i\n", (unsigned int)v1, *(unsigned int *)(*((_QWORD *)a1 + 1) + 4 * v1));
++v1;
}
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 func1(unsigned int *a1)
{
__int64 v1; // rbx

puts("=======\n Neural Network Options \n");
printf("NumHiddenLayers:%i\n", *a1);
if ( (int)*a1 > 0 )
{
v1 = 0LL;
do
{
printf("HiddenLayer %i: %i\n", (unsigned int)v1, *(unsigned int *)(*((_QWORD *)a1 + 1) + 4 * v1));
++v1;
}
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 i; // rbx

if ( a2 <= 0 )
return 0LL;
for ( i = 0LL; i != a2; ++i )
{
if ( !strcmp(*(const char **)(a1 + 8 * i), a3) && a2 - 1 != (_DWORD)i )
return *(_QWORD *)(a1 + 8 * i + 8);
}
return 0LL;
}

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

if ( a2 <= 0 )
return 0LL;
for ( i = 0LL; i != a2; ++i )
{
if ( !strcmp(*(const char **)(a1 + 8 * i), a3) && a2 - 1 != (_DWORD)i )
return *(_QWORD *)(a1 + 8 * i + 8);
}
return 0LL;
}

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 *


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;
while ( strcmp(*v4, a3) )
{
if ( ++v4 == &a1[(unsigned int)(a2 - 1) + 1] )
return 0LL;
}
return 1LL;
}

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

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

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 func4()
{
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; // rax
int v16; // eax
char *v17; // rax
char *v18; // rdi
__int64 v19; // rbp
int *v20; // 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);
*a1 = v16;
realloc(*((void **)a1 + 1), 4LL * v16);
memset(*((void **)a1 + 1), 0, 4LL * *a1);
}
v17 = (char *)getValueSpecified(a2, a3, "--numNeurons");
if ( v17 )
{
v18 = strtok(v17, ",");
v19 = 0LL;
if ( v18 )
{
while ( *a1 >= (int)v19 )
{
v20 = (int *)(*((_QWORD *)a1 + 1) + 4 * v19);
*v20 = atoi(v18);
v17 = strtok(0LL, ",");
v18 = v17;
++v19;
if ( !v17 )
return (int)v17;
}
LODWORD(v17) = puts("Numbers of hidden layers do not match specification");
}
else
{
LODWORD(v17) = puts("Invalid format ");
}
}
return (int)v17;
}

canonical_decompiled_code:
int __fastcall func5(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; // rax
int v16; // eax
char *v17; // rax
char *v18; // rdi
__int64 v19; // rbp
int *v20; // r12

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

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 v1; // rbp
__int64 v2; // rbp

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

canonical_decompiled_code:
void __fastcall func0(void *ptr)
{
__int64 v1; // rbp
__int64 v2; // rbp

if ( *(int *)ptr > 0 )
{
v1 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 1) + 8 * v1++));
while ( *(_DWORD *)ptr > (int)v1 );
}
free(*((void **)ptr + 1));
if ( *(int *)ptr > 0 )
{
v2 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 2) + 8 * v2++));
while ( *(_DWORD *)ptr > (int)v2 );
}
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 v1; // rbx

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

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; }