yyparse

decompiled_code:
__int64 yyparse()
{
__int64 v0; // r15
unsigned __int64 v1; // rbp
__m128i *v2; // rbx
__int16 *v3; // r11
__int16 *v4; // r12
unsigned int v5; // er13
unsigned int v6; // er14
int v7; // eax
int v8; // eax
__int16 *v9; // r13
unsigned __int64 v10; // rax
signed __int64 v11; // rbx
__int64 v12; // r13
__int16 *v13; // rax
__int16 *v14; // r14
__int64 v15; // rdx
unsigned int v16; // er13
int v17; // er15
__int64 v18; // rax
unsigned int v19; // er13
__int64 v21; // rdi
__int64 v22; // rsi
__m128i *v24; // r14
int v25; // edx
int v26; // er9
int v27; // eax
unsigned int v28; // er9
int v29; // eax
__int16 *v30; // r11
int v31; // er14
const char *v32; // rdi
long double *v33; // rax
long double v34; // fst6
__int64 v35; // rax
const char *v36; // rdi
long double x; // fst7
int v38; // eax
long double v39; // fst5
long double v40; // fst7
long double v41; // rt1
long double v42; // fst5
long double v43; // fst4
char *v44; // [rsp+20h] [rbp-F08h]
int v45; // [rsp+28h] [rbp-F00h]
__int16 *v46; // [rsp+28h] [rbp-F00h]
__int16 *v47; // [rsp+28h] [rbp-F00h]
__int16 *v48; // [rsp+28h] [rbp-F00h]
__int16 *v49; // [rsp+30h] [rbp-EF8h]
__int16 *v50; // [rsp+30h] [rbp-EF8h]
__int16 *v51; // [rsp+30h] [rbp-EF8h]
long double v52; // [rsp+30h] [rbp-EF8h]
__int16 *v53; // [rsp+40h] [rbp-EE8h]
__int16 *v54; // [rsp+40h] [rbp-EE8h]
void *ptr; // [rsp+50h] [rbp-ED8h] BYREF
size_t size; // [rsp+58h] [rbp-ED0h] BYREF
char v57[128]; // [rsp+60h] [rbp-EC8h] BYREF
__int16 src[200]; // [rsp+E0h] [rbp-E48h] BYREF
char v59[3256]; // [rsp+270h] [rbp-CB8h] BYREF

v0 = 0LL;
v1 = 200LL;
yynerrs = 0;
v2 = (__m128i *)v59;
size = 128LL;
ptr = v57;
yychar = -2;
v45 = 0;
v44 = v59;
src[0] = 0;
v3 = src;
v4 = src;
while ( 1 )
{
v5 = yypact[v0];
v6 = v5;
if ( v5 != -15 )
{
v7 = yychar;
if ( yychar == -2 )
{
v49 = v3;
v7 = yylex();
v3 = v49;
yychar = v7;
}
if ( v7 <= 0 )
{
yychar = 0;
v8 = 0;
}
else if ( v7 <= 265 )
{
v8 = (unsigned __int8)yytranslate[v7];
v6 = v5 + v8;
}
else
{
v6 = v5 + 2;
v8 = 2;
}
if ( v6 <= 0x7C && yycheck[v6] == v8 )
{
v0 = (unsigned __int8)yytable[v6];
if ( yytable[v6] )
{
v9 = v3;
yychar = -2;
v2[1] = _mm_load_si128((const __m128i *)&yylval);
++v2;
v45 = (v45 == 0) + v45 - 1;
goto LABEL_12;
}
_FST7 = *(long double *)&v2[1];
v9 = v3;
v24 = v2;
v25 = -23;
v26 = 48;
goto LABEL_48;
}
}
if ( !yydefact[v0] )
{
v17 = -2;
if ( yychar == -2 || (v17 = 2, (unsigned int)yychar > 0x109) )
{
if ( v45 )
{
LABEL_27:
if ( v45 == 3 )
{
if ( yychar > 0 )
{
yychar = -2;
goto LABEL_34;
}
if ( !yychar )
{
v3 = v4;
v16 = 1;
goto LABEL_39;
}
}
while ( 1 )
{
LABEL_34:
if ( v5 == -15 )
goto LABEL_32;
v19 = v5 + 1;
if ( v19 > 0x7C )
goto LABEL_32;
if ( yycheck[v19] == 1 )
break;
if ( v3 == v4 )
{
LABEL_38:
v16 = 1;
goto LABEL_39;
}
LABEL_33:
v18 = *--v3;
--v2;
v5 = yypact[v18];
}
v0 = (unsigned __int8)yytable[v19];
if ( yytable[v19] )
{
v45 = 3;
++v2;
v9 = v3;
*v2 = _mm_load_si128((const __m128i *)&yylval);
goto LABEL_12;
}
LABEL_32:
if ( v3 == v4 )
goto LABEL_38;
goto LABEL_33;
}
}
else
{
v17 = (unsigned __int8)yytranslate[yychar];
if ( v45 )
goto LABEL_27;
}
v46 = v3;
++yynerrs;
v29 = yysyntax_error(&size, (const char **)&ptr, v3, v17);
v30 = v46;
v31 = v29;
if ( !v29 )
{
yyerror((const char *)ptr);
v3 = v46;
goto LABEL_34;
}
v32 = "syntax error";
if ( v29 == 1 )
{
if ( ptr != v57 )
{
free(ptr);
v30 = v46;
}
v48 = v30;
ptr = malloc(size);
if ( !ptr )
{
size = 128LL;
ptr = v57;
yyerror("syntax error");
LABEL_55:
v16 = 2;
yyerror("memory exhausted");
v3 = v4;
LABEL_39:
if ( v3 != src )
goto LABEL_40;
goto LABEL_41;
}
v38 = yysyntax_error(&size, (const char **)&ptr, v48, v17);
v32 = (const char *)ptr;
v30 = v48;
v31 = v38;
}
v47 = v30;
yyerror(v32);
v3 = v47;
if ( v31 != 2 )
goto LABEL_34;
goto LABEL_55;
}
v21 = (unsigned __int8)yyr2[(unsigned __int8)yydefact[v0]];
v22 = v21;
_FST7 = *(long double *)&v2[1 - (int)v21];
switch ( yydefact[v0] )
{
case 3:
v24 = v2 - 2;
v9 = v3 - 2;
v25 = 1;
had_error = 0;
v26 = -15;
break;
case 7:
v9 = v3 - 2;
v24 = v2 - 2;
v25 = 2;
v26 = -15;
if ( !had_error )
{
printf("%s%.15Lg\n", outprompt, *(long double *)&v2[-1]);
*(long double *)(get_sym("ans") + 16) = *(long double *)&v2[-1];
v25 = 2;
v26 = -15;
}
break;
case 8:
v25 = 2;
v45 = 0;
v26 = -15;
v9 = &v3[-v21];
v24 = &v2[-v21];
break;
case 11:
v54 = v3;
v24 = v2 - 1;
run_command(v2->m128i_i64[0], 0LL);
free((void *)v2->m128i_i64[0]);
v25 = 4;
v26 = -15;
v9 = v54 - 1;
break;
case 12:
v53 = v3;
v24 = v2 - 2;
run_command(v2[-1].m128i_i64[0], v2->m128i_i64[0]);
free((void *)v2[-1].m128i_i64[0]);
free((void *)v2->m128i_i64[0]);
v25 = 4;
v26 = -15;
v9 = v53 - 2;
break;
case 13:
v34 = *(long double *)v2;
v35 = v2[-2].m128i_i64[0];
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 5;
v26 = -15;
*(_DWORD *)(v35 + 8) = 1;
*(long double *)(v35 + 16) = v34;
break;
case 14:
_FST7 = *(long double *)v2;
v24 = v2 - 1;
v9 = v3 - 1;
v25 = 6;
v26 = -8;
break;
case 15:
v33 = (long double *)v2->m128i_i64[0];
v9 = v3 - 1;
v24 = v2 - 1;
if ( *(_DWORD *)(v2->m128i_i64[0] + 8) == 1 )
_FST7 = v33[1];
else
yyerror("variable %s has not been initialised", *(const char **)v33);
v25 = 6;
v26 = -8;
break;
case 16:
v50 = v3;
v24 = v2 - 4;
(*(void (__fastcall **)(__int64, __int64))(v2[-3].m128i_i64[0] + 16))(v21, v21);
v25 = 6;
v26 = -8;
v9 = v50 - 4;
break;
case 17:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] + *(long double *)v2;
break;
case 18:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] - *(long double *)v2;
break;
case 19:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] * *(long double *)v2;
break;
case 20:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] / *(long double *)v2;
break;
case 21:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] / *(long double *)v2;
__asm { frndint }
break;
case 22:
v51 = v3;
_FST7 = fmodl(*(long double *)&v2[-2], *(long double *)v2);
goto LABEL_74;
case 23:
v24 = v2 - 2;
v9 = v3 - 2;
v25 = 6;
v26 = -8;
_FST7 = -*(long double *)v2;
break;
case 24:
v51 = v3;
_FST7 = powl(*(long double *)&v2[-2], *(long double *)v2);
LABEL_74:
v24 = v2 - 3;
v25 = 6;
v26 = -8;
v9 = v51 - 3;
break;
case 25:
v9 = v3 - 2;
v24 = v2 - 2;
v36 = "factorial undefined for negative numbers";
v52 = _FST7;
x = *(long double *)&v2[-1];
if ( x < 0.0 )
goto LABEL_80;
if ( fmodl(x, 1.0) == 0.0 )
{
v39 = 1.0;
v40 = *(long double *)&v2[-1];
if ( v40 <= 0.0 )
{
_FST7 = 1.0;
}
else
{
while ( 1 )
{
v41 = v39 * v40;
v42 = v40;
_FST7 = v41;
v43 = v42 - 1.0;
if ( v43 <= 0.0 )
break;
v39 = _FST7;
v40 = v43;
}
}
v25 = 6;
v26 = -8;
}
else
{
v36 = "factorial undefined for non-integer numbers";
LABEL_80:
yyerror(v36, v22);
v25 = 6;
v26 = -8;
_FST7 = v52;
}
break;
case 26:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = fabs(*(long double *)&v2[-1]);
break;
case 27:
_FST7 = *(long double *)&v2[-1];
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
break;
default:
v25 = (unsigned __int8)yyr1[(unsigned __int8)yydefact[v0]] - 23;
v26 = yypgoto[v25];
v9 = &v3[-v21];
v24 = &v2[-v21];
break;
}
LABEL_48:
v27 = *v9;
*(long double *)&v24[1] = _FST7;
v2 = v24 + 1;
v28 = v27 + v26;
if ( v28 <= 0x7C && (_WORD)v27 == yycheck[v28] )
v0 = (unsigned __int8)yytable[v28];
else
v0 = yydefgoto[v25];
LABEL_12:
v10 = 2 * v1;
v3 = v9 + 1;
v9[1] = v0;
if ( v9 + 1 < &v4[v1 - 1] )
goto LABEL_21;
v11 = (char *)v3 - (char *)v4;
v12 = v3 - v4 + 1;
if ( v1 > 0x270F )
goto LABEL_55;
v1 = 10000LL;
if ( v10 <= 0x2710 )
v1 = v10;
v13 = (__int16 *)malloc(18 * v1 + 15);
v14 = v13;
if ( !v13 )
goto LABEL_55;
memcpy(v13, v4, v11 + 2);
memcpy((char *)v14 + ((2 * v1 + 15) & 0xFFFFFFFFFFFFFFF0LL), v44, 16 * v12);
v15 = 16 * v12;
if ( v4 != src )
{
free(v4);
v15 = 16 * v12;
}
v3 = (__int16 *)((char *)v14 + v11);
v2 = (__m128i *)((char *)v14 + ((2 * v1 + 15) & 0xFFFFFFFFFFFFFFF0LL) + v15 - 16);
if ( v3 >= &v14[v1 - 1] )
break;
v44 = (char *)v14 + ((2 * v1 + 15) & 0xFFFFFFFFFFFFFFF0LL);
v4 = v14;
LABEL_21:
if ( (_DWORD)v0 == 2 )
{
v3 = v4;
v16 = 0;
goto LABEL_39;
}
}
v3 = v14;
v16 = 1;
LABEL_40:
free(v3);
LABEL_41:
if ( ptr != v57 )
free(ptr);
return v16;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 v0; // r15
unsigned __int64 v1; // rbp
__m128i *v2; // rbx
__int16 *v3; // r11
__int16 *v4; // r12
unsigned int v5; // er13
unsigned int v6; // er14
int v7; // eax
int v8; // eax
__int16 *v9; // r13
unsigned __int64 v10; // rax
signed __int64 v11; // rbx
__int64 v12; // r13
__int16 *v13; // rax
__int16 *v14; // r14
__int64 v15; // rdx
unsigned int v16; // er13
int v17; // er15
__int64 v18; // rax
unsigned int v19; // er13
__int64 v21; // rdi
__int64 v22; // rsi
__m128i *v24; // r14
int v25; // edx
int v26; // er9
int v27; // eax
unsigned int v28; // er9
int v29; // eax
__int16 *v30; // r11
int v31; // er14
const char *v32; // rdi
long double *v33; // rax
long double v34; // fst6
__int64 v35; // rax
const char *v36; // rdi
long double x; // fst7
int v38; // eax
long double v39; // fst5
long double v40; // fst7
long double v41; // rt1
long double v42; // fst5
long double v43; // fst4
char *v44; // [rsp+20h] [rbp-F08h]
int v45; // [rsp+28h] [rbp-F00h]
__int16 *v46; // [rsp+28h] [rbp-F00h]
__int16 *v47; // [rsp+28h] [rbp-F00h]
__int16 *v48; // [rsp+28h] [rbp-F00h]
__int16 *v49; // [rsp+30h] [rbp-EF8h]
__int16 *v50; // [rsp+30h] [rbp-EF8h]
__int16 *v51; // [rsp+30h] [rbp-EF8h]
long double v52; // [rsp+30h] [rbp-EF8h]
__int16 *v53; // [rsp+40h] [rbp-EE8h]
__int16 *v54; // [rsp+40h] [rbp-EE8h]
void *ptr; // [rsp+50h] [rbp-ED8h] BYREF
size_t size; // [rsp+58h] [rbp-ED0h] BYREF
char v57[128]; // [rsp+60h] [rbp-EC8h] BYREF
__int16 src[200]; // [rsp+E0h] [rbp-E48h] BYREF
char v59[3256]; // [rsp+270h] [rbp-CB8h] BYREF

v0 = 0LL;
v1 = 200LL;
yynerrs = 0;
v2 = (__m128i *)v59;
size = 128LL;
ptr = v57;
yychar = -2;
v45 = 0;
v44 = v59;
src[0] = 0;
v3 = src;
v4 = src;
while ( 1 )
{
v5 = yypact[v0];
v6 = v5;
if ( v5 != -15 )
{
v7 = yychar;
if ( yychar == -2 )
{
v49 = v3;
v7 = yylex();
v3 = v49;
yychar = v7;
}
if ( v7 <= 0 )
{
yychar = 0;
v8 = 0;
}
else if ( v7 <= 265 )
{
v8 = (unsigned __int8)yytranslate[v7];
v6 = v5 + v8;
}
else
{
v6 = v5 + 2;
v8 = 2;
}
if ( v6 <= 0x7C && yycheck[v6] == v8 )
{
v0 = (unsigned __int8)yytable[v6];
if ( yytable[v6] )
{
v9 = v3;
yychar = -2;
v2[1] = _mm_load_si128((const __m128i *)&yylval);
++v2;
v45 = (v45 == 0) + v45 - 1;
goto LABEL_12;
}
_FST7 = *(long double *)&v2[1];
v9 = v3;
v24 = v2;
v25 = -23;
v26 = 48;
goto LABEL_48;
}
}
if ( !yydefact[v0] )
{
v17 = -2;
if ( yychar == -2 || (v17 = 2, (unsigned int)yychar > 0x109) )
{
if ( v45 )
{
LABEL_27:
if ( v45 == 3 )
{
if ( yychar > 0 )
{
yychar = -2;
goto LABEL_34;
}
if ( !yychar )
{
v3 = v4;
v16 = 1;
goto LABEL_39;
}
}
while ( 1 )
{
LABEL_34:
if ( v5 == -15 )
goto LABEL_32;
v19 = v5 + 1;
if ( v19 > 0x7C )
goto LABEL_32;
if ( yycheck[v19] == 1 )
break;
if ( v3 == v4 )
{
LABEL_38:
v16 = 1;
goto LABEL_39;
}
LABEL_33:
v18 = *--v3;
--v2;
v5 = yypact[v18];
}
v0 = (unsigned __int8)yytable[v19];
if ( yytable[v19] )
{
v45 = 3;
++v2;
v9 = v3;
*v2 = _mm_load_si128((const __m128i *)&yylval);
goto LABEL_12;
}
LABEL_32:
if ( v3 == v4 )
goto LABEL_38;
goto LABEL_33;
}
}
else
{
v17 = (unsigned __int8)yytranslate[yychar];
if ( v45 )
goto LABEL_27;
}
v46 = v3;
++yynerrs;
v29 = func0(&size, (const char **)&ptr, v3, v17);
v30 = v46;
v31 = v29;
if ( !v29 )
{
yyerror((const char *)ptr);
v3 = v46;
goto LABEL_34;
}
v32 = "syntax error";
if ( v29 == 1 )
{
if ( ptr != v57 )
{
free(ptr);
v30 = v46;
}
v48 = v30;
ptr = malloc(size);
if ( !ptr )
{
size = 128LL;
ptr = v57;
yyerror("syntax error");
LABEL_55:
v16 = 2;
yyerror("memory exhausted");
v3 = v4;
LABEL_39:
if ( v3 != src )
goto LABEL_40;
goto LABEL_41;
}
v38 = func0(&size, (const char **)&ptr, v48, v17);
v32 = (const char *)ptr;
v30 = v48;
v31 = v38;
}
v47 = v30;
yyerror(v32);
v3 = v47;
if ( v31 != 2 )
goto LABEL_34;
goto LABEL_55;
}
v21 = (unsigned __int8)yyr2[(unsigned __int8)yydefact[v0]];
v22 = v21;
_FST7 = *(long double *)&v2[1 - (int)v21];
switch ( yydefact[v0] )
{
case 3:
v24 = v2 - 2;
v9 = v3 - 2;
v25 = 1;
had_error = 0;
v26 = -15;
break;
case 7:
v9 = v3 - 2;
v24 = v2 - 2;
v25 = 2;
v26 = -15;
if ( !had_error )
{
printf("%s%.15Lg\n", outprompt, *(long double *)&v2[-1]);
*(long double *)(get_sym("ans") + 16) = *(long double *)&v2[-1];
v25 = 2;
v26 = -15;
}
break;
case 8:
v25 = 2;
v45 = 0;
v26 = -15;
v9 = &v3[-v21];
v24 = &v2[-v21];
break;
case 11:
v54 = v3;
v24 = v2 - 1;
run_command(v2->m128i_i64[0], 0LL);
free((void *)v2->m128i_i64[0]);
v25 = 4;
v26 = -15;
v9 = v54 - 1;
break;
case 12:
v53 = v3;
v24 = v2 - 2;
run_command(v2[-1].m128i_i64[0], v2->m128i_i64[0]);
free((void *)v2[-1].m128i_i64[0]);
free((void *)v2->m128i_i64[0]);
v25 = 4;
v26 = -15;
v9 = v53 - 2;
break;
case 13:
v34 = *(long double *)v2;
v35 = v2[-2].m128i_i64[0];
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 5;
v26 = -15;
*(_DWORD *)(v35 + 8) = 1;
*(long double *)(v35 + 16) = v34;
break;
case 14:
_FST7 = *(long double *)v2;
v24 = v2 - 1;
v9 = v3 - 1;
v25 = 6;
v26 = -8;
break;
case 15:
v33 = (long double *)v2->m128i_i64[0];
v9 = v3 - 1;
v24 = v2 - 1;
if ( *(_DWORD *)(v2->m128i_i64[0] + 8) == 1 )
_FST7 = v33[1];
else
yyerror("variable %s has not been initialised", *(const char **)v33);
v25 = 6;
v26 = -8;
break;
case 16:
v50 = v3;
v24 = v2 - 4;
(*(void (__fastcall **)(__int64, __int64))(v2[-3].m128i_i64[0] + 16))(v21, v21);
v25 = 6;
v26 = -8;
v9 = v50 - 4;
break;
case 17:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] + *(long double *)v2;
break;
case 18:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] - *(long double *)v2;
break;
case 19:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] * *(long double *)v2;
break;
case 20:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] / *(long double *)v2;
break;
case 21:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = *(long double *)&v2[-2] / *(long double *)v2;
__asm { frndint }
break;
case 22:
v51 = v3;
_FST7 = fmodl(*(long double *)&v2[-2], *(long double *)v2);
goto LABEL_74;
case 23:
v24 = v2 - 2;
v9 = v3 - 2;
v25 = 6;
v26 = -8;
_FST7 = -*(long double *)v2;
break;
case 24:
v51 = v3;
_FST7 = powl(*(long double *)&v2[-2], *(long double *)v2);
LABEL_74:
v24 = v2 - 3;
v25 = 6;
v26 = -8;
v9 = v51 - 3;
break;
case 25:
v9 = v3 - 2;
v24 = v2 - 2;
v36 = "factorial undefined for negative numbers";
v52 = _FST7;
x = *(long double *)&v2[-1];
if ( x < 0.0 )
goto LABEL_80;
if ( fmodl(x, 1.0) == 0.0 )
{
v39 = 1.0;
v40 = *(long double *)&v2[-1];
if ( v40 <= 0.0 )
{
_FST7 = 1.0;
}
else
{
while ( 1 )
{
v41 = v39 * v40;
v42 = v40;
_FST7 = v41;
v43 = v42 - 1.0;
if ( v43 <= 0.0 )
break;
v39 = _FST7;
v40 = v43;
}
}
v25 = 6;
v26 = -8;
}
else
{
v36 = "factorial undefined for non-integer numbers";
LABEL_80:
yyerror(v36, v22);
v25 = 6;
v26 = -8;
_FST7 = v52;
}
break;
case 26:
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
_FST7 = fabs(*(long double *)&v2[-1]);
break;
case 27:
_FST7 = *(long double *)&v2[-1];
v24 = v2 - 3;
v9 = v3 - 3;
v25 = 6;
v26 = -8;
break;
default:
v25 = (unsigned __int8)yyr1[(unsigned __int8)yydefact[v0]] - 23;
v26 = yypgoto[v25];
v9 = &v3[-v21];
v24 = &v2[-v21];
break;
}
LABEL_48:
v27 = *v9;
*(long double *)&v24[1] = _FST7;
v2 = v24 + 1;
v28 = v27 + v26;
if ( v28 <= 0x7C && (_WORD)v27 == yycheck[v28] )
v0 = (unsigned __int8)yytable[v28];
else
v0 = yydefgoto[v25];
LABEL_12:
v10 = 2 * v1;
v3 = v9 + 1;
v9[1] = v0;
if ( v9 + 1 < &v4[v1 - 1] )
goto LABEL_21;
v11 = (char *)v3 - (char *)v4;
v12 = v3 - v4 + 1;
if ( v1 > 0x270F )
goto LABEL_55;
v1 = 10000LL;
if ( v10 <= 0x2710 )
v1 = v10;
v13 = (__int16 *)malloc(18 * v1 + 15);
v14 = v13;
if ( !v13 )
goto LABEL_55;
memcpy(v13, v4, v11 + 2);
memcpy((char *)v14 + ((2 * v1 + 15) & 0xFFFFFFFFFFFFFFF0LL), v44, 16 * v12);
v15 = 16 * v12;
if ( v4 != src )
{
free(v4);
v15 = 16 * v12;
}
v3 = (__int16 *)((char *)v14 + v11);
v2 = (__m128i *)((char *)v14 + ((2 * v1 + 15) & 0xFFFFFFFFFFFFFFF0LL) + v15 - 16);
if ( v3 >= &v14[v1 - 1] )
break;
v44 = (char *)v14 + ((2 * v1 + 15) & 0xFFFFFFFFFFFFFFF0LL);
v4 = v14;
LABEL_21:
if ( (_DWORD)v0 == 2 )
{
v3 = v4;
v16 = 0;
goto LABEL_39;
}
}
v3 = v14;
v16 = 1;
LABEL_40:
free(v3);
LABEL_41:
if ( ptr != v57 )
free(ptr);
return v16;
}

original_code:
int
yyparse (void)
{
    int yystate;
    int yyerrstatus;
    yytype_int16 yyssa[200];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;
    YYSTYPE yyvsa[200];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;
    long unsigned int yystacksize;
  int yyn;
  int yyresult;
  int yytoken = 0;
  YYSTYPE yyval;
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  long unsigned int yymsg_alloc = sizeof yymsgbuf;
  int yylen = 0;
  yyssp = yyss = yyssa;
  yyvsp = yyvs = yyvsa;
  yystacksize = 200;
  ;
  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = (-2);
  goto yysetstate;
yynewstate:
  yyssp++;
yysetstate:
  *yyssp = (yytype_int16) yystate;
  if (yyss + yystacksize - 1 <= yyssp)
    {
      long unsigned int yysize = (long unsigned int) (yyssp - yyss + 1);
      if (10000 <= yystacksize)
        goto yyexhaustedlab;
      yystacksize *= 2;
      if (10000 < yystacksize)
        yystacksize = 10000;
      {
        yytype_int16 *yyss1 = yyss;
        union yyalloc *yyptr =
          (union yyalloc *) malloc (((yystacksize) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) + (sizeof (union yyalloc) - 1)));
        if (! yyptr)
          goto yyexhaustedlab;
        do { long unsigned int yynewbytes; __builtin_memcpy (&yyptr->yyss_alloc, yyss, (yysize) * sizeof (*(yyss))); yyss = &yyptr->yyss_alloc; yynewbytes = yystacksize * sizeof (*yyss) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        do { long unsigned int yynewbytes; __builtin_memcpy (&yyptr->yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs))); yyvs = &yyptr->yyvs_alloc; yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        if (yyss1 != yyssa)
          free (yyss1);
      }
      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
      ;
      if (yyss + yystacksize - 1 <= yyssp)
        goto yyabortlab;
    }
  ;
  if (yystate == 2)
    goto yyacceptlab;
  goto yybackup;
yybackup:
  yyn = yypact[yystate];
  if ((!!((yyn) == (-15))))
    goto yydefault;
  if (yychar == (-2))
    {
      ;
      yychar = yylex ();
    }
  if (yychar <= 0)
    {
      yychar = yytoken = 0;
      ;
    }
  else
    {
      yytoken = ((unsigned) (yychar) <= 265 ? yytranslate[yychar] : 2);
      ;
    }
  yyn += yytoken;
  if (yyn < 0 || 124 < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (0)
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  if (yyerrstatus)
    yyerrstatus--;
  ;
  yychar = (-2);
  yystate = yyn;

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen];
  ;
  switch (yyn)
    {
        case 3:
    { had_error = 0; }
    break;
  case 7:
    {
 if (!had_error) {
  printf("%s%.15Lg\n", outprompt, (yyvsp[-1].fval));
  SymRec* ans = get_sym("ans");
  ans->value.var = (yyvsp[-1].fval);
 }
}
    break;
  case 8:
    { (yyerrstatus = 0); }
    break;
  case 11:
    { run_command((yyvsp[0].sval), ((void *)0)); free((yyvsp[0].sval)); }
    break;
  case 12:
    { run_command((yyvsp[-1].sval), (yyvsp[0].sval)); free((yyvsp[-1].sval)); free((yyvsp[0].sval)); }
    break;
  case 13:
    { (yyvsp[-2].sym)->value.var = (yyvsp[0].fval); (yyvsp[-2].sym)->init = 1; }
    break;
  case 14:
    { (yyval.fval) = (yyvsp[0].fval); }
    break;
  case 15:
    {
    if ((yyvsp[0].sym)->init == 1){
        (yyval.fval) = (yyvsp[0].sym)->value.var;
    } else {
        yyerror("variable %s has not been initialised", (yyvsp[0].sym)->name);
    }
}
    break;
  case 16:
    { (yyval.fval) = (*((yyvsp[-3].sym)->value.func))((yyvsp[-1].fval)); }
    break;
  case 17:
    { (yyval.fval) = (yyvsp[-2].fval) + (yyvsp[0].fval); }
    break;
  case 18:
    { (yyval.fval) = (yyvsp[-2].fval) - (yyvsp[0].fval); }
    break;
  case 19:
    { (yyval.fval) = (yyvsp[-2].fval) * (yyvsp[0].fval); }
    break;
  case 20:
    { (yyval.fval) = (yyvsp[-2].fval) / (yyvsp[0].fval); }
    break;
  case 21:
    { (yyval.fval) = floorl((yyvsp[-2].fval) / (yyvsp[0].fval)); }
    break;
  case 22:
    { (yyval.fval) = fmodl((yyvsp[-2].fval), (yyvsp[0].fval)); }
    break;
  case 23:
    { (yyval.fval) = -(yyvsp[0].fval); }
    break;
  case 24:
    { (yyval.fval) = powl((yyvsp[-2].fval), (yyvsp[0].fval)); }
    break;
  case 25:
    {
    if ((yyvsp[-1].fval) < 0) {
        yyerror("factorial undefined for negative numbers");
    } else if (fmodl((yyvsp[-1].fval), 1) != 0) {
        yyerror("factorial undefined for non-integer numbers");
    } else {
        (yyval.fval) = 1;
        for (long double i = (yyvsp[-1].fval); i > 0; i--) (yyval.fval) *= i;
    }
}
    break;
  case 26:
    { (yyval.fval) = fabsl((yyvsp[-1].fval)); }
    break;
  case 27:
    { (yyval.fval) = (yyvsp[-1].fval); }
    break;
      default: break;
    }
  ;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  *++yyvsp = yyval;
  {
    const int yylhs = yyr1[yyn] - 23;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 124 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned) (yychar) <= 265 ? yytranslate[yychar] : 2);
  if (!yyerrstatus)
    {
      ++yynerrs;
      {
        char const *yymsgp = "syntax error";
        int yysyntax_error_status;
        yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, yyssp, yytoken);
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == 1)
          {
            if (yymsg != yymsgbuf)
              free (yymsg);
            yymsg = (char *) malloc (yymsg_alloc);
            if (!yymsg)
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = 2;
              }
            else
              {
                yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, yyssp, yytoken);
                yymsgp = yymsg;
              }
          }
        yyerror (yymsgp);
        if (yysyntax_error_status == 2)
          goto yyexhaustedlab;
      }
    }
  if (yyerrstatus == 3)
    {
      if (yychar <= 0)
        {
          if (yychar == 0)
            goto yyabortlab;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = (-2);
        }
    }
  goto yyerrlab1;
yyerrorlab:
  if (0)
    goto yyerrorlab;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-15))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 124 && yycheck[yyn] == 1)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }
      if (yyssp == yyss)
        goto yyabortlab;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
      yystate = *yyssp;
      ;
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  ;
  yystate = yyn;
  goto yynewstate;
yyacceptlab:
  yyresult = 0;
  goto yyreturn;
yyabortlab:
  yyresult = 1;
  goto yyreturn;
yyexhaustedlab:
  yyerror ("memory exhausted");
  yyresult = 2;
yyreturn:
  if (yychar != (-2))
    {
      yytoken = ((unsigned) (yychar) <= 265 ? yytranslate[yychar] : 2);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  (yyvsp -= (yylen), yyssp -= (yylen));
  ;
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  yystos[*yyssp], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
    }
  if (yyss != yyssa)
    free (yyss);
  if (yymsg != yymsgbuf)
    free (yymsg);
  return yyresult;
}

canonical_original_code:
int yyparse()
{
    int yystate;
    int yyerrstatus;
    short yyssa[200];
    short *yyss;
    short *yyssp;
    union YYSTYPE yyvsa[200];
    union YYSTYPE *yyvs;
    union YYSTYPE *yyvsp;
    unsigned long yystacksize;
  int yyn;
  int yyresult;
  int yytoken = 0;
  union YYSTYPE yyval;
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  unsigned long yymsg_alloc = sizeof yymsgbuf;
  int yylen = 0;
  yyssp = yyss = yyssa;
  yyvsp = yyvs = yyvsa;
  yystacksize = 200;
  ;
  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = (-2);
  goto yysetstate;
yynewstate:
  yyssp++;
yysetstate:
  *yyssp = (short) yystate;
  if (yyss + yystacksize - 1 <= yyssp)
    {
      unsigned long yysize = (long unsigned int) (yyssp - yyss + 1);
      if (10000 <= yystacksize)
        goto yyexhaustedlab;
      yystacksize *= 2;
      if (10000 < yystacksize)
        yystacksize = 10000;
      {
        short *yyss1 = yyss;
        union yyalloc *yyptr = (union yyalloc *) malloc (((yystacksize) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) + (sizeof (union yyalloc) - 1)));
        if (! yyptr)
          goto yyexhaustedlab;
        do { unsigned long yynewbytes; __builtin_memcpy (&yyptr->yyss_alloc, yyss, (yysize) * sizeof (*(yyss))); yyss = &yyptr->yyss_alloc; yynewbytes = yystacksize * sizeof (*yyss) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        do { unsigned long yynewbytes; __builtin_memcpy (&yyptr->yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs))); yyvs = &yyptr->yyvs_alloc; yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof (union yyalloc) - 1); yyptr += yynewbytes / sizeof (*yyptr); } while (0);
        if (yyss1 != yyssa)
          free (yyss1);
      }
      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
      ;
      if (yyss + yystacksize - 1 <= yyssp)
        goto yyabortlab;
    }
  ;
  if (yystate == 2)
    goto yyacceptlab;
  goto yybackup;
yybackup:
  yyn = yypact[yystate];
  if ((!!((yyn) == (-15))))
    goto yydefault;
  if (yychar == (-2))
    {
      ;
      yychar = yylex ();
    }
  if (yychar <= 0)
    {
      yychar = yytoken = 0;
      ;
    }
  else
    {
      yytoken = ((unsigned int) (yychar) <= 265 ? yytranslate[yychar] : 2);
      ;
    }
  yyn += yytoken;
  if (yyn < 0 || 124 < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (0)
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  if (yyerrstatus)
    yyerrstatus--;
  ;
  yychar = (-2);
  yystate = yyn;

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen];
  ;
  switch (yyn)
    {
        case 3:
    { had_error = 0; }
    break;
  case 7:
    {
 if (!had_error) {
  printf("%s%.15Lg\n", outprompt, (yyvsp[-1].fval));
  struct SymRec *ans = get_sym("ans");
  ans->value.var = (yyvsp[-1].fval);
 }
}
    break;
  case 8:
    { (yyerrstatus = 0); }
    break;
  case 11:
    { run_command((yyvsp[0].sval), ((void *)0)); free((yyvsp[0].sval)); }
    break;
  case 12:
    { run_command((yyvsp[-1].sval), (yyvsp[0].sval)); free((yyvsp[-1].sval)); free((yyvsp[0].sval)); }
    break;
  case 13:
    { (yyvsp[-2].sym)->value.var = (yyvsp[0].fval); (yyvsp[-2].sym)->init = 1; }
    break;
  case 14:
    { (yyval.fval) = (yyvsp[0].fval); }
    break;
  case 15:
    {
    if ((yyvsp[0].sym)->init == 1){
        (yyval.fval) = (yyvsp[0].sym)->value.var;
    } else {
        yyerror("variable %s has not been initialised", (yyvsp[0].sym)->name);
    }
}
    break;
  case 16:
    { (yyval.fval) = (*((yyvsp[-3].sym)->value.func))((yyvsp[-1].fval)); }
    break;
  case 17:
    { (yyval.fval) = (yyvsp[-2].fval) + (yyvsp[0].fval); }
    break;
  case 18:
    { (yyval.fval) = (yyvsp[-2].fval) - (yyvsp[0].fval); }
    break;
  case 19:
    { (yyval.fval) = (yyvsp[-2].fval) * (yyvsp[0].fval); }
    break;
  case 20:
    { (yyval.fval) = (yyvsp[-2].fval) / (yyvsp[0].fval); }
    break;
  case 21:
    { (yyval.fval) = floorl((yyvsp[-2].fval) / (yyvsp[0].fval)); }
    break;
  case 22:
    { (yyval.fval) = fmodl((yyvsp[-2].fval), (yyvsp[0].fval)); }
    break;
  case 23:
    { (yyval.fval) = -(yyvsp[0].fval); }
    break;
  case 24:
    { (yyval.fval) = powl((yyvsp[-2].fval), (yyvsp[0].fval)); }
    break;
  case 25:
    {
    if ((yyvsp[-1].fval) < 0) {
        yyerror("factorial undefined for negative numbers");
    } else if (fmodl((yyvsp[-1].fval), 1) != 0) {
        yyerror("factorial undefined for non-integer numbers");
    } else {
        (yyval.fval) = 1;
        for (long double i = (yyvsp[-1].fval); i > 0; i--) (yyval.fval) *= i;
    }
}
    break;
  case 26:
    { (yyval.fval) = fabsl((yyvsp[-1].fval)); }
    break;
  case 27:
    { (yyval.fval) = (yyvsp[-1].fval); }
    break;
      default: break;
    }
  ;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  *++yyvsp = yyval;
  {
    int yylhs = yyr1[yyn] - 23;
    int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 124 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned int) (yychar) <= 265 ? yytranslate[yychar] : 2);
  if (!yyerrstatus)
    {
      ++yynerrs;
      {
        char *yymsgp = "syntax error";
        int yysyntax_error_status;
        yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, yyssp, yytoken);
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == 1)
          {
            if (yymsg != yymsgbuf)
              free (yymsg);
            yymsg = (char *) malloc (yymsg_alloc);
            if (!yymsg)
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = 2;
              }
            else
              {
                yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, yyssp, yytoken);
                yymsgp = yymsg;
              }
          }
        yyerror (yymsgp);
        if (yysyntax_error_status == 2)
          goto yyexhaustedlab;
      }
    }
  if (yyerrstatus == 3)
    {
      if (yychar <= 0)
        {
          if (yychar == 0)
            goto yyabortlab;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = (-2);
        }
    }
  goto yyerrlab1;
yyerrorlab:
  if (0)
    goto yyerrorlab;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-15))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 124 && yycheck[yyn] == 1)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }
      if (yyssp == yyss)
        goto yyabortlab;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
      yystate = *yyssp;
      ;
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  ;
  yystate = yyn;
  goto yynewstate;
yyacceptlab:
  yyresult = 0;
  goto yyreturn;
yyabortlab:
  yyresult = 1;
  goto yyreturn;
yyexhaustedlab:
  yyerror ("memory exhausted");
  yyresult = 2;
yyreturn:
  if (yychar != (-2))
    {
      yytoken = ((unsigned int) (yychar) <= 265 ? yytranslate[yychar] : 2);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  (yyvsp -= (yylen), yyssp -= (yylen));
  ;
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  yystos[*yyssp], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
    }
  if (yyss != yyssa)
    free (yyss);
  if (yymsg != yymsgbuf)
    free (yymsg);
  return yyresult;
}

variable_types: yystate int

variable_types: yyerrstatus int

variable_types:
yyssa
short [200]

variable_types:
yyss
short *

variable_types: union YYSTYPE { long double fval; char *sval; struct SymRec { char *name; int init; char type; union { long double (*func)(long double arg); long double var; } value; struct SymRec *next; } *sym; } [200]

variable_types: union YYSTYPE { long double fval; char *sval; struct SymRec { char *name; int init; char type; union { long double (*func)(long double arg); long double var; } value; struct SymRec *next; } *sym; } *

variable_types:
yystacksize
unsigned long

variable_types: yyresult int

variable_types:
yymsgbuf
char [128]

variable_types:
yymsg
char *

variable_types: yylen int

variable_types: union yyalloc { short yyss_alloc; union YYSTYPE { long double fval; char *sval; struct SymRec { char *name; int init; char type; union { long double (*func)(long double arg); long double var; } value; struct SymRec *next; } *sym; } yyvs_alloc; } *

variable_types:
yynewbytes
unsigned long

variable_types:
i
long double

variable_types: yylhs int

variable_types:
yymsgp
char *

user_defined_types: union YYSTYPE { long double fval; char *sval; struct SymRec *sym; }

user_defined_types: union yyalloc { short yyss_alloc; union YYSTYPE yyvs_alloc; }


yyerror

decompiled_code:
int yyerror(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

had_error = 1;
result = qflag;
if ( !qflag )
{
va_start(arg, format);
fwrite(&unk_1AE, 1uLL, 2uLL, stderr);
vfprintf(stderr, format, arg);
result = fputc(10, stderr);
}
return result;
}

canonical_decompiled_code:
int func0(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

had_error = 1;
result = qflag;
if ( !qflag )
{
va_start(arg, format);
fwrite(&unk_1AE, 1uLL, 2uLL, stderr);
vfprintf(stderr, format, arg);
result = fputc(10, stderr);
}
return result;
}

original_code:
void yyerror(const char* fmt, ...) {
    had_error = 1;
    if (qflag) return;
    va_list argp;
    __builtin_va_start(argp,fmt);
    fprintf(stderr, "! ");
    vfprintf(stderr, fmt, argp);
    fprintf(stderr, "\n");
    __builtin_va_end(argp);
}

canonical_original_code:
void yyerror(char *fmt, ...) {
    had_error = 1;
    if (qflag) return;
    __builtin_va_list argp;
    __builtin_va_start(argp,fmt);
    fprintf(stderr, "! ");
    vfprintf(stderr, fmt, argp);
    fprintf(stderr, "\n");
    __builtin_va_end(argp);
}

variable_types:
fmt
char *

return_type: void


decompiled_code:
int cmd_print(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

result = qflag;
if ( !qflag )
{
va_start(arg, format);
printf("$ ");
vprintf(format, arg);
result = putchar(10);
}
return result;
}

canonical_decompiled_code:
int func1(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

result = qflag;
if ( !qflag )
{
va_start(arg, format);
printf("$ ");
vprintf(format, arg);
result = putchar(10);
}
return result;
}

original_code:
void cmd_print(const char* fmt, ...) {
    if (qflag) return;
    va_list argp;
    __builtin_va_start(argp,fmt);
    printf("$ ");
    vprintf(fmt, argp);
    printf("\n");
    __builtin_va_end(argp);
}

canonical_original_code:
void cmd_print(char *fmt, ...) {
    if (qflag) return;
    __builtin_va_list argp;
    __builtin_va_start(argp,fmt);
    printf("$ ");
    vprintf(fmt, argp);
    printf("\n");
    __builtin_va_end(argp);
}


decompiled_code:
char *__fastcall tilde_expansion(char *s)
{
char *v2; // r14
size_t v3; // rbx
int v4; // eax
__int64 v5; // r13
void *v6; // r12

if ( *s != 126 )
return strdup(s);
v2 = getenv("HOME");
v3 = strlen(v2);
v4 = strlen(s);
v5 = (int)v3 + v4;
v6 = calloc((int)v3 + v4 + 1, 1uLL);
memcpy(v6, v2, v3);
strcpy((char *)v6 + v3, s + 1);
*((_BYTE *)v6 + v5) = 0;
return (char *)v6;
}

canonical_decompiled_code:
char *__fastcall func0(char *s)
{
char *v2; // r14
size_t v3; // rbx
int v4; // eax
__int64 v5; // r13
void *v6; // r12

if ( *s != 126 )
return strdup(s);
v2 = getenv("HOME");
v3 = strlen(v2);
v4 = strlen(s);
v5 = (int)v3 + v4;
v6 = calloc((int)v3 + v4 + 1, 1uLL);
memcpy(v6, v2, v3);
strcpy((char *)v6 + v3, s + 1);
*((_BYTE *)v6 + v5) = 0;
return (char *)v6;
}

original_code:
char* tilde_expansion(const char* path) {
    if (path[0] != '~') return strdup(path);
    char* home = getenv("HOME");
    int h_len = strlen(home);
    int p_len = strlen(path);
    char* new_path = calloc(h_len + p_len + 1, sizeof(char));
    strcpy(new_path, home);
    strcat(new_path, path + 1);
    new_path[h_len + p_len] = '\0';
    return new_path;
}

canonical_original_code:
char *tilde_expansion(char *path) {
    if (path[0] != '~') return strdup(path);
    char *home = getenv("HOME");
    int h_len = strlen(home);
    int p_len = strlen(path);
    char *new_path = calloc(h_len + p_len + 1, sizeof(char));
    strcpy(new_path, home);
    strcat(new_path, path + 1);
    new_path[h_len + p_len] = '\0';
    return new_path;
}

variable_types:
path
char *

variable_types:
home
char *

return_type: char *


decompiled_code:
void clear_lib_table()
{
void **i; // rbp
void *v1; // rdi
void *v2; // rdi

for ( i = (void **)lib_table; lib_table; i = (void **)lib_table )
{
v1 = *i;
lib_table = i[2];
if ( v1 )
free(v1);
v2 = i[1];
if ( v2 )
dlclose(v2);
free(i);
}
}

canonical_decompiled_code:
void func1()
{
void **i; // rbp
void *v1; // rdi
void *v2; // rdi

for ( i = (void **)lib_table; lib_table; i = (void **)lib_table )
{
v1 = *i;
lib_table = i[2];
if ( v1 )
free(v1);
v2 = i[1];
if ( v2 )
dlclose(v2);
free(i);
}
}

original_code:
void clear_lib_table(void) {
    LibRec* temp = lib_table;
    for (; temp != ((void *)0); temp = lib_table) {
        lib_table = temp->next;
        if (temp->path) free(temp->path);
        if (temp->lib) dlclose(temp->lib);
        free(temp);
    }
}

canonical_original_code:
void clear_lib_table() {
    struct LibRec *temp = lib_table;
    for (; temp != ((void *)0); temp = lib_table) {
        lib_table = temp->next;
        if (temp->path) free(temp->path);
        if (temp->lib) dlclose(temp->lib);
        free(temp);
    }
}

variable_types: struct LibRec { char *path; void *lib; struct LibRec *next; } *


decompiled_code:
_BYTE *non_readline_readline()
{
__int64 v0; // r13
int v1; // ebp
int v2; // ebx
_BYTE *i; // r12
_BYTE *v4; // r14
char v5; // al
size_t v7; // rsi
_BYTE *v8; // rax

v0 = 512LL;
v1 = 255;
v2 = 0;
for ( i = calloc(0x100uLL, 1uLL); ; i = v8 )
{
v4 = &i[v2];
if ( v1 > v2 )
break;
LABEL_11:
v7 = v0;
v1 += 256;
v0 += 256LL;
v8 = realloc(i, v7);
if ( !v8 )
{
yyerror("memory error");
*i = 0;
return i;
}
}
while ( 1 )
{
v5 = getc(stdin);
if ( !v2 && v5 == -1 )
return 0LL;
if ( v5 == 10 || v5 == -1 )
break;
++v2;
*v4++ = v5;
if ( v1 == v2 )
goto LABEL_11;
}
*v4 = 0;
return i;
}

original_code:
char* non_readline_readline(void) {
    int length = 256;
    char* str = calloc(length, sizeof(char));
    int i = 0;
    int reading = 1;
    while (reading) {
        for (; i < length - 1; i++) {
            char c = getc(stdin);
            if (c == (-1) && i == 0) {
                return ((void *)0);
            } else if (c == '\n' || c == (-1)) {
                str[i] = '\0';
                reading = 0;
                break;
            } else {
                str[i] = c;
            }
        }
        if (reading) {
            length += 256;
            char* memcheck = realloc(str, length * sizeof(char));
            if (memcheck == ((void *)0)) {
                yyerror("memory error");
                str[0] = '\0';
                return str;
            } else {
    str = memcheck;
   }
        }
    }
    return str;
}

canonical_original_code:
char *non_readline_readline() {
    int length = 256;
    char *str = calloc(length, sizeof(char));
    int i = 0;
    int reading = 1;
    while (reading) {
        for (; i < length - 1; i++) {
            char c = getc(stdin);
            if (c == (-1) && i == 0) {
                return ((void *)0);
            } else if (c == '\n' || c == (-1)) {
                str[i] = '\0';
                reading = 0;
                break;
            } else {
                str[i] = c;
            }
        }
        if (reading) {
            length += 256;
            char *memcheck = realloc(str, length * sizeof(char));
            if (memcheck == ((void *)0)) {
                yyerror("memory error");
                str[0] = '\0';
                return str;
            } else {
    str = memcheck;
   }
        }
    }
    return str;
}

variable_types: length int

variable_types:
str
char *

variable_types: i int

variable_types: reading int

variable_types: c char

variable_types:
memcheck
char *


decompiled_code:
char *__fastcall rl_gets(__int64 a1)
{
char *result; // rax
char *v2; // r12
int v3; // ebp

if ( rl_line )
{
free(rl_line);
rl_line = 0LL;
}
if ( a1 )
result = (char *)readline(a1);
else
result = non_readline_readline();
rl_line = result;
if ( result && *result )
{
add_history(result);
v2 = rl_line;
v3 = strlen(rl_line);
result = (char *)realloc(v2, v3 + 2);
if ( result )
{
rl_line = result;
result[v3] = 10;
result[v3 + 1] = 0;
}
else
{
yyerror("memory error");
result = rl_line;
*rl_line = 0;
}
}
return result;
}

canonical_decompiled_code:
char *__fastcall func1(__int64 a1)
{
char *result; // rax
char *v2; // r12
int v3; // ebp

if ( rl_line )
{
free(rl_line);
rl_line = 0LL;
}
if ( a1 )
result = (char *)readline(a1);
else
result = func0();
rl_line = result;
if ( result && *result )
{
add_history(result);
v2 = rl_line;
v3 = strlen(rl_line);
result = (char *)realloc(v2, v3 + 2);
if ( result )
{
rl_line = result;
result[v3] = 10;
result[v3 + 1] = 0;
}
else
{
yyerror("memory error");
result = rl_line;
*rl_line = 0;
}
}
return result;
}

original_code:
char* rl_gets(char* prompt) {
    if (rl_line) {
        free(rl_line);
        rl_line = ((void *)0);
    }
    if (prompt == ((void *)0)) {
        rl_line = non_readline_readline();
    } else {
        rl_line = readline(prompt);
    }
    if (rl_line && *rl_line) {
        add_history(rl_line);
        int len = strlen(rl_line);
        char* temp = realloc(rl_line, (len + 2) * sizeof(char));
        if (temp == ((void *)0)) {
            yyerror("memory error");
            *rl_line = '\0';
        } else {
   rl_line = temp;
   rl_line[len] = '\n';
   rl_line[len+1] = '\0';
        }
    }
    return rl_line;
}

canonical_original_code:
char *rl_gets(char *prompt) {
    if (rl_line) {
        free(rl_line);
        rl_line = ((void *)0);
    }
    if (prompt == ((void *)0)) {
        rl_line = non_readline_readline();
    } else {
        rl_line = readline(prompt);
    }
    if (rl_line && *rl_line) {
        add_history(rl_line);
        int len = strlen(rl_line);
        char *temp = realloc(rl_line, (len + 2) * sizeof(char));
        if (temp == ((void *)0)) {
            yyerror("memory error");
            *rl_line = '\0';
        } else {
   rl_line = temp;
   rl_line[len] = '\n';
   rl_line[len+1] = '\0';
        }
    }
    return rl_line;
}

variable_types:
prompt
char *

variable_types: len int

variable_types:
temp
char *


decompiled_code:
int __fastcall run_command(const char *a1, __int64 a2)
{
bool v3; // cf
bool v4; // zf
const char *v6; // rdi
__int64 v7; // rcx
const char *v8; // rsi
int result; // eax
bool v10; // al
bool v11; // cf
bool v12; // zf
const char *v13; // rdi
__int64 v14; // rcx
const char *v15; // rsi

v3 = 0;
v4 = a2 == 0;
if ( a2 )
{
v6 = "$load";
v7 = 6LL;
v8 = a1;
do
{
if ( !v7 )
break;
v3 = *v8 < (unsigned int)*v6;
v4 = *v8++ == *v6++;
--v7;
}
while ( v4 );
if ( (!v3 && !v4) == v3 )
return load_lib(a2, v8);
return yyerror("unknown command: %s", a1);
}
if ( !strcmp(a1, "$exit") || (v10 = strcmp(a1, "$quit") != 0, v11 = 0, v12 = !v10) )
{
result = qflag;
if ( !qflag )
result = puts("Goodbye!");
program_running = 0;
}
else
{
v13 = "$fly";
v14 = 5LL;
v15 = a1;
do
{
if ( !v14 )
break;
v11 = *v15 < (unsigned int)*v13;
v12 = *v15++ == *v13++;
--v14;
}
while ( v12 );
if ( (!v11 && !v12) != v11 )
return yyerror("unknown command: %s", a1);
cmd_print("You throw yourself at the ground and smash face-first into the mud.", v15);
result = cmd_print("Why on earth did you think that would ever work?!", v15);
}
return result;
}

canonical_decompiled_code:
int __fastcall func0(const char *a1, __int64 a2)
{
bool v3; // cf
bool v4; // zf
const char *v6; // rdi
__int64 v7; // rcx
const char *v8; // rsi
int result; // eax
bool v10; // al
bool v11; // cf
bool v12; // zf
const char *v13; // rdi
__int64 v14; // rcx
const char *v15; // rsi

v3 = 0;
v4 = a2 == 0;
if ( a2 )
{
v6 = "$load";
v7 = 6LL;
v8 = a1;
do
{
if ( !v7 )
break;
v3 = *v8 < (unsigned int)*v6;
v4 = *v8++ == *v6++;
--v7;
}
while ( v4 );
if ( (!v3 && !v4) == v3 )
return load_lib(a2, v8);
return yyerror("unknown command: %s", a1);
}
if ( !strcmp(a1, "$exit") || (v10 = strcmp(a1, "$quit") != 0, v11 = 0, v12 = !v10) )
{
result = qflag;
if ( !qflag )
result = puts("Goodbye!");
program_running = 0;
}
else
{
v13 = "$fly";
v14 = 5LL;
v15 = a1;
do
{
if ( !v14 )
break;
v11 = *v15 < (unsigned int)*v13;
v12 = *v15++ == *v13++;
--v14;
}
while ( v12 );
if ( (!v11 && !v12) != v11 )
return yyerror("unknown command: %s", a1);
cmd_print("You throw yourself at the ground and smash face-first into the mud.", v15);
result = cmd_print("Why on earth did you think that would ever work?!", v15);
}
return result;
}

original_code:
void run_command(const char* cmd, const char* arg) {
    if (arg == ((void *)0)) {
        if (strcmp(cmd, "$exit") == 0 || strcmp(cmd, "$quit") == 0) {
            if (!qflag) printf("Goodbye!\n");
            program_running = 0;
  } else if (strcmp(cmd, "$fly") == 0) {
   cmd_print("You throw yourself at the ground and smash face-first into the mud.");
      cmd_print("Why on earth did you think that would ever work?!");
        } else {
            yyerror("unknown command: %s", cmd);
        }
    } else {
        if (strcmp(cmd, "$load") == 0) {
            load_lib(arg);
        } else {
            yyerror("unknown command: %s", cmd);
        }
    }
}

canonical_original_code:
void run_command(char *cmd, char *arg) {
    if (arg == ((void *)0)) {
        if (strcmp(cmd, "$exit") == 0 || strcmp(cmd, "$quit") == 0) {
            if (!qflag) printf("Goodbye!\n");
            program_running = 0;
  } else if (strcmp(cmd, "$fly") == 0) {
   cmd_print("You throw yourself at the ground and smash face-first into the mud.");
      cmd_print("Why on earth did you think that would ever work?!");
        } else {
            yyerror("unknown command: %s", cmd);
        }
    } else {
        if (strcmp(cmd, "$load") == 0) {
            load_lib(arg);
        } else {
            yyerror("unknown command: %s", cmd);
        }
    }
}

variable_types:
cmd
char *

variable_types:
arg
char *


decompiled_code:
void clear_sym_table()
{
void **i; // rbp
void *v1; // rdi

for ( i = (void **)sym_table; sym_table; i = (void **)sym_table )
{
v1 = *i;
sym_table = i[4];
if ( v1 )
free(v1);
free(i);
}
}

canonical_decompiled_code:
void func0()
{
void **i; // rbp
void *v1; // rdi

for ( i = (void **)sym_table; sym_table; i = (void **)sym_table )
{
v1 = *i;
sym_table = i[4];
if ( v1 )
free(v1);
free(i);
}
}

original_code:
void clear_sym_table(void) {
    SymRec* temp = sym_table;
    for (; temp != ((void *)0); temp = sym_table) {
        sym_table = temp->next;
        if (temp->name) free(temp->name);
        free(temp);
    }
}

canonical_original_code:
void clear_sym_table() {
    struct SymRec *temp = sym_table;
    for (; temp != ((void *)0); temp = sym_table) {
        sym_table = temp->next;
        if (temp->name) free(temp->name);
        free(temp);
    }
}

variable_types: struct SymRec { char *name; int init; char type; union { long double (*func)(long double arg); long double var; } value; struct SymRec *next; } *


main

canonical_name: main

repo: SeanHogan/webscale-db

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v4; // r15
int v5; // eax
int v6; // ebx
unsigned int v7; // er15
const char *v8; // rdi
__int64 v9; // rsi
const char *v10; // rax
int v11; // eax
unsigned int v12; // er15
const char *v13; // rdi
const char *v14; // rax
int v15; // eax
unsigned int v16; // eax
int v17; // [rsp+Ch] [rbp-6Ch]
int v18; // [rsp+1Ch] [rbp-5Ch]
__int64 v19; // [rsp+20h] [rbp-58h]
void *ptr; // [rsp+28h] [rbp-50h] BYREF

if ( argc == 2 )
{
v17 = chidb_open();
if ( v17 )
{
fprintf(stderr, "ERROR: Could not open file %s or file is not well formed.\n", argv[1]);
return 1;
}
el_init();
el_set();
el_set();
if ( !history_init() )
{
fwrite("ERROR: Could not initialize history.\n", 1uLL, 0x25uLL, stderr);
return 1;
}
history();
el_set();
while ( 1 )
{
while ( 1 )
{
v4 = el_gets();
if ( v18 == 1 )
{
history_end();
el_end();
return v17;
}
history();
v5 = chidb_prepare(v19, v4, &ptr);
if ( !v5 )
break;
if ( v5 == 1 )
{
puts("SQL syntax error.");
}
else if ( v5 == 2 )
{
puts("ERROR: Could not allocate memory.");
}
}
v6 = chidb_column_count(ptr);
if ( v6 > 0 )
{
v7 = 0;
v8 = "";
do
{
printf(v8);
v9 = v7++;
v10 = (const char *)chidb_column_name(ptr, v9);
printf("%s", v10);
v8 = "|";
}
while ( v6 != v7 );
}
LABEL_16:
while ( 1 )
{
putchar(10);
v11 = chidb_step(ptr);
if ( v11 != 100 )
break;
v12 = 0;
v13 = "";
if ( v6 > 0 )
{
while ( 1 )
{
printf(v13);
v15 = chidb_column_type(ptr, v12);
if ( v15 == 4 )
goto LABEL_25;
if ( v15 > 4 )
{
if ( v15 == 13 )
{
v14 = (const char *)chidb_column_text(ptr, v12);
printf("%s", v14);
}
goto LABEL_21;
}
if ( (unsigned int)(v15 - 1) <= 1 )
{
LABEL_25:
v16 = chidb_column_int(ptr, v12);
printf("%i", v16);
}
LABEL_21:
++v12;
v13 = "|";
if ( v6 == v12 )
goto LABEL_16;
}
}
}
if ( v11 == 7 )
{
puts("ERROR: An I/O error has occurred when accessing the file.");
}
else if ( v11 > 7 )
{
if ( v11 == 8 )
puts("ERROR: API used incorrectly.");
}
else if ( v11 == 5 )
{
puts("ERROR: SQL statement failed because of a constraint violation.");
}
else if ( v11 == 6 )
{
puts("ERROR: Data type mismatch.");
}
if ( (unsigned int)chidb_finalize(ptr) == 8 )
puts("API used incorrectly.");
}
}
fwrite("ERROR: Must specify a database file.\n", 1uLL, 0x25uLL, stderr);
return 1;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v4; // r15
int v5; // eax
int v6; // ebx
unsigned int v7; // er15
const char *v8; // rdi
__int64 v9; // rsi
const char *v10; // rax
int v11; // eax
unsigned int v12; // er15
const char *v13; // rdi
const char *v14; // rax
int v15; // eax
unsigned int v16; // eax
int v17; // [rsp+Ch] [rbp-6Ch]
int v18; // [rsp+1Ch] [rbp-5Ch]
__int64 v19; // [rsp+20h] [rbp-58h]
void *ptr; // [rsp+28h] [rbp-50h] BYREF

if ( argc == 2 )
{
v17 = chidb_open();
if ( v17 )
{
fprintf(stderr, "ERROR: Could not open file %s or file is not well formed.\n", argv[1]);
return 1;
}
el_init();
el_set();
el_set();
if ( !history_init() )
{
fwrite("ERROR: Could not initialize history.\n", 1uLL, 0x25uLL, stderr);
return 1;
}
func1();
el_set();
while ( 1 )
{
while ( 1 )
{
v4 = el_gets();
if ( v18 == 1 )
{
history_end();
el_end();
return v17;
}
func1();
v5 = func10(v19, v4, &ptr);
if ( !v5 )
break;
if ( v5 == 1 )
{
puts("SQL syntax error.");
}
else if ( v5 == 2 )
{
puts("ERROR: Could not allocate memory.");
}
}
v6 = func13(ptr);
if ( v6 > 0 )
{
v7 = 0;
v8 = "";
do
{
printf(v8);
v9 = v7++;
v10 = (const char *)func15(ptr, v9);
printf("%s", v10);
v8 = "|";
}
while ( v6 != v7 );
}
LABEL_16:
while ( 1 )
{
putchar(10);
v11 = func11(ptr);
if ( v11 != 100 )
break;
v12 = 0;
v13 = "";
if ( v6 > 0 )
{
while ( 1 )
{
printf(v13);
v15 = func14(ptr, v12);
if ( v15 == 4 )
goto LABEL_25;
if ( v15 > 4 )
{
if ( v15 == 13 )
{
v14 = (const char *)chidb_column_text(ptr, v12);
printf("%s", v14);
}
goto LABEL_21;
}
if ( (unsigned int)(v15 - 1) <= 1 )
{
LABEL_25:
v16 = func16(ptr, v12);
printf("%i", v16);
}
LABEL_21:
++v12;
v13 = "|";
if ( v6 == v12 )
goto LABEL_16;
}
}
}
if ( v11 == 7 )
{
puts("ERROR: An I/O error has occurred when accessing the file.");
}
else if ( v11 > 7 )
{
if ( v11 == 8 )
puts("ERROR: API used incorrectly.");
}
else if ( v11 == 5 )
{
puts("ERROR: SQL statement failed because of a constraint violation.");
}
else if ( v11 == 6 )
{
puts("ERROR: Data type mismatch.");
}
if ( (unsigned int)func12(ptr) == 8 )
puts("API used incorrectly.");
}
}
fwrite("ERROR: Must specify a database file.\n", 1uLL, 0x25uLL, stderr);
return 1;
}

original_code:
int main()
{
 if (CUE_SUCCESS != CU_initialize_registry())
  return CU_get_error();
 init_tests_utils();
 init_tests_dbrecord();
 init_tests_pager();
 init_tests_btree();
 CU_basic_set_mode(CU_BRM_VERBOSE);
 CU_basic_run_tests();
 CU_cleanup_registry();
 return CU_get_error();
}

return_type: int


decompiled_code:
__int64 test_string()
{
const char **v0; // rbx
int v1; // eax
int v2; // eax
size_t v3; // rax
__int64 result; // rax
int v5; // [rsp+Ch] [rbp-1Ch] BYREF
__int64 v6; // [rsp+10h] [rbp-18h] BYREF
char *s2; // [rsp+18h] [rbp-10h] BYREF

v0 = (const char **)str_values;
do
{
chidb_DBRecord_create(&v6, &unk_BA1, *v0);
CU_assertImplementation(*(_BYTE *)(v6 + 12) == 1, 19LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
chidb_DBRecord_getString(v6, 0LL, &s2);
v1 = chidb_DBRecord_getType(v6, 0LL);
CU_assertImplementation(
v1 == 13,
21LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_TEXT)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v2 = strcmp(*v0, s2);
CU_assertImplementation(
v2 == 0,
22LL,
"CU_ASSERT_STRING_EQUAL(str_values[i],val)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getStringLength(v6, 0LL, &v5);
v3 = strlen(*v0++);
CU_assertImplementation(
v5 == v3,
24LL,
"CU_ASSERT_EQUAL(strlen(str_values[i]),len)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
result = chidb_DBRecord_destroy(v6);
}
while ( v0 != (const char **)&str_values[8] );
return result;
}

canonical_decompiled_code:
__int64 func0()
{
const char **v0; // rbx
int v1; // eax
int v2; // eax
size_t v3; // rax
__int64 result; // rax
int v5; // [rsp+Ch] [rbp-1Ch] BYREF
__int64 v6; // [rsp+10h] [rbp-18h] BYREF
char *s2; // [rsp+18h] [rbp-10h] BYREF

v0 = (const char **)str_values;
do
{
chidb_DBRecord_create(&v6, &unk_BA1, *v0);
CU_assertImplementation(*(_BYTE *)(v6 + 12) == 1, 19LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
chidb_DBRecord_getString(v6, 0LL, &s2);
v1 = chidb_DBRecord_getType(v6, 0LL);
CU_assertImplementation(
v1 == 13,
21LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_TEXT)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v2 = strcmp(*v0, s2);
CU_assertImplementation(
v2 == 0,
22LL,
"CU_ASSERT_STRING_EQUAL(str_values[i],val)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getStringLength(v6, 0LL, &v5);
v3 = strlen(*v0++);
CU_assertImplementation(
v5 == v3,
24LL,
"CU_ASSERT_EQUAL(strlen(str_values[i]),len)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
result = chidb_DBRecord_destroy(v6);
}
while ( v0 != (const char **)&str_values[8] );
return result;
}

original_code:
void test_string(void)
{
 for(int i=0; i<(8); i++)
 {
  DBRecord *dbr;
  char *val; int len;
  chidb_DBRecord_create(&dbr, "|s|", str_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 19, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getString(dbr, 0, &val);
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((13))), 21, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_TEXT" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(!(strcmp((const char*)(str_values[i]), (const char*)(val))), 22, ("CU_ASSERT_STRING_EQUAL(" "str_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getStringLength(dbr, 0, &len);
  { CU_assertImplementation(((strlen(str_values[i])) == (len)), 24, ("CU_ASSERT_EQUAL(" "strlen(str_values[i])" "," "len" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

canonical_original_code:
void test_string()
{
 for(int i = 0; i<(8); i++)
 {
  struct DBRecord *dbr;
  char *val; int len;
  chidb_DBRecord_create(&dbr, "|s|", str_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 19, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getString(dbr, 0, &val);
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((13))), 21, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_TEXT" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(!(strcmp((char *)(str_values[i]), (char *)(val))), 22, ("CU_ASSERT_STRING_EQUAL(" "str_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getStringLength(dbr, 0, &len);
  { CU_assertImplementation(((strlen(str_values[i])) == (len)), 24, ("CU_ASSERT_EQUAL(" "strlen(str_values[i])" "," "len" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

variable_types: struct DBRecord { unsigned char *data; unsigned int data_len; unsigned char nfields; unsigned int packed_len; unsigned int *types; unsigned int *offsets; } *

variable_types:
val
char *


decompiled_code:
__int64 __fastcall test_null(__int64 a1, __int64 a2, __int64 a3)
{
int v3; // eax
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

chidb_DBRecord_create(&v5, "|0|", a3);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 79LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v3 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v3 == 0,
80LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_NULL)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
return chidb_DBRecord_destroy(v5);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3)
{
int v3; // eax
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

chidb_DBRecord_create(&v5, "|0|", a3);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 79LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v3 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v3 == 0,
80LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_NULL)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
return chidb_DBRecord_destroy(v5);
}

original_code:
void test_null(void)
{
 DBRecord *dbr;
 chidb_DBRecord_create(&dbr, "|0|");
 { CU_assertImplementation((dbr->nfields == 1), 79, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
 { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((0))), 80, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_NULL" ")"), "tests-dbrecord.c", "", 0); };
 chidb_DBRecord_destroy(dbr);
}

canonical_original_code:
void test_null()
{
 struct DBRecord *dbr;
 chidb_DBRecord_create(&dbr, "|0|");
 { CU_assertImplementation((dbr->nfields == 1), 79, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
 { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((0))), 80, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_NULL" ")"), "tests-dbrecord.c", "", 0); };
 chidb_DBRecord_destroy(dbr);
}

user_defined_types: struct DBRecord { unsigned char *data; unsigned int data_len; unsigned char nfields; unsigned int packed_len; unsigned int *types; unsigned int *offsets; }


decompiled_code:
__int64 test_int8()
{
char *v0; // rbx
int v1; // eax
_BOOL8 v2; // rdi
__int64 result; // rax
unsigned __int8 v4; // [rsp+7h] [rbp-11h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v0 = &int8_values;
do
{
chidb_DBRecord_create(&v5, "|i1|", (unsigned int)*v0);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 36LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v1 == 1,
37LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_INTEGER_1BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt8(v5, 0LL, &v4);
v2 = *v0++ == (char)v4;
CU_assertImplementation(v2, 39LL, "CU_ASSERT_EQUAL(int8_values[i],val)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v5);
}
while ( v0 != &int8_values + 8 );
return result;
}

canonical_decompiled_code:
__int64 func2()
{
char *v0; // rbx
int v1; // eax
_BOOL8 v2; // rdi
__int64 result; // rax
unsigned __int8 v4; // [rsp+7h] [rbp-11h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v0 = &int8_values;
do
{
chidb_DBRecord_create(&v5, "|i1|", (unsigned int)*v0);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 36LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v1 == 1,
37LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_INTEGER_1BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt8(v5, 0LL, &v4);
v2 = *v0++ == (char)v4;
CU_assertImplementation(v2, 39LL, "CU_ASSERT_EQUAL(int8_values[i],val)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v5);
}
while ( v0 != &int8_values + 8 );
return result;
}

original_code:
void test_int8(void)
{
 for(int i=0; i<(8); i++)
 {
  DBRecord *dbr;
  int8_t val;
  chidb_DBRecord_create(&dbr, "|i1|", int8_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 36, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((1))), 37, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_INTEGER_1BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt8(dbr, 0, &val);
  { CU_assertImplementation(((int8_values[i]) == (val)), 39, ("CU_ASSERT_EQUAL(" "int8_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

canonical_original_code:
void test_int8()
{
 for(int i = 0; i<(8); i++)
 {
  struct DBRecord *dbr;
  char val;
  chidb_DBRecord_create(&dbr, "|i1|", int8_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 36, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((1))), 37, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_INTEGER_1BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt8(dbr, 0, &val);
  { CU_assertImplementation(((int8_values[i]) == (val)), 39, ("CU_ASSERT_EQUAL(" "int8_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

variable_types: val char


decompiled_code:
__int64 test_int16()
{
__int16 *v0; // rbx
int v1; // eax
_BOOL8 v2; // rdi
__int64 result; // rax
unsigned __int16 v4; // [rsp+6h] [rbp-12h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v0 = &int16_values;
do
{
chidb_DBRecord_create(&v5, "|i2|", (unsigned int)*v0);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 51LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v1 == 2,
52LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_INTEGER_2BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt16(v5, 0LL, &v4);
v2 = *v0++ == (__int16)v4;
CU_assertImplementation(v2, 54LL, "CU_ASSERT_EQUAL(int16_values[i],val)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v5);
}
while ( v0 != &int16_values + 8 );
return result;
}

canonical_decompiled_code:
__int64 func3()
{
__int16 *v0; // rbx
int v1; // eax
_BOOL8 v2; // rdi
__int64 result; // rax
unsigned __int16 v4; // [rsp+6h] [rbp-12h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v0 = &int16_values;
do
{
chidb_DBRecord_create(&v5, "|i2|", (unsigned int)*v0);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 51LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v1 == 2,
52LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_INTEGER_2BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt16(v5, 0LL, &v4);
v2 = *v0++ == (__int16)v4;
CU_assertImplementation(v2, 54LL, "CU_ASSERT_EQUAL(int16_values[i],val)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v5);
}
while ( v0 != &int16_values + 8 );
return result;
}

original_code:
void test_int16(void)
{
 for(int i=0; i<(8); i++)
 {
  DBRecord *dbr;
  int16_t val;
  chidb_DBRecord_create(&dbr, "|i2|", int16_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 51, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((2))), 52, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_INTEGER_2BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt16(dbr, 0, &val);
  { CU_assertImplementation(((int16_values[i]) == (val)), 54, ("CU_ASSERT_EQUAL(" "int16_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

canonical_original_code:
void test_int16()
{
 for(int i = 0; i<(8); i++)
 {
  struct DBRecord *dbr;
  short val;
  chidb_DBRecord_create(&dbr, "|i2|", int16_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 51, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((2))), 52, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_INTEGER_2BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt16(dbr, 0, &val);
  { CU_assertImplementation(((int16_values[i]) == (val)), 54, ("CU_ASSERT_EQUAL(" "int16_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

variable_types: val short


decompiled_code:
__int64 test_int32()
{
int *v0; // rbx
int v1; // eax
_BOOL8 v2; // rdi
__int64 result; // rax
int v4; // [rsp+4h] [rbp-14h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v0 = &int32_values;
do
{
chidb_DBRecord_create(&v5, "|i4|", (unsigned int)*v0);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 66LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v1 == 4,
67LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_INTEGER_4BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt32(v5, 0LL, &v4);
v2 = *v0++ == v4;
CU_assertImplementation(v2, 69LL, "CU_ASSERT_EQUAL(int32_values[i],val)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v5);
}
while ( v0 != &int32_values + 8 );
return result;
}

canonical_decompiled_code:
__int64 func4()
{
int *v0; // rbx
int v1; // eax
_BOOL8 v2; // rdi
__int64 result; // rax
int v4; // [rsp+4h] [rbp-14h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v0 = &int32_values;
do
{
chidb_DBRecord_create(&v5, "|i4|", (unsigned int)*v0);
CU_assertImplementation(*(_BYTE *)(v5 + 12) == 1, 66LL, "dbr->nfields == 1", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v5, 0LL);
CU_assertImplementation(
v1 == 4,
67LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_INTEGER_4BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt32(v5, 0LL, &v4);
v2 = *v0++ == v4;
CU_assertImplementation(v2, 69LL, "CU_ASSERT_EQUAL(int32_values[i],val)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v5);
}
while ( v0 != &int32_values + 8 );
return result;
}

original_code:
void test_int32(void)
{
 for(int i=0; i<(8); i++)
 {
  DBRecord *dbr;
  int32_t val;
  chidb_DBRecord_create(&dbr, "|i4|", int32_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 66, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((4))), 67, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_INTEGER_4BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt32(dbr, 0, &val);
  { CU_assertImplementation(((int32_values[i]) == (val)), 69, ("CU_ASSERT_EQUAL(" "int32_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

canonical_original_code:
void test_int32()
{
 for(int i = 0; i<(8); i++)
 {
  struct DBRecord *dbr;
  int val;
  chidb_DBRecord_create(&dbr, "|i4|", int32_values[i]);
  { CU_assertImplementation((dbr->nfields == 1), 66, "dbr->nfields == 1", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((4))), 67, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_INTEGER_4BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt32(dbr, 0, &val);
  { CU_assertImplementation(((int32_values[i]) == (val)), 69, ("CU_ASSERT_EQUAL(" "int32_values[i]" "," "val" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

variable_types: val int


decompiled_code:
__int64 test_multiplefields()
{
__int64 i; // rbx
int v1; // eax
int v2; // eax
size_t v3; // rax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
_BOOL8 v8; // rdi
__int64 result; // rax
char v10; // [rsp+5h] [rbp-23h] BYREF
__int16 v11; // [rsp+6h] [rbp-22h] BYREF
int v12; // [rsp+8h] [rbp-20h] BYREF
int v13; // [rsp+Ch] [rbp-1Ch] BYREF
__int64 v14; // [rsp+10h] [rbp-18h] BYREF
char *s2; // [rsp+18h] [rbp-10h] BYREF

for ( i = 0LL; i != 8; ++i )
{
chidb_DBRecord_create(&v14, "|s|0|i1|i2|i4|", str_values[i]);
CU_assertImplementation(*(_BYTE *)(v14 + 12) == 5, 93LL, "dbr->nfields == 5", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v14, 0LL);
CU_assertImplementation(
v1 == 13,
95LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_TEXT)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getString(v14, 0LL, &s2);
v2 = strcmp(str_values[i], s2);
CU_assertImplementation(v2 == 0, 97LL, "CU_ASSERT_STRING_EQUAL(str_values[i],s)", "tests-dbrecord.c", &unk_BA5, 0LL);
chidb_DBRecord_getStringLength(v14, 0LL, &v13);
v3 = strlen(str_values[i]);
CU_assertImplementation(
v13 == v3,
99LL,
"CU_ASSERT_EQUAL(strlen(str_values[i]),len)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v4 = chidb_DBRecord_getType(v14, 1LL);
CU_assertImplementation(
v4 == 0,
101LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 1),SQL_NULL)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v5 = chidb_DBRecord_getType(v14, 2LL);
CU_assertImplementation(
v5 == 1,
103LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 2),SQL_INTEGER_1BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt8(v14, 2LL, &v10);
CU_assertImplementation(
int8_values[i] == v10,
105LL,
"CU_ASSERT_EQUAL(int8_values[i],i8)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v6 = chidb_DBRecord_getType(v14, 3LL);
CU_assertImplementation(
v6 == 2,
107LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 3),SQL_INTEGER_2BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt16(v14, 3LL, &v11);
CU_assertImplementation(
int16_values[i] == v11,
109LL,
"CU_ASSERT_EQUAL(int16_values[i],i16)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v7 = chidb_DBRecord_getType(v14, 4LL);
CU_assertImplementation(
v7 == 4,
111LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 4),SQL_INTEGER_4BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt32(v14, 4LL, &v12);
v8 = int32_values[i] == v12;
CU_assertImplementation(v8, 113LL, "CU_ASSERT_EQUAL(int32_values[i],i32)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v14);
}
return result;
}

canonical_decompiled_code:
__int64 func5()
{
__int64 i; // rbx
int v1; // eax
int v2; // eax
size_t v3; // rax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
_BOOL8 v8; // rdi
__int64 result; // rax
char v10; // [rsp+5h] [rbp-23h] BYREF
__int16 v11; // [rsp+6h] [rbp-22h] BYREF
int v12; // [rsp+8h] [rbp-20h] BYREF
int v13; // [rsp+Ch] [rbp-1Ch] BYREF
__int64 v14; // [rsp+10h] [rbp-18h] BYREF
char *s2; // [rsp+18h] [rbp-10h] BYREF

for ( i = 0LL; i != 8; ++i )
{
chidb_DBRecord_create(&v14, "|s|0|i1|i2|i4|", str_values[i]);
CU_assertImplementation(*(_BYTE *)(v14 + 12) == 5, 93LL, "dbr->nfields == 5", "tests-dbrecord.c", &unk_BA5, 0LL);
v1 = chidb_DBRecord_getType(v14, 0LL);
CU_assertImplementation(
v1 == 13,
95LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 0),SQL_TEXT)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getString(v14, 0LL, &s2);
v2 = strcmp(str_values[i], s2);
CU_assertImplementation(v2 == 0, 97LL, "CU_ASSERT_STRING_EQUAL(str_values[i],s)", "tests-dbrecord.c", &unk_BA5, 0LL);
chidb_DBRecord_getStringLength(v14, 0LL, &v13);
v3 = strlen(str_values[i]);
CU_assertImplementation(
v13 == v3,
99LL,
"CU_ASSERT_EQUAL(strlen(str_values[i]),len)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v4 = chidb_DBRecord_getType(v14, 1LL);
CU_assertImplementation(
v4 == 0,
101LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 1),SQL_NULL)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v5 = chidb_DBRecord_getType(v14, 2LL);
CU_assertImplementation(
v5 == 1,
103LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 2),SQL_INTEGER_1BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt8(v14, 2LL, &v10);
CU_assertImplementation(
int8_values[i] == v10,
105LL,
"CU_ASSERT_EQUAL(int8_values[i],i8)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v6 = chidb_DBRecord_getType(v14, 3LL);
CU_assertImplementation(
v6 == 2,
107LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 3),SQL_INTEGER_2BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt16(v14, 3LL, &v11);
CU_assertImplementation(
int16_values[i] == v11,
109LL,
"CU_ASSERT_EQUAL(int16_values[i],i16)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v7 = chidb_DBRecord_getType(v14, 4LL);
CU_assertImplementation(
v7 == 4,
111LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr, 4),SQL_INTEGER_4BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt32(v14, 4LL, &v12);
v8 = int32_values[i] == v12;
CU_assertImplementation(v8, 113LL, "CU_ASSERT_EQUAL(int32_values[i],i32)", "tests-dbrecord.c", &unk_BA5, 0LL);
result = chidb_DBRecord_destroy(v14);
}
return result;
}

original_code:
void test_multiplefields(void)
{
 DBRecord *dbr;
 char *s; int8_t i8; int16_t i16; int32_t i32;
 int len;
 for(int i=0; i<(8); i++)
 {
  chidb_DBRecord_create(&dbr, "|s|0|i1|i2|i4|", str_values[i], int8_values[i], int16_values[i], int32_values[i]);
  { CU_assertImplementation((dbr->nfields == 5), 93, "dbr->nfields == 5", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((13))), 95, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_TEXT" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getString(dbr, 0, &s);
  { CU_assertImplementation(!(strcmp((const char*)(str_values[i]), (const char*)(s))), 97, ("CU_ASSERT_STRING_EQUAL(" "str_values[i]" "," "s" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getStringLength(dbr, 0, &len);
  { CU_assertImplementation(((strlen(str_values[i])) == (len)), 99, ("CU_ASSERT_EQUAL(" "strlen(str_values[i])" "," "len" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 1)) == ((0))), 101, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 1)" "," "SQL_NULL" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 2)) == ((1))), 103, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 2)" "," "SQL_INTEGER_1BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt8(dbr, 2, &i8);
  { CU_assertImplementation(((int8_values[i]) == (i8)), 105, ("CU_ASSERT_EQUAL(" "int8_values[i]" "," "i8" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 3)) == ((2))), 107, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 3)" "," "SQL_INTEGER_2BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt16(dbr, 3, &i16);
  { CU_assertImplementation(((int16_values[i]) == (i16)), 109, ("CU_ASSERT_EQUAL(" "int16_values[i]" "," "i16" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 4)) == ((4))), 111, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 4)" "," "SQL_INTEGER_4BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt32(dbr, 4, &i32);
  { CU_assertImplementation(((int32_values[i]) == (i32)), 113, ("CU_ASSERT_EQUAL(" "int32_values[i]" "," "i32" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

canonical_original_code:
void test_multiplefields()
{
 struct DBRecord *dbr;
 char *s; char i8; short i16; int i32;
 int len;
 for(int i = 0; i<(8); i++)
 {
  chidb_DBRecord_create(&dbr, "|s|0|i1|i2|i4|", str_values[i], int8_values[i], int16_values[i], int32_values[i]);
  { CU_assertImplementation((dbr->nfields == 5), 93, "dbr->nfields == 5", "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 0)) == ((13))), 95, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 0)" "," "SQL_TEXT" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getString(dbr, 0, &s);
  { CU_assertImplementation(!(strcmp((char *)(str_values[i]), (char *)(s))), 97, ("CU_ASSERT_STRING_EQUAL(" "str_values[i]" "," "s" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getStringLength(dbr, 0, &len);
  { CU_assertImplementation(((strlen(str_values[i])) == (len)), 99, ("CU_ASSERT_EQUAL(" "strlen(str_values[i])" "," "len" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 1)) == ((0))), 101, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 1)" "," "SQL_NULL" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 2)) == ((1))), 103, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 2)" "," "SQL_INTEGER_1BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt8(dbr, 2, &i8);
  { CU_assertImplementation(((int8_values[i]) == (i8)), 105, ("CU_ASSERT_EQUAL(" "int8_values[i]" "," "i8" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 3)) == ((2))), 107, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 3)" "," "SQL_INTEGER_2BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt16(dbr, 3, &i16);
  { CU_assertImplementation(((int16_values[i]) == (i16)), 109, ("CU_ASSERT_EQUAL(" "int16_values[i]" "," "i16" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr, 4)) == ((4))), 111, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr, 4)" "," "SQL_INTEGER_4BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt32(dbr, 4, &i32);
  { CU_assertImplementation(((int32_values[i]) == (i32)), 113, ("CU_ASSERT_EQUAL(" "int32_values[i]" "," "i32" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr);
 }
}

variable_types:
s
char *


decompiled_code:
void test_packunpack()
{
__int64 v0; // rbx
int v1; // eax
int v2; // eax
size_t v3; // rax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
_BOOL8 v8; // rdi
char v9; // [rsp+5h] [rbp-33h] BYREF
__int16 v10; // [rsp+6h] [rbp-32h] BYREF
int v11; // [rsp+8h] [rbp-30h] BYREF
int v12; // [rsp+Ch] [rbp-2Ch] BYREF
__int64 v13; // [rsp+10h] [rbp-28h] BYREF
__int64 v14; // [rsp+18h] [rbp-20h] BYREF
char *s2; // [rsp+20h] [rbp-18h] BYREF
void *ptr; // [rsp+28h] [rbp-10h] BYREF

v0 = 0LL;
do
{
chidb_DBRecord_create(&v13, "|s|0|i1|i2|i4|", str_values[v0]);
chidb_DBRecord_pack(v13, &ptr);
chidb_DBRecord_unpack(&v14, ptr);
v1 = chidb_DBRecord_getType(v14, 0LL);
CU_assertImplementation(
v1 == 13,
133LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 0),SQL_TEXT)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getString(v14, 0LL, &s2);
v2 = strcmp(str_values[v0], s2);
CU_assertImplementation(
v2 == 0,
135LL,
"CU_ASSERT_STRING_EQUAL(str_values[i],s)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getStringLength(v14, 0LL, &v12);
v3 = strlen(str_values[v0]);
CU_assertImplementation(
v12 == v3,
137LL,
"CU_ASSERT_EQUAL(strlen(str_values[i]),len)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v4 = chidb_DBRecord_getType(v14, 1LL);
CU_assertImplementation(
v4 == 0,
139LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 1),SQL_NULL)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v5 = chidb_DBRecord_getType(v14, 2LL);
CU_assertImplementation(
v5 == 1,
141LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 2),SQL_INTEGER_1BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt8(v14, 2LL, &v9);
CU_assertImplementation(
int8_values[v0] == v9,
143LL,
"CU_ASSERT_EQUAL(int8_values[i],i8)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v6 = chidb_DBRecord_getType(v14, 3LL);
CU_assertImplementation(
v6 == 2,
145LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 3),SQL_INTEGER_2BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt16(v14, 3LL, &v10);
CU_assertImplementation(
int16_values[v0] == v10,
147LL,
"CU_ASSERT_EQUAL(int16_values[i],i16)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v7 = chidb_DBRecord_getType(v14, 4LL);
CU_assertImplementation(
v7 == 4,
149LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 4),SQL_INTEGER_4BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt32(v14, 4LL, &v11);
v8 = int32_values[v0++] == v11;
CU_assertImplementation(v8, 151LL, "CU_ASSERT_EQUAL(int32_values[i],i32)", "tests-dbrecord.c", &unk_BA5, 0LL);
chidb_DBRecord_destroy(v13);
chidb_DBRecord_destroy(v14);
free(ptr);
}
while ( v0 != 8 );
}

canonical_decompiled_code:
void func6()
{
__int64 v0; // rbx
int v1; // eax
int v2; // eax
size_t v3; // rax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
_BOOL8 v8; // rdi
char v9; // [rsp+5h] [rbp-33h] BYREF
__int16 v10; // [rsp+6h] [rbp-32h] BYREF
int v11; // [rsp+8h] [rbp-30h] BYREF
int v12; // [rsp+Ch] [rbp-2Ch] BYREF
__int64 v13; // [rsp+10h] [rbp-28h] BYREF
__int64 v14; // [rsp+18h] [rbp-20h] BYREF
char *s2; // [rsp+20h] [rbp-18h] BYREF
void *ptr; // [rsp+28h] [rbp-10h] BYREF

v0 = 0LL;
do
{
chidb_DBRecord_create(&v13, "|s|0|i1|i2|i4|", str_values[v0]);
chidb_DBRecord_pack(v13, &ptr);
chidb_DBRecord_unpack(&v14, ptr);
v1 = chidb_DBRecord_getType(v14, 0LL);
CU_assertImplementation(
v1 == 13,
133LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 0),SQL_TEXT)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getString(v14, 0LL, &s2);
v2 = strcmp(str_values[v0], s2);
CU_assertImplementation(
v2 == 0,
135LL,
"CU_ASSERT_STRING_EQUAL(str_values[i],s)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getStringLength(v14, 0LL, &v12);
v3 = strlen(str_values[v0]);
CU_assertImplementation(
v12 == v3,
137LL,
"CU_ASSERT_EQUAL(strlen(str_values[i]),len)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v4 = chidb_DBRecord_getType(v14, 1LL);
CU_assertImplementation(
v4 == 0,
139LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 1),SQL_NULL)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v5 = chidb_DBRecord_getType(v14, 2LL);
CU_assertImplementation(
v5 == 1,
141LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 2),SQL_INTEGER_1BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt8(v14, 2LL, &v9);
CU_assertImplementation(
int8_values[v0] == v9,
143LL,
"CU_ASSERT_EQUAL(int8_values[i],i8)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v6 = chidb_DBRecord_getType(v14, 3LL);
CU_assertImplementation(
v6 == 2,
145LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 3),SQL_INTEGER_2BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt16(v14, 3LL, &v10);
CU_assertImplementation(
int16_values[v0] == v10,
147LL,
"CU_ASSERT_EQUAL(int16_values[i],i16)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
v7 = chidb_DBRecord_getType(v14, 4LL);
CU_assertImplementation(
v7 == 4,
149LL,
"CU_ASSERT_EQUAL(chidb_DBRecord_getType(dbr2, 4),SQL_INTEGER_4BYTE)",
"tests-dbrecord.c",
&unk_BA5,
0LL);
chidb_DBRecord_getInt32(v14, 4LL, &v11);
v8 = int32_values[v0++] == v11;
CU_assertImplementation(v8, 151LL, "CU_ASSERT_EQUAL(int32_values[i],i32)", "tests-dbrecord.c", &unk_BA5, 0LL);
chidb_DBRecord_destroy(v13);
chidb_DBRecord_destroy(v14);
free(ptr);
}
while ( v0 != 8 );
}

original_code:
void test_packunpack(void)
{
 DBRecord *dbr1, *dbr2;
 char *s; int8_t i8; int16_t i16; int32_t i32;
 uint8_t *buf;
 int len;
 for(int i=0; i<(8); i++)
 {
  chidb_DBRecord_create(&dbr1, "|s|0|i1|i2|i4|", str_values[i], int8_values[i], int16_values[i], int32_values[i]);
  chidb_DBRecord_pack(dbr1, &buf);
  chidb_DBRecord_unpack(&dbr2, buf);
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 0)) == ((13))), 133, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 0)" "," "SQL_TEXT" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getString(dbr2, 0, &s);
  { CU_assertImplementation(!(strcmp((const char*)(str_values[i]), (const char*)(s))), 135, ("CU_ASSERT_STRING_EQUAL(" "str_values[i]" "," "s" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getStringLength(dbr2, 0, &len);
  { CU_assertImplementation(((strlen(str_values[i])) == (len)), 137, ("CU_ASSERT_EQUAL(" "strlen(str_values[i])" "," "len" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 1)) == ((0))), 139, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 1)" "," "SQL_NULL" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 2)) == ((1))), 141, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 2)" "," "SQL_INTEGER_1BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt8(dbr2, 2, &i8);
  { CU_assertImplementation(((int8_values[i]) == (i8)), 143, ("CU_ASSERT_EQUAL(" "int8_values[i]" "," "i8" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 3)) == ((2))), 145, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 3)" "," "SQL_INTEGER_2BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt16(dbr2, 3, &i16);
  { CU_assertImplementation(((int16_values[i]) == (i16)), 147, ("CU_ASSERT_EQUAL(" "int16_values[i]" "," "i16" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 4)) == ((4))), 149, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 4)" "," "SQL_INTEGER_4BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt32(dbr2, 4, &i32);
  { CU_assertImplementation(((int32_values[i]) == (i32)), 151, ("CU_ASSERT_EQUAL(" "int32_values[i]" "," "i32" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr1);
  chidb_DBRecord_destroy(dbr2);
  free(buf);
 }
}

canonical_original_code:
void test_packunpack()
{
 struct DBRecord *dbr1; struct DBRecord *dbr2;
 char *s; char i8; short i16; int i32;
 unsigned char *buf;
 int len;
 for(int i = 0; i<(8); i++)
 {
  chidb_DBRecord_create(&dbr1, "|s|0|i1|i2|i4|", str_values[i], int8_values[i], int16_values[i], int32_values[i]);
  chidb_DBRecord_pack(dbr1, &buf);
  chidb_DBRecord_unpack(&dbr2, buf);
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 0)) == ((13))), 133, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 0)" "," "SQL_TEXT" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getString(dbr2, 0, &s);
  { CU_assertImplementation(!(strcmp((char *)(str_values[i]), (char *)(s))), 135, ("CU_ASSERT_STRING_EQUAL(" "str_values[i]" "," "s" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getStringLength(dbr2, 0, &len);
  { CU_assertImplementation(((strlen(str_values[i])) == (len)), 137, ("CU_ASSERT_EQUAL(" "strlen(str_values[i])" "," "len" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 1)) == ((0))), 139, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 1)" "," "SQL_NULL" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 2)) == ((1))), 141, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 2)" "," "SQL_INTEGER_1BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt8(dbr2, 2, &i8);
  { CU_assertImplementation(((int8_values[i]) == (i8)), 143, ("CU_ASSERT_EQUAL(" "int8_values[i]" "," "i8" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 3)) == ((2))), 145, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 3)" "," "SQL_INTEGER_2BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt16(dbr2, 3, &i16);
  { CU_assertImplementation(((int16_values[i]) == (i16)), 147, ("CU_ASSERT_EQUAL(" "int16_values[i]" "," "i16" ")"), "tests-dbrecord.c", "", 0); };
  { CU_assertImplementation(((chidb_DBRecord_getType(dbr2, 4)) == ((4))), 149, ("CU_ASSERT_EQUAL(" "chidb_DBRecord_getType(dbr2, 4)" "," "SQL_INTEGER_4BYTE" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_getInt32(dbr2, 4, &i32);
  { CU_assertImplementation(((int32_values[i]) == (i32)), 151, ("CU_ASSERT_EQUAL(" "int32_values[i]" "," "i32" ")"), "tests-dbrecord.c", "", 0); };
  chidb_DBRecord_destroy(dbr1);
  chidb_DBRecord_destroy(dbr2);
  free(buf);
 }
}

variable_types:
buf
unsigned char *


decompiled_code:
__int64 init_tests_dbrecord()
{
__int64 v0; // rax
__int64 v1; // rbp

v0 = CU_add_suite("dbrecord", 0LL, 0LL);
if ( !v0
|| (v1 = v0, !CU_add_test(v0, "Single-string record", test_string))
|| !CU_add_test(v1, "Single-int8 record", test_int8)
|| !CU_add_test(v1, "Single-int16 record", test_int16)
|| !CU_add_test(v1, "Single-int32 record", test_int32)
|| !CU_add_test(v1, "Single-null record", test_null)
|| !CU_add_test(v1, "Multiple-field record", test_multiplefields)
|| !CU_add_test(v1, "Packing/unpacking a record", test_packunpack) )
{
CU_cleanup_registry();
}
return CU_get_error();
}

canonical_decompiled_code:
__int64 func7()
{
__int64 v0; // rax
__int64 v1; // rbp

v0 = CU_add_suite("dbrecord", 0LL, 0LL);
if ( !v0
|| (v1 = v0, !CU_add_test(v0, "Single-string record", test_string))
|| !CU_add_test(v1, "Single-int8 record", test_int8)
|| !CU_add_test(v1, "Single-int16 record", test_int16)
|| !CU_add_test(v1, "Single-int32 record", test_int32)
|| !CU_add_test(v1, "Single-null record", test_null)
|| !CU_add_test(v1, "Multiple-field record", test_multiplefields)
|| !CU_add_test(v1, "Packing/unpacking a record", test_packunpack) )
{
CU_cleanup_registry();
}
return CU_get_error();
}

original_code:
int init_tests_dbrecord()
{
 CU_pSuite dbrecordTests = ((void *)0);
 dbrecordTests = CU_add_suite("dbrecord", ((void *)0), ((void *)0));
 if (((void *)0) == dbrecordTests)
 {
  CU_cleanup_registry();
  return CU_get_error();
 }
 if (
  (((void *)0) == CU_add_test(dbrecordTests, "Single-string record", test_string)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-int8 record", test_int8)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-int16 record", test_int16)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-int32 record", test_int32)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-null record", test_null))||
  (((void *)0) == CU_add_test(dbrecordTests, "Multiple-field record", test_multiplefields))||
  (((void *)0) == CU_add_test(dbrecordTests, "Packing/unpacking a record", test_packunpack))
    )
    {
      CU_cleanup_registry();
      return CU_get_error();
   }
 return CU_get_error();
}

canonical_original_code:
int init_tests_dbrecord()
{
 struct CU_Suite *dbrecordTests = ((void *)0);
 dbrecordTests = CU_add_suite("dbrecord", ((void *)0), ((void *)0));
 if (((void *)0) == dbrecordTests)
 {
  CU_cleanup_registry();
  return CU_get_error();
 }
 if (
  (((void *)0) == CU_add_test(dbrecordTests, "Single-string record", test_string)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-int8 record", test_int8)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-int16 record", test_int16)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-int32 record", test_int32)) ||
  (((void *)0) == CU_add_test(dbrecordTests, "Single-null record", test_null))||
  (((void *)0) == CU_add_test(dbrecordTests, "Multiple-field record", test_multiplefields))||
  (((void *)0) == CU_add_test(dbrecordTests, "Packing/unpacking a record", test_packunpack))
    )
    {
      CU_cleanup_registry();
      return CU_get_error();
   }
 return CU_get_error();
}

variable_types: struct CU_Suite { char *pName; int fActive; struct CU_Test { char *pName; int fActive; void (*pTestFunc)(); struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t { unsigned long __val[-1]; } __saved_mask; } (*pJumpBuf)[1]; struct CU_Test *pNext; struct CU_Test *pPrev; } *pTest; int (*pInitializeFunc)(); int (*pCleanupFunc)(); void (*pSetUpFunc)(); void (*pTearDownFunc)(); unsigned int uiNumberOfTests; struct CU_Suite *pNext; struct CU_Suite *pPrev; unsigned int uiNumberOfTestsFailed; unsigned int uiNumberOfTestsSuccess; } *

user_defined_types: struct CU_Suite { char *pName; int fActive; struct CU_Test *pTest; int (*pInitializeFunc)(); int (*pCleanupFunc)(); void (*pSetUpFunc)(); void (*pTearDownFunc)(); unsigned int uiNumberOfTests; struct CU_Suite *pNext; struct CU_Suite *pPrev; unsigned int uiNumberOfTestsFailed; unsigned int uiNumberOfTestsSuccess; }

user_defined_types: struct CU_Test { char *pName; int fActive; void (*pTestFunc)(); struct __jmp_buf_tag (*pJumpBuf)[1]; struct CU_Test *pNext; struct CU_Test *pPrev; }

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


yyerror

decompiled_code:
int __fastcall yyerror(const char *a1)
{
return fprintf(stderr, "Error [line %d]: %s\n", yylineno, a1);
}

canonical_decompiled_code:
int __fastcall func0(const char *a1)
{
return fprintf(stderr, "Error [line %d]: %s\n", yylineno, a1);
}

original_code:
void yyerror(char const *str)
{
        fprintf(stderr,"Error [line %d]: %s\n", yylineno, str);
}

canonical_original_code:
void yyerror(char *str)
{
        fprintf(stderr,"Error [line %d]: %s\n", yylineno, str);
}

variable_types:
str
char *


decompiled_code:
__int64 test_getput2byte()
{
char *v0; // rbx
__int64 result; // rax

v0 = (char *)&uint16_values;
do
{
v0 += 2;
result = CU_assertImplementation(1LL, 21LL, "CU_ASSERT_EQUAL(val,uint16_values[i])", "tests-utils.c", &unk_1F1, 0LL);
}
while ( v0 != (char *)&uint16_values + 16 );
return result;
}

canonical_decompiled_code:
__int64 func0()
{
char *v0; // rbx
__int64 result; // rax

v0 = (char *)&uint16_values;
do
{
v0 += 2;
result = CU_assertImplementation(1LL, 21LL, "CU_ASSERT_EQUAL(val,uint16_values[i])", "tests-utils.c", &unk_1F1, 0LL);
}
while ( v0 != (char *)&uint16_values + 16 );
return result;
}

original_code:
void test_getput2byte(void)
{
 uint8_t buf[2];
 for(int i=0; i<(8); i++)
 {
  uint16_t val;
  ((buf)[0] = (uint8_t)((uint16_values[i])>>8), (buf)[1] = (uint8_t)(uint16_values[i]));
  val = ((buf)[0]<<8 | (buf)[1]);
  { CU_assertImplementation(((val) == (uint16_values[i])), 21, ("CU_ASSERT_EQUAL(" "val" "," "uint16_values[i]" ")"), "tests-utils.c", "", 0); };
 }
}

canonical_original_code:
void test_getput2byte()
{
 unsigned char buf[2];
 for(int i = 0; i<(8); i++)
 {
  unsigned short val;
  ((buf)[0] = (unsigned char)((uint16_values[i])>>8), (buf)[1] = (unsigned char)(uint16_values[i]));
  val = ((buf)[0]<<8 | (buf)[1]);
  { CU_assertImplementation(((val) == (uint16_values[i])), 21, ("CU_ASSERT_EQUAL(" "val" "," "uint16_values[i]" ")"), "tests-utils.c", "", 0); };
 }
}

variable_types:
buf
unsigned char [2]

variable_types: i int

variable_types:
val
unsigned short


decompiled_code:
__int64 test_getput4byte()
{
unsigned int *v0; // rbx
_BOOL8 v1; // rdi
__int64 result; // rax
char v3[12]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = (unsigned int *)&uint32_values;
do
{
put4byte(v3, *v0);
v1 = *v0++ == (unsigned int)get4byte(v3);
result = CU_assertImplementation(v1, 35LL, "CU_ASSERT_EQUAL(val,uint32_values[i])", "tests-utils.c", &unk_1F1, 0LL);
}
while ( v0 != (unsigned int *)((char *)&uint32_values + 32) );
return result;
}

canonical_decompiled_code:
__int64 func1()
{
unsigned int *v0; // rbx
_BOOL8 v1; // rdi
__int64 result; // rax
char v3[12]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = (unsigned int *)&uint32_values;
do
{
put4byte(v3, *v0);
v1 = *v0++ == (unsigned int)get4byte(v3);
result = CU_assertImplementation(v1, 35LL, "CU_ASSERT_EQUAL(val,uint32_values[i])", "tests-utils.c", &unk_1F1, 0LL);
}
while ( v0 != (unsigned int *)((char *)&uint32_values + 32) );
return result;
}

original_code:
void test_getput4byte(void)
{
 uint8_t buf[4];
 for(int i=0; i<(8); i++)
 {
  uint32_t val;
  put4byte(buf, uint32_values[i]);
  val = get4byte(buf);
  { CU_assertImplementation(((val) == (uint32_values[i])), 35, ("CU_ASSERT_EQUAL(" "val" "," "uint32_values[i]" ")"), "tests-utils.c", "", 0); };
 }
}

canonical_original_code:
void test_getput4byte()
{
 unsigned char buf[4];
 for(int i = 0; i<(8); i++)
 {
  unsigned int val;
  put4byte(buf, uint32_values[i]);
  val = get4byte(buf);
  { CU_assertImplementation(((val) == (uint32_values[i])), 35, ("CU_ASSERT_EQUAL(" "val" "," "uint32_values[i]" ")"), "tests-utils.c", "", 0); };
 }
}

variable_types:
buf
unsigned char [4]

variable_types:
val
unsigned int


decompiled_code:
__int64 test_varint32()
{
unsigned int *v0; // rbx
_BOOL8 v1; // rdi
__int64 result; // rax
int v3; // [rsp+8h] [rbp-10h] BYREF
char v4[12]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = (unsigned int *)&varint32_values;
do
{
putVarint32(v4, *v0);
getVarint32(v4, &v3);
v1 = *v0++ == v3;
result = CU_assertImplementation(
v1,
49LL,
"CU_ASSERT_EQUAL(val,varint32_values[i])",
"tests-utils.c",
&unk_1F1,
0LL);
}
while ( v0 != (unsigned int *)((char *)&varint32_values + 32) );
return result;
}

canonical_decompiled_code:
__int64 func2()
{
unsigned int *v0; // rbx
_BOOL8 v1; // rdi
__int64 result; // rax
int v3; // [rsp+8h] [rbp-10h] BYREF
char v4[12]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = (unsigned int *)&varint32_values;
do
{
putVarint32(v4, *v0);
getVarint32(v4, &v3);
v1 = *v0++ == v3;
result = CU_assertImplementation(
v1,
49LL,
"CU_ASSERT_EQUAL(val,varint32_values[i])",
"tests-utils.c",
&unk_1F1,
0LL);
}
while ( v0 != (unsigned int *)((char *)&varint32_values + 32) );
return result;
}

original_code:
void test_varint32(void)
{
 uint8_t buf[4];
 for(int i=0; i<(8); i++)
 {
  uint32_t val;
  putVarint32(buf, varint32_values[i]);
  getVarint32(buf, &val);
  { CU_assertImplementation(((val) == (varint32_values[i])), 49, ("CU_ASSERT_EQUAL(" "val" "," "varint32_values[i]" ")"), "tests-utils.c", "", 0); };
 }
}

canonical_original_code:
void test_varint32()
{
 unsigned char buf[4];
 for(int i = 0; i<(8); i++)
 {
  unsigned int val;
  putVarint32(buf, varint32_values[i]);
  getVarint32(buf, &val);
  { CU_assertImplementation(((val) == (varint32_values[i])), 49, ("CU_ASSERT_EQUAL(" "val" "," "varint32_values[i]" ")"), "tests-utils.c", "", 0); };
 }
}