ReadOffset

decompiled_code:
void __fastcall ReadOffset(__int64 a1)
{
int v2; // edi
int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2 = GetToken(v3);
if ( (unsigned int)(v2 + 8) <= 1 )
{
if ( v2 == -8 )
{
if ( (unsigned int)GetToken(v3) == -1 )
{
*(_DWORD *)(a1 + 4) = -v3[0];
return;
}
}
else if ( (unsigned int)GetToken(v3) == -1 )
{
*(_DWORD *)(a1 + 4) = v3[0];
return;
}
DisplayError(1LL, "Reading offset value, integer expected\n");
return;
}
if ( (unsigned int)(v2 + 4) <= 1 )
{
UnGetToken(v2, v3[0]);
*(_DWORD *)(a1 + 4) = 0;
}
else
{
DisplayError(1LL, "Reading offset value, + or - expected\n");
}
}

canonical_decompiled_code:
void __fastcall func4(__int64 a1)
{
int v2; // edi
int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2 = func1(v3);
if ( (unsigned int)(v2 + 8) <= 1 )
{
if ( v2 == -8 )
{
if ( (unsigned int)func1(v3) == -1 )
{
*(_DWORD *)(a1 + 4) = -v3[0];
return;
}
}
else if ( (unsigned int)func1(v3) == -1 )
{
*(_DWORD *)(a1 + 4) = v3[0];
return;
}
DisplayError(1LL, "Reading offset value, integer expected\n");
return;
}
if ( (unsigned int)(v2 + 4) <= 1 )
{
func0(v2, v3[0]);
*(_DWORD *)(a1 + 4) = 0;
}
else
{
DisplayError(1LL, "Reading offset value, + or - expected\n");
}
}

original_code:
static void ReadOffset( INSTRUCTION *instruction )
{
    int token, negative, branch;
    token = GetToken( &branch );
    if ( token == -7 || token == -8 ) {
        if ( token == -8 ) negative = 1; else negative = 0;
        token = GetToken( &branch );
        if ( token == -1 ) {
            if ( negative ) instruction->offset = -branch;
            else instruction->offset = branch;
        }
        else {
            DisplayError( 1, "Reading offset value, integer expected\n" );
        }
    }
    else if ( token == -3 || token == -4 ) {
        UnGetToken( token, branch );
        instruction->offset = 0;
    }
    else {
        DisplayError( 1, "Reading offset value, + or - expected\n" );
    }
}

canonical_original_code:
static void ReadOffset(struct INSTRUCTION *instruction)
{
    int token; int negative; int branch;
    token = GetToken( &branch );
    if ( token == -7 || token == -8 ) {
        if ( token == -8 ) negative = 1; else negative = 0;
        token = GetToken( &branch );
        if ( token == -1 ) {
            if ( negative ) instruction->offset = -branch;
            else instruction->offset = branch;
        }
        else {
            DisplayError( 1, "Reading offset value, integer expected\n" );
        }
    }
    else if ( token == -3 || token == -4 ) {
        UnGetToken( token, branch );
        instruction->offset = 0;
    }
    else {
        DisplayError( 1, "Reading offset value, + or - expected\n" );
    }
}

variable_types: negative int

variable_types: branch int


ReadLoadStore

repo: Ethanjfobrien/LanguageProcessorsProject

decompiled_code:
void __fastcall ReadLoadStore(_DWORD *a1, int a2)
{
int v2; // eax
int v3; // eax
unsigned int v4; // edx
int v5; // eax
int v6[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = GetToken(v6);
switch ( v2 )
{
case -11:
*a1 = 3 * (a2 != -5) + 24;
ReadOffset((__int64)a1);
return;
case -9:
if ( a2 != -5 )
{
DisplayError(1LL, "Immediate mode illgal with STORE\n");
return;
}
*a1 = 22;
v3 = GetToken(v6);
v4 = v3 + 8;
if ( v3 == -1 )
{
if ( v4 > 1 )
{
LABEL_15:
v5 = v6[0];
goto LABEL_17;
}
}
else if ( v4 > 1 )
{
DisplayError(1LL, "Reading LOAD #<datum>, integer expected\n");
return;
}
if ( v3 == -8 )
{
if ( (unsigned int)GetToken(v6) != -1 )
DisplayError(1LL, "Reading LOAD #<datum>, integer expected\n");
v5 = -v6[0];
goto LABEL_17;
}
if ( (unsigned int)GetToken(v6) != -1 )
DisplayError(1LL, "Reading LOAD #<datum>, integer expected\n");
goto LABEL_15;
case -1:
*a1 = 3 * (a2 != -5) + 23;
v5 = v6[0];
if ( v6[0] > 0x3FFu )
{
DisplayError(1LL, "Data address out of range\n");
return;
}
LABEL_17:
a1[1] = v5;
return;
case -12:
*a1 = 3 * (a2 != -5) + 25;
ReadOffset((__int64)a1);
break;
default:
DisplayError(1LL, "Unknown form of LOAD or STORE encountered\n");
break;
}
}

canonical_decompiled_code:
void __fastcall func5(_DWORD *a1, int a2)
{
int v2; // eax
int v3; // eax
unsigned int v4; // edx
int v5; // eax
int v6[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = func1(v6);
switch ( v2 )
{
case -11:
*a1 = 3 * (a2 != -5) + 24;
func4((__int64)a1);
return;
case -9:
if ( a2 != -5 )
{
DisplayError(1LL, "Immediate mode illgal with STORE\n");
return;
}
*a1 = 22;
v3 = func1(v6);
v4 = v3 + 8;
if ( v3 == -1 )
{
if ( v4 > 1 )
{
LABEL_15:
v5 = v6[0];
goto LABEL_17;
}
}
else if ( v4 > 1 )
{
DisplayError(1LL, "Reading LOAD #<datum>, integer expected\n");
return;
}
if ( v3 == -8 )
{
if ( (unsigned int)func1(v6) != -1 )
DisplayError(1LL, "Reading LOAD #<datum>, integer expected\n");
v5 = -v6[0];
goto LABEL_17;
}
if ( (unsigned int)func1(v6) != -1 )
DisplayError(1LL, "Reading LOAD #<datum>, integer expected\n");
goto LABEL_15;
case -1:
*a1 = 3 * (a2 != -5) + 23;
v5 = v6[0];
if ( v6[0] > 0x3FFu )
{
DisplayError(1LL, "Data address out of range\n");
return;
}
LABEL_17:
a1[1] = v5;
return;
case -12:
*a1 = 3 * (a2 != -5) + 25;
func4((__int64)a1);
break;
default:
DisplayError(1LL, "Unknown form of LOAD or STORE encountered\n");
break;
}
}

original_code:
static void ReadLoadStore( INSTRUCTION *instruction, int class )
{
    int token, branch, negative;
    token = GetToken( &branch );
    if ( token == -11 ) {
        if ( class == -5 ) instruction->opcode = 24;
        else instruction->opcode = 27;
        ReadOffset( instruction );
    }
    else if ( token == -9 ) {
        if ( class == -5 ) {
            instruction->opcode = 22;
            token = GetToken( &branch );
            if ( token != -1 && token != -7 && token != -8 ) {
                DisplayError( 1, "Reading LOAD #<datum>, integer expected\n" );
            }
            else {
                if ( token == -7 || token == -8 ) {
      if ( token == -8 ) negative = 1; else negative = 0;
                    token = GetToken( &branch );
                    if ( token != -1 ) {
                        DisplayError( 1,
                                 "Reading LOAD #<datum>, integer expected\n" );
                    }
                    if ( negative ) branch = -branch;
                }
                instruction->offset = branch;
            }
        }
        else DisplayError( 1, "Immediate mode illgal with STORE\n" );
    }
    else if ( token == -1 ) {
        if ( class == -5 ) instruction->opcode = 23;
        else instruction->opcode = 26;
        if ( branch < 0 || branch >= 1024 ) {
            DisplayError( 1, "Data address out of range\n" );
        }
        else instruction->offset = branch;
    }
    else if ( token == -12 ) {
        if ( class == -5 ) instruction->opcode = 25;
        else instruction->opcode = 28;
        ReadOffset( instruction );
    }
    else {
        DisplayError( 1, "Unknown form of LOAD or STORE encountered\n" );
    }
}

canonical_original_code:
static void ReadLoadStore(struct INSTRUCTION *instruction, int class)
{
    int token; int branch; int negative;
    token = GetToken( &branch );
    if ( token == -11 ) {
        if ( class == -5 ) instruction->opcode = 24;
        else instruction->opcode = 27;
        ReadOffset( instruction );
    }
    else if ( token == -9 ) {
        if ( class == -5 ) {
            instruction->opcode = 22;
            token = GetToken( &branch );
            if ( token != -1 && token != -7 && token != -8 ) {
                DisplayError( 1, "Reading LOAD #<datum>, integer expected\n" );
            }
            else {
                if ( token == -7 || token == -8 ) {
      if ( token == -8 ) negative = 1; else negative = 0;
                    token = GetToken( &branch );
                    if ( token != -1 ) {
                        DisplayError( 1,
                                 "Reading LOAD #<datum>, integer expected\n" );
                    }
                    if ( negative ) branch = -branch;
                }
                instruction->offset = branch;
            }
        }
        else DisplayError( 1, "Immediate mode illgal with STORE\n" );
    }
    else if ( token == -1 ) {
        if ( class == -5 ) instruction->opcode = 23;
        else instruction->opcode = 26;
        if ( branch < 0 || branch >= 1024 ) {
            DisplayError( 1, "Data address out of range\n" );
        }
        else instruction->offset = branch;
    }
    else if ( token == -12 ) {
        if ( class == -5 ) instruction->opcode = 25;
        else instruction->opcode = 28;
        ReadOffset( instruction );
    }
    else {
        DisplayError( 1, "Unknown form of LOAD or STORE encountered\n" );
    }
}

variable_types: struct INSTRUCTION { int opcode; int offset; } *

variable_types: class int

variable_types: token int

return_type: void


ReadInstruction

decompiled_code:
__int64 __fastcall ReadInstruction(unsigned int *a1)
{
unsigned int v1; // eax
unsigned int v2; // ebx
unsigned int v3; // eax
unsigned int v4; // er12
int v6[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = GetToken(v6);
if ( v1 == -3 )
{
do
v2 = GetToken(v6);
while ( v2 == -3 );
}
else
{
v2 = v1;
}
if ( v2 != -1 )
{
v3 = v2 + 6;
goto LABEL_5;
}
v2 = GetToken(v6);
v3 = v2 + 6;
if ( v2 + 6 <= 0x24 )
{
LABEL_5:
switch ( v3 )
{
case 0u:
v4 = 1;
ReadLoadStore(a1, -6);
goto LABEL_10;
case 1u:
v4 = 1;
ReadLoadStore(a1, -5);
goto LABEL_10;
case 2u:
v4 = 0;
break;
case 4u:
v4 = 0;
DisplayError(1LL, "Error, invalid token\n");
goto LABEL_10;
case 6u:
case 7u:
case 8u:
case 9u:
case 0xAu:
case 0xBu:
case 0x14u:
case 0x15u:
case 0x16u:
case 0x1Bu:
case 0x23u:
case 0x24u:
*a1 = v2;
v4 = 1;
a1[1] = 0;
goto LABEL_9;
case 0xCu:
case 0xDu:
case 0xEu:
case 0xFu:
case 0x10u:
case 0x11u:
case 0x12u:
case 0x13u:
case 0x17u:
case 0x18u:
*a1 = v2;
v4 = 1;
ReadAddress((__int64)a1);
goto LABEL_9;
case 0x19u:
case 0x1Au:
*a1 = v2;
v4 = 1;
ReadNatural((__int64)a1);
goto LABEL_9;
default:
goto LABEL_7;
}
return v4;
}
LABEL_7:
v4 = 0;
DisplayError(0LL, "Error, unknown token read ");
DisplayError(1LL, "%d\n", v2);
LABEL_9:
if ( v2 + 4 > 1 )
{
LABEL_10:
while ( (unsigned int)GetToken(v6) + 4 > 1 )
;
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned int *a1)
{
unsigned int v1; // eax
unsigned int v2; // ebx
unsigned int v3; // eax
unsigned int v4; // er12
int v6[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = func1(v6);
if ( v1 == -3 )
{
do
v2 = func1(v6);
while ( v2 == -3 );
}
else
{
v2 = v1;
}
if ( v2 != -1 )
{
v3 = v2 + 6;
goto LABEL_5;
}
v2 = func1(v6);
v3 = v2 + 6;
if ( v2 + 6 <= 0x24 )
{
LABEL_5:
switch ( v3 )
{
case 0u:
v4 = 1;
func5(a1, -6);
goto LABEL_10;
case 1u:
v4 = 1;
func5(a1, -5);
goto LABEL_10;
case 2u:
v4 = 0;
break;
case 4u:
v4 = 0;
DisplayError(1LL, "Error, invalid token\n");
goto LABEL_10;
case 6u:
case 7u:
case 8u:
case 9u:
case 0xAu:
case 0xBu:
case 0x14u:
case 0x15u:
case 0x16u:
case 0x1Bu:
case 0x23u:
case 0x24u:
*a1 = v2;
v4 = 1;
a1[1] = 0;
goto LABEL_9;
case 0xCu:
case 0xDu:
case 0xEu:
case 0xFu:
case 0x10u:
case 0x11u:
case 0x12u:
case 0x13u:
case 0x17u:
case 0x18u:
*a1 = v2;
v4 = 1;
func2((__int64)a1);
goto LABEL_9;
case 0x19u:
case 0x1Au:
*a1 = v2;
v4 = 1;
func3((__int64)a1);
goto LABEL_9;
default:
goto LABEL_7;
}
return v4;
}
LABEL_7:
v4 = 0;
DisplayError(0LL, "Error, unknown token read ");
DisplayError(1LL, "%d\n", v2);
LABEL_9:
if ( v2 + 4 > 1 )
{
LABEL_10:
while ( (unsigned int)func1(v6) + 4 > 1 )
;
}
return v4;
}

original_code:
int ReadInstruction( INSTRUCTION *Instruction )
{
    int token, offset, status = 0;
    token = GetToken( &offset );
    while ( token == -3 )
        token = GetToken( &offset );
    if ( token == -1 )
        token = GetToken( &offset );
    switch ( token ) {
        case -4: status = 0; break;
        case 0:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 14:
        case 15:
        case 16:
        case 21:
        case 29:
        case 30: Instruction->opcode = token;
                        Instruction->offset = 0;
                        status = 1; break;
        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
        case 11:
        case 12:
        case 17:
        case 18:
        case 13: Instruction->opcode = token;
                        ReadAddress( Instruction );
                        status = 1; break;
        case 19:
        case 20: Instruction->opcode = token;
                        ReadNatural( Instruction );
                        status = 1; break;
        case -5: ReadLoadStore( Instruction, -5 );
                        status = 1; break;
        case -6: ReadLoadStore( Instruction, -6 );
                        status = 1; break;
        case -2: DisplayError( 1, "Error, invalid token\n" );
                        break;
        default: DisplayError( !1, "Error, unknown token read  " );
                        DisplayError( 1, "%d\n", token );
                        break;
    }
    while ( token != -3 && token != -4 )
        token = GetToken( &offset );
    return status;
}

canonical_original_code:
int ReadInstruction(struct INSTRUCTION *Instruction)
{
    int token; int offset; int status = 0;
    token = GetToken( &offset );
    while ( token == -3 )
        token = GetToken( &offset );
    if ( token == -1 )
        token = GetToken( &offset );
    switch ( token ) {
        case -4: status = 0; break;
        case 0:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 14:
        case 15:
        case 16:
        case 21:
        case 29:
        case 30: Instruction->opcode = token;
                        Instruction->offset = 0;
                        status = 1; break;
        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
        case 11:
        case 12:
        case 17:
        case 18:
        case 13: Instruction->opcode = token;
                        ReadAddress( Instruction );
                        status = 1; break;
        case 19:
        case 20: Instruction->opcode = token;
                        ReadNatural( Instruction );
                        status = 1; break;
        case -5: ReadLoadStore( Instruction, -5 );
                        status = 1; break;
        case -6: ReadLoadStore( Instruction, -6 );
                        status = 1; break;
        case -2: DisplayError( 1, "Error, invalid token\n" );
                        break;
        default: DisplayError( !1, "Error, unknown token read  " );
                        DisplayError( 1, "%d\n", token );
                        break;
    }
    while ( token != -3 && token != -4 )
        token = GetToken( &offset );
    return status;
}

variable_types: offset int

variable_types: status int

return_type: int

user_defined_types: struct INSTRUCTION { int opcode; int offset; }


Disassemble

decompiled_code:
unsigned int __fastcall Disassemble(unsigned int *a1, char *a2)
{
unsigned int v2; // er12
unsigned int result; // eax
char dest[34]; // [rsp+6h] [rbp-22h] BYREF

v2 = *a1;
if ( *a1 > 0x1E )
return sprintf(a2, "Unknown opcode %d\n", v2);
strcpy(dest, (&mnemonics)[v2]);
switch ( v2 )
{
case 6u:
case 7u:
case 8u:
case 9u:
case 0xAu:
case 0xBu:
case 0xCu:
case 0xDu:
case 0x11u:
case 0x12u:
case 0x13u:
case 0x14u:
case 0x17u:
case 0x1Au:
result = sprintf(a2, "%-8s%-4d", dest, a1[1]);
break;
case 0x15u:
goto LABEL_8;
case 0x16u:
result = sprintf(a2, "%-8s#%-4d", dest, a1[1]);
break;
case 0x18u:
case 0x1Bu:
if ( a1[1] )
result = sprintf(a2, "%-8sFP%-+4d", dest);
else
LABEL_8:
result = sprintf(a2, "%-8sFP", dest);
break;
case 0x19u:
case 0x1Cu:
if ( a1[1] )
result = sprintf(a2, "%-8s[SP]%-+4d", dest);
else
result = sprintf(a2, "%-8s[SP]", dest);
break;
default:
result = (unsigned int)strcpy(a2, dest);
break;
}
return result;
}

canonical_decompiled_code:
unsigned int __fastcall func0(unsigned int *a1, char *a2)
{
unsigned int v2; // er12
unsigned int result; // eax
char dest[34]; // [rsp+6h] [rbp-22h] BYREF

v2 = *a1;
if ( *a1 > 0x1E )
return sprintf(a2, "Unknown opcode %d\n", v2);
strcpy(dest, (&mnemonics)[v2]);
switch ( v2 )
{
case 6u:
case 7u:
case 8u:
case 9u:
case 0xAu:
case 0xBu:
case 0xCu:
case 0xDu:
case 0x11u:
case 0x12u:
case 0x13u:
case 0x14u:
case 0x17u:
case 0x1Au:
result = sprintf(a2, "%-8s%-4d", dest, a1[1]);
break;
case 0x15u:
goto LABEL_8;
case 0x16u:
result = sprintf(a2, "%-8s#%-4d", dest, a1[1]);
break;
case 0x18u:
case 0x1Bu:
if ( a1[1] )
result = sprintf(a2, "%-8sFP%-+4d", dest);
else
LABEL_8:
result = sprintf(a2, "%-8sFP", dest);
break;
case 0x19u:
case 0x1Cu:
if ( a1[1] )
result = sprintf(a2, "%-8s[SP]%-+4d", dest);
else
result = sprintf(a2, "%-8s[SP]", dest);
break;
default:
result = (unsigned int)strcpy(a2, dest);
break;
}
return result;
}

original_code:
void Disassemble( INSTRUCTION *inst, char *buffer )
{
    char temp[10];
    if ( inst->opcode < 0 || inst->opcode > 30 ) {
        sprintf( buffer, "Unknown opcode %d\n", inst->opcode );
    }
    else {
        strcpy( temp, mnemonics[inst->opcode] );
        switch ( inst->opcode ) {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 14:
            case 15:
            case 16:
            case 29:
            case 30: strcpy( buffer, temp );
                            break;
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 17:
            case 18:
            case 19:
            case 20:
            case 23:
            case 26: sprintf( buffer, "%-8s%-4d", temp, inst->offset );
                            break;
            case 21: sprintf( buffer, "%-8sFP", temp );
                            break;
            case 22: sprintf( buffer, "%-8s#%-4d", temp, inst->offset );
                            break;
            case 24:
            case 27:
                if ( inst->offset == 0 ) sprintf( buffer, "%-8sFP", temp );
                else sprintf( buffer, "%-8sFP%-+4d", temp, inst->offset );
                break;
            case 25:
            case 28:
                if ( inst->offset == 0 ) sprintf( buffer, "%-8s[SP]", temp );
                else sprintf( buffer, "%-8s[SP]%-+4d", temp, inst->offset );
                break;
            default:
                fprintf( stderr, "Error - shouldn't be here, %d %d\n",
                         inst->opcode, inst->offset );
                break;
        }
    }
}

canonical_original_code:
void Disassemble(struct INSTRUCTION *inst, char *buffer)
{
    char temp[10];
    if ( inst->opcode < 0 || inst->opcode > 30 ) {
        sprintf( buffer, "Unknown opcode %d\n", inst->opcode );
    }
    else {
        strcpy( temp, mnemonics[inst->opcode] );
        switch ( inst->opcode ) {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 14:
            case 15:
            case 16:
            case 29:
            case 30: strcpy( buffer, temp );
                            break;
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 17:
            case 18:
            case 19:
            case 20:
            case 23:
            case 26: sprintf( buffer, "%-8s%-4d", temp, inst->offset );
                            break;
            case 21: sprintf( buffer, "%-8sFP", temp );
                            break;
            case 22: sprintf( buffer, "%-8s#%-4d", temp, inst->offset );
                            break;
            case 24:
            case 27:
                if ( inst->offset == 0 ) sprintf( buffer, "%-8sFP", temp );
                else sprintf( buffer, "%-8sFP%-+4d", temp, inst->offset );
                break;
            case 25:
            case 28:
                if ( inst->offset == 0 ) sprintf( buffer, "%-8s[SP]", temp );
                else sprintf( buffer, "%-8s[SP]%-+4d", temp, inst->offset );
                break;
            default:
                fprintf( stderr, "Error - shouldn't be here, %d %d\n",
                         inst->opcode, inst->offset );
                break;
        }
    }
}

variable_types:
buffer
char *

variable_types:
temp
char [10]


textcolor

repo: Ethilanie/C-Project

decompiled_code:
int __fastcall textcolor(unsigned int a1, int a2, int a3)
{
char s[21]; // [rsp+3h] [rbp-15h] BYREF

sprintf(s, "%c[%d;%d;%dm", 27LL, a1, (unsigned int)(a2 + 30), (unsigned int)(a3 + 40));
return printf("%s", s);
}

canonical_decompiled_code:
int __fastcall func0(unsigned int a1, int a2, int a3)
{
char s[21]; // [rsp+3h] [rbp-15h] BYREF

sprintf(s, "%c[%d;%d;%dm", 27LL, a1, (unsigned int)(a2 + 30), (unsigned int)(a3 + 40));
return printf("%s", s);
}

original_code:
void textcolor(int attr, int fg, int bg){
 char command[13];
 sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
 printf("%s", command);
}

variable_types: attr int

variable_types: fg int

variable_types: bg int

variable_types:
command
char [13]


nbPiles

decompiled_code:
__int64 __fastcall nbPiles(int a1, double a2)
{
unsigned int v2; // er12
unsigned int v4; // eax

if ( init_0 )
{
v4 = time(0LL);
srand(v4);
init_0 = 0;
}
v2 = 0;
while ( (float)((float)rand() * 4.6566129e-10) > a2 )
{
if ( (int)++v2 > a1 )
{
rand();
return v2;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1, double a2)
{
unsigned int v2; // er12
unsigned int v4; // eax

if ( init_0 )
{
v4 = time(0LL);
srand(v4);
init_0 = 0;
}
v2 = 0;
while ( (float)((float)rand() * 4.6566129e-10) > a2 )
{
if ( (int)++v2 > a1 )
{
rand();
return v2;
}
}
return v2;
}

original_code:
int nbPiles(double proba, int hauteur) {
     static int init = 1;
     int stop = 0;
     if(init) {
         srand((unsigned)time(((void *)0)));
         init = 0;
     }
 int etages = 0;
    while(((float) rand() / 2147483647)> proba && stop ==0){
   etages++;
   if(etages>=hauteur+1){stop=1;}
    }
 return etages;
}

canonical_original_code:
int nbPiles(double proba, int hauteur) {
     static int init = 1;
     int stop = 0;
     if(init) {
         srand((unsigned int)time(((void *)0)));
         init = 0;
     }
 int etages = 0;
    while(((float) rand() / 2147483647)> proba && stop ==0){
   etages++;
   if(etages>=hauteur+1){stop=1;}
    }
 return etages;
}

variable_types: proba double

variable_types: hauteur int

variable_types: init int

variable_types: stop int

variable_types: etages int


hauteur

decompiled_code:
__int64 __fastcall hauteur(__int64 a1)
{
__int64 v1; // rax
unsigned int i; // er8

if ( !a1 )
return 0LL;
v1 = *(_QWORD *)(a1 + 8);
for ( i = 1; v1; ++i )
v1 = *(_QWORD *)(v1 + 8);
return i;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
__int64 v1; // rax
unsigned int i; // er8

if ( !a1 )
return 0LL;
v1 = *(_QWORD *)(a1 + 8);
for ( i = 1; v1; ++i )
v1 = *(_QWORD *)(v1 + 8);
return i;
}

original_code:
int hauteur(L* skipList){
 int ht = 1;
 if(skipList==((void *)0)) return 0;
 while(skipList->suite!=((void *)0)){
  ht=ht +1;
  skipList= skipList->suite;
 }
 return ht;
}

canonical_original_code:
int hauteur(struct _L *skipList){
 int ht = 1;
 if(skipList==((void *)0)) return 0;
 while(skipList->suite!=((void *)0)){
  ht=ht +1;
  skipList= skipList->suite;
 }
 return ht;
}

variable_types: struct _L { struct _CL { int val; struct _CL *suiv; struct _CL *bas; } *tete; struct _L *suite; } *

variable_types: ht int

user_defined_types: struct _L { struct _CL *tete; struct _L *suite; }


recherche

decompiled_code:
__int64 __fastcall recherche(int a1, _QWORD *a2)
{
_DWORD *v2; // rax
unsigned int v3; // er8
_QWORD *v4; // rdx
_DWORD *v5; // rdx

v2 = (_DWORD *)*a2;
v3 = 1;
if ( *a2 )
{
while ( 1 )
{
while ( 1 )
{
if ( *v2 <= a1 )
{
v5 = (_DWORD *)*((_QWORD *)v2 + 1);
if ( !v5 )
goto LABEL_11;
goto LABEL_8;
}
v4 = (_QWORD *)a2[1];
if ( !v4 )
break;
v2 = (_DWORD *)*v4;
++v3;
if ( !*v4 )
return 0;
a2 = (_QWORD *)a2[1];
}
while ( 1 )
{
v5 = (_DWORD *)*((_QWORD *)v2 + 1);
if ( !v5 )
break;
LABEL_8:
if ( *v5 > a1 )
break;
++v3;
v2 = v5;
}
LABEL_11:
if ( *v2 == a1 )
return v3;
v2 = (_DWORD *)*((_QWORD *)v2 + 2);
if ( !v2 )
return 0;
++v3;
}
}
return 0;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, _QWORD *a2)
{
_DWORD *v2; // rax
unsigned int v3; // er8
_QWORD *v4; // rdx
_DWORD *v5; // rdx

v2 = (_DWORD *)*a2;
v3 = 1;
if ( *a2 )
{
while ( 1 )
{
while ( 1 )
{
if ( *v2 <= a1 )
{
v5 = (_DWORD *)*((_QWORD *)v2 + 1);
if ( !v5 )
goto LABEL_11;
goto LABEL_8;
}
v4 = (_QWORD *)a2[1];
if ( !v4 )
break;
v2 = (_DWORD *)*v4;
++v3;
if ( !*v4 )
return 0;
a2 = (_QWORD *)a2[1];
}
while ( 1 )
{
v5 = (_DWORD *)*((_QWORD *)v2 + 1);
if ( !v5 )
break;
LABEL_8:
if ( *v5 > a1 )
break;
++v3;
v2 = v5;
}
LABEL_11:
if ( *v2 == a1 )
return v3;
v2 = (_DWORD *)*((_QWORD *)v2 + 2);
if ( !v2 )
return 0;
++v3;
}
}
return 0;
}

original_code:
int recherche(int valeur, L* skipList){
    CL* temp;
    int trouve = 0;
    int pas = 1;
    temp = skipList->tete;
    if(skipList != ((void *)0))
    {
        while(trouve == 0)
        {
            while (skipList !=((void *)0) && temp!=((void *)0) && temp->val > valeur && skipList->suite !=((void *)0) )
            {
                skipList = skipList->suite;
                temp = skipList->tete;
                pas = pas +1;
            }
            while(temp!=((void *)0) && temp->suiv != ((void *)0) && temp->suiv->val<=valeur)
            {
                temp= temp->suiv;
                pas = pas+1;
            }
            if(temp!=((void *)0) && temp->val == valeur)
            {
                trouve = 1;
                return pas;
            }
            else
            {
                if(temp!=((void *)0) && temp->bas != ((void *)0))
                {
                    temp = temp->bas;
                    pas = pas + 1;
                }
                else
                {
                    trouve=1;
                    return 0;
                }
            }
        }
    }
}

canonical_original_code:
int recherche(int valeur, struct _L *skipList){
    struct _CL *temp;
    int trouve = 0;
    int pas = 1;
    temp = skipList->tete;
    if(skipList != ((void *)0))
    {
        while(trouve == 0)
        {
            while (skipList !=((void *)0) && temp!=((void *)0) && temp->val > valeur && skipList->suite !=((void *)0) )
            {
                skipList = skipList->suite;
                temp = skipList->tete;
                pas = pas +1;
            }
            while(temp!=((void *)0) && temp->suiv != ((void *)0) && temp->suiv->val<=valeur)
            {
                temp= temp->suiv;
                pas = pas+1;
            }
            if(temp!=((void *)0) && temp->val == valeur)
            {
                trouve = 1;
                return pas;
            }
            else
            {
                if(temp!=((void *)0) && temp->bas != ((void *)0))
                {
                    temp = temp->bas;
                    pas = pas + 1;
                }
                else
                {
                    trouve=1;
                    return 0;
                }
            }
        }
    }
}

variable_types: valeur int

variable_types: struct _CL { int val; struct _CL *suiv; struct _CL *bas; } *

variable_types: trouve int

variable_types: pas int


boucleRecherche

original_code:
void boucleRecherche(L* skipList, int nbElements){
    int pas = 0;
    int i = 0;
    int tabPas[nbElements];
    for (i = 0; i<nbElements; i++)
    {
        tabPas[i] = recherche(i, skipList);
    }
    printf("  ==========================\n");
    printf("||  Cases || Nombre de pas ||\n");
    for (i = 0; i < nbElements; i++)
    {
        printf("||%7d ||%15d||\n",i, tabPas[i]);
    }
    printf("  =========================");
    for(i = 0; i<nbElements; i++)
    {
        pas = pas + tabPas[i];
    }
 printf("\n 0 : la valeur n'existe pas");
    printf("\n \n Somme des pas : %d\n", pas);
}

canonical_original_code:
void boucleRecherche(struct _L *skipList, int nbElements){
    int pas = 0;
    int i = 0;
    int tabPas[-1];
    for (i = 0; i<nbElements; i++)
    {
        tabPas[i] = recherche(i, skipList);
    }
    printf("  ==========================\n");
    printf("||  Cases || Nombre de pas ||\n");
    for (i = 0; i < nbElements; i++)
    {
        printf("||%7d ||%15d||\n",i, tabPas[i]);
    }
    printf("  =========================");
    for(i = 0; i<nbElements; i++)
    {
        pas = pas + tabPas[i];
    }
 printf("\n 0 : la valeur n'existe pas");
    printf("\n \n Somme des pas : %d\n", pas);
}

variable_types: nbElements int

variable_types: i int

variable_types:
tabPas
int [-1]

user_defined_types: struct _CL { int val; struct _CL *suiv; struct _CL *bas; }


place

decompiled_code:
__int64 __fastcall place(int **a1, int a2)
{
int *v2; // rax
unsigned int v3; // er8
int v4; // edx

v2 = *a1;
v3 = 0;
if ( *a1 )
{
do
{
v4 = *v2;
v2 = (int *)*((_QWORD *)v2 + 1);
++v3;
}
while ( v2 && v4 != a2 );
if ( v4 != a2 )
v3 = 0;
}
return v3;
}

original_code:
int place(L*SkipList, int valeur){
    int i=0;
    CL*temp;
    int trouve=0;
    temp=SkipList->tete;
    while(temp!=((void *)0) && trouve ==0){
        if(valeur == temp->val){
            trouve=1;
        }
            i++;
        temp=temp->suiv;
    }
 if(trouve==0){
  return 0;
 }else{
  return i;
 }
}

canonical_original_code:
int place(struct _L *SkipList, int valeur){
    int i = 0;
    struct _CL *temp;
    int trouve = 0;
    temp=SkipList->tete;
    while(temp!=((void *)0) && trouve ==0){
        if(valeur == temp->val){
            trouve=1;
        }
            i++;
        temp=temp->suiv;
    }
 if(trouve==0){
  return 0;
 }else{
  return i;
 }
}


afficheListe

decompiled_code:
int __fastcall afficheListe(__int64 a1)
{
int v1; // eax
unsigned int **v2; // rbp
int i; // er12
unsigned int *j; // rbx

v1 = hauteur(a1);
if ( v1 > 0 )
{
v2 = (unsigned int **)a1;
for ( i = v1; i > 0; --i )
{
if ( !v2 )
break;
for ( j = *v2; j; j = (unsigned int *)*((_QWORD *)j + 1) )
printf("valeur :%d -", *j);
putchar(10);
v2 = (unsigned int **)v2[1];
}
}
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func10(__int64 a1)
{
int v1; // eax
unsigned int **v2; // rbp
int i; // er12
unsigned int *j; // rbx

v1 = func5(a1);
if ( v1 > 0 )
{
v2 = (unsigned int **)a1;
for ( i = v1; i > 0; --i )
{
if ( !v2 )
break;
for ( j = *v2; j; j = (unsigned int *)*((_QWORD *)j + 1) )
printf("valeur :%d -", *j);
putchar(10);
v2 = (unsigned int **)v2[1];
}
}
return putchar(10);
}

original_code:
void afficheListe(L* skipList){
    CL* temp;
    int ht = hauteur(skipList);
    while(ht >= 1 && skipList!=((void *)0))
    {
        temp = skipList->tete;
        while(temp!=((void *)0))
        {
            printf("valeur :%d -",temp->val);
            temp = temp->suiv;
        }
        printf("\n");
        skipList= skipList->suite;
        ht = ht - 1;
    }
    printf("\n");
}

canonical_original_code:
void afficheListe(struct _L *skipList){
    struct _CL *temp;
    int ht = hauteur(skipList);
    while(ht >= 1 && skipList!=((void *)0))
    {
        temp = skipList->tete;
        while(temp!=((void *)0))
        {
            printf("valeur :%d -",temp->val);
            temp = temp->suiv;
        }
        printf("\n");
        skipList= skipList->suite;
        ht = ht - 1;
    }
    printf("\n");
}


AfficherAide

decompiled_code:
int AfficherAide()
{
textcolor(3u, 2, 0);
puts("\n\t NAME");
textcolor(3u, 3, 0);
puts("\t\t Le programme prog.exe permet de creer des skip-list avec les options choisies");
textcolor(3u, 2, 0);
puts("\t SYNOPSIS");
textcolor(3u, 3, 0);
puts("\t\t ./prog [-h]");
puts("\t\t [-p var-double]");
puts("\t\t [-n var-int | -f @file]");
puts("\t\t [-o] [h][l][t][r][i]");
textcolor(3u, 2, 0);
puts("\t DESCRIPTION");
textcolor(3u, 3, 0);
puts(
"\t\t Le programme prog permet de creer des skiplistes.\n"
"\t\t Developpe en C.\n"
"\t\t Il est possible d'utiliser plusieurs options mais certaines ne doivent pas etre groupees : -f et -n\n"
"\t\t L'ordre des options n'importe pas");
textcolor(3u, 2, 0);
puts("\t OPTIONS");
textcolor(3u, 3, 0);
puts("\t\t Sommaire\n\t\t Voici le sommaire des options, par type.\n");
puts("\t\t Option Probabilite\n\t\t -p\n");
puts("\t\t Option Elements\n\t\t -n -f\n");
puts("\t\t Option Affichage\n\t\t -o\n");
puts("\t\t -p Modifie la probabilite par defaut \n");
puts("\t\t -n Modifie le nombre d'elements a ajouter dans la skip-list \n");
puts("\t\t -f Ajoute les elements du fichier a la skip-list \n");
puts("\t\t -o Precise les affichages \n");
puts("\t\t\t -oh : affiche la hauteur \n");
puts("\t\t\t -ol : affiche la longueur de chaque liste \n");
puts("\t\t\t -ot : affiche la skip-list en mode texte \n");
puts("\t\t\t -or : recherche chaque element et affiche le nombre de pas \n");
puts("\t\t\t -oi : affiche graphiquement la skip-list \n");
return textcolor(3u, 7, 0);
}

canonical_decompiled_code:
int func11()
{
func0(3u, 2, 0);
puts("\n\t NAME");
func0(3u, 3, 0);
puts("\t\t Le programme prog.exe permet de creer des skip-list avec les options choisies");
func0(3u, 2, 0);
puts("\t SYNOPSIS");
func0(3u, 3, 0);
puts("\t\t ./prog [-h]");
puts("\t\t [-p var-double]");
puts("\t\t [-n var-int | -f @file]");
puts("\t\t [-o] [h][l][t][r][i]");
func0(3u, 2, 0);
puts("\t DESCRIPTION");
func0(3u, 3, 0);
puts(
"\t\t Le programme prog permet de creer des skiplistes.\n"
"\t\t Developpe en C.\n"
"\t\t Il est possible d'utiliser plusieurs options mais certaines ne doivent pas etre groupees : -f et -n\n"
"\t\t L'ordre des options n'importe pas");
func0(3u, 2, 0);
puts("\t OPTIONS");
func0(3u, 3, 0);
puts("\t\t Sommaire\n\t\t Voici le sommaire des options, par type.\n");
puts("\t\t Option Probabilite\n\t\t -p\n");
puts("\t\t Option Elements\n\t\t -n -f\n");
puts("\t\t Option Affichage\n\t\t -o\n");
puts("\t\t -p Modifie la probabilite par defaut \n");
puts("\t\t -n Modifie le nombre d'elements a ajouter dans la skip-list \n");
puts("\t\t -f Ajoute les elements du fichier a la skip-list \n");
puts("\t\t -o Precise les affichages \n");
puts("\t\t\t -oh : affiche la hauteur \n");
puts("\t\t\t -ol : affiche la longueur de chaque liste \n");
puts("\t\t\t -ot : affiche la skip-list en mode texte \n");
puts("\t\t\t -or : recherche chaque element et affiche le nombre de pas \n");
puts("\t\t\t -oi : affiche graphiquement la skip-list \n");
return func0(3u, 7, 0);
}

original_code:
void AfficherAide(){
 textcolor(3,2, 0 );
 printf("\n\t NAME\n");
 textcolor(3,3, 0 );
 printf("\t\t Le programme prog.exe permet de creer des skip-list avec les options choisies\n");
 textcolor(3,2, 0 );
 printf("\t SYNOPSIS\n");
 textcolor(3,3, 0 );
 printf("\t\t ./prog [-h]\n");
 printf("\t\t        [-p var-double]\n");
 printf("\t\t        [-n var-int | -f @file]\n");
 printf("\t\t        [-o] [h][l][t][r][i]\n");
 textcolor(3,2, 0 );
 printf("\t DESCRIPTION\n");
 textcolor(3,3, 0 );
 printf("\t\t Le programme prog permet de creer des skiplistes.\n	\t Developpe en C.\n	\t Il est possible d'utiliser plusieurs options mais certaines ne doivent pas etre groupees : -f et -n\n	\t L'ordre des options n'importe pas\n");
 textcolor(3,2, 0 );
 printf("\t OPTIONS\n");
 textcolor(3,3, 0 );
 printf("\t\t Sommaire\n\t\t Voici le sommaire des options, par type.\n\n");
 printf("\t\t Option Probabilite\n\t\t -p\n\n");
 printf("\t\t Option Elements\n\t\t -n -f\n\n");
 printf("\t\t Option Affichage\n\t\t -o\n\n");
 printf("\t\t -p Modifie la probabilite par defaut \n\n");
 printf("\t\t -n Modifie le nombre d'elements a ajouter dans la skip-list \n\n");
 printf("\t\t -f Ajoute les elements du fichier a la skip-list \n\n");
 printf("\t\t -o Precise les affichages \n\n");
 printf("\t\t\t -oh : affiche la hauteur \n\n");
 printf("\t\t\t -ol : affiche la longueur de chaque liste \n\n");
 printf("\t\t\t -ot : affiche la skip-list en mode texte \n\n");
 printf("\t\t\t -or : recherche chaque element et affiche le nombre de pas \n\n");
 printf("\t\t\t -oi : affiche graphiquement la skip-list \n\n");
 textcolor(3,7, 0 );
}


nbElemHauteur

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

result = hauteur((__int64)a2);
if ( (_DWORD)result )
{
while ( (_DWORD)result != v3 )
{
if ( !a2 )
nbElemHauteur_cold();
a2 = (__int64 *)a2[1];
LODWORD(result) = hauteur((__int64)a2);
}
v4 = *a2;
for ( result = 0LL; v4; result = (unsigned int)(result + 1) )
v4 = *(_QWORD *)(v4 + 8);
}
return result;
}

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

result = func5((__int64)a2);
if ( (_DWORD)result )
{
while ( (_DWORD)result != v3 )
{
if ( !a2 )
func16();
a2 = (__int64 *)a2[1];
LODWORD(result) = func5((__int64)a2);
}
v4 = *a2;
for ( result = 0LL; v4; result = (unsigned int)(result + 1) )
v4 = *(_QWORD *)(v4 + 8);
}
return result;
}

original_code:
int nbElemHauteur(int ht,L* SkipList){
    if (hauteur(SkipList)==0) return 0;
    while(hauteur(SkipList)!=ht && SkipList!=((void *)0)){
        SkipList=SkipList->suite;
    }
    int i=0;
    CL*temp;
    temp = SkipList->tete;
    while(temp!=((void *)0)){
        i++;
        temp=temp->suiv;
    }
    return i;
}

canonical_original_code:
int nbElemHauteur(int ht, struct _L *SkipList){
    if (hauteur(SkipList)==0) return 0;
    while(hauteur(SkipList)!=ht && SkipList!=((void *)0)){
        SkipList=SkipList->suite;
    }
    int i = 0;
    struct _CL *temp;
    temp = SkipList->tete;
    while(temp!=((void *)0)){
        i++;
        temp=temp->suiv;
    }
    return i;
}


afficheLongueur

decompiled_code:
int __fastcall afficheLongueur(__int64 a1)
{
__int64 *v1; // rbp
int v2; // ebx
unsigned int v3; // eax

v1 = (__int64 *)a1;
v2 = hauteur(a1);
puts("\n---Longueur de chaque hauteur---\n");
if ( v2 > 0 )
{
do
{
v3 = nbElemHauteur((unsigned int)v2, v1);
printf("Hauteur %d : %d element(s) \n", (unsigned int)v2, v3);
v1 = (__int64 *)v1[1];
--v2;
}
while ( v2 );
}
return puts("\n");
}

canonical_decompiled_code:
int __fastcall func13(__int64 a1)
{
__int64 *v1; // rbp
int v2; // ebx
unsigned int v3; // eax

v1 = (__int64 *)a1;
v2 = func5(a1);
puts("\n---Longueur de chaque hauteur---\n");
if ( v2 > 0 )
{
do
{
v3 = func12((unsigned int)v2, v1);
printf("Hauteur %d : %d element(s) \n", (unsigned int)v2, v3);
v1 = (__int64 *)v1[1];
--v2;
}
while ( v2 );
}
return puts("\n");
}

original_code:
void afficheLongueur(L*SkipList){
 int ht = hauteur(SkipList);
 printf("\n---Longueur de chaque hauteur---\n\n");
 while(ht>0){
  printf("Hauteur %d : %d element(s) \n", ht, nbElemHauteur(ht,SkipList));
  ht--;
  SkipList=SkipList->suite;
 }
 printf("\n\n");
}

canonical_original_code:
void afficheLongueur(struct _L *SkipList){
 int ht = hauteur(SkipList);
 printf("\n---Longueur de chaque hauteur---\n\n");
 while(ht>0){
  printf("Hauteur %d : %d element(s) \n", ht, nbElemHauteur(ht,SkipList));
  ht--;
  SkipList=SkipList->suite;
 }
 printf("\n\n");
}


isNumeric

decompiled_code:
_BOOL8 __fastcall isNumeric(char a1)
{
return (unsigned __int8)(a1 - 48) <= 9u;
}

canonical_decompiled_code:
_BOOL8 __fastcall func14(char a1)
{
return (unsigned __int8)(a1 - 48) <= 9u;
}

original_code:
int isNumeric(char caractere){
    if(caractere=='0'){
        return 1;
    }
    if(caractere=='1'){
        return 1;
    }
     if(caractere=='2'){
        return 1;
    }
     if(caractere=='3'){
        return 1;
    }
     if(caractere=='4'){
        return 1;
    }
     if(caractere=='5'){
        return 1;
    }
     if(caractere=='6'){
        return 1;
    }
     if(caractere=='7'){
        return 1;
    }
     if(caractere=='8'){
        return 1;
    }
     if(caractere=='9'){
        return 1;
    }
    return 0;
}

variable_types: caractere char


main

canonical_name: main

repo: EvanPurkhiser/CS-Matrix-Multiplication

original_code:
int main(int argc, char* argv[])
{
 for (int i = 0; i < 2048; ++i)
  for (int k = 0; k < 2048; ++k)
   A[i][k] = B[i][k] = 1;
 int k, j, i, jj, kk;
 for (int trial = 0; trial < 8; ++trial)
 {
  printf("Trial %d: ", trial);
  for (int block_size = 256; block_size <= 2048; block_size *= 2)
  {
   memset(C, 0, sizeof(C[0][0] * 2048 * 2048));
   struct timeval time_start;
   struct timeval time_end;
   gettimeofday(&time_start, ((void *)0));
   for (k = 0; k < 2048; k += block_size)
    for (j = 0; j < 2048; j += block_size)
     for (i = 0; i < 2048; ++i)
      for (jj = j; jj < min(j + block_size, 2048); ++jj)
       for (kk = k; kk < min(k + block_size, 2048); ++kk)
        C[i][jj] += A[i][kk] * B[kk][jj];
   gettimeofday(&time_end, ((void *)0));
   long long execution_time = 1000000LL
    * (time_end.tv_sec - time_start.tv_sec)
    + (time_end.tv_usec - time_start.tv_usec);
   printf("%lld,", execution_time);
   fflush(stdout);
  }
  puts("");
 }
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 for (int i = 0; i < 2048; ++i)
  for (int k = 0; k < 2048; ++k)
   A[i][k] = B[i][k] = 1;
 int k; int j; int i; int jj; int kk;
 for (int trial = 0; trial < 8; ++trial)
 {
  printf("Trial %d: ", trial);
  for (int block_size = 256; block_size <= 2048; block_size *= 2)
  {
   memset(C, 0, sizeof(C[0][0] * 2048 * 2048));
   struct timeval time_start;
   struct timeval time_end;
   gettimeofday(&time_start, ((void *)0));
   for (k = 0; k < 2048; k += block_size)
    for (j = 0; j < 2048; j += block_size)
     for (i = 0; i < 2048; ++i)
      for (jj = j; jj < min(j + block_size, 2048); ++jj)
       for (kk = k; kk < min(k + block_size, 2048); ++kk)
        C[i][jj] += A[i][kk] * B[kk][jj];
   gettimeofday(&time_end, ((void *)0));
   long long execution_time = 1000000LL
    * (time_end.tv_sec - time_start.tv_sec)
    + (time_end.tv_usec - time_start.tv_usec);
   printf("%lld,", execution_time);
   fflush(stdout);
  }
  puts("");
 }
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: k int

variable_types: j int

variable_types: jj int

variable_types: kk int

variable_types: trial int

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


min

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

result = a1;
if ( (int)a2 <= (int)a1 )
result = a2;
return result;
}

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

result = a1;
if ( (int)a2 <= (int)a1 )
result = a2;
return result;
}

original_code:
int min(int a, int b)
{
 return a < b ? a : b;
}

variable_types: a int

variable_types: b int


repo: Exanis/hh

decompiled_code:
__int64 __fastcall hh_find_parent_of_type(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rbp
unsigned __int64 v4; // r12
__int64 v5; // rbx
unsigned __int64 v6; // r13
__int64 v7; // rdx

result = 0LL;
if ( a2 && *(_DWORD *)a2 == -904811746 )
{
v3 = *(_QWORD *)(a1 + 8);
if ( *(_QWORD *)(a2 + 8) == v3 )
{
result = a2;
}
else
{
v4 = *(_QWORD *)(a2 + 48);
v5 = a2 + 56;
if ( v4 > 0x38 )
{
v6 = 56LL;
while ( 1 )
{
if ( *(_DWORD *)v5 != -904811746 )
return 0LL;
result = hh_find_parent_of_type(a1, v5);
if ( result )
return result;
v7 = *(_QWORD *)(v5 + 48);
if ( *(_QWORD *)(v5 + 8) == v3 )
break;
v6 += v7;
v5 += v7;
if ( v4 <= v6 )
return result;
}
result = v5;
}
}
}
return result;
}

original_code:
void *hh_find_parent_of_type(hh_object_struct *object, hh_object_struct *this)
{
  if (this == ((void *)0))
    return ((void *)0);
  size_t jump = sizeof(hh_object_struct);
  size_t jumped = 0;
  size_t max_jump = this->size;
  if (this->magic_number != 0xCA11AB1E)
    return (((void *)0));
  while (object->__this_identifier != this->__this_identifier)
    {
      void *tmp;
      this = (hh_object_struct *) (((char *) this) + jump);
      jumped += jump;
      if (jumped >= max_jump || this->magic_number != 0xCA11AB1E)
 return (((void *)0));
      if ((tmp = hh_find_parent_of_type(object, this)) != ((void *)0))
 return (tmp);
      jump = this->size;
    }
  return (this);
}

canonical_original_code:
void *hh_find_parent_of_type(struct hh_object_struct *object, struct hh_object_struct *this)
{
  if (this == ((void *)0))
    return ((void *)0);
  unsigned long jump = sizeof(hh_object_struct);
  unsigned long jumped = 0;
  unsigned long max_jump = this->size;
  if (this->magic_number != 0xCA11AB1E)
    return (((void *)0));
  while (object->__this_identifier != this->__this_identifier)
    {
      void *tmp;
      this = (struct hh_object_struct *) (((char *) this) + jump);
      jumped += jump;
      if (jumped >= max_jump || this->magic_number != 0xCA11AB1E)
 return (((void *)0));
      if ((tmp = hh_find_parent_of_type(object, this)) != ((void *)0))
 return (tmp);
      jump = this->size;
    }
  return (this);
}

variable_types: struct hh_object_struct { unsigned int magic_number; void *__this_identifier; unsigned long next_parent; void (*__init)(); void (*__construct)(); void (*__delete)(void *); unsigned long size; } *

variable_types:
this
struct hh_object_struct *

variable_types:
jump
unsigned long

variable_types:
jumped
unsigned long

variable_types:
tmp
void *

return_type: void *


decompiled_code:
__int64 __fastcall hh_find_child_of_type(__int64 a1, __int64 a2)
{
int v2; // edx
__int64 result; // rax

if ( !a2 )
return 0LL;
v2 = *(_DWORD *)(a2 - 1);
result = a2 - 1;
while ( v2 != -904811746 )
v2 = *(_DWORD *)--result;
while ( *(_QWORD *)(result + 8) != *(_QWORD *)(a1 + 8) )
;
return result;
}

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

if ( !a2 )
return 0LL;
v2 = *(_DWORD *)(a2 - 1);
result = a2 - 1;
while ( v2 != -904811746 )
v2 = *(_DWORD *)--result;
while ( *(_QWORD *)(result + 8) != *(_QWORD *)(a1 + 8) )
;
return result;
}

original_code:
void *hh_find_child_of_type(hh_object_struct *type, hh_object_struct *this)
{
  char *position = (char *) this;
  if (this == ((void *)0))
    return ((void *)0);
  position--;
  do {
    while (((hh_object_struct *) position)->magic_number != 0xCA11AB1E)
      position--;
    if (((hh_object_struct *) position)->__this_identifier == type->__this_identifier)
      return position;
  } while (1);
}

canonical_original_code:
void *hh_find_child_of_type(struct hh_object_struct *type, struct hh_object_struct *this)
{
  char *position = (char *) this;
  if (this == ((void *)0))
    return ((void *)0);
  position--;
  do {
    while (((struct hh_object_struct *) position)->magic_number != 0xCA11AB1E)
      position--;
    if (((struct hh_object_struct *) position)->__this_identifier == type->__this_identifier)
      return position;
  } while (1);
}

variable_types:
position
char *

user_defined_types: struct hh_object_struct { unsigned int magic_number; void *__this_identifier; unsigned long next_parent; void (*__init)(); void (*__construct)(); void (*__delete)(void *); unsigned long size; }


decompiled_code:
__int64 __fastcall hh_find_of_type(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // r8
__int64 v4; // r9

if ( !a2 )
return 0LL;
result = hh_find_parent_of_type(a1, a2);
if ( !result )
result = hh_find_child_of_type(v4, v3);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // r8
__int64 v4; // r9

if ( !a2 )
return 0LL;
result = func0(a1, a2);
if ( !result )
result = func1(v4, v3);
return result;
}

original_code:
void *hh_find_of_type(hh_object_struct *type, hh_object_struct *this)
{
  void *result;
  if (this == ((void *)0))
    return ((void *)0);
  result = hh_find_parent_of_type(type, this);
  if (!result)
    result = hh_find_child_of_type(type,this);
  return (result);
}

canonical_original_code:
void *hh_find_of_type(struct hh_object_struct *type, struct hh_object_struct *this)
{
  void *result;
  if (this == ((void *)0))
    return ((void *)0);
  result = hh_find_parent_of_type(type, this);
  if (!result)
    result = hh_find_child_of_type(type,this);
  return (result);
}

variable_types:
result
void *


decompiled_code:
_QWORD *hh_add_try_context()
{
_QWORD *result; // rax
void *v1; // rdx

result = malloc(0xD0uLL);
v1 = buffers;
buffers = result;
result[25] = v1;
return result;
}

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *result; // rax
void *v1; // rdx

result = malloc(0xD0uLL);
v1 = buffers;
buffers = result;
result[25] = v1;
return result;
}

original_code:
jmp_buf *hh_add_try_context()
{
  hh_jmp_buffer_t *buffer = malloc(sizeof(hh_jmp_buffer_t));
  buffer->next = buffers;
  buffers = buffer;
  return (&(buffer->buffer));
}

canonical_original_code:
struct __jmp_buf_tag (*hh_add_try_context())[1]
{
  struct hh_jmp_buffer *buffer = malloc(sizeof(hh_jmp_buffer_t));
  buffer->next = buffers;
  buffers = buffer;
  return (&(buffer->buffer));
}

variable_types: struct hh_jmp_buffer { struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t { unsigned long __val[-1]; } __saved_mask; } buffer[1]; struct hh_jmp_buffer *next; } *

return_type: struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t { unsigned long __val[-1]; } __saved_mask; } (*)[1]

user_defined_types: struct hh_jmp_buffer { struct __jmp_buf_tag buffer[1]; struct hh_jmp_buffer *next; }

user_defined_types: struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t __saved_mask; }


decompiled_code:
void hh_remove_try_context()
{
void *v0; // rdi

v0 = buffers;
buffers = (void *)*((_QWORD *)buffers + 25);
free(v0);
}

canonical_decompiled_code:
void func1()
{
void *v0; // rdi

v0 = buffers;
buffers = (void *)*((_QWORD *)buffers + 25);
free(v0);
}

original_code:
void hh_remove_try_context(__attribute__((unused)) void *_)
{
  hh_jmp_buffer_t *tmp = buffers;
  buffers = tmp->next;
  free(tmp);
}

canonical_original_code:
void hh_remove_try_context(void *_)
{
  struct hh_jmp_buffer *tmp = buffers;
  buffers = tmp->next;
  free(tmp);
}

user_defined_types: struct __sigset_t { unsigned long __val[-1]; }


decompiled_code:
void *hh_get_last_try_context()
{
return buffers;
}

canonical_decompiled_code:
void *func2()
{
return buffers;
}

original_code:
jmp_buf *hh_get_last_try_context()
{
  return (&(buffers->buffer));
}

canonical_original_code:
struct __jmp_buf_tag (*hh_get_last_try_context())[1]
{
  return (&(buffers->buffer));
}


original_code:
static void run_delete(void *object)
{
  hh_object_struct *obj = object;
  char *struct_ptr = object;
  char *max_position;
  max_position = struct_ptr + obj->size;
  obj->__delete(object);
  struct_ptr = struct_ptr + sizeof(hh_object_struct);
  while (struct_ptr < max_position)
    {
      hh_object_struct *obj_struct = (hh_object_struct *) struct_ptr;
      if (obj_struct->magic_number != 0xCA11AB1E)
 return ;
      char *next_struct_ptr = struct_ptr + obj_struct->size;
      run_delete((void *) obj_struct);
      struct_ptr = next_struct_ptr;
    }
}

canonical_original_code:
static void run_delete(void *object)
{
  struct hh_object_struct *obj = object;
  char *struct_ptr = object;
  char *max_position;
  max_position = struct_ptr + obj->size;
  obj->__delete(object);
  struct_ptr = struct_ptr + sizeof(hh_object_struct);
  while (struct_ptr < max_position)
    {
      struct hh_object_struct *obj_struct = (hh_object_struct *) struct_ptr;
      if (obj_struct->magic_number != 0xCA11AB1E)
 return ;
      char *next_struct_ptr = struct_ptr + obj_struct->size;
      run_delete((void *) obj_struct);
      struct_ptr = next_struct_ptr;
    }
}

variable_types:
object
void *


original_code:
void *hh_init_memory()
{
  void *args = __builtin_apply_args();
  hh_object_struct *object = hh_tmp_this_reference;
  object->__construct();
  __builtin_apply(object->__init, args, 100);
  return (object);
}

canonical_original_code:
void *hh_init_memory()
{
  void *args = __builtin_apply_args();
  struct hh_object_struct *object = hh_tmp_this_reference;
  object->__construct();
  __builtin_apply(object->__init, args, 100);
  return (object);
}

variable_types:
args
void *


delete

decompiled_code:
void __fastcall delete(void *ptr)
{
run_delete((__int64)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
func0((__int64)ptr);
free(ptr);
}

original_code:
void delete(void *object)
{
  run_delete(object);
  free(object);
}


decompiled_code:
void __fastcall hh_cleanup_local(void **a1)
{
delete(*a1);
}

canonical_decompiled_code:
void __fastcall func4(void **a1)
{
func3(*a1);
}

original_code:
void hh_cleanup_local(void *obj)
{
  hh_object_struct **object = (hh_object_struct **) obj;
  delete(*object);
}

canonical_original_code:
void hh_cleanup_local(void *obj)
{
  struct hh_object_struct **object = (hh_object_struct **) obj;
  delete(*object);
}

variable_types:
obj
void *

variable_types: struct hh_object_struct { unsigned int magic_number; void *__this_identifier; unsigned long next_parent; void (*__init)(); void (*__construct)(); void (*__delete)(void *); unsigned long size; } **


decompiled_code:
ssize_t __fastcall protocole_acc(int fd, __m128i a2)
{
float v2; // ebx
double v3; // xmm0_8
double v4; // xmm0_8
int v5; // ebx
float v7; // [rsp+Ch] [rbp-11Ch]
char s[280]; // [rsp+10h] [rbp-118h] BYREF

acc_power_on();
*(double *)a2.m128i_i64 = acc_read_acceleration(0LL);
v2 = COERCE_FLOAT(_mm_cvtsi128_si32(a2));
v3 = acc_read_acceleration(1LL);
v7 = *(float *)&v3;
v4 = acc_read_acceleration(2LL);
v5 = sprintf(s, "Ax = %f, Ay = %f, Az = %f", v2, v7, *(float *)&v4);
printf("%s", s);
s[v5] = 0;
return send(fd, s, v5, 0);
}

canonical_decompiled_code:
ssize_t __fastcall func9(int fd, __m128i a2)
{
float v2; // ebx
double v3; // xmm0_8
double v4; // xmm0_8
int v5; // ebx
float v7; // [rsp+Ch] [rbp-11Ch]
char s[280]; // [rsp+10h] [rbp-118h] BYREF

func11();
*(double *)a2.m128i_i64 = func15(0LL);
v2 = COERCE_FLOAT(_mm_cvtsi128_si32(a2));
v3 = func15(1LL);
v7 = *(float *)&v3;
v4 = func15(2LL);
v5 = sprintf(s, "Ax = %f, Ay = %f, Az = %f", v2, v7, *(float *)&v4);
printf("%s", s);
s[v5] = 0;
return send(fd, s, v5, 0);
}

original_code:
void protocole_acc(int socket_s)
{
 float a[3];
 int dim;
 char message [256];
 acc_power_on();
 a[0] = acc_read_acceleration(0);
 a[1] = acc_read_acceleration(1);
 a[2] = acc_read_acceleration(2);
 dim = sprintf(message,"Ax = %f, Ay = %f, Az = %f",a[0],a[1],a[2]);
 printf("%s",message);
 message[dim] = 0;
 send(socket_s , message, dim, 0);
}

canonical_original_code:
void protocole_acc(int socket_s)
{
 float a[3];
 int dim;
 char message[256];
 acc_power_on();
 a[0] = acc_read_acceleration(0);
 a[1] = acc_read_acceleration(1);
 a[2] = acc_read_acceleration(2);
 dim = sprintf(message,"Ax = %f, Ay = %f, Az = %f",a[0],a[1],a[2]);
 printf("%s",message);
 message[dim] = 0;
 send(socket_s , message, dim, 0);
}

variable_types:
a
float [3]

variable_types: dim int

variable_types:
message
char [256]


decompiled_code:
ssize_t __fastcall protocole_temp(int fd)
{
float v1; // xmm0_4
int v2; // ebx
char v4[280]; // [rsp+0h] [rbp-118h] BYREF

v1 = readTemp();
v2 = sprintf(v4, "T = %f degrees\n", v1);
printf("%s", v4);
v4[v2] = 0;
return send(fd, v4, v2, 0);
}

canonical_decompiled_code:
ssize_t __fastcall func10(int fd)
{
float v1; // xmm0_4
int v2; // ebx
char v4[280]; // [rsp+0h] [rbp-118h] BYREF

v1 = func16();
v2 = sprintf(v4, "T = %f degrees\n", v1);
printf("%s", v4);
v4[v2] = 0;
return send(fd, v4, v2, 0);
}

original_code:
void protocole_temp(int socket_s)
{
 float temperature;
 char message[256];
 int dim;
 temperature = readTemp();
 dim = sprintf(message,"T = %f degrees\n",temperature);
 printf("%s",message);
 message[dim] = 0;
 send(socket_s , message, dim, 0);
}

variable_types: temperature float


decompiled_code:
float __fastcall acc_read_acceleration(char a1)
{
char v2; // [rsp+Eh] [rbp-Ah] BYREF
char v3[9]; // [rsp+Fh] [rbp-9h] BYREF

switch ( a1 )
{
case 1:
acc_read_register(43, &v2);
acc_read_register(42, v3);
break;
case 2:
acc_read_register(45, &v2);
acc_read_register(44, v3);
break;
case 0:
acc_read_register(41, &v2);
acc_read_register(40, v3);
break;
}
return (double)(v3[0] + (v2 << 8)) * 0.001796;
}

canonical_decompiled_code:
float __fastcall func15(char a1)
{
char v2; // [rsp+Eh] [rbp-Ah] BYREF
char v3[9]; // [rsp+Fh] [rbp-9h] BYREF

switch ( a1 )
{
case 1:
func13(43, &v2);
func13(42, v3);
break;
case 2:
func13(45, &v2);
func13(44, v3);
break;
case 0:
func13(41, &v2);
func13(40, v3);
break;
}
return (double)(v3[0] + (v2 << 8)) * 0.001796;
}

original_code:
float acc_read_acceleration(char axis)
{
 char buffh, buffl;
 int acc_integer;
 float acc_float;
 switch (axis) {
  case 0:
   acc_read_register(0x29, &buffh);
   acc_read_register(0x28, &buffl);
   break;
  case 1:
   acc_read_register(0x2B, &buffh);
   acc_read_register(0x2A, &buffl);
   break;
  case 2:
   acc_read_register(0x2D, &buffh);
   acc_read_register(0x2C, &buffl);
   break;
  default:
   break;
 }
 acc_integer=(buffh<<8)+buffl;
 if(acc_integer>32768)
 {
  acc_integer-=65536;
 }
 acc_float = 0.001796 * acc_integer;
 return acc_float;
}

canonical_original_code:
float acc_read_acceleration(char axis)
{
 char buffh; char buffl;
 int acc_integer;
 float acc_float;
 switch (axis) {
  case 0:
   acc_read_register(0x29, &buffh);
   acc_read_register(0x28, &buffl);
   break;
  case 1:
   acc_read_register(0x2B, &buffh);
   acc_read_register(0x2A, &buffl);
   break;
  case 2:
   acc_read_register(0x2D, &buffh);
   acc_read_register(0x2C, &buffl);
   break;
  default:
   break;
 }
 acc_integer=(buffh<<8)+buffl;
 if(acc_integer>32768)
 {
  acc_integer-=65536;
 }
 acc_float = 0.001796 * acc_integer;
 return acc_float;
}

variable_types: axis char

variable_types: buffh char

variable_types: buffl char

return_type: float


OnGetACC

decompiled_code:
int __fastcall OnGetACC(__int64 a1, _BYTE *a2, _BYTE *a3, char *a4)
{
float v6; // xmm0_4
int result; // eax

v6 = acc_read_acceleration((unsigned int)(char)(*a2 - 48));
result = sprintf(a4, "%f", v6);
*a3 = result;
if ( !(_BYTE)result )
{
result = sprintf(a4, "%c", 202LL);
*a3 = 1;
}
return result;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, _BYTE *a2, _BYTE *a3, char *a4)
{
float v6; // xmm0_4
int result; // eax

v6 = acc_read_acceleration((unsigned int)(char)(*a2 - 48));
result = sprintf(a4, "%f", v6);
*a3 = result;
if ( !(_BYTE)result )
{
result = sprintf(a4, "%c", 202LL);
*a3 = 1;
}
return result;
}

original_code:
void OnGetACC(u_char param_len, const char * parametres, u_char * rep_len, char * reponse)
{
 char axe = (*parametres)-48;
 float acc = acc_read_acceleration(axe);
 *rep_len = sprintf(reponse,"%f",acc);
 if ((*rep_len) <= 0)
 {
  *rep_len = sprintf(reponse,"%c",202);
 }
}

canonical_original_code:
void OnGetACC(unsigned char param_len, char *parametres, unsigned char *rep_len, char *reponse)
{
 char axe = (*parametres)-48;
 float acc = acc_read_acceleration(axe);
 *rep_len = sprintf(reponse,"%f",acc);
 if ((*rep_len) <= 0)
 {
  *rep_len = sprintf(reponse,"%c",202);
 }
}

variable_types:
parametres
char *

variable_types:
reponse
char *

variable_types: axe char

variable_types: acc float


decompiled_code:
ssize_t __fastcall protocole_acc(int fd, __m128i a2)
{
float v2; // ebx
float v3; // xmm2_4
int v4; // ebx
float v6; // [rsp+Ch] [rbp-11Ch]
char s[280]; // [rsp+10h] [rbp-118h] BYREF

acc_power_on();
*(float *)a2.m128i_i32 = acc_read_acceleration(0LL);
v2 = COERCE_FLOAT(_mm_cvtsi128_si32(a2));
v6 = acc_read_acceleration(1LL);
v3 = acc_read_acceleration(2LL);
v4 = sprintf(s, "Ax = %f, Ay = %f, Az = %f", v2, v6, v3);
printf("%s", s);
s[v4] = 0;
return send(fd, s, v4, 0);
}

canonical_decompiled_code:
ssize_t __fastcall func6(int fd, __m128i a2)
{
float v2; // ebx
float v3; // xmm2_4
int v4; // ebx
float v6; // [rsp+Ch] [rbp-11Ch]
char s[280]; // [rsp+10h] [rbp-118h] BYREF

acc_power_on();
*(float *)a2.m128i_i32 = acc_read_acceleration(0LL);
v2 = COERCE_FLOAT(_mm_cvtsi128_si32(a2));
v6 = acc_read_acceleration(1LL);
v3 = acc_read_acceleration(2LL);
v4 = sprintf(s, "Ax = %f, Ay = %f, Az = %f", v2, v6, v3);
printf("%s", s);
s[v4] = 0;
return send(fd, s, v4, 0);
}


canonical_decompiled_code:
ssize_t __fastcall func7(int fd)
{
float v1; // xmm0_4
int v2; // ebx
char v4[280]; // [rsp+0h] [rbp-118h] BYREF

v1 = readTemp();
v2 = sprintf(v4, "T = %f degrees\n", v1);
printf("%s", v4);
v4[v2] = 0;
return send(fd, v4, v2, 0);
}

canonical_original_code:
void protocole_temp(int socket_s)
{
 float temperature;
 char message[256];
 int dim;
 temperature = readTemp();
 dim = sprintf(message,"T = %f degrees\n",temperature);
 printf("%s",message);
 message[dim] = 0;
 send(socket_s , message, dim, 0);
}


repo: ExperimentMonty/tutoring

decompiled_code:
int print_list()
{
return puts("Printing list");
}

canonical_decompiled_code:
int func8()
{
return puts("Printing list");
}

original_code:
void print_list()
{
  printf("Printing list\n");
  return;
}


decompiled_code:
int print_commands()
{
puts("Unrecognizable command");
puts("Printing commands and their usage!");
puts("Invalid command, valid commands are:");
puts("quit");
puts("list");
puts("show <email_address>");
return puts("paths <email_address>");
}

canonical_decompiled_code:
int func9()
{
puts("Unrecognizable command");
puts("Printing commands and their usage!");
puts("Invalid command, valid commands are:");
puts("quit");
puts("list");
puts("show <email_address>");
return puts("paths <email_address>");
}

original_code:
void print_commands()
{
  printf("Unrecognizable command\n");
  printf("Printing commands and their usage!\n");
  printf("Invalid command, valid commands are:\n");
  printf("quit\n");
  printf("list\n");
  printf("show <email_address>\n");
  printf("paths <email_address>\n");
  return;
}


decompiled_code:
int __fastcall show_statistics(const char *a1)
{
return printf("Showing statistics about %s\n", a1);
}

canonical_decompiled_code:
int __fastcall func10(const char *a1)
{
return printf("Showing statistics about %s\n", a1);
}

original_code:
void show_statistics(char* email)
{
  printf("Showing statistics about %s\n", email);
  return;
}

canonical_original_code:
void show_statistics(char *email)
{
  printf("Showing statistics about %s\n", email);
  return;
}

variable_types:
email
char *


decompiled_code:
int __fastcall show_paths(const char *a1)
{
return printf("Showing paths for %s\n", a1);
}

canonical_decompiled_code:
int __fastcall func11(const char *a1)
{
return printf("Showing paths for %s\n", a1);
}

original_code:
void show_paths(char* email)
{
  printf("Showing paths for %s\n", email);
  return;
}

canonical_original_code:
void show_paths(char *email)
{
  printf("Showing paths for %s\n", email);
  return;
}


main

repo: Extraterrestrial/zombies

decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, 1);
usleep(0x3E8u);
pthread_create(&pthread, &attr, threadfunc, 0LL);
while ( 1 )
shoot();
}

canonical_decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, 1);
usleep(0x3E8u);
pthread_create(&pthread, &attr, threadfunc, 0LL);
while ( 1 )
func12();
}

original_code:
int main()
{
  pthread_attr_init(&attr);
  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
  usleep((1)*1000);
  pthread_create(&pthread, &attr, threadfunc, ((void *)0));
  while(1) {
    shoot();
  }
  return 0;
}


decompiled_code:
int zombies_lookout()
{
int result; // eax
__int64 v1; // rbx
const char *v2; // rsi

result = zombie_size;
if ( zombie_size > 0 )
{
v1 = 0LL;
do
{
v2 = (const char *)*((_QWORD *)zombie + v1++);
result = printf("Zombie \"%s\".\n", v2);
}
while ( zombie_size > (int)v1 );
}
return result;
}

canonical_decompiled_code:
int func7()
{
int result; // eax
__int64 v1; // rbx
const char *v2; // rsi

result = zombie_size;
if ( zombie_size > 0 )
{
v1 = 0LL;
do
{
v2 = (const char *)*((_QWORD *)zombie + v1++);
result = printf("Zombie \"%s\".\n", v2);
}
while ( zombie_size > (int)v1 );
}
return result;
}

original_code:
void zombies_lookout()
{
  int i = 0;
  for(i = 0; i < zombie_size; i++)
  printf("Zombie \"%s\".\n", zombie[i]);
  return;
}

variable_types: i int


decompiled_code:
__int64 zombies_check_corpses()
{
const char **v0; // rax
unsigned int v1; // er8
const char **i; // rdx
bool v3; // zf

if ( zombie_size <= 0 )
return 0LL;
v0 = (const char **)zombie;
v1 = 0;
for ( i = (const char **)((char *)zombie + 8); ; ++i )
{
v3 = strcmp(*v0, "_CORPSE") == 0;
v0 = i;
v1 += v3;
if ( i == (const char **)((char *)zombie + 8 * (unsigned int)(zombie_size - 1) + 8) )
break;
}
return v1;
}

canonical_decompiled_code:
__int64 func8()
{
const char **v0; // rax
unsigned int v1; // er8
const char **i; // rdx
bool v3; // zf

if ( zombie_size <= 0 )
return 0LL;
v0 = (const char **)zombie;
v1 = 0;
for ( i = (const char **)((char *)zombie + 8); ; ++i )
{
v3 = strcmp(*v0, "_CORPSE") == 0;
v0 = i;
v1 += v3;
if ( i == (const char **)((char *)zombie + 8 * (unsigned int)(zombie_size - 1) + 8) )
break;
}
return v1;
}

original_code:
int zombies_check_corpses()
{
  int i, corpse_count;
  for(i = 0; i < zombie_size; i++) {
    if(!strcmp(zombie[i], "_CORPSE"))
      corpse_count++;
  }
  return corpse_count;
}

canonical_original_code:
int zombies_check_corpses()
{
  int i; int corpse_count;
  for(i = 0; i < zombie_size; i++) {
    if(!strcmp(zombie[i], "_CORPSE"))
      corpse_count++;
  }
  return corpse_count;
}


decompiled_code:
__int64 zombies_reload_ammo()
{
puts("Reloading shotgun...");
usleep(0x2DC6C0u);
return 7LL;
}

canonical_decompiled_code:
__int64 func9()
{
puts("Reloading shotgun...");
usleep(0x2DC6C0u);
return 7LL;
}

original_code:
int zombies_reload_ammo(int ammo)
{
  printf("Reloading shotgun...\n");
  usleep((3000)*1000);
  ammo = 7;
  return ammo;
}

variable_types: ammo int


decompiled_code:
__int64 zombies_start()
{
unsigned int v0; // eax
unsigned int v1; // ebp
int v2; // ebx
__int64 v3; // rbx
int v4; // eax
char **v5; // rbp
char *v6; // rax
bool v7; // cc
__int64 v8; // rbx
_QWORD *v9; // rdx
bool v10; // cf
bool v11; // zf
__int64 v12; // rcx
const char *v13; // rdi
const char *v14; // rsi
__int64 v15; // rdi

free(zombie);
v0 = time(0LL);
srand(v0);
v1 = ++wave;
zombie_size += 5;
v2 = zombie_size;
zombie = malloc(8LL * zombie_size);
if ( v2 > 0 )
{
v3 = 0LL;
do
{
v4 = rand();
v5 = (char **)((char *)zombie + 8 * v3++);
v6 = strdup((&names)[v4 % 57]);
v7 = zombie_size <= (int)v3;
*v5 = v6;
}
while ( !v7 );
v1 = wave;
}
v8 = 0LL;
printf("Wave %d, get ready...\n", v1);
usleep(0x2DC6C0u);
zombies_lookout();
v9 = zombie;
v10 = 0;
v11 = zombie_size == 0;
if ( zombie_size > 0 )
{
do
{
v12 = 8LL;
v13 = "_CORPSE";
v14 = (const char *)v9[v8];
do
{
if ( !v12 )
break;
v10 = *v14 < (unsigned int)*v13;
v11 = *v14++ == *v13++;
--v12;
}
while ( v11 );
if ( (!v10 && !v11) == v10 )
{
v15 = (unsigned int)(1000 * zomb_time);
usleep(v15);
if ( (unsigned int)zombies_check_corpses(v15, v14) == zombie_size )
return 0LL;
}
else
{
printf("Zombie \"%s\" is nearby, shoot them NOW!!!\n", (const char *)v9[v8]);
usleep(1000 * zomb_time);
}
v9 = zombie;
if ( strcmp(*((const char **)zombie + v8), "_CORPSE") )
{
printf("\nZombie \"%s\" kill you!\n", *((const char **)zombie + v8));
puts("You was eaten by zombies.");
puts("Your dead of valor will be remembered.");
killme = 1;
printf("Your score: %d zombies.\n", (unsigned int)score);
free(zombie);
exit(0);
}
v10 = zombie_size < (unsigned int)++v8;
v11 = zombie_size == (_DWORD)v8;
}
while ( zombie_size > (int)v8 );
}
if ( (unsigned int)(-858993459 * wave + 429496729) > 0x33333332 )
return 0LL;
if ( zomb_time > 1300 )
{
zomb_time -= 200;
puts("Zombie time has increased...");
}
zombie_size = 0;
return 0LL;
}

canonical_decompiled_code:
__int64 func10()
{
unsigned int v0; // eax
unsigned int v1; // ebp
int v2; // ebx
__int64 v3; // rbx
int v4; // eax
char **v5; // rbp
char *v6; // rax
bool v7; // cc
__int64 v8; // rbx
_QWORD *v9; // rdx
bool v10; // cf
bool v11; // zf
__int64 v12; // rcx
const char *v13; // rdi
const char *v14; // rsi
__int64 v15; // rdi

free(zombie);
v0 = time(0LL);
srand(v0);
v1 = ++wave;
zombie_size += 5;
v2 = zombie_size;
zombie = malloc(8LL * zombie_size);
if ( v2 > 0 )
{
v3 = 0LL;
do
{
v4 = rand();
v5 = (char **)((char *)zombie + 8 * v3++);
v6 = strdup((&names)[v4 % 57]);
v7 = zombie_size <= (int)v3;
*v5 = v6;
}
while ( !v7 );
v1 = wave;
}
v8 = 0LL;
printf("Wave %d, get ready...\n", v1);
usleep(0x2DC6C0u);
func7();
v9 = zombie;
v10 = 0;
v11 = zombie_size == 0;
if ( zombie_size > 0 )
{
do
{
v12 = 8LL;
v13 = "_CORPSE";
v14 = (const char *)v9[v8];
do
{
if ( !v12 )
break;
v10 = *v14 < (unsigned int)*v13;
v11 = *v14++ == *v13++;
--v12;
}
while ( v11 );
if ( (!v10 && !v11) == v10 )
{
v15 = (unsigned int)(1000 * zomb_time);
usleep(v15);
if ( (unsigned int)func8(v15, v14) == zombie_size )
return 0LL;
}
else
{
printf("Zombie \"%s\" is nearby, shoot them NOW!!!\n", (const char *)v9[v8]);
usleep(1000 * zomb_time);
}
v9 = zombie;
if ( strcmp(*((const char **)zombie + v8), "_CORPSE") )
{
printf("\nZombie \"%s\" kill you!\n", *((const char **)zombie + v8));
puts("You was eaten by zombies.");
puts("Your dead of valor will be remembered.");
killme = 1;
printf("Your score: %d zombies.\n", (unsigned int)score);
free(zombie);
exit(0);
}
v10 = zombie_size < (unsigned int)++v8;
v11 = zombie_size == (_DWORD)v8;
}
while ( zombie_size > (int)v8 );
}
if ( (unsigned int)(-858993459 * wave + 429496729) > 0x33333332 )
return 0LL;
if ( zomb_time > 1300 )
{
zomb_time -= 200;
puts("Zombie time has increased...");
}
zombie_size = 0;
return 0LL;
}

original_code:
int zombies_start()
{
  int i = 0;
  free(zombie);
  srand(time(((void *)0)));
  wave++;
  zombie_size += 5;
  zombie = malloc(sizeof(char *) * zombie_size);
  for(i = 0; i < zombie_size; i++) {
    zombie[i] = strdup(names[rand() % 57]);
  }
  printf("Wave %d, get ready...\n", wave);
  usleep((3000)*1000);
  zombies_lookout();
  for(i = 0; i < zombie_size; i++) {
    if(strcmp(zombie[i], "_CORPSE")) {
      printf("Zombie \"%s\" is nearby, shoot them NOW!!!\n", zombie[i]);
      usleep((zomb_time)*1000);
    }
    else {
      usleep((zomb_time)*1000);
      if(zombies_check_corpses() == zombie_size)
        return 0;
    }
    if(strcmp(zombie[i], "_CORPSE")) {
      printf("\nZombie \"%s\" kill you!\n", zombie[i]);
      printf("You was eaten by zombies.\n");
      printf("Your dead of valor will be remembered.\n");
      killme = 1;
      printf("Your score: %d zombies.\n", score);
      free(zombie);
      exit(0);
    }
  }
  if(wave % 5 == 0) {
    if(zomb_time > 1300) {
        zomb_time-=200;
        printf("Zombie time has increased...\n");
    }
    zombie_size = 0;
  }
  return 0;
}


threadfunc

decompiled_code:
void __fastcall __noreturn threadfunc(void *a1)
{
while ( 1 )
zombies_start(a1);
}

canonical_decompiled_code:
void __fastcall __noreturn func11(void *a1)
{
while ( 1 )
func10(a1);
}

original_code:
static void * threadfunc(void * arg)
{
  while(1) {
    zombies_start();
  }
}

canonical_original_code:
static void *threadfunc(void *arg)
{
  while(1) {
    zombies_start();
  }
}

variable_types:
arg
void *


shoot

decompiled_code:
__int64 shoot()
{
const char *v0; // rbp
int v1; // eax
__int64 result; // rax
__int64 v3; // rsi
const char **v4; // rbx
const char **v5; // r14
char *v6; // r13

v0 = (const char *)malloc(0xFFuLL);
usleep(0x3E8u);
printf("Target: ");
__isoc99_scanf();
v1 = *(unsigned __int8 *)v0;
if ( v1 == 108 && !v0[1] )
{
zombies_lookout();
return 1LL;
}
if ( v1 == 97 )
{
v3 = (unsigned int)ammo_0;
if ( !v0[1] )
{
printf("Ammo: %d/7\n", v3);
return 1LL;
}
}
else
{
LOBYTE(v3) = ammo_0;
}
if ( v1 != 114 || v0[1] )
{
if ( (_BYTE)v3 )
{
if ( !strcmp(v0, "_CORPSE") )
{
puts("You can't kill corpse, lol");
result = 1LL;
--ammo_0;
}
else
{
puts("Player shoots with good shotgun...");
--ammo_0;
if ( zombie_size <= 0 )
{
LABEL_20:
puts("You are missed, zombie is still alive...");
result = 1LL;
}
else
{
v4 = (const char **)zombie;
v5 = (const char **)((char *)zombie + 8 * (unsigned int)(zombie_size - 1) + 8);
while ( 1 )
{
v6 = (char *)*v4;
if ( !strcmp(*v4, v0) )
break;
if ( v5 == ++v4 )
goto LABEL_20;
}
*(_QWORD *)v6 = 0x455350524F435FLL;
puts("Zombie killed!\n");
result = 0LL;
++score;
}
}
}
else
{
puts("You have no ammo in the shotgun.");
result = 1LL;
}
}
else
{
ammo_0 = zombies_reload_ammo((unsigned int)(char)v3);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 func12()
{
const char *v0; // rbp
int v1; // eax
__int64 result; // rax
__int64 v3; // rsi
const char **v4; // rbx
const char **v5; // r14
char *v6; // r13

v0 = (const char *)malloc(0xFFuLL);
usleep(0x3E8u);
printf("Target: ");
__isoc99_scanf();
v1 = *(unsigned __int8 *)v0;
if ( v1 == 108 && !v0[1] )
{
func7();
return 1LL;
}
if ( v1 == 97 )
{
v3 = (unsigned int)ammo_0;
if ( !v0[1] )
{
printf("Ammo: %d/7\n", v3);
return 1LL;
}
}
else
{
LOBYTE(v3) = ammo_0;
}
if ( v1 != 114 || v0[1] )
{
if ( (_BYTE)v3 )
{
if ( !strcmp(v0, "_CORPSE") )
{
puts("You can't kill corpse, lol");
result = 1LL;
--ammo_0;
}
else
{
puts("Player shoots with good shotgun...");
--ammo_0;
if ( zombie_size <= 0 )
{
LABEL_20:
puts("You are missed, zombie is still alive...");
result = 1LL;
}
else
{
v4 = (const char **)zombie;
v5 = (const char **)((char *)zombie + 8 * (unsigned int)(zombie_size - 1) + 8);
while ( 1 )
{
v6 = (char *)*v4;
if ( !strcmp(*v4, v0) )
break;
if ( v5 == ++v4 )
goto LABEL_20;
}
*(_QWORD *)v6 = 0x455350524F435FLL;
puts("Zombie killed!\n");
result = 0LL;
++score;
}
}
}
else
{
puts("You have no ammo in the shotgun.");
result = 1LL;
}
}
else
{
ammo_0 = func9((unsigned int)(char)v3);
result = 1LL;
}
return result;
}

original_code:
int shoot()
{
  char * target = malloc(255);
  int i = 0;
  static char ammo = 7;
  usleep((1)*1000);
  printf("Target: ");
 scanf("%s", target);
 if(!strcmp(target, "l")) {
   zombies_lookout();
   return 1;
  }
  else if(!strcmp(target, "a")) {
   printf("Ammo: %d/7\n", ammo);
   return 1;
  }
  else if(!strcmp(target, "r")) {
    ammo = zombies_reload_ammo(ammo);
    return 1;
  }
  if(ammo == 0) {
    printf("You have no ammo in the shotgun.\n");
    return 1;
  }
  else if(!strcmp(target, "_CORPSE")) {
    printf("You can't kill corpse, lol\n");
    ammo--;
    return 1;
  }
  printf("Player shoots with good shotgun...\n");
  ammo--;
  for(i = 0; i < zombie_size; i++) {
    if(!strcmp(zombie[i], target)) {
      strcpy(zombie[i], "_CORPSE");
      printf("Zombie killed!\n\n");
      score++;
      return 0;
    }
  }
  printf("You are missed, zombie is still alive...\n");
  return 1;
}

canonical_original_code:
int shoot()
{
  char *target = malloc(255);
  int i = 0;
  static char ammo = 7;
  usleep((1)*1000);
  printf("Target: ");
 scanf("%s", target);
 if(!strcmp(target, "l")) {
   zombies_lookout();
   return 1;
  }
  else if(!strcmp(target, "a")) {
   printf("Ammo: %d/7\n", ammo);
   return 1;
  }
  else if(!strcmp(target, "r")) {
    ammo = zombies_reload_ammo(ammo);
    return 1;
  }
  if(ammo == 0) {
    printf("You have no ammo in the shotgun.\n");
    return 1;
  }
  else if(!strcmp(target, "_CORPSE")) {
    printf("You can't kill corpse, lol\n");
    ammo--;
    return 1;
  }
  printf("Player shoots with good shotgun...\n");
  ammo--;
  for(i = 0; i < zombie_size; i++) {
    if(!strcmp(zombie[i], target)) {
      strcpy(zombie[i], "_CORPSE");
      printf("Zombie killed!\n\n");
      score++;
      return 0;
    }
  }
  printf("You are missed, zombie is still alive...\n");
  return 1;
}

variable_types:
target
char *

variable_types: ammo char


seconds

repo: FEPC-Expert/FEPC

decompiled_code:
double seconds()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v1, 0LL);
return (double)SLODWORD(v1.tv_usec) * 0.000001 + (double)SLODWORD(v1.tv_sec);
}

canonical_decompiled_code:
double func0()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v1, 0LL);
return (double)SLODWORD(v1.tv_usec) * 0.000001 + (double)SLODWORD(v1.tv_sec);
}

original_code:
double
seconds ()
{
    double sec, usec;
    struct timeval tvd;
    gettimeofday( & tvd, ((void *)0) );
    sec = tvd.tv_sec;
    usec = tvd.tv_usec;
    return sec + (usec * 1e-6);
}

canonical_original_code:
double seconds()
{
    double sec; double usec;
    struct timeval tvd;
    gettimeofday( & tvd, ((void *)0) );
    sec = tvd.tv_sec;
    usec = tvd.tv_usec;
    return sec + (usec * 1e-6);
}

variable_types: sec double

variable_types: usec double

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

return_type: double


main

original_code:
int main(int argc, char* argv[]) {
 func_p f, g, w, fepc, ref;
 fepc_real_t norm;
 fepc_real_t a,b,c, mesh, temp1, temp2;
 int dim, i,j , l, pos;
 vec_p grad, start, lang, r, s;
 vec_real_p h;
 char dateiname1[20];
 dim = 2;
 a = 0.15;
 b = 4.;
 c = -3.5;
 mesh = 0.2;
 h = vec_real_new(5);
 for(l=0;l<5;l++) {
  h->array[l] = mesh*pow(2,-l);
 }
 f = func_new(2,dim);
 for(l=0;l<=f->maxlevel;l++) {
  grad = vec_new(dim);
  grad->array[0] = 0;
  grad->array[1] = 0;
  f->hierarchie[l] = folgen_vektor_new( grad );
 }
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 0;
 start->array[1] = 0;
 lang->array[0] = 5;
 lang->array[1] = 5;
 f->hierarchie[0]->vektor[0] = folge_new(start,lang);
 for(l=1;l<=f->maxlevel;l++) {
  start = vec_new(dim);
  lang = vec_new(dim);
  start->array[0] = 0;
  start->array[1] = 0;
  lang->array[0] = 4;
  lang->array[1] = pow(2,l)*5;
  f->hierarchie[l]->vektor[0] = folge_new(start,lang);
 }
 l=0;
 for(i=2;i<5;i++) {
  for(j=0;j<5;j++) {
   r = vec_new(dim);
   r->array[0] = i;
   r->array[1] = j;
   pos = entry_d2one(r,f->hierarchie[l]->vektor[0]->lang);
   vec_del(r);
   f->hierarchie[l]->vektor[0]->glied[pos] = log((i+1)*h->array[l]+a) - log(i*h->array[l]+a);
  }
 }
 for(l=1;l<f->maxlevel;l++) {
  for(i=2;i<4;i++) {
   for(j=0;j<(5*pow(2,l));j++) {
    r = vec_new(dim);
    r->array[0] = i;
    r->array[1] = j;
    pos = entry_d2one(r,f->hierarchie[l]->vektor[0]->lang);
    vec_del(r);
    f->hierarchie[l]->vektor[0]->glied[pos] = log((i+1)*h->array[l]+a) - log(i*h->array[l]+a);
   }
  }
 }
 l=f->maxlevel;
 for(i=0;i<4;i++) {
  for(j=0;j<(5*pow(2,l));j++) {
   r = vec_new(dim);
   r->array[0] = i;
   r->array[1] = j;
   pos = entry_d2one(r,f->hierarchie[l]->vektor[0]->lang);
   vec_del(r);
   f->hierarchie[l]->vektor[0]->glied[pos] = log((i+1)*h->array[l]+a) - log(i*h->array[l]+a);
  }
 }
 g = func_new(0,dim);
 for(l=0;l<=g->maxlevel;l++) {
  grad = vec_new(dim);
  grad->array[0] = 0;
  grad->array[1] = 0;
  g->hierarchie[l] = folgen_vektor_new( grad );
 }
 for(l=0;l<=g->maxlevel;l++) {
  start = vec_new(dim);
  lang = vec_new(dim);
  start->array[0] = 0;
  lang->array[0] = 5*pow(2,l);
  start->array[1] = 0;
  lang->array[1] = 5*pow(2,l);
  g->hierarchie[l]->vektor[0] = folge_new(start,lang);
 }
 l=g->maxlevel;
 for(i=0;i<(5*pow(2,l));i++) {
  for(j=0;j<(5*pow(2,l));j++) {
   r = vec_new(dim);
   r->array[0] = i;
   r->array[1] = j;
   pos = entry_d2one(r,g->hierarchie[l]->vektor[0]->lang);
   vec_del(r);
   temp1 = b/2.*pow(h->array[l],2);
   temp2 = 2*i + 1;
   g->hierarchie[l]->vektor[0]->glied[pos] = temp1*temp2 + c*h->array[l];
  }
 }
 w = func_new(2,dim);
 for(l=0;l<=w->maxlevel;l++) {
  grad = vec_new(dim);
  grad->array[0] = 0;
  grad->array[1] = 0;
  w->hierarchie[l] = folgen_vektor_new( grad );
 }
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 0;
 lang->array[0] = 5;
 start->array[1] = 0;
 lang->array[1] = 5;
 w->hierarchie[0]->vektor[0] = folge_new(start,lang);
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 2;
 lang->array[0] = 6;
 start->array[1] = 4;
 lang->array[1] = 6;
 w->hierarchie[1]->vektor[0] = folge_new(start,lang);
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 8;
 lang->array[0] = 4;
 start->array[1] = 16;
 lang->array[1] = 4;
 w->hierarchie[2]->vektor[0] = folge_new(start,lang);
 fepc = faltung_fepc(f,g,w,mesh);
 ref = faltung_ref(f,g,w,mesh);
 norm = faltung_hilfe_norm(fepc,ref);
 printf("\n Norm %lf \n",norm);
 sprintf(dateiname1,"Beispiel_2d/tab.xyz");
 func_plot_2d( fepc, dateiname1, mesh);
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[]) {
 struct func_t *f; struct func_t *g; struct func_t *w; struct func_t *fepc; struct func_t *ref;
 double norm;
 double a; double b; double c; double mesh; double temp1; double temp2;
 int dim; int i; int j; int l; int pos;
 struct vec_t *grad; struct vec_t *start; struct vec_t *lang; struct vec_t *r; struct vec_t *s;
 struct vec_real_t *h;
 char dateiname1[20];
 dim = 2;
 a = 0.15;
 b = 4.;
 c = -3.5;
 mesh = 0.2;
 h = vec_real_new(5);
 for(l=0;l<5;l++) {
  h->array[l] = mesh*pow(2,-l);
 }
 f = func_new(2,dim);
 for(l=0;l<=f->maxlevel;l++) {
  grad = vec_new(dim);
  grad->array[0] = 0;
  grad->array[1] = 0;
  f->hierarchie[l] = folgen_vektor_new( grad );
 }
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 0;
 start->array[1] = 0;
 lang->array[0] = 5;
 lang->array[1] = 5;
 f->hierarchie[0]->vektor[0] = folge_new(start,lang);
 for(l=1;l<=f->maxlevel;l++) {
  start = vec_new(dim);
  lang = vec_new(dim);
  start->array[0] = 0;
  start->array[1] = 0;
  lang->array[0] = 4;
  lang->array[1] = pow(2,l)*5;
  f->hierarchie[l]->vektor[0] = folge_new(start,lang);
 }
 l=0;
 for(i=2;i<5;i++) {
  for(j=0;j<5;j++) {
   r = vec_new(dim);
   r->array[0] = i;
   r->array[1] = j;
   pos = entry_d2one(r,f->hierarchie[l]->vektor[0]->lang);
   vec_del(r);
   f->hierarchie[l]->vektor[0]->glied[pos] = log((i+1)*h->array[l]+a) - log(i*h->array[l]+a);
  }
 }
 for(l=1;l<f->maxlevel;l++) {
  for(i=2;i<4;i++) {
   for(j=0;j<(5*pow(2,l));j++) {
    r = vec_new(dim);
    r->array[0] = i;
    r->array[1] = j;
    pos = entry_d2one(r,f->hierarchie[l]->vektor[0]->lang);
    vec_del(r);
    f->hierarchie[l]->vektor[0]->glied[pos] = log((i+1)*h->array[l]+a) - log(i*h->array[l]+a);
   }
  }
 }
 l=f->maxlevel;
 for(i=0;i<4;i++) {
  for(j=0;j<(5*pow(2,l));j++) {
   r = vec_new(dim);
   r->array[0] = i;
   r->array[1] = j;
   pos = entry_d2one(r,f->hierarchie[l]->vektor[0]->lang);
   vec_del(r);
   f->hierarchie[l]->vektor[0]->glied[pos] = log((i+1)*h->array[l]+a) - log(i*h->array[l]+a);
  }
 }
 g = func_new(0,dim);
 for(l=0;l<=g->maxlevel;l++) {
  grad = vec_new(dim);
  grad->array[0] = 0;
  grad->array[1] = 0;
  g->hierarchie[l] = folgen_vektor_new( grad );
 }
 for(l=0;l<=g->maxlevel;l++) {
  start = vec_new(dim);
  lang = vec_new(dim);
  start->array[0] = 0;
  lang->array[0] = 5*pow(2,l);
  start->array[1] = 0;
  lang->array[1] = 5*pow(2,l);
  g->hierarchie[l]->vektor[0] = folge_new(start,lang);
 }
 l=g->maxlevel;
 for(i=0;i<(5*pow(2,l));i++) {
  for(j=0;j<(5*pow(2,l));j++) {
   r = vec_new(dim);
   r->array[0] = i;
   r->array[1] = j;
   pos = entry_d2one(r,g->hierarchie[l]->vektor[0]->lang);
   vec_del(r);
   temp1 = b/2.*pow(h->array[l],2);
   temp2 = 2*i + 1;
   g->hierarchie[l]->vektor[0]->glied[pos] = temp1*temp2 + c*h->array[l];
  }
 }
 w = func_new(2,dim);
 for(l=0;l<=w->maxlevel;l++) {
  grad = vec_new(dim);
  grad->array[0] = 0;
  grad->array[1] = 0;
  w->hierarchie[l] = folgen_vektor_new( grad );
 }
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 0;
 lang->array[0] = 5;
 start->array[1] = 0;
 lang->array[1] = 5;
 w->hierarchie[0]->vektor[0] = folge_new(start,lang);
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 2;
 lang->array[0] = 6;
 start->array[1] = 4;
 lang->array[1] = 6;
 w->hierarchie[1]->vektor[0] = folge_new(start,lang);
 start = vec_new(dim);
 lang = vec_new(dim);
 start->array[0] = 8;
 lang->array[0] = 4;
 start->array[1] = 16;
 lang->array[1] = 4;
 w->hierarchie[2]->vektor[0] = folge_new(start,lang);
 fepc = faltung_fepc(f,g,w,mesh);
 ref = faltung_ref(f,g,w,mesh);
 norm = faltung_hilfe_norm(fepc,ref);
 printf("\n Norm %lf \n",norm);
 sprintf(dateiname1,"Beispiel_2d/tab.xyz");
 func_plot_2d( fepc, dateiname1, mesh);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: struct func_t { int dim; int maxlevel; struct folgen_vektor_t { struct vec_t { int dim; int *array; } *grad; struct folge_t { struct vec_t *start; struct vec_t *lang; double *glied; } **vektor; } **hierarchie; } *

variable_types: norm double

variable_types: a double

variable_types: b double

variable_types: c double

variable_types: mesh double

variable_types: dim int

variable_types: j int

variable_types: l int

variable_types: pos int

variable_types:
grad
struct vec_t { int dim; int *array; } *

variable_types:
start
struct vec_t { int dim; int *array; } *

variable_types:
lang
struct vec_t { int dim; int *array; } *

variable_types:
r
struct vec_t { int dim; int *array; } *

variable_types:
s
struct vec_t { int dim; int *array; } *

variable_types: struct vec_real_t { int dim; double *array; } *

user_defined_types: struct func_t { int dim; int maxlevel; struct folgen_vektor_t **hierarchie; }

user_defined_types: struct folgen_vektor_t { struct vec_t *grad; struct folge_t **vektor; }


repo: Faison/fliptable

decompiled_code:
// local variable allocation has failed, the output may be wrong!
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char **v3; // rbx
const char **v4; // rbp
char v5; // al
const char *v6; // rax
char *v7; // r12

if ( argc == 1 )
{
fliptable(argc, argv, envp);
}
else if ( argc > 1 )
{
v3 = argv + 1;
v4 = &argv[(unsigned int)(argc - 2) + 2];
do
{
if ( **v3 == 45 )
{
v5 = (*v3)[1];
if ( v5 == 100 )
{
double_fliptable(*(_QWORD *)&argc, argv, envp);
}
else if ( v5 == 118 )
{
v6 = (const char *)get_fliptable(*(_QWORD *)&argc, argv, envp);
argv = (const char **)"1.0";
v7 = (char *)v6;
printf("fliptable %s, written by Faison for fun! %s\n", "1.0", v6);
*(_QWORD *)&argc = v7;
free(v7);
}
}
++v3;
}
while ( v3 != v4 );
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char **v3; // rbx
const char **v4; // rbp
char v5; // al
const char *v6; // rax
char *v7; // r12

if ( argc == 1 )
{
func7(argc, argv, envp);
}
else if ( argc > 1 )
{
v3 = argv + 1;
v4 = &argv[(unsigned int)(argc - 2) + 2];
do
{
if ( **v3 == 45 )
{
v5 = (*v3)[1];
if ( v5 == 100 )
{
func8(*(_QWORD *)&argc, argv, envp);
}
else if ( v5 == 118 )
{
v6 = (const char *)func9(*(_QWORD *)&argc, argv, envp);
argv = (const char **)"1.0";
v7 = (char *)v6;
printf("fliptable %s, written by Faison for fun! %s\n", "1.0", v6);
*(_QWORD *)&argc = v7;
free(v7);
}
}
++v3;
}
while ( v3 != v4 );
}
return 0;
}

original_code:
int main(int argc, char *argv[])
{
 if(argc == 1) {
  fliptable();
 } else if(argc > 1) {
  for(int i = 1; i < argc; i++) {
   if(argv[i][0] == '-') {
    switch(argv[i][1]) {
     case 'v':
     {
      char *flip = get_fliptable();
      printf("fliptable %s, written by Faison for fun! %s\n", VERSION, flip);
      free(flip);
      break;
     }
     case 'd':
     {
      double_fliptable();
     }
    }
   }
  }
 }
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: i int

variable_types:
flip
char *


fliptable

decompiled_code:
int fliptable()
{
return puts(&s);
}

canonical_decompiled_code:
int func7()
{
return puts(&s);
}

original_code:
void fliptable()
{
 puts(FLIP_STRING);
}

canonical_original_code:
void fliptable()
{
 puts(FLIP_STRING);
}


decompiled_code:
int double_fliptable()
{
return puts(&byte_402028);
}

canonical_decompiled_code:
int func8()
{
return puts(&byte_402028);
}

original_code:
void double_fliptable()
{
 puts(DOUBLE_FLIP_STRING);
}


decompiled_code:
__int64 get_fliptable()
{
return (int)strdup(&s);
}

canonical_decompiled_code:
__int64 func9()
{
return (int)strdup(&s);
}

original_code:
char* get_fliptable()
{
 return strdup(FLIP_STRING);
}

canonical_original_code:
char *get_fliptable()
{
 return strdup(FLIP_STRING);
}

return_type: char *


decompiled_code:
__int64 get_double_fliptable()
{
return (int)strdup(&byte_402028);
}

canonical_decompiled_code:
__int64 func10()
{
return (int)strdup(&byte_402028);
}

original_code:
char* get_double_fliptable()
{
 return strdup(DOUBLE_FLIP_STRING);
}

canonical_original_code:
char *get_double_fliptable()
{
 return strdup(DOUBLE_FLIP_STRING);
}


main

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

if ( (unsigned int)(argc - 2) > 1 )
{
v3 = 1;
puts("Using: ./app -c/-m/-d [path]");
}
else
{
if ( argc == 2 )
argv[2] = "./";
v3 = 0;
if ( (unsigned int)hens(argv[1], argv[2], envp) == -1 )
puts("Invalid command -- you can use: doc -help");
}
return v3;
}

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

if ( (unsigned int)(argc - 2) > 1 )
{
v3 = 1;
puts("Using: ./app -c/-m/-d [path]");
}
else
{
if ( argc == 2 )
argv[2] = "./";
v3 = 0;
if ( (unsigned int)func13(argv[1], argv[2], envp) == -1 )
puts("Invalid command -- you can use: doc -help");
}
return v3;
}

original_code:
int main(int argc, const char *argv[])
{
    if(argc < 2 || argc > 3)
    {
        printf("Using: ./app -c/-m/-d [path]\n");
        return 1;
    }
    if(2 == argc)
        argv[2] = "./";
    if((-1 == hens (argv[1], argv[2])))
    {
        printf("Invalid command -- you can use: doc -help\n");
    }
    return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
    if(argc < 2 || argc > 3)
    {
        printf("Using: ./app -c/-m/-d [path]\n");
        return 1;
    }
    if(2 == argc)
        argv[2] = "./";
    if((-1 == hens (argv[1], argv[2])))
    {
        printf("Invalid command -- you can use: doc -help\n");
    }
    return 0;
}


decompiled_code:
int __fastcall pro_document_manager(__int64 a1, char a2)
{
int result; // eax
_BYTE savedregs[264]; // [rsp+0h] [rbp+0h] BYREF

memset(savedregs, 0, 0x100uLL);
if ( a2 == 102 )
{
sprintf(savedregs, format, a1, a1, a1, a1, a1, a1);
result = system(savedregs);
}
else
{
result = 0;
if ( a2 == 117 )
{
sprintf(savedregs, aRmS, a1, a1, a1, a1);
result = system(savedregs);
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1, char a2)
{
int result; // eax
_BYTE savedregs[264]; // [rsp+0h] [rbp+0h] BYREF

memset(savedregs, 0, 0x100uLL);
if ( a2 == 102 )
{
sprintf(savedregs, format, a1, a1, a1, a1, a1, a1);
result = system(savedregs);
}
else
{
result = 0;
if ( a2 == 117 )
{
sprintf(savedregs, aRmS, a1, a1, a1, a1);
result = system(savedregs);
}
}
return result;
}

original_code:
int pro_document_manager(const char *path, char ch)
{
    char buf[256];
    memset(buf, 0, 256);
    if(ch == 'f')
    {
        sprintf(buf, "touch %s可行性分析.odt %s需求分析.odt %s概要设计.odt %s详细设计.odt %s测试计划及结果.odt %s使用手册.odt", path, path, path, path, path, path);
        return system(buf);
    }
    else if(ch == 'u')
    {
        sprintf(buf, "rm %s可行性分析.odt %s需求分析.odt %s概要设计.odt %s详细设计.odt %s测试计划及结果.odt %s使用手册.odt", path, path, path, path, path, path);
        return system(buf);
    }
    return 0;
}

canonical_original_code:
int pro_document_manager(char *path, char ch)
{
    char buf[256];
    memset(buf, 0, 256);
    if(ch == 'f')
    {
        sprintf(buf, "touch %s可行性分析.odt %s需求分析.odt %s概要设计.odt %s详细设计.odt %s测试计划及结果.odt %s使用手册.odt", path, path, path, path, path, path);
        return system(buf);
    }
    else if(ch == 'u')
    {
        sprintf(buf, "rm %s可行性分析.odt %s需求分析.odt %s概要设计.odt %s详细设计.odt %s测试计划及结果.odt %s使用手册.odt", path, path, path, path, path, path);
        return system(buf);
    }
    return 0;
}

variable_types:
path
char *

variable_types: ch char

variable_types:
buf
char [256]


decompiled_code:
__pid_t __fastcall mv_file(__int64 a1, __int64 a2)
{
__pid_t v2; // eax
__pid_t result; // eax

v2 = fork();
if ( v2 < 0 )
{
perror("fork");
exit(1);
}
if ( !v2 || (result = execlp("mv", "mv", a2, a1, 0LL)) != 0 )
result = wait(0LL);
return result;
}

canonical_decompiled_code:
__pid_t __fastcall func8(__int64 a1, __int64 a2)
{
__pid_t v2; // eax
__pid_t result; // eax

v2 = fork();
if ( v2 < 0 )
{
perror("fork");
exit(1);
}
if ( !v2 || (result = execlp("mv", "mv", a2, a1, 0LL)) != 0 )
result = wait(0LL);
return result;
}

original_code:
static void mv_file (char d_name[], char f_name[])
{
    pid_t pid = fork();
    if(pid < 0) {
        perror("fork");
        exit(1);
    }
    if(pid > 0){
        if(!(execlp("mv", "mv", f_name, d_name, ((void *)0))))
        {
            return;
        }
    }
    wait(((void *)0));
}

canonical_original_code:
static void mv_file(char d_name[], char f_name[])
{
    int pid = fork();
    if(pid < 0) {
        perror("fork");
        exit(1);
    }
    if(pid > 0){
        if(!(execlp("mv", "mv", f_name, d_name, ((void *)0))))
        {
            return;
        }
    }
    wait(((void *)0));
}

variable_types: pid int


decompiled_code:
__int64 make_dir()
{
const char *v0; // rdx
_QWORD v2[33]; // [rsp+0h] [rbp-108h] BYREF

init_constprop_0(v2);
sprintf((char *)v2, "mkdir %s", v0);
return (unsigned int)-(system((const char *)v2) != 0);
}

canonical_decompiled_code:
__int64 func10()
{
const char *v0; // rdx
_QWORD v2[33]; // [rsp+0h] [rbp-108h] BYREF

func9(v2);
sprintf((char *)v2, "mkdir %s", v0);
return (unsigned int)-(system((const char *)v2) != 0);
}

original_code:
static int make_dir (char d_name[])
{
    char buf[256];
    init(buf, 256);
    sprintf(buf, "mkdir %s", d_name);
    if(system(buf))
    {
        return -1;
    }
    return 0;
}

canonical_original_code:
static int make_dir(char d_name[])
{
    char buf[256];
    init(buf, 256);
    sprintf(buf, "mkdir %s", d_name);
    if(system(buf))
    {
        return -1;
    }
    return 0;
}


hens

decompiled_code:
__int64 __fastcall hens(__int64 a1, const char *a2)
{
__int64 result; // rax
const char *v3; // rdx
unsigned int v4; // [rsp+Ch] [rbp-Ch]

v4 = 0;
if ( *(_BYTE *)a1 != 45 )
goto LABEL_23;
if ( *(_BYTE *)(a1 + 1) == 99 && !*(_BYTE *)(a1 + 2) )
{
v4 = 22;
LABEL_14:
document_handle(a2, v4);
return 0LL;
}
if ( *(_BYTE *)(a1 + 1) == 109 && !*(_BYTE *)(a1 + 2) )
{
document_handle(a2, 0x21u);
return 0LL;
}
if ( *(_BYTE *)(a1 + 1) != 100 || *(_BYTE *)(a1 + 2) )
{
LABEL_23:
if ( strcmp((const char *)a1, "-ud") )
{
result = 0xFFFFFFFFLL;
if ( strcmp((const char *)a1, "-help") )
return result;
help_tip();
goto LABEL_14;
}
if ( pro_document_manager((__int64)a2, 117) != -1 )
return 0LL;
v3 = "failed to clean project document";
LABEL_11:
fprintf(_bss_start, "%s\n", v3);
return 1LL;
}
if ( pro_document_manager((__int64)a2, 102) == -1 )
{
v3 = "failed to create project document";
goto LABEL_11;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, const char *a2)
{
__int64 result; // rax
const char *v3; // rdx
unsigned int v4; // [rsp+Ch] [rbp-Ch]

v4 = 0;
if ( *(_BYTE *)a1 != 45 )
goto LABEL_23;
if ( *(_BYTE *)(a1 + 1) == 99 && !*(_BYTE *)(a1 + 2) )
{
v4 = 22;
LABEL_14:
func11(a2, v4);
return 0LL;
}
if ( *(_BYTE *)(a1 + 1) == 109 && !*(_BYTE *)(a1 + 2) )
{
func11(a2, 0x21u);
return 0LL;
}
if ( *(_BYTE *)(a1 + 1) != 100 || *(_BYTE *)(a1 + 2) )
{
LABEL_23:
if ( strcmp((const char *)a1, "-ud") )
{
result = 0xFFFFFFFFLL;
if ( strcmp((const char *)a1, "-help") )
return result;
func12();
goto LABEL_14;
}
if ( func7((__int64)a2, 117) != -1 )
return 0LL;
v3 = "failed to clean project document";
LABEL_11:
fprintf(_bss_start, "%s\n", v3);
return 1LL;
}
if ( func7((__int64)a2, 102) == -1 )
{
v3 = "failed to create project document";
goto LABEL_11;
}
return 0LL;
}

original_code:
int hens (const char *arg, const char *path)
{
    volatile int mode = 0;
    if(0 == strcmp(arg, "-c"))
    {
        mode = 22;
    }
    else if(0 == strcmp(arg, "-m"))
    {
        mode = 33;
    }
    else if(0 == strcmp(arg, "-d"))
    {
        if(-1 == pro_document_manager(path, 'f'))
        {
            fprintf(stdout, "%s\n", "failed to create project document");
            return 1;
        }
        return 0;
    }
    else if(0 == strcmp(arg, "-ud"))
    {
        if(-1 == pro_document_manager(path, 'u'))
        {
            fprintf(stdout, "%s\n", "failed to clean project document");
            return 1;
        }
        return 0;
    }
    else if(0 == strcmp(arg, "-help"))
    {
        help_tip();
    }
    else{
        return -1;
    }
    document_handle (path, mode);
    return 0;
}

canonical_original_code:
int hens(char *arg, char *path)
{
    int mode = 0;
    if(0 == strcmp(arg, "-c"))
    {
        mode = 22;
    }
    else if(0 == strcmp(arg, "-m"))
    {
        mode = 33;
    }
    else if(0 == strcmp(arg, "-d"))
    {
        if(-1 == pro_document_manager(path, 'f'))
        {
            fprintf(stdout, "%s\n", "failed to create project document");
            return 1;
        }
        return 0;
    }
    else if(0 == strcmp(arg, "-ud"))
    {
        if(-1 == pro_document_manager(path, 'u'))
        {
            fprintf(stdout, "%s\n", "failed to clean project document");
            return 1;
        }
        return 0;
    }
    else if(0 == strcmp(arg, "-help"))
    {
        help_tip();
    }
    else{
        return -1;
    }
    document_handle (path, mode);
    return 0;
}

variable_types:
arg
char *

variable_types: mode int


decompiled_code:
time_t get_elapsed()
{
unsigned __int16 v0; // dx
time_t v1; // rax
time_t result; // rax
struct timeb v3; // [rsp+0h] [rbp-18h] BYREF

ftime(&v3);
v0 = start.millitm;
v1 = v3.time - start.time;
v3.time -= start.time;
if ( v3.millitm < v0 )
return v1 - 1;
result = v3.time;
v3.millitm -= v0;
return result;
}

canonical_decompiled_code:
time_t func1()
{
unsigned __int16 v0; // dx
time_t v1; // rax
time_t result; // rax
struct timeb v3; // [rsp+0h] [rbp-18h] BYREF

ftime(&v3);
v0 = start.millitm;
v1 = v3.time - start.time;
v3.time -= start.time;
if ( v3.millitm < v0 )
return v1 - 1;
result = v3.time;
v3.millitm -= v0;
return result;
}

original_code:
struct timeb get_elapsed() {
 struct timeb now;
 ftime(&now);
 now.time -= start.time;
 if ( now.millitm >= start.millitm ) {
  now.millitm -= start.millitm;
 } else {
  now.time--;
  now.millitm = start.millitm - now.millitm;
 }
 return now;
}

variable_types: struct timeb { long time; unsigned short millitm; short timezone; short dstflag; }


decompiled_code:
__int64 __fastcall priority_encoder(unsigned int a1)
{
unsigned int v1; // er8
int v2; // edx
int v3; // eax

v1 = a1;
if ( (_BYTE)a1 && (a1 & 0x7F) > 1 )
{
v2 = -128;
do
{
v3 = v2;
LOBYTE(v2) = (unsigned __int8)v2 >> 1;
v1 &= ~v3;
}
while ( ((unsigned __int8)v1 & ~(unsigned __int8)v2) > 1 );
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int a1)
{
unsigned int v1; // er8
int v2; // edx
int v3; // eax

v1 = a1;
if ( (_BYTE)a1 && (a1 & 0x7F) > 1 )
{
v2 = -128;
do
{
v3 = v2;
LOBYTE(v2) = (unsigned __int8)v2 >> 1;
v1 &= ~v3;
}
while ( ((unsigned __int8)v1 & ~(unsigned __int8)v2) > 1 );
}
return v1;
}

original_code:
loglevel_t priority_encoder(loglevel_t level) {
 loglevel_t mask = 1 << (8 * sizeof(loglevel_t) - 1);
 if ( level == 0 ) return level;
 while ( (level & (~mask)) > 1 ) {
  level &= ~mask;
  mask >>= 1;
 }
 return level;
}

canonical_original_code:
unsigned char priority_encoder(unsigned char level) {
 unsigned char mask = 1 << (8 * sizeof(loglevel_t) - 1);
 if ( level == 0 ) return level;
 while ( (level & (~mask)) > 1 ) {
  level &= ~mask;
  mask >>= 1;
 }
 return level;
}

variable_types:
level
unsigned char

variable_types:
mask
unsigned char

return_type: unsigned char