main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v4; // er12
int v5; // er12
void *v6; // rsp
void *v7; // rsp
void *v8; // rsp
void *v9; // rsp
__int64 v10; // rax
__int64 v11; // rsi
__int64 v12; // rdi
double v13; // xmm0_8
__int64 v14; // rdi
double v15; // xmm0_8
__int64 v16; // rdx
__int64 v17; // rdx
__int64 v18; // rdx
int v20; // er12
double v21; // xmm5_8
__int64 v22; // rbx
double v23; // xmm3_8
double v24; // xmm2_8
double v25; // xmm4_8
double v26; // xmm1_8
double v27; // rbx
double v28; // xmm1_8
double v29; // xmm1_8
double v30; // xmm3_8
unsigned int v31; // ebx
int v32; // ebx
_BYTE v33[8]; // [rsp+0h] [rbp-D0h] BYREF
__int64 v34; // [rsp+8h] [rbp-C8h]
__int64 v35; // [rsp+10h] [rbp-C0h]
int v36; // [rsp+1Ch] [rbp-B4h]
int v37; // [rsp+20h] [rbp-B0h]
int v38; // [rsp+24h] [rbp-ACh]
__int64 v39; // [rsp+28h] [rbp-A8h]
int v40; // [rsp+30h] [rbp-A0h]
int v41; // [rsp+34h] [rbp-9Ch]
__int64 v42; // [rsp+38h] [rbp-98h]
_BYTE *v43; // [rsp+40h] [rbp-90h]
unsigned int v44; // [rsp+48h] [rbp-88h]
int v45; // [rsp+4Ch] [rbp-84h]
double v46; // [rsp+50h] [rbp-80h]
double v47; // [rsp+58h] [rbp-78h]
char v48[8]; // [rsp+68h] [rbp-68h] BYREF
double v49; // [rsp+70h] [rbp-60h] BYREF
double v50; // [rsp+78h] [rbp-58h] BYREF
unsigned __int64 v51; // [rsp+80h] [rbp-50h] BYREF
int v52; // [rsp+88h] [rbp-48h]
int v53; // [rsp+8Ch] [rbp-44h]
int v54; // [rsp+90h] [rbp-40h]
int v55; // [rsp+94h] [rbp-3Ch]
int v56; // [rsp+98h] [rbp-38h]
int v57; // [rsp+9Ch] [rbp-34h]

v51 = 1000000000LL;
v52 = 4095;
v53 = 1;
v54 = 1;
v55 = -100000;
v56 = 0;
v57 = 0;
v40 = 0;
v3 = 0;
v37 = 0;
v38 = 50;
v45 = 0;
while ( 1 )
{
v4 = getopt(argc, (char *const *)argv, "vhHRf:n:o:p:s:i:t:u:");
if ( v4 == -1 )
break;
switch ( v4 )
{
case 'H':
v54 = 0;
break;
case 'R':
v53 = 0;
break;
case 'f':
v51 = atol(optarg);
break;
case 'i':
v3 = atoi(optarg);
break;
case 'n':
v38 = atoi(optarg);
break;
case 'o':
v55 = atoi(optarg);
break;
case 'p':
v56 = atoi(optarg);
break;
case 's':
v37 = atoi(optarg);
break;
case 't':
v40 = atoi(optarg);
v57 = v40;
break;
case 'u':
v52 = atoi(optarg);
break;
case 'v':
++v45;
break;
default:
printk("Usage: tktest [options]\n"
"\n"
"options:\n"
"\t-f freq\t\tclock frequency (Hz)\n"
"\t-o freq\t\tinitial frequency offset (ppb)\n"
"\t-p freq\t\tfrequency step (ppb)\n"
"\t-n samples\tcollected samples\n"
"\t-s sample\tfirst regressed sample\n"
"\t-i samples\tignore samples\n"
"\t-t samples\tsplit samples for stats\n"
"\t-u samples\tclock update interval\n"
"\t-H\t\tdisable nohz\n"
"\t-R\t\tdisable random update interval\n"
"\t-v\t\tprint samples\n"
"\t-h\t\tprint help\n");
exit(v4 != 104);
}
}
v5 = v38;
v6 = alloca(8LL * v38);
v7 = alloca(8LL * v38);
v43 = v33;
v8 = alloca(8LL * v38);
v9 = alloca(8LL * v38);
srandom(0xBC4FF2u);
tk_test(v33, v43, (unsigned int)v5, &v51);
if ( v5 > 0 )
{
v10 = 0LL;
v11 = (__int64)v43;
do
{
v17 = *(_QWORD *)&v33[8 * v10];
if ( v17 < 0 )
{
v12 = *(_QWORD *)&v33[8 * v10] & 1LL | ((unsigned __int64)v17 >> 1);
v13 = (double)(int)v12 + (double)(int)v12;
}
else
{
v13 = (double)(int)v17;
}
*(double *)&v33[8 * v10] = v13;
v18 = *(_QWORD *)(v11 + 8 * v10);
if ( v18 < 0 )
{
v14 = *(_QWORD *)(v11 + 8 * v10) & 1LL | ((unsigned __int64)v18 >> 1);
v15 = (double)(int)v14 + (double)(int)v14;
}
else
{
v15 = (double)(int)v18;
}
*(double *)&v33[8 * v10] = v15;
v16 = v10++;
}
while ( v16 != v5 - 1 );
}
if ( v40 )
{
if ( v40 > v38 )
return 0;
}
else
{
v40 = v38;
}
v20 = v40;
v36 = v40;
v44 = v3 + 1;
v35 = v40;
v39 = v3;
v34 = 8LL * v40;
v42 = 8 * (v3 + (__int64)v37);
do
{
v32 = v44 - 1;
v41 = v37;
regress(&v33[v42], &v33[v42], v20 - v37 - (v44 - 1), &v49, &v50, v48);
if ( v20 <= v32 )
{
v46 = 0.0;
v47 = 0.0;
}
else
{
v22 = v39;
v46 = 0.0;
v47 = 0.0;
do
{
v23 = *(double *)&v33[8 * v22];
v24 = v23 * v50 + v49 - v23;
v46 = v24 * v24 + v46;
v47 = fmax(COERCE_DOUBLE(*(_QWORD *)&v24 & LC3), v47);
if ( v45 )
{
if ( (v51 & 0x8000000000000000LL) != 0LL )
v21 = (double)(int)(v51 & 1 | (v51 >> 1)) + (double)(int)(v51 & 1 | (v51 >> 1));
else
v21 = (double)(int)v51;
v25 = 0.0;
if ( (int)v22 > 0 )
v25 = (v23 - *(double *)&v33[8 * (int)v22 - 8])
/ (v23 - *(double *)&v33[8 * (int)v22 - 8])
* v21
/ 1000000000.0
- 1.0;
printk(
"%5d %lld %lld %e %9.1f %9.1f\n",
(unsigned int)(v22 + 1),
*(_QWORD *)&v33[8 * v22],
*(_QWORD *)&v43[8 * v22],
v25);
}
++v22;
}
while ( v20 > (int)v22 );
}
if ( (v51 & 0x8000000000000000LL) != 0LL )
v26 = (double)(int)(v51 & 1 | (v51 >> 1)) + (double)(int)(v51 & 1 | (v51 >> 1));
else
v26 = (double)(int)v51;
v27 = (v50 / 1000000000.0 * v26 - 1.0) * 1000000.0;
v28 = v46 / (double)v20;
if ( v28 < 0.0 )
v29 = sqrt(v28);
else
v29 = sqrt(v28);
v30 = v27;
v31 = v44;
printk(
"samples: %d-%d reg: %d-%d slope: %.2f dev: %.1f max: %.1f freq: %.5f\n",
v44,
(unsigned int)v20,
v44 + v41,
(unsigned int)v20,
v50,
v29,
v47,
v30);
v20 += v40;
v44 = v36 + v31;
v39 += v35;
v42 += v34;
}
while ( v38 >= v20 );
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
int v4; // er12
int v5; // er12
void *v6; // rsp
void *v7; // rsp
void *v8; // rsp
void *v9; // rsp
__int64 v10; // rax
__int64 v11; // rsi
__int64 v12; // rdi
double v13; // xmm0_8
__int64 v14; // rdi
double v15; // xmm0_8
__int64 v16; // rdx
__int64 v17; // rdx
__int64 v18; // rdx
int v20; // er12
double v21; // xmm5_8
__int64 v22; // rbx
double v23; // xmm3_8
double v24; // xmm2_8
double v25; // xmm4_8
double v26; // xmm1_8
double v27; // rbx
double v28; // xmm1_8
double v29; // xmm1_8
double v30; // xmm3_8
unsigned int v31; // ebx
int v32; // ebx
_BYTE v33[8]; // [rsp+0h] [rbp-D0h] BYREF
__int64 v34; // [rsp+8h] [rbp-C8h]
__int64 v35; // [rsp+10h] [rbp-C0h]
int v36; // [rsp+1Ch] [rbp-B4h]
int v37; // [rsp+20h] [rbp-B0h]
int v38; // [rsp+24h] [rbp-ACh]
__int64 v39; // [rsp+28h] [rbp-A8h]
int v40; // [rsp+30h] [rbp-A0h]
int v41; // [rsp+34h] [rbp-9Ch]
__int64 v42; // [rsp+38h] [rbp-98h]
_BYTE *v43; // [rsp+40h] [rbp-90h]
unsigned int v44; // [rsp+48h] [rbp-88h]
int v45; // [rsp+4Ch] [rbp-84h]
double v46; // [rsp+50h] [rbp-80h]
double v47; // [rsp+58h] [rbp-78h]
char v48[8]; // [rsp+68h] [rbp-68h] BYREF
double v49; // [rsp+70h] [rbp-60h] BYREF
double v50; // [rsp+78h] [rbp-58h] BYREF
unsigned __int64 v51; // [rsp+80h] [rbp-50h] BYREF
int v52; // [rsp+88h] [rbp-48h]
int v53; // [rsp+8Ch] [rbp-44h]
int v54; // [rsp+90h] [rbp-40h]
int v55; // [rsp+94h] [rbp-3Ch]
int v56; // [rsp+98h] [rbp-38h]
int v57; // [rsp+9Ch] [rbp-34h]

v51 = 1000000000LL;
v52 = 4095;
v53 = 1;
v54 = 1;
v55 = -100000;
v56 = 0;
v57 = 0;
v40 = 0;
v3 = 0;
v37 = 0;
v38 = 50;
v45 = 0;
while ( 1 )
{
v4 = getopt(argc, (char *const *)argv, "vhHRf:n:o:p:s:i:t:u:");
if ( v4 == -1 )
break;
switch ( v4 )
{
case 'H':
v54 = 0;
break;
case 'R':
v53 = 0;
break;
case 'f':
v51 = atol(optarg);
break;
case 'i':
v3 = atoi(optarg);
break;
case 'n':
v38 = atoi(optarg);
break;
case 'o':
v55 = atoi(optarg);
break;
case 'p':
v56 = atoi(optarg);
break;
case 's':
v37 = atoi(optarg);
break;
case 't':
v40 = atoi(optarg);
v57 = v40;
break;
case 'u':
v52 = atoi(optarg);
break;
case 'v':
++v45;
break;
default:
func0("Usage: tktest [options]\n"
"\n"
"options:\n"
"\t-f freq\t\tclock frequency (Hz)\n"
"\t-o freq\t\tinitial frequency offset (ppb)\n"
"\t-p freq\t\tfrequency step (ppb)\n"
"\t-n samples\tcollected samples\n"
"\t-s sample\tfirst regressed sample\n"
"\t-i samples\tignore samples\n"
"\t-t samples\tsplit samples for stats\n"
"\t-u samples\tclock update interval\n"
"\t-H\t\tdisable nohz\n"
"\t-R\t\tdisable random update interval\n"
"\t-v\t\tprint samples\n"
"\t-h\t\tprint help\n");
exit(v4 != 104);
}
}
v5 = v38;
v6 = alloca(8LL * v38);
v7 = alloca(8LL * v38);
v43 = v33;
v8 = alloca(8LL * v38);
v9 = alloca(8LL * v38);
srandom(0xBC4FF2u);
tk_test(v33, v43, (unsigned int)v5, &v51);
if ( v5 > 0 )
{
v10 = 0LL;
v11 = (__int64)v43;
do
{
v17 = *(_QWORD *)&v33[8 * v10];
if ( v17 < 0 )
{
v12 = *(_QWORD *)&v33[8 * v10] & 1LL | ((unsigned __int64)v17 >> 1);
v13 = (double)(int)v12 + (double)(int)v12;
}
else
{
v13 = (double)(int)v17;
}
*(double *)&v33[8 * v10] = v13;
v18 = *(_QWORD *)(v11 + 8 * v10);
if ( v18 < 0 )
{
v14 = *(_QWORD *)(v11 + 8 * v10) & 1LL | ((unsigned __int64)v18 >> 1);
v15 = (double)(int)v14 + (double)(int)v14;
}
else
{
v15 = (double)(int)v18;
}
*(double *)&v33[8 * v10] = v15;
v16 = v10++;
}
while ( v16 != v5 - 1 );
}
if ( v40 )
{
if ( v40 > v38 )
return 0;
}
else
{
v40 = v38;
}
v20 = v40;
v36 = v40;
v44 = v3 + 1;
v35 = v40;
v39 = v3;
v34 = 8LL * v40;
v42 = 8 * (v3 + (__int64)v37);
do
{
v32 = v44 - 1;
v41 = v37;
regress(&v33[v42], &v33[v42], v20 - v37 - (v44 - 1), &v49, &v50, v48);
if ( v20 <= v32 )
{
v46 = 0.0;
v47 = 0.0;
}
else
{
v22 = v39;
v46 = 0.0;
v47 = 0.0;
do
{
v23 = *(double *)&v33[8 * v22];
v24 = v23 * v50 + v49 - v23;
v46 = v24 * v24 + v46;
v47 = fmax(COERCE_DOUBLE(*(_QWORD *)&v24 & LC3), v47);
if ( v45 )
{
if ( (v51 & 0x8000000000000000LL) != 0LL )
v21 = (double)(int)(v51 & 1 | (v51 >> 1)) + (double)(int)(v51 & 1 | (v51 >> 1));
else
v21 = (double)(int)v51;
v25 = 0.0;
if ( (int)v22 > 0 )
v25 = (v23 - *(double *)&v33[8 * (int)v22 - 8])
/ (v23 - *(double *)&v33[8 * (int)v22 - 8])
* v21
/ 1000000000.0
- 1.0;
func0(
"%5d %lld %lld %e %9.1f %9.1f\n",
(unsigned int)(v22 + 1),
*(_QWORD *)&v33[8 * v22],
*(_QWORD *)&v43[8 * v22],
v25);
}
++v22;
}
while ( v20 > (int)v22 );
}
if ( (v51 & 0x8000000000000000LL) != 0LL )
v26 = (double)(int)(v51 & 1 | (v51 >> 1)) + (double)(int)(v51 & 1 | (v51 >> 1));
else
v26 = (double)(int)v51;
v27 = (v50 / 1000000000.0 * v26 - 1.0) * 1000000.0;
v28 = v46 / (double)v20;
if ( v28 < 0.0 )
v29 = sqrt(v28);
else
v29 = sqrt(v28);
v30 = v27;
v31 = v44;
func0(
"samples: %d-%d reg: %d-%d slope: %.2f dev: %.1f max: %.1f freq: %.5f\n",
v44,
(unsigned int)v20,
v44 + v41,
(unsigned int)v20,
v50,
v29,
v47,
v30);
v20 += v40;
v44 = v36 + v31;
v39 += v35;
v42 += v34;
}
while ( v38 >= v20 );
return 0;
}

original_code:
int main(int argc, char **argv) {
 struct tk_test_params test_params = {
  .clock_freq = 1000000000,
  .update_interval = 4095,
  .random_update = 1,
  .nohz = 1,
  .freq_offset = -100000,
  .freq_step = 0,
  .freq_step_interval = 0,
 };
 int verbose = 0, total_samples = 50, start = 0, ignore = 0, split = 0;
 int i, opt, samples;
 double slope, intercept, offset, variance, varsum, max_offset;
 while ((opt = getopt(argc, argv, "vhHRf:n:o:p:s:i:t:u:")) != -1) {
  switch (opt) {
   case 'v':
    verbose++;
    break;
   case 'H':
    test_params.nohz = 0;
    break;
   case 'R':
    test_params.random_update = 0;
    break;
   case 'f':
    test_params.clock_freq = atol(optarg);
    break;
   case 'n':
    total_samples = atoi(optarg);
    break;
   case 'o':
    test_params.freq_offset = atoi(optarg);
    break;
   case 'p':
    test_params.freq_step = atoi(optarg);
    break;
   case 's':
    start = atoi(optarg);
    break;
   case 'i':
    ignore = atoi(optarg);
    break;
   case 't':
    split = atoi(optarg);
    test_params.freq_step_interval = split;
    break;
   case 'u':
    test_params.update_interval = atoi(optarg);
    break;
   case 'h':
   default:
    printk( "Usage: tktest [options]\n\n"
     "options:\n"
     "	-f freq		clock frequency (Hz)\n"
     "	-o freq		initial frequency offset (ppb)\n"
     "	-p freq		frequency step (ppb)\n"
     "	-n samples	collected samples\n"
     "	-s sample	first regressed sample\n"
     "	-i samples	ignore samples\n"
     "	-t samples	split samples for stats\n"
     "	-u samples	clock update interval\n"
     "	-H		disable nohz\n"
     "	-R		disable random update interval\n"
     "	-v		print samples\n"
     "	-h		print help\n");
    exit(opt != 'h');
  }
 }
 uint64_t ts_x[total_samples], ts_y[total_samples];
 double x[total_samples], y[total_samples];
 srandom(12341234);
 tk_test(ts_x, ts_y, total_samples, &test_params);
 for (i = 0; i < total_samples; i++) {
  x[i] = ts_x[i];
  y[i] = ts_y[i];
 }
 if (split == 0)
  split = total_samples;
 for (samples = split; samples <= total_samples; samples += split, ignore += split) {
  regress(x + start + ignore, y + start + ignore, samples - start - ignore,
    &intercept, &slope, &variance);
  max_offset = 0.0;
  varsum = 0.0;
  for (i = ignore; i < samples; i++) {
   offset = x[i] * slope + intercept - y[i];
   varsum += offset * offset;
   if (fabs(offset) > max_offset)
    max_offset = fabs(offset);
   if (verbose) {
    printk("%5d %lld %lld %e %9.1f %9.1f\n", i + 1,
     ts_x[i], ts_y[i],
     i > 0 ? (y[i] - y[i - 1]) / (x[i] - x[i - 1]) *
      test_params.clock_freq / 1e9 - 1.0 : 0.0,
     y[i] - x[i] / test_params.clock_freq * 1e9, offset);
   }
  }
  printk("samples: %d-%d reg: %d-%d slope: %.2f dev: %.1f max: %.1f freq: %.5f\n",
    ignore + 1, samples, start + ignore + 1, samples,
    slope, sqrt(varsum / samples), max_offset,
    (slope / 1e9 * test_params.clock_freq - 1.0) * 1e6);
 }
 return 0;
}

canonical_original_code:
int main(int argc, char **argv) {
 struct tk_test_params test_params = {
  .clock_freq = 1000000000,
  .update_interval = 4095,
  .random_update = 1,
  .nohz = 1,
  .freq_offset = -100000,
  .freq_step = 0,
  .freq_step_interval = 0,
 };
 int verbose = 0; int total_samples = 50; int start = 0; int ignore = 0; int split = 0;
 int i; int opt; int samples;
 double slope; double intercept; double offset; double variance; double varsum; double max_offset;
 while ((opt = getopt(argc, argv, "vhHRf:n:o:p:s:i:t:u:")) != -1) {
  switch (opt) {
   case 'v':
    verbose++;
    break;
   case 'H':
    test_params.nohz = 0;
    break;
   case 'R':
    test_params.random_update = 0;
    break;
   case 'f':
    test_params.clock_freq = atol(optarg);
    break;
   case 'n':
    total_samples = atoi(optarg);
    break;
   case 'o':
    test_params.freq_offset = atoi(optarg);
    break;
   case 'p':
    test_params.freq_step = atoi(optarg);
    break;
   case 's':
    start = atoi(optarg);
    break;
   case 'i':
    ignore = atoi(optarg);
    break;
   case 't':
    split = atoi(optarg);
    test_params.freq_step_interval = split;
    break;
   case 'u':
    test_params.update_interval = atoi(optarg);
    break;
   case 'h':
   default:
    printk( "Usage: tktest [options]\n\n"
     "options:\n"
     "	-f freq		clock frequency (Hz)\n"
     "	-o freq		initial frequency offset (ppb)\n"
     "	-p freq		frequency step (ppb)\n"
     "	-n samples	collected samples\n"
     "	-s sample	first regressed sample\n"
     "	-i samples	ignore samples\n"
     "	-t samples	split samples for stats\n"
     "	-u samples	clock update interval\n"
     "	-H		disable nohz\n"
     "	-R		disable random update interval\n"
     "	-v		print samples\n"
     "	-h		print help\n");
    exit(opt != 'h');
  }
 }
 unsigned long ts_x[-1]; unsigned long ts_y[-1];
 double x[-1]; double y[-1];
 srandom(12341234);
 tk_test(ts_x, ts_y, total_samples, &test_params);
 for (i = 0; i < total_samples; i++) {
  x[i] = ts_x[i];
  y[i] = ts_y[i];
 }
 if (split == 0)
  split = total_samples;
 for (samples = split; samples <= total_samples; samples += split, ignore += split) {
  regress(x + start + ignore, y + start + ignore, samples - start - ignore,
    &intercept, &slope, &variance);
  max_offset = 0.0;
  varsum = 0.0;
  for (i = ignore; i < samples; i++) {
   offset = x[i] * slope + intercept - y[i];
   varsum += offset * offset;
   if (fabs(offset) > max_offset)
    max_offset = fabs(offset);
   if (verbose) {
    printk("%5d %lld %lld %e %9.1f %9.1f\n", i + 1,
     ts_x[i], ts_y[i],
     i > 0 ? (y[i] - y[i - 1]) / (x[i] - x[i - 1]) *
      test_params.clock_freq / 1e9 - 1.0 : 0.0,
     y[i] - x[i] / test_params.clock_freq * 1e9, offset);
   }
  }
  printk("samples: %d-%d reg: %d-%d slope: %.2f dev: %.1f max: %.1f freq: %.5f\n",
    ignore + 1, samples, start + ignore + 1, samples,
    slope, sqrt(varsum / samples), max_offset,
    (slope / 1e9 * test_params.clock_freq - 1.0) * 1e6);
 }
 return 0;
}

variable_types:
argv
char **

variable_types: struct tk_test_params { unsigned long clock_freq; unsigned int update_interval; int random_update; int nohz; int freq_offset; int freq_step; int freq_step_interval; }

variable_types: verbose int

variable_types: start int

variable_types: ignore int

variable_types: split int

variable_types: opt int

variable_types: samples int

variable_types: slope double

variable_types: intercept double

variable_types: offset double

variable_types: variance double

variable_types: varsum double

variable_types:
x
double [-1]

variable_types:
y
double [-1]


repo: mludvig/mini-printf

decompiled_code:
__int64 __fastcall mini_strlen(_BYTE *a1)
{
__int64 v1; // rax
unsigned int v2; // edx

if ( !*a1 )
return 0;
v1 = 1LL;
do
v2 = v1++;
while ( a1[v1 - 1] );
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1)
{
__int64 v1; // rax
unsigned int v2; // edx

if ( !*a1 )
return 0;
v1 = 1LL;
do
v2 = v1++;
while ( a1[v1 - 1] );
return v2;
}

original_code:
static int
mini_strlen(const char *s)
{
 int len = 0;
 while (s[len] != '\0') len++;
 return len;
}

canonical_original_code:
static int mini_strlen(char *s)
{
 int len = 0;
 while (s[len] != '\0') len++;
 return len;
}

variable_types:
s
char *

variable_types: len int

return_type: int


decompiled_code:
__int64 __fastcall mini_pad(__int64 a1, int a2, char a3, int a4, _BYTE *a5)
{
_BYTE *v5; // rdx
int v6; // er10
unsigned int v7; // esi
int v8; // ecx
_BYTE *v9; // rax
__int64 i; // rax
unsigned __int64 v11; // rdx
unsigned __int64 v12; // rax

if ( !a4 )
{
v5 = a5;
goto LABEL_9;
}
if ( a4 >= a2 )
{
v8 = a4 - a2;
if ( v8 <= 0 )
{
v5 = a5;
}
else
{
v9 = a5;
do
*v9++ = a3;
while ( v9 != &a5[v8] );
v5 = &a5[v8];
}
LABEL_9:
v6 = 0;
if ( a2 <= 0 )
return (unsigned int)((_DWORD)v5 - (_DWORD)a5);
goto LABEL_10;
}
v5 = a5;
a2 = a4;
v6 = 1;
if ( a4 <= 0 )
return 0;
LABEL_10:
for ( i = 0LL; i != a2; ++i )
v5[i] = *(_BYTE *)(a1 + i);
v11 = (unsigned __int64)&v5[a2];
v7 = v11 - (_DWORD)a5;
if ( v6 && (unsigned __int64)a5 < v11 )
{
v12 = v11;
do
*(_BYTE *)--v12 = 42;
while ( (int)v11 - (int)v12 <= 2 && (unsigned __int64)a5 < v12 );
}
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, int a2, char a3, int a4, _BYTE *a5)
{
_BYTE *v5; // rdx
int v6; // er10
unsigned int v7; // esi
int v8; // ecx
_BYTE *v9; // rax
__int64 i; // rax
unsigned __int64 v11; // rdx
unsigned __int64 v12; // rax

if ( !a4 )
{
v5 = a5;
goto LABEL_9;
}
if ( a4 >= a2 )
{
v8 = a4 - a2;
if ( v8 <= 0 )
{
v5 = a5;
}
else
{
v9 = a5;
do
*v9++ = a3;
while ( v9 != &a5[v8] );
v5 = &a5[v8];
}
LABEL_9:
v6 = 0;
if ( a2 <= 0 )
return (unsigned int)((_DWORD)v5 - (_DWORD)a5);
goto LABEL_10;
}
v5 = a5;
a2 = a4;
v6 = 1;
if ( a4 <= 0 )
return 0;
LABEL_10:
for ( i = 0LL; i != a2; ++i )
v5[i] = *(_BYTE *)(a1 + i);
v11 = (unsigned __int64)&v5[a2];
v7 = v11 - (_DWORD)a5;
if ( v6 && (unsigned __int64)a5 < v11 )
{
v12 = v11;
do
*(_BYTE *)--v12 = 42;
while ( (int)v11 - (int)v12 <= 2 && (unsigned __int64)a5 < v12 );
}
return v7;
}

original_code:
static int
mini_pad(char* ptr, int len, char pad_char, int pad_to, char *buffer)
{
 int i;
 int overflow = 0;
 char * pbuffer = buffer;
 if(pad_to == 0) pad_to = len;
 if(len > pad_to) {
  len = pad_to;
  overflow = 1;
 }
 for(i = pad_to - len; i > 0; i --) {
  *(pbuffer++) = pad_char;
 }
 for(i = len; i > 0; i --) {
  *(pbuffer++) = *(ptr++);
 }
 len = pbuffer - buffer;
 if(overflow) {
  for (i = 0; i < 3 && pbuffer > buffer; i ++) {
   *(pbuffer-- - 1) = '*';
  }
 }
 return len;
}

canonical_original_code:
static int mini_pad(char *ptr, int len, char pad_char, int pad_to, char *buffer)
{
 int i;
 int overflow = 0;
 char *pbuffer = buffer;
 if(pad_to == 0) pad_to = len;
 if(len > pad_to) {
  len = pad_to;
  overflow = 1;
 }
 for(i = pad_to - len; i > 0; i --) {
  *(pbuffer++) = pad_char;
 }
 for(i = len; i > 0; i --) {
  *(pbuffer++) = *(ptr++);
 }
 len = pbuffer - buffer;
 if(overflow) {
  for (i = 0; i < 3 && pbuffer > buffer; i ++) {
   *(pbuffer-- - 1) = '*';
  }
 }
 return len;
}

variable_types:
ptr
char *

variable_types:
buffer
char *

variable_types: i int

variable_types: overflow int

variable_types:
pbuffer
char *


decompiled_code:
void __fastcall mini_printf_set_handler(__int64 a1, __int64 a2, __int64 a3)
{
mini_handler = a2;
mini_handler_freeor = a3;
mini_handler_data = a1;
}

canonical_decompiled_code:
void __fastcall func4(__int64 a1, __int64 a2, __int64 a3)
{
mini_handler = a2;
mini_handler_freeor = a3;
mini_handler_data = a1;
}

original_code:
void mini_printf_set_handler(
 void* data,
 int (*handler)(void* data, void* obj, int ch, int len_hint, char** buf),
 void (*freeor)(void* data, void* buf))
{
 mini_handler = handler;
 mini_handler_freeor = freeor;
 mini_handler_data = data;
}

canonical_original_code:
void mini_printf_set_handler(void *data, int (*handler)(void *data, void *obj, int ch, int len_hint, char **buf), void (*freeor)(void *data, void *buf))
{
 mini_handler = handler;
 mini_handler_freeor = freeor;
 mini_handler_data = data;
}

variable_types:
data
void *

variable_types: int (*)(void *data, void *obj, int ch, int len_hint, char **buf)

variable_types:
freeor
void (*)(void *data, void *buf)

return_type: void


decompiled_code:
__int64 __fastcall mini_vsnprintf(__int64 a1, int a2, char *a3)
{
__int64 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+8h] [rbp-20h]
int v6; // [rsp+10h] [rbp-18h]

v4 = a1;
v5 = a1;
v6 = a2;
if ( !a2 || !a1 )
return mini_vpprintf(puts, 0LL, a3);
mini_vpprintf(puts, (__int64)&v4, a3);
return (unsigned int)(v5 - v4);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, int a2, char *a3)
{
__int64 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+8h] [rbp-20h]
int v6; // [rsp+10h] [rbp-18h]

v4 = a1;
v5 = a1;
v6 = a2;
if ( !a2 || !a1 )
return func5(puts, 0LL, a3);
func5(puts, (__int64)&v4, a3);
return (unsigned int)(v5 - v4);
}

original_code:
int
mini_vsnprintf(char *buffer, unsigned int buffer_len, const char *fmt, va_list va)
{
 struct mini_buff b;
 b.buffer = buffer;
 b.pbuffer = buffer;
 b.buffer_len = buffer_len;
 if(buffer_len == 0) buffer = (void*) 0;
 int n = mini_vpprintf(_puts, (buffer != (void*)0)?&b:(void*)0, fmt, va);
 if(buffer == (void*) 0) {
  return n;
 }
 return b.pbuffer - b.buffer;
}

canonical_original_code:
int mini_vsnprintf(char *buffer, unsigned int buffer_len, char *fmt, __builtin_va_list va)
{
 struct mini_buff b;
 b.buffer = buffer;
 b.pbuffer = buffer;
 b.buffer_len = buffer_len;
 if(buffer_len == 0) buffer = (void *) 0;
 int n = mini_vpprintf(_puts, (buffer != (void*)0)?&b:(void*)0, fmt, va);
 if(buffer == (void *) 0) {
  return n;
 }
 return b.pbuffer - b.buffer;
}

variable_types:
fmt
char *

variable_types: struct mini_buff { char *buffer; unsigned int buffer_len; }

variable_types: n int


decompiled_code:
__int64 __fastcall mini_snprintf(__int64 a1, int a2, char *a3)
{
return mini_vsnprintf(a1, a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, int a2, char *a3)
{
return func6(a1, a2, a3);
}

original_code:
int
mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...)
{
 int ret;
 va_list va;
 __builtin_va_start(va,fmt);
 ret = mini_vsnprintf(buffer, buffer_len, fmt, va);
 __builtin_va_end(va);
 return ret;
}

canonical_original_code:
int mini_snprintf(char *buffer, unsigned int buffer_len, char *fmt, ...)
{
 int ret;
 __builtin_va_list va;
 __builtin_va_start(va,fmt);
 ret = mini_vsnprintf(buffer, buffer_len, fmt, va);
 __builtin_va_end(va);
 return ret;
}

variable_types: ret int


decompiled_code:
__int64 __fastcall mini_pprintf(int (*a1)(const char *s), __int64 a2, char *a3)
{
return mini_vpprintf(a1, a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func8(int (*a1)(const char *s), __int64 a2, char *a3)
{
return func5(a1, a2, a3);
}

original_code:
int
mini_pprintf(int (*puts)(char*s, int len, void* buf), void* buf, const char *fmt, ...)
{
 int ret;
 va_list va;
 __builtin_va_start(va,fmt);
 ret = mini_vpprintf(puts, buf, fmt, va);
 __builtin_va_end(va);
 return ret;
}

canonical_original_code:
int mini_pprintf(int (*puts)(char *s, int len, void *buf), void *buf, char *fmt, ...)
{
 int ret;
 __builtin_va_list va;
 __builtin_va_start(va,fmt);
 ret = mini_vpprintf(puts, buf, fmt, va);
 __builtin_va_end(va);
 return ret;
}

variable_types:
puts
int (*)(char *s, int len, void *buf)

variable_types:
buf
void *


canonical_name: main

repo: mmaannii/gitTest

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
puts("\n Hello World");
puts("\n Hello from feature X and Y branch");
return 0;
}

original_code:
int main()
{
 printf("\n Hello World\n");
 printf("\n Hello from feature X and Y branch\n");
 return 0;
}


repo: mmadsen/slatkin-exact-tools

original_code:
int main(int argc, char *argv[]) {
 int r_obs[] = {0, 9, 2, 1, 1, 1, 1, 1, 0};
 int i, k, maxrep;
 slatkin_result results;
 maxrep = 100000;
 for(i=0; i < 1000; i++) {
  results = slatkin_mc(maxrep, r_obs);
  printf("%g\t%g\n", results.probability, results.theta_estimate );
 }
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[]) {
 int r_obs[] = {0, 9, 2, 1, 1, 1, 1, 1, 0};
 int i; int k; int maxrep;
 struct slatkin_result results;
 maxrep = 100000;
 for(i=0; i < 1000; i++) {
  results = slatkin_mc(maxrep, r_obs);
  printf("%g\t%g\n", results.probability, results.theta_estimate );
 }
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: k int

variable_types: maxrep int

variable_types: struct slatkin_result { double probability; double theta_estimate; }


repo: mmainar/unizarPracticals

decompiled_code:
int __fastcall generar_inicio_programa(const char *a1)
{
return fprintf(yyout, "<Programa name=\"%s\">\n", a1);
}

canonical_decompiled_code:
int __fastcall func0(const char *a1)
{
return fprintf(yyout, "<Programa name=\"%s\">\n", a1);
}

original_code:
void generar_inicio_programa(char *nombre)
{
  fprintf(yyout, "<Programa name=\"%s\">\n", nombre);
}

variable_types:
nombre
char *


decompiled_code:
size_t generar_cierre_programa()
{
return fwrite("</Programa>\n", 1uLL, 0xCuLL, yyout);
}

canonical_decompiled_code:
size_t func1()
{
return fwrite("</Programa>\n", 1uLL, 0xCuLL, yyout);
}

original_code:
void generar_cierre_programa(char *nombre)
{
  fprintf(yyout, "</Programa>\n");
}


decompiled_code:
size_t __fastcall generar_dec_var(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("<declaracion_variables>\n", 1uLL, 0x18uLL, yyout);
}

canonical_decompiled_code:
size_t __fastcall func2(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("<declaracion_variables>\n", 1uLL, 0x18uLL, yyout);
}

original_code:
void generar_dec_var(int nivel)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<declaracion_variables>\n");
}

variable_types: nivel int

variable_types: i int


decompiled_code:
size_t __fastcall generar_cierre_dec_var(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("</declaracion_variables>\n", 1uLL, 0x19uLL, yyout);
}

canonical_decompiled_code:
size_t __fastcall func3(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("</declaracion_variables>\n", 1uLL, 0x19uLL, yyout);
}

original_code:
void generar_cierre_dec_var(int nivel, char *nombre)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "</declaracion_variables>\n");
}


decompiled_code:
size_t __fastcall generar_dec_acc(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("<declaracion_acciones>\n", 1uLL, 0x17uLL, yyout);
}

canonical_decompiled_code:
size_t __fastcall func4(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("<declaracion_acciones>\n", 1uLL, 0x17uLL, yyout);
}

original_code:
void generar_dec_acc(int nivel)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<declaracion_acciones>\n");
}


decompiled_code:
size_t __fastcall generar_cierre_dec_acc(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("</declaracion_acciones>\n", 1uLL, 0x18uLL, yyout);
}

canonical_decompiled_code:
size_t __fastcall func5(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("</declaracion_acciones>\n", 1uLL, 0x18uLL, yyout);
}

original_code:
void generar_cierre_dec_acc(int nivel)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "</declaracion_acciones>\n");
}


decompiled_code:
int __fastcall generar_nueva_var_simple(int a1, const char *a2, int a3)
{
int i; // ebx
int result; // eax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
result = fprintf(yyout, "<var nombre=\"%s\" tipo=\"", a2);
switch ( a3 )
{
case 2:
return fwrite("booleano\" />\n", 1uLL, 0xDuLL, yyout);
case 3:
return fwrite("caracter\" />\n", 1uLL, 0xDuLL, yyout);
case 1:
result = fwrite("entero\" />\n", 1uLL, 0xBuLL, yyout);
break;
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(int a1, const char *a2, int a3)
{
int i; // ebx
int result; // eax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
result = fprintf(yyout, "<var nombre=\"%s\" tipo=\"", a2);
switch ( a3 )
{
case 2:
return fwrite("booleano\" />\n", 1uLL, 0xDuLL, yyout);
case 3:
return fwrite("caracter\" />\n", 1uLL, 0xDuLL, yyout);
case 1:
result = fwrite("entero\" />\n", 1uLL, 0xBuLL, yyout);
break;
}
return result;
}

original_code:
void generar_nueva_var_simple(int nivel, char *nombre, TIPO_VARIABLE tipo)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<var nombre=\"%s\" tipo=\"", nombre);
  switch (tipo)
  {
    case ENTERO: fprintf (yyout, "entero\" />\n"); break;
    case BOOLEANO: fprintf (yyout, "booleano\" />\n"); break;
    case CHAR: fprintf (yyout, "caracter\" />\n"); break;
    default: ;
  }
}

canonical_original_code:
void generar_nueva_var_simple(int nivel, char *nombre, enum TIPO_VARIABLE tipo)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<var nombre=\"%s\" tipo=\"", nombre);
  switch (tipo)
  {
    case ENTERO: fprintf (yyout, "entero\" />\n"); break;
    case BOOLEANO: fprintf (yyout, "booleano\" />\n"); break;
    case CHAR: fprintf (yyout, "caracter\" />\n"); break;
    default: ;
  }
}

variable_types: enum TIPO_VARIABLE { DESCONOCIDO=0, ENTERO=1, BOOLEANO=2, CHAR=3, CADENA=4, VECTOR=5 }


decompiled_code:
int __fastcall generar_nueva_acc(int a1, const char *a2)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fprintf(yyout, "<accion nombre=\"%s\">\n", a2);
}

canonical_decompiled_code:
int __fastcall func7(int a1, const char *a2)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fprintf(yyout, "<accion nombre=\"%s\">\n", a2);
}

original_code:
void generar_nueva_acc(int nivel, char *nombre)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<accion nombre=\"%s\">\n", nombre);
}


decompiled_code:
size_t __fastcall generar_nuevo_par(int a1, const char *a2, int a3, int a4)
{
int i; // ebx
size_t result; // rax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
fprintf(yyout, "<parametro nombre=\"%s\" tipo=\"", a2);
switch ( a3 )
{
case 2:
fwrite("booleano\"", 1uLL, 9uLL, yyout);
break;
case 3:
fwrite("caracter\"", 1uLL, 9uLL, yyout);
break;
case 1:
fwrite("entero\"", 1uLL, 7uLL, yyout);
break;
}
result = fwrite(" paso=\"", 1uLL, 7uLL, yyout);
if ( !a4 )
return fwrite("val\" />\n", 1uLL, 8uLL, yyout);
if ( a4 == 1 )
result = fwrite("ref\" />\n", 1uLL, 8uLL, yyout);
return result;
}

canonical_decompiled_code:
size_t __fastcall func8(int a1, const char *a2, int a3, int a4)
{
int i; // ebx
size_t result; // rax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
fprintf(yyout, "<parametro nombre=\"%s\" tipo=\"", a2);
switch ( a3 )
{
case 2:
fwrite("booleano\"", 1uLL, 9uLL, yyout);
break;
case 3:
fwrite("caracter\"", 1uLL, 9uLL, yyout);
break;
case 1:
fwrite("entero\"", 1uLL, 7uLL, yyout);
break;
}
result = fwrite(" paso=\"", 1uLL, 7uLL, yyout);
if ( !a4 )
return fwrite("val\" />\n", 1uLL, 8uLL, yyout);
if ( a4 == 1 )
result = fwrite("ref\" />\n", 1uLL, 8uLL, yyout);
return result;
}

original_code:
void generar_nuevo_par(int nivel, char *nombre, TIPO_VARIABLE tipo,
                       CLASE_PARAMETRO clase)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<parametro nombre=\"%s\" tipo=\"", nombre);
  switch (tipo)
  {
    case ENTERO: fprintf (yyout, "entero\""); break;
    case BOOLEANO: fprintf (yyout, "booleano\""); break;
    case CHAR: fprintf (yyout, "caracter\""); break;
    default: ;
  }
  fprintf(yyout, " paso=\"");
  switch (clase)
  {
    case VAL: fprintf(yyout, "val\" />\n"); break;
    case REF: fprintf(yyout, "ref\" />\n"); break;
  }
}

canonical_original_code:
void generar_nuevo_par(int nivel, char *nombre, enum TIPO_VARIABLE tipo, enum CLASE_PARAMETRO clase)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<parametro nombre=\"%s\" tipo=\"", nombre);
  switch (tipo)
  {
    case ENTERO: fprintf (yyout, "entero\""); break;
    case BOOLEANO: fprintf (yyout, "booleano\""); break;
    case CHAR: fprintf (yyout, "caracter\""); break;
    default: ;
  }
  fprintf(yyout, " paso=\"");
  switch (clase)
  {
    case VAL: fprintf(yyout, "val\" />\n"); break;
    case REF: fprintf(yyout, "ref\" />\n"); break;
  }
}

variable_types:
clase
enum CLASE_PARAMETRO { VAL=0, REF=1 }

user_defined_types: enum TIPO_VARIABLE { DESCONOCIDO=0, ENTERO=1, BOOLEANO=2, CHAR=3, CADENA=4, VECTOR=5 }


decompiled_code:
size_t __fastcall generar_cierre_acc(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("</accion>\n", 1uLL, 0xAuLL, yyout);
}

canonical_decompiled_code:
size_t __fastcall func9(int a1)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
return fwrite("</accion>\n", 1uLL, 0xAuLL, yyout);
}

original_code:
void generar_cierre_acc(int nivel)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "</accion>\n");
}


decompiled_code:
int __fastcall generar_nueva_var_vector(int a1, const char *a2, int a3, unsigned int a4, unsigned int a5)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
fprintf(yyout, "<var nombre=\"%s\" tipo=\"vector\" tipo_componentes=\"", a2);
switch ( a3 )
{
case 2:
fwrite("booleano\"", 1uLL, 9uLL, yyout);
break;
case 3:
fwrite("caracter\"", 1uLL, 9uLL, yyout);
break;
case 1:
fwrite("entero\"", 1uLL, 7uLL, yyout);
break;
}
return fprintf(yyout, " indice inferior=\"%d\" indice superior =\"%d\" />\n", a4, a5);
}

canonical_decompiled_code:
int __fastcall func10(int a1, const char *a2, int a3, unsigned int a4, unsigned int a5)
{
int i; // ebx

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
fputc(9, yyout);
}
fprintf(yyout, "<var nombre=\"%s\" tipo=\"vector\" tipo_componentes=\"", a2);
switch ( a3 )
{
case 2:
fwrite("booleano\"", 1uLL, 9uLL, yyout);
break;
case 3:
fwrite("caracter\"", 1uLL, 9uLL, yyout);
break;
case 1:
fwrite("entero\"", 1uLL, 7uLL, yyout);
break;
}
return fprintf(yyout, " indice inferior=\"%d\" indice superior =\"%d\" />\n", a4, a5);
}

original_code:
void generar_nueva_var_vector(int nivel, char *nombre,
                              TIPO_VARIABLE tipo_componentes, int indiceInf,
         int indiceSup)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<var nombre=\"%s\" tipo=\"vector\" tipo_componentes=\"",
                 nombre);
  switch (tipo_componentes)
  {
    case ENTERO: fprintf (yyout, "entero\""); break;
    case BOOLEANO: fprintf (yyout, "booleano\""); break;
    case CHAR: fprintf (yyout, "caracter\""); break;
    default: ;
  }
  fprintf(yyout, " indice inferior=\"%d\" indice superior =\"%d\" />\n", indiceInf, indiceSup);
}

canonical_original_code:
void generar_nueva_var_vector(int nivel, char *nombre, enum TIPO_VARIABLE tipo_componentes, int indiceInf, int indiceSup)
{
  int i;
  for (i = 0; i < nivel; i++) fprintf(yyout, "\t");
  fprintf(yyout, "<var nombre=\"%s\" tipo=\"vector\" tipo_componentes=\"",
                 nombre);
  switch (tipo_componentes)
  {
    case ENTERO: fprintf (yyout, "entero\""); break;
    case BOOLEANO: fprintf (yyout, "booleano\""); break;
    case CHAR: fprintf (yyout, "caracter\""); break;
    default: ;
  }
  fprintf(yyout, " indice inferior=\"%d\" indice superior =\"%d\" />\n", indiceInf, indiceSup);
}

variable_types: indiceInf int

variable_types: indiceSup int


newlabel

decompiled_code:
char *newlabel()
{
char *v0; // rbx
__int64 v1; // rdx

v0 = (char *)malloc(5uLL);
v1 = (unsigned int)l_0++;
sprintf(v0, "L%d", v1);
return v0;
}

canonical_decompiled_code:
char *func0()
{
char *v0; // rbx
__int64 v1; // rdx

v0 = (char *)malloc(5uLL);
v1 = (unsigned int)l_0++;
sprintf(v0, "L%d", v1);
return v0;
}

original_code:
char *newlabel ()
{
   static int l = 0;
   char *m = malloc (5);
   sprintf (m, "L%d", l++);
   return m;
}

canonical_original_code:
char *newlabel()
{
   static int l = 0;
   char *m = malloc (5);
   sprintf (m, "L%d", l++);
   return m;
}

variable_types: l int

variable_types:
m
char *

return_type: char *


mnemonic

decompiled_code:
const char *__fastcall mnemonic(unsigned int a1)
{
const char *result; // rax

switch ( a1 )
{
case 0u:
result = "AND ";
break;
case 1u:
result = "ASG ";
break;
case 2u:
result = "ASGI ";
break;
case 3u:
result = "CSF ";
break;
case 4u:
result = "DIV ";
break;
case 5u:
result = "DRF ";
break;
case 6u:
result = "DUP ";
break;
case 7u:
result = "ENP ";
break;
case 8u:
result = "EQ ";
break;
case 9u:
result = "GT ";
break;
case 0xAu:
result = "GTE ";
break;
case 0xBu:
result = "JMF ";
break;
case 0xCu:
result = "JMP ";
break;
case 0xDu:
result = "JMT ";
break;
case 0xEu:
result = "LT ";
break;
case 0xFu:
result = "LTE ";
break;
case 0x10u:
result = "LVP ";
break;
case 0x11u:
result = "MOD ";
break;
case 0x12u:
result = "NEQ ";
break;
case 0x13u:
result = "NGB ";
break;
case 0x14u:
result = "NGI ";
break;
case 0x15u:
result = "NOP ";
break;
case 0x16u:
result = "OR ";
break;
case 0x17u:
result = "OSF ";
break;
case 0x18u:
result = "PLUS ";
break;
case 0x19u:
result = "POP ";
break;
case 0x1Au:
result = "RD ";
break;
case 0x1Bu:
result = "SBT ";
break;
case 0x1Cu:
result = "SRF ";
break;
case 0x1Du:
result = "STC ";
break;
case 0x1Eu:
result = "TMS ";
break;
case 0x1Fu:
result = "SWP ";
break;
case 0x20u:
result = "WRT ";
break;
default:
fprintf(stderr, "MNEMONIC (genast.c): code %d desconocido!", a1);
exit(1);
}
return result;
}

canonical_decompiled_code:
const char *__fastcall func3(unsigned int a1)
{
const char *result; // rax

switch ( a1 )
{
case 0u:
result = "AND ";
break;
case 1u:
result = "ASG ";
break;
case 2u:
result = "ASGI ";
break;
case 3u:
result = "CSF ";
break;
case 4u:
result = "DIV ";
break;
case 5u:
result = "DRF ";
break;
case 6u:
result = "DUP ";
break;
case 7u:
result = "ENP ";
break;
case 8u:
result = "EQ ";
break;
case 9u:
result = "GT ";
break;
case 0xAu:
result = "GTE ";
break;
case 0xBu:
result = "JMF ";
break;
case 0xCu:
result = "JMP ";
break;
case 0xDu:
result = "JMT ";
break;
case 0xEu:
result = "LT ";
break;
case 0xFu:
result = "LTE ";
break;
case 0x10u:
result = "LVP ";
break;
case 0x11u:
result = "MOD ";
break;
case 0x12u:
result = "NEQ ";
break;
case 0x13u:
result = "NGB ";
break;
case 0x14u:
result = "NGI ";
break;
case 0x15u:
result = "NOP ";
break;
case 0x16u:
result = "OR ";
break;
case 0x17u:
result = "OSF ";
break;
case 0x18u:
result = "PLUS ";
break;
case 0x19u:
result = "POP ";
break;
case 0x1Au:
result = "RD ";
break;
case 0x1Bu:
result = "SBT ";
break;
case 0x1Cu:
result = "SRF ";
break;
case 0x1Du:
result = "STC ";
break;
case 0x1Eu:
result = "TMS ";
break;
case 0x1Fu:
result = "SWP ";
break;
case 0x20u:
result = "WRT ";
break;
default:
fprintf(stderr, "MNEMONIC (genast.c): code %d desconocido!", a1);
exit(1);
}
return result;
}

original_code:
char *mnemonic (int code)
{
   switch (code) {
          case 0 : return ("AND "); break;
          case 1 : return ("ASG "); break;
          case 2 : return ("ASGI "); break;
          case 3 : return ("CSF "); break;
          case 5 : return ("DRF "); break;
          case 6 : return ("DUP "); break;
          case 7 : return ("ENP "); break;
          case 8 : return ("EQ "); break;
          case 9 : return ("GT "); break;
          case 10 : return ("GTE "); break;
          case 4 : return ("DIV "); break;
          case 17 : return ("MOD "); break;
          case 22 : return ("OR "); break;
          case 11 : return ("JMF "); break;
          case 12 : return ("JMP "); break;
          case 13 : return ("JMT "); break;
          case 14 : return ("LT "); break;
          case 15 : return ("LTE "); break;
          case 16 : return ("LVP "); break;
          case 18 : return ("NEQ "); break;
          case 19 : return ("NGB "); break;
          case 20 : return ("NGI "); break;
          case 21 : return ("NOP "); break;
          case 23 : return ("OSF "); break;
          case 24 : return ("PLUS "); break;
          case 25 : return ("POP "); break;
          case 26 : return ("RD "); break;
          case 27 : return ("SBT "); break;
          case 28 : return ("SRF "); break;
          case 29 : return ("STC "); break;
          case 31 : return ("SWP "); break;
          case 30 : return ("TMS "); break;
          case 32 : return ("WRT "); break;
          default : fprintf (stderr, "MNEMONIC (genast.c): code %d desconocido!", code);
                        exit(1);
   }
}

canonical_original_code:
char *mnemonic(int code)
{
   switch (code) {
          case 0 : return ("AND "); break;
          case 1 : return ("ASG "); break;
          case 2 : return ("ASGI "); break;
          case 3 : return ("CSF "); break;
          case 5 : return ("DRF "); break;
          case 6 : return ("DUP "); break;
          case 7 : return ("ENP "); break;
          case 8 : return ("EQ "); break;
          case 9 : return ("GT "); break;
          case 10 : return ("GTE "); break;
          case 4 : return ("DIV "); break;
          case 17 : return ("MOD "); break;
          case 22 : return ("OR "); break;
          case 11 : return ("JMF "); break;
          case 12 : return ("JMP "); break;
          case 13 : return ("JMT "); break;
          case 14 : return ("LT "); break;
          case 15 : return ("LTE "); break;
          case 16 : return ("LVP "); break;
          case 18 : return ("NEQ "); break;
          case 19 : return ("NGB "); break;
          case 20 : return ("NGI "); break;
          case 21 : return ("NOP "); break;
          case 23 : return ("OSF "); break;
          case 24 : return ("PLUS "); break;
          case 25 : return ("POP "); break;
          case 26 : return ("RD "); break;
          case 27 : return ("SBT "); break;
          case 28 : return ("SRF "); break;
          case 29 : return ("STC "); break;
          case 31 : return ("SWP "); break;
          case 30 : return ("TMS "); break;
          case 32 : return ("WRT "); break;
          default : fprintf (stderr, "MNEMONIC (genast.c): code %d desconocido!", code);
                        exit(1);
   }
}

variable_types: code int


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

++instno;
if ( numPasada == 2 )
result = generar(yyout, a1);
return result;
}

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

++instno;
if ( numPasada == 2 )
result = generar(yyout, a1);
return result;
}

original_code:
void tratar_instruccion_sin_argumentos (int instruccion)
{
  instno++;
  if (numPasada == 2) generar(yyout, instruccion);
}

canonical_original_code:
void tratar_instruccion_sin_argumentos(int instruccion)
{
  instno++;
  if (numPasada == 2) generar(yyout, instruccion);
}

variable_types: instruccion int


decompiled_code:
int __fastcall tratar_instruccion_con_1_argumento(unsigned int a1, int a2)
{
int result; // eax

++instno;
if ( numPasada == 2 )
{
result = generar(yyout, a1);
switch ( a1 )
{
case 7u:
if ( instno == a2 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a si misma\n", lineno, linepos);
error = 1;
}
if ( a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP tiene el argumento erroneo\n", lineno, linepos);
error = 1;
}
if ( numInst < a2 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a una instruccion mas alla del final del programa\n",
lineno,
linepos);
error = 1;
}
break;
case 0xBu:
case 0xDu:
if ( a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion tiene el argumento erroneo\n", lineno, linepos);
error = 1;
}
if ( numInst < a2 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): no se puede saltar a una instruccion mas alla del final del programa\n",
lineno,
linepos);
error = 1;
}
break;
case 0xCu:
if ( instno == a2 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a si misma\n", lineno, linepos);
error = 1;
}
if ( a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP tiene el argumento erroneo\n", lineno, linepos);
error = 1;
}
if ( numInst < a2 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a una instruccion mas alla del final del programa\n",
lineno,
linepos);
error = 1;
}
break;
case 0x1Au:
case 0x20u:
if ( (unsigned int)a2 > 1 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): La instruccion no puede tener un argumento distinto de 0 o 1\n",
lineno,
linepos);
error = 1;
}
break;
case 0x1Du:
if ( (unsigned int)(a2 + 0x8000) > 0xFFFF )
{
printf(
"ERROR SEMANTICO! (%d, %d): La instruccion STC tiene un argumento fuera del rango permitido para el mismo.\n",
lineno,
linepos);
result = printf("El rango permitido es [%d, %d]\n", 4294934528LL, 0x7FFFLL);
error = 1;
}
break;
default:
return result;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func1(unsigned int a1, int a2)
{
int result; // eax

++instno;
if ( numPasada == 2 )
{
result = generar(yyout, a1);
switch ( a1 )
{
case 7u:
if ( instno == a2 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a si misma\n", lineno, linepos);
error = 1;
}
if ( a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP tiene el argumento erroneo\n", lineno, linepos);
error = 1;
}
if ( numInst < a2 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a una instruccion mas alla del final del programa\n",
lineno,
linepos);
error = 1;
}
break;
case 0xBu:
case 0xDu:
if ( a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion tiene el argumento erroneo\n", lineno, linepos);
error = 1;
}
if ( numInst < a2 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): no se puede saltar a una instruccion mas alla del final del programa\n",
lineno,
linepos);
error = 1;
}
break;
case 0xCu:
if ( instno == a2 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a si misma\n", lineno, linepos);
error = 1;
}
if ( a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP tiene el argumento erroneo\n", lineno, linepos);
error = 1;
}
if ( numInst < a2 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a una instruccion mas alla del final del programa\n",
lineno,
linepos);
error = 1;
}
break;
case 0x1Au:
case 0x20u:
if ( (unsigned int)a2 > 1 )
{
result = printf(
"ERROR SEMANTICO! (%d, %d): La instruccion no puede tener un argumento distinto de 0 o 1\n",
lineno,
linepos);
error = 1;
}
break;
case 0x1Du:
if ( (unsigned int)(a2 + 0x8000) > 0xFFFF )
{
printf(
"ERROR SEMANTICO! (%d, %d): La instruccion STC tiene un argumento fuera del rango permitido para el mismo.\n",
lineno,
linepos);
result = printf("El rango permitido es [%d, %d]\n", 4294934528LL, 0x7FFFLL);
error = 1;
}
break;
default:
return result;
}
}
return result;
}

original_code:
void tratar_instruccion_con_1_argumento (int instruccion, int arg1)
{
  instno++;
  if (numPasada == 2)
  {
    generar(yyout, instruccion, arg1);
    switch (instruccion)
    {
      case 29: if ((arg1 < (-0x7fff - 1)) || (arg1 > 0x7fff))
                 {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion STC tiene un argumento fuera del rango permitido para el mismo.\n",
             lineno, linepos);
     printf("El rango permitido es [%d, %d]\n", (-0x7fff - 1), 0x7fff);
       error = 1;
   }
                 break;
      case 7: if (arg1 == instno)
                 {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a si misma\n",
             lineno, linepos);
       error = 1;
   }
   if (arg1 <= 0)
                 {
            printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP tiene el argumento erroneo\n",
             lineno, linepos);
       error = 1;
          }
   if (arg1 > numInst)
   {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a una instruccion mas alla del final del programa\n",
             lineno, linepos);
       error = 1;
   }
   break;
      case 12: if (arg1 == instno)
                 {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a si misma\n",
             lineno, linepos);
       error = 1;
   }
   if (arg1 <= 0)
                 {
            printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP tiene el argumento erroneo\n",
             lineno, linepos);
       error = 1;
          }
   if (arg1 > numInst)
   {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a una instruccion mas alla del final del programa\n",
             lineno, linepos);
       error = 1;
   }
   break;
      case 11:
      case 13: if (arg1 <= 0)
                 {
            printf("ERROR SEMANTICO! (%d, %d): La instruccion tiene el argumento erroneo\n",
             lineno, linepos);
       error = 1;
          }
   if (arg1 > numInst)
   {
     printf("ERROR SEMANTICO! (%d, %d): no se puede saltar a una instruccion mas alla del final del programa\n",
             lineno, linepos);
       error = 1;
   }
   break;
      case 26:
      case 32: if ((arg1 != 0) && (arg1 != 1))
                {
           printf("ERROR SEMANTICO! (%d, %d): La instruccion no puede tener un argumento distinto de 0 o 1\n",
            lineno, linepos);
        error = 1;
         }
  break;
      default : ;
     }
  }
}

canonical_original_code:
void tratar_instruccion_con_1_argumento(int instruccion, int arg1)
{
  instno++;
  if (numPasada == 2)
  {
    generar(yyout, instruccion, arg1);
    switch (instruccion)
    {
      case 29: if ((arg1 < (-0x7fff - 1)) || (arg1 > 0x7fff))
                 {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion STC tiene un argumento fuera del rango permitido para el mismo.\n",
             lineno, linepos);
     printf("El rango permitido es [%d, %d]\n", (-0x7fff - 1), 0x7fff);
       error = 1;
   }
                 break;
      case 7: if (arg1 == instno)
                 {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a si misma\n",
             lineno, linepos);
       error = 1;
   }
   if (arg1 <= 0)
                 {
            printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP tiene el argumento erroneo\n",
             lineno, linepos);
       error = 1;
          }
   if (arg1 > numInst)
   {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion ENP no puede saltar a una instruccion mas alla del final del programa\n",
             lineno, linepos);
       error = 1;
   }
   break;
      case 12: if (arg1 == instno)
                 {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a si misma\n",
             lineno, linepos);
       error = 1;
   }
   if (arg1 <= 0)
                 {
            printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP tiene el argumento erroneo\n",
             lineno, linepos);
       error = 1;
          }
   if (arg1 > numInst)
   {
     printf("ERROR SEMANTICO! (%d, %d): La instruccion JMP no puede saltar a una instruccion mas alla del final del programa\n",
             lineno, linepos);
       error = 1;
   }
   break;
      case 11:
      case 13: if (arg1 <= 0)
                 {
            printf("ERROR SEMANTICO! (%d, %d): La instruccion tiene el argumento erroneo\n",
             lineno, linepos);
       error = 1;
          }
   if (arg1 > numInst)
   {
     printf("ERROR SEMANTICO! (%d, %d): no se puede saltar a una instruccion mas alla del final del programa\n",
             lineno, linepos);
       error = 1;
   }
   break;
      case 26:
      case 32: if ((arg1 != 0) && (arg1 != 1))
                {
           printf("ERROR SEMANTICO! (%d, %d): La instruccion no puede tener un argumento distinto de 0 o 1\n",
            lineno, linepos);
        error = 1;
         }
  break;
      default : ;
     }
  }
}


decompiled_code:
int __fastcall tratar_instruccion_con_2_argumentos(unsigned int a1, int a2, int a3)
{
int result; // eax

++instno;
if ( numPasada == 2 )
{
result = generar(yyout, a1);
if ( a2 < 0 || a3 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion SRF tiene algun argumento erroneo\n", lineno, linepos);
error = 1;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(unsigned int a1, int a2, int a3)
{
int result; // eax

++instno;
if ( numPasada == 2 )
{
result = generar(yyout, a1);
if ( a2 < 0 || a3 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion SRF tiene algun argumento erroneo\n", lineno, linepos);
error = 1;
}
}
return result;
}

original_code:
void tratar_instruccion_con_2_argumentos (int instruccion, int arg1, int arg2)
{
  instno++;
  if (numPasada == 2)
  {
    generar(yyout, instruccion, arg1, arg2);
    if ((arg1 < 0) || (arg2 <= 0))
    {
      printf("ERROR SEMANTICO! (%d, %d): La instruccion SRF tiene algun argumento erroneo\n",
       lineno, linepos);
      error = 1;
    }
  }
}

canonical_original_code:
void tratar_instruccion_con_2_argumentos(int instruccion, int arg1, int arg2)
{
  instno++;
  if (numPasada == 2)
  {
    generar(yyout, instruccion, arg1, arg2);
    if ((arg1 < 0) || (arg2 <= 0))
    {
      printf("ERROR SEMANTICO! (%d, %d): La instruccion SRF tiene algun argumento erroneo\n",
       lineno, linepos);
      error = 1;
    }
  }
}


decompiled_code:
char __fastcall tratar_instruccion_con_3_argumentos(unsigned int a1, int a2, int a3, int a4)
{
char result; // al

++instno;
if ( numPasada == 2 )
{
generar(yyout, a1);
result = a3 < 0 || a4 <= 0;
if ( result || a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion OSF tiene algun argumento erroneo\n", lineno, linepos);
error = 1;
}
}
return result;
}

canonical_decompiled_code:
char __fastcall func3(unsigned int a1, int a2, int a3, int a4)
{
char result; // al

++instno;
if ( numPasada == 2 )
{
generar(yyout, a1);
result = a3 < 0 || a4 <= 0;
if ( result || a2 <= 0 )
{
result = printf("ERROR SEMANTICO! (%d, %d): La instruccion OSF tiene algun argumento erroneo\n", lineno, linepos);
error = 1;
}
}
return result;
}

original_code:
void tratar_instruccion_con_3_argumentos (int instruccion, int arg1, int arg2, int arg3)
{
  instno++;
  if (numPasada == 2)
  {
    generar(yyout, instruccion, arg1, arg2, arg3);
    if ((arg3 <= 0) || (arg2 < 0) || (arg1 <= 0))
    {
      printf("ERROR SEMANTICO! (%d, %d): La instruccion OSF tiene algun argumento erroneo\n",
        lineno, linepos);
      error = 1;
    }
  }
}

canonical_original_code:
void tratar_instruccion_con_3_argumentos(int instruccion, int arg1, int arg2, int arg3)
{
  instno++;
  if (numPasada == 2)
  {
    generar(yyout, instruccion, arg1, arg2, arg3);
    if ((arg3 <= 0) || (arg2 < 0) || (arg1 <= 0))
    {
      printf("ERROR SEMANTICO! (%d, %d): La instruccion OSF tiene algun argumento erroneo\n",
        lineno, linepos);
      error = 1;
    }
  }
}


decompiled_code:
void __fastcall agregar_etiqueta(const char *a1)
{
if ( numPasada == 1 )
{
if ( (unsigned int)buscar_etiqueta() == -1 )
{
anadir_etiqueta(a1, (unsigned int)(instno + 1));
}
else
{
printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s ya ha sido declarada.\n", lineno, linepos, a1);
error = 1;
}
}
}

canonical_decompiled_code:
void __fastcall func4(const char *a1)
{
if ( numPasada == 1 )
{
if ( (unsigned int)buscar_etiqueta() == -1 )
{
anadir_etiqueta(a1, (unsigned int)(instno + 1));
}
else
{
printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s ya ha sido declarada.\n", lineno, linepos, a1);
error = 1;
}
}
}

original_code:
void agregar_etiqueta (char *etiqueta)
{
  if (numPasada == 1)
  {
    if (buscar_etiqueta(etiqueta) == -1) anadir_etiqueta(etiqueta, instno+1);
    else
    {
      printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s ya ha sido declarada.\n",
              lineno, linepos, etiqueta);
      error = 1;
    }
  }
}

canonical_original_code:
void agregar_etiqueta(char *etiqueta)
{
  if (numPasada == 1)
  {
    if (buscar_etiqueta(etiqueta) == -1) anadir_etiqueta(etiqueta, instno+1);
    else
    {
      printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s ya ha sido declarada.\n",
              lineno, linepos, etiqueta);
      error = 1;
    }
  }
}

variable_types:
etiqueta
char *


referencia

decompiled_code:
__int64 __fastcall referencia(const char *a1)
{
unsigned int v1; // ebx

if ( numPasada != 2 )
return (unsigned int)-1;
v1 = buscar_etiqueta();
if ( v1 == -1 )
{
printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s no ha sido declarada.\n", lineno, linepos, a1);
error = 1;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func5(const char *a1)
{
unsigned int v1; // ebx

if ( numPasada != 2 )
return (unsigned int)-1;
v1 = buscar_etiqueta();
if ( v1 == -1 )
{
printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s no ha sido declarada.\n", lineno, linepos, a1);
error = 1;
}
return v1;
}

original_code:
int referencia (char *etiqueta)
{
  int r;
  if (numPasada == 2)
  {
    if ((r = buscar_etiqueta(etiqueta)) == -1)
    {
      printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s no ha sido declarada.\n",
              lineno, linepos, etiqueta);
      error = 1;
      return r;
    }
    else return r;
  }
  else return -1;
}

canonical_original_code:
int referencia(char *etiqueta)
{
  int r;
  if (numPasada == 2)
  {
    if ((r = buscar_etiqueta(etiqueta)) == -1)
    {
      printf("ERROR SEMANTICO! (%d, %d): la etiqueta %s no ha sido declarada.\n",
              lineno, linepos, etiqueta);
      error = 1;
      return r;
    }
    else return r;
  }
  else return -1;
}

variable_types: r int


yyparse

original_code:
int
yyparse()

{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;
  int yychar1 = 0;
  short yyssa[200];
  YYSTYPE yyvsa[200];
  short *yyss = yyssa;
  YYSTYPE *yyvs = yyvsa;
  int yystacksize = 200;
  int yyfree_stacks = 0;
  YYSTYPE yyval;
  int yylen;
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = -2;
  yyssp = yyss - 1;
  yyvsp = yyvs;
yynewstate:
  *++yyssp = yystate;
  if (yyssp >= yyss + yystacksize - 1)
    {
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
      int size = yyssp - yyss + 1;
      if (yystacksize >= 10000)
 {
   yyerror("parser stack overflow");
   if (yyfree_stacks)
     {
       free (yyss);
       free (yyvs);
     }
   return 2;
 }
      yystacksize *= 2;
      if (yystacksize > 10000)
 yystacksize = 10000;
      yyss = (short *) __builtin_alloca (yystacksize * sizeof (*yyssp));
      __builtin_memcpy((char *)yyss,(char *)yyss1,size * (unsigned int) sizeof (*yyssp));
      yyvs = (YYSTYPE *) __builtin_alloca (yystacksize * sizeof (*yyvsp));
      __builtin_memcpy((char *)yyvs,(char *)yyvs1,size * (unsigned int) sizeof (*yyvsp));
      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
      if (yydebug)
 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
      if (yyssp >= yyss + yystacksize - 1)
 goto yyabortlab;
    }
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
  goto yybackup;
 yybackup:
  yyn = yypact[yystate];
  if (yyn == -32768)
    goto yydefault;
  if (yychar == -2)
    {
      if (yydebug)
 fprintf(stderr, "Reading a token: ");
      yychar = yylex();
    }
  if (yychar <= 0)
    {
      yychar1 = 0;
      yychar = 0;
      if (yydebug)
 fprintf(stderr, "Now at end of input.\n");
    }
  else
    {
      yychar1 = ((unsigned)(yychar) <= 292 ? yytranslate[yychar] : 85);
      if (yydebug)
 {
   fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
   fprintf (stderr, ")\n");
 }
    }
  yyn += yychar1;
  if (yyn < 0 || yyn > 158 || yycheck[yyn] != yychar1)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == -32768)
 goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;
  if (yyn == 106)
    goto yyacceptlab;
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  if (yychar != 0)
    yychar = -2;
  *++yyvsp = yylval;
  if (yyerrstatus) yyerrstatus--;
  yystate = yyn;
  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen];
  if (yydebug)
    {
      int i;
      fprintf (stderr, "Reducing via rule %d (line %d), ",
        yyn, yyrline[yyn]);
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
  switch (yyn) {
case 5:
{ agregar_etiqueta(yyvsp[-1].identificador); ;
    break;}
case 6:
{ agregar_etiqueta(yyvsp[-1].identificador); ;
    break;}
case 7:
{
      tratar_instruccion_con_1_argumento(yyvsp[-1].constante, yyvsp[0].constante);
    ;
    break;}
case 8:
{
      tratar_instruccion_con_1_argumento(yyvsp[-1].constante, referencia(yyvsp[0].identificador));
    ;
    break;}
case 13:
{ tratar_instruccion_sin_argumentos(yyvsp[0].constante); ;
    break;}
case 14:
{
     tratar_instruccion_sin_argumentos(yyvsp[0].constante);
   ;
    break;}
case 15:
{
              tratar_instruccion_sin_argumentos(yyvsp[0].constante);
            ;
    break;}
case 16:
{
       tratar_instruccion_con_1_argumento(yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 17:
{
       tratar_instruccion_con_1_argumento(yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 18:
{
       tratar_instruccion_con_1_argumento(yyvsp[-1].constante, referencia(yyvsp[0].identificador));
     ;
    break;}
case 19:
{
        tratar_instruccion_con_2_argumentos(yyvsp[-2].constante, yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 20:
{
        tratar_instruccion_con_3_argumentos(yyvsp[-3].constante, yyvsp[-2].constante, yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 21:
{
       tratar_instruccion_con_3_argumentos(yyvsp[-3].constante, yyvsp[-2].constante, yyvsp[-1].constante, referencia(yyvsp[0].identificador));
     ;
    break;}
case 57:
{ yyval.constante = 0; ;
    break;}
case 58:
{ yyval.constante = 1; ;
    break;}
case 59:
{ yyval.constante = 2; ;
    break;}
case 60:
{ yyval.constante = 3; ;
    break;}
case 61:
{ yyval.constante = 4; ;
    break;}
case 62:
{ yyval.constante = 5; ;
    break;}
case 63:
{ yyval.constante = 6; ;
    break;}
case 64:
{ yyval.constante = 7; ;
    break;}
case 65:
{ yyval.constante = 8; ;
    break;}
case 66:
{ yyval.constante = 9; ;
    break;}
case 67:
{ yyval.constante = 10; ;
    break;}
case 68:
{ yyval.constante = 11; ;
    break;}
case 69:
{ yyval.constante = 12; ;
    break;}
case 70:
{ yyval.constante = 13; ;
    break;}
case 71:
{ yyval.constante = 14; ;
    break;}
case 72:
{ yyval.constante = 15; ;
    break;}
case 73:
{ yyval.constante = 16; ;
    break;}
case 74:
{ yyval.constante = 17; ;
    break;}
case 75:
{ yyval.constante = 18; ;
    break;}
case 76:
{ yyval.constante = 19; ;
    break;}
case 77:
{ yyval.constante = 20; ;
    break;}
case 78:
{ yyval.constante = 21; ;
    break;}
case 79:
{ yyval.constante = 24; ;
    break;}
case 80:
{ yyval.constante = 22; ;
    break;}
case 81:
{ yyval.constante = 23; ;
    break;}
case 82:
{ yyval.constante = 25; ;
    break;}
case 83:
{ yyval.constante = 26; ;
    break;}
case 84:
{ yyval.constante = 27; ;
    break;}
case 85:
{ yyval.constante = 28; ;
    break;}
case 86:
{ yyval.constante = 29; ;
    break;}
case 87:
{ yyval.constante = 30; ;
    break;}
case 88:
{ yyval.constante = 32; ;
    break;}
case 89:
{ yyval.constante = 31; ;
    break;}
}
  yyvsp -= yylen;
  yyssp -= yylen;
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
 fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
  *++yyvsp = yyval;
  yyn = yyr1[yyn];
  yystate = yypgoto[yyn - 40] + *yyssp;
  if (yystate >= 0 && yystate <= 158 && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - 40];
  goto yynewstate;
yyerrlab:
  if (! yyerrstatus)
    {
      ++yynerrs;
 yyerror("parse error");
    }
  goto yyerrlab1;
yyerrlab1:
  if (yyerrstatus == 3)
    {
      if (yychar == 0)
 goto yyabortlab;
      if (yydebug)
 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
      yychar = -2;
    }
  yyerrstatus = 3;
  goto yyerrhandle;
yyerrdefault:
yyerrpop:
  if (yyssp == yyss) goto yyabortlab;
  yyvsp--;
  yystate = *--yyssp;
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
 fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
yyerrhandle:
  yyn = yypact[yystate];
  if (yyn == -32768)
    goto yyerrdefault;
  yyn += 1;
  if (yyn < 0 || yyn > 158 || yycheck[yyn] != 1)
    goto yyerrdefault;
  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == -32768)
 goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;
  if (yyn == 106)
    goto yyacceptlab;
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
  *++yyvsp = yylval;
  yystate = yyn;
  goto yynewstate;
 yyacceptlab:
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
    }
  return 0;
 yyabortlab:
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
    }
  return 1;
}

canonical_original_code:
int yyparse()

{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register union YYSTYPE *yyvsp;
  int yyerrstatus;
  int yychar1 = 0;
  short yyssa[200];
  union YYSTYPE yyvsa[200];
  short *yyss = yyssa;
  union YYSTYPE *yyvs = yyvsa;
  int yystacksize = 200;
  int yyfree_stacks = 0;
  union YYSTYPE yyval;
  int yylen;
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = -2;
  yyssp = yyss - 1;
  yyvsp = yyvs;
yynewstate:
  *++yyssp = yystate;
  if (yyssp >= yyss + yystacksize - 1)
    {
      union YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
      int size = yyssp - yyss + 1;
      if (yystacksize >= 10000)
 {
   yyerror("parser stack overflow");
   if (yyfree_stacks)
     {
       free (yyss);
       free (yyvs);
     }
   return 2;
 }
      yystacksize *= 2;
      if (yystacksize > 10000)
 yystacksize = 10000;
      yyss = (short *) __builtin_alloca (yystacksize * sizeof (*yyssp));
      __builtin_memcpy((char *)yyss,(char *)yyss1,size * (unsigned int) sizeof (*yyssp));
      yyvs = (union YYSTYPE *) __builtin_alloca (yystacksize * sizeof (*yyvsp));
      __builtin_memcpy((char *)yyvs,(char *)yyvs1,size * (unsigned int) sizeof (*yyvsp));
      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
      if (yydebug)
 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
      if (yyssp >= yyss + yystacksize - 1)
 goto yyabortlab;
    }
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
  goto yybackup;
 yybackup:
  yyn = yypact[yystate];
  if (yyn == -32768)
    goto yydefault;
  if (yychar == -2)
    {
      if (yydebug)
 fprintf(stderr, "Reading a token: ");
      yychar = yylex();
    }
  if (yychar <= 0)
    {
      yychar1 = 0;
      yychar = 0;
      if (yydebug)
 fprintf(stderr, "Now at end of input.\n");
    }
  else
    {
      yychar1 = ((unsigned int)(yychar) <= 292 ? yytranslate[yychar] : 85);
      if (yydebug)
 {
   fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
   fprintf (stderr, ")\n");
 }
    }
  yyn += yychar1;
  if (yyn < 0 || yyn > 158 || yycheck[yyn] != yychar1)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == -32768)
 goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;
  if (yyn == 106)
    goto yyacceptlab;
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  if (yychar != 0)
    yychar = -2;
  *++yyvsp = yylval;
  if (yyerrstatus) yyerrstatus--;
  yystate = yyn;
  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen];
  if (yydebug)
    {
      int i;
      fprintf (stderr, "Reducing via rule %d (line %d), ",
        yyn, yyrline[yyn]);
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
  switch (yyn) {
case 5:
{ agregar_etiqueta(yyvsp[-1].identificador); ;
    break;}
case 6:
{ agregar_etiqueta(yyvsp[-1].identificador); ;
    break;}
case 7:
{
      tratar_instruccion_con_1_argumento(yyvsp[-1].constante, yyvsp[0].constante);
    ;
    break;}
case 8:
{
      tratar_instruccion_con_1_argumento(yyvsp[-1].constante, referencia(yyvsp[0].identificador));
    ;
    break;}
case 13:
{ tratar_instruccion_sin_argumentos(yyvsp[0].constante); ;
    break;}
case 14:
{
     tratar_instruccion_sin_argumentos(yyvsp[0].constante);
   ;
    break;}
case 15:
{
              tratar_instruccion_sin_argumentos(yyvsp[0].constante);
            ;
    break;}
case 16:
{
       tratar_instruccion_con_1_argumento(yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 17:
{
       tratar_instruccion_con_1_argumento(yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 18:
{
       tratar_instruccion_con_1_argumento(yyvsp[-1].constante, referencia(yyvsp[0].identificador));
     ;
    break;}
case 19:
{
        tratar_instruccion_con_2_argumentos(yyvsp[-2].constante, yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 20:
{
        tratar_instruccion_con_3_argumentos(yyvsp[-3].constante, yyvsp[-2].constante, yyvsp[-1].constante, yyvsp[0].constante);
     ;
    break;}
case 21:
{
       tratar_instruccion_con_3_argumentos(yyvsp[-3].constante, yyvsp[-2].constante, yyvsp[-1].constante, referencia(yyvsp[0].identificador));
     ;
    break;}
case 57:
{ yyval.constante = 0; ;
    break;}
case 58:
{ yyval.constante = 1; ;
    break;}
case 59:
{ yyval.constante = 2; ;
    break;}
case 60:
{ yyval.constante = 3; ;
    break;}
case 61:
{ yyval.constante = 4; ;
    break;}
case 62:
{ yyval.constante = 5; ;
    break;}
case 63:
{ yyval.constante = 6; ;
    break;}
case 64:
{ yyval.constante = 7; ;
    break;}
case 65:
{ yyval.constante = 8; ;
    break;}
case 66:
{ yyval.constante = 9; ;
    break;}
case 67:
{ yyval.constante = 10; ;
    break;}
case 68:
{ yyval.constante = 11; ;
    break;}
case 69:
{ yyval.constante = 12; ;
    break;}
case 70:
{ yyval.constante = 13; ;
    break;}
case 71:
{ yyval.constante = 14; ;
    break;}
case 72:
{ yyval.constante = 15; ;
    break;}
case 73:
{ yyval.constante = 16; ;
    break;}
case 74:
{ yyval.constante = 17; ;
    break;}
case 75:
{ yyval.constante = 18; ;
    break;}
case 76:
{ yyval.constante = 19; ;
    break;}
case 77:
{ yyval.constante = 20; ;
    break;}
case 78:
{ yyval.constante = 21; ;
    break;}
case 79:
{ yyval.constante = 24; ;
    break;}
case 80:
{ yyval.constante = 22; ;
    break;}
case 81:
{ yyval.constante = 23; ;
    break;}
case 82:
{ yyval.constante = 25; ;
    break;}
case 83:
{ yyval.constante = 26; ;
    break;}
case 84:
{ yyval.constante = 27; ;
    break;}
case 85:
{ yyval.constante = 28; ;
    break;}
case 86:
{ yyval.constante = 29; ;
    break;}
case 87:
{ yyval.constante = 30; ;
    break;}
case 88:
{ yyval.constante = 32; ;
    break;}
case 89:
{ yyval.constante = 31; ;
    break;}
}
  yyvsp -= yylen;
  yyssp -= yylen;
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
 fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
  *++yyvsp = yyval;
  yyn = yyr1[yyn];
  yystate = yypgoto[yyn - 40] + *yyssp;
  if (yystate >= 0 && yystate <= 158 && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - 40];
  goto yynewstate;
yyerrlab:
  if (! yyerrstatus)
    {
      ++yynerrs;
 yyerror("parse error");
    }
  goto yyerrlab1;
yyerrlab1:
  if (yyerrstatus == 3)
    {
      if (yychar == 0)
 goto yyabortlab;
      if (yydebug)
 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
      yychar = -2;
    }
  yyerrstatus = 3;
  goto yyerrhandle;
yyerrdefault:
yyerrpop:
  if (yyssp == yyss) goto yyabortlab;
  yyvsp--;
  yystate = *--yyssp;
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
 fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
yyerrhandle:
  yyn = yypact[yystate];
  if (yyn == -32768)
    goto yyerrdefault;
  yyn += 1;
  if (yyn < 0 || yyn > 158 || yycheck[yyn] != 1)
    goto yyerrdefault;
  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == -32768)
 goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;
  if (yyn == 106)
    goto yyacceptlab;
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
  *++yyvsp = yylval;
  yystate = yyn;
  goto yynewstate;
 yyacceptlab:
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
    }
  return 0;
 yyabortlab:
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
    }
  return 1;
}

variable_types: yystate int

variable_types: yyn int

variable_types:
yyssp
short *

variable_types: union YYSTYPE { int constante; char *identificador; } *

variable_types: yyerrstatus int

variable_types:
yyssa
short [200]

variable_types: union YYSTYPE { int constante; char *identificador; } [200]

variable_types:
yyss
short *

variable_types: yystacksize int

variable_types: yylen int

variable_types: size int


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

result = instno;
numInst = instno;
instno = -1;
lineno = 1;
linepos = 1;
++numPasada;
return result;
}

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

result = instno;
numInst = instno;
instno = -1;
lineno = 1;
linepos = 1;
++numPasada;
return result;
}

original_code:
void finalizar_pasada()
{
  numInst = instno;
  instno = -1;
  lineno = 1;
  linepos = 1;
  numPasada++;
}


yyerror

decompiled_code:
void __fastcall __noreturn yyerror(const char *a1)
{
fprintf(stderr, "ERROR SINTACTICO! (%d, %d, %s): %s\n", lineno, linepos, (const char *)&yytext, a1);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func0(const char *a1)
{
fprintf(stderr, "ERROR SINTACTICO! (%d, %d, %s): %s\n", lineno, linepos, (const char *)&yytext, a1);
exit(1);
}

original_code:
void yyerror(char *m)
{
    fprintf (stderr, "ERROR SINTACTICO! (%d, %d, %s): %s\n",
                     lineno, linepos, yytext, m);
    exit (1);
}


decompiled_code:
int __fastcall error_semantico(const char *a1)
{
LODWORD(error) = 1;
return fprintf(stderr, "ERROR SEMANTICO! (%d, %d, %s) %s\n", lineno, linepos, yytext, a1);
}

canonical_decompiled_code:
int __fastcall func2(const char *a1)
{
LODWORD(error) = 1;
return fprintf(stderr, "ERROR SEMANTICO! (%d, %d, %s) %s\n", lineno, linepos, yytext, a1);
}

original_code:
void error_semantico (char *mens)
{
        error = 1;
 fprintf (stderr, "ERROR SEMANTICO! (%d, %d, %s) %s\n", lineno, linepos, yytext, mens);
}

canonical_original_code:
void error_semantico(char *mens)
{
        error = 1;
 fprintf (stderr, "ERROR SEMANTICO! (%d, %d, %s) %s\n", lineno, linepos, yytext, mens);
}

variable_types:
mens
char *


decompiled_code:
__int64 __fastcall anadir_etiqueta(const char *a1, __int16 a2)
{
int v2; // ebx
char *v3; // rcx
__int64 result; // rax

v2 = netiqueta;
if ( netiqueta == 10000 )
{
fwrite("(etiquetas): Vector de etiquetas agotado.", 1uLL, 0x29uLL, stderr);
exit(1);
}
v3 = strdup(a1);
result = 2LL * v2;
etiquetas[result] = (__int64)v3;
LOWORD(etiquetas[result + 1]) = a2;
WORD1(etiquetas[result + 1]) = 0;
netiqueta = v2 + 1;
return result * 8;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, __int16 a2)
{
int v2; // ebx
char *v3; // rcx
__int64 result; // rax

v2 = netiqueta;
if ( netiqueta == 10000 )
{
fwrite("(etiquetas): Vector de etiquetas agotado.", 1uLL, 0x29uLL, stderr);
exit(1);
}
v3 = strdup(a1);
result = 2LL * v2;
etiquetas[result] = (__int64)v3;
LOWORD(etiquetas[result + 1]) = a2;
WORD1(etiquetas[result + 1]) = 0;
netiqueta = v2 + 1;
return result * 8;
}

original_code:
void anadir_etiqueta (char *etiqueta, int instr)
{
   if (netiqueta == 10000)
   {
   fprintf(stderr, "(etiquetas): Vector de etiquetas agotado.");
   exit (1);
   }
   else
   {
   etiquetas[netiqueta].nombre = strdup (etiqueta);
   etiquetas[netiqueta].instr = instr;
   etiquetas[netiqueta].referenciada = 0;
   ++netiqueta;
   }
}

canonical_original_code:
void anadir_etiqueta(char *etiqueta, int instr)
{
   if (netiqueta == 10000)
   {
   fprintf(stderr, "(etiquetas): Vector de etiquetas agotado.");
   exit (1);
   }
   else
   {
   etiquetas[netiqueta].nombre = strdup (etiqueta);
   etiquetas[netiqueta].instr = instr;
   etiquetas[netiqueta].referenciada = 0;
   ++netiqueta;
   }
}

variable_types: instr int


decompiled_code:
__int64 __fastcall buscar_etiqueta(char *s2)
{
int v1; // er12
__int64 v2; // rbx
__int64 v4; // rbp

v1 = netiqueta;
if ( netiqueta <= 0 )
return 0xFFFFFFFFLL;
v2 = 0LL;
while ( strcmp((const char *)etiquetas[2 * v2], s2) )
{
if ( ++v2 == v1 )
return 0xFFFFFFFFLL;
}
v4 = 2LL * (int)v2;
WORD1(etiquetas[v4 + 1]) = 1;
return (unsigned int)SLOWORD(etiquetas[v4 + 1]);
}

canonical_decompiled_code:
__int64 __fastcall func1(char *s2)
{
int v1; // er12
__int64 v2; // rbx
__int64 v4; // rbp

v1 = netiqueta;
if ( netiqueta <= 0 )
return 0xFFFFFFFFLL;
v2 = 0LL;
while ( strcmp((const char *)etiquetas[2 * v2], s2) )
{
if ( ++v2 == v1 )
return 0xFFFFFFFFLL;
}
v4 = 2LL * (int)v2;
WORD1(etiquetas[v4 + 1]) = 1;
return (unsigned int)SLOWORD(etiquetas[v4 + 1]);
}

original_code:
int buscar_etiqueta (char *etiqueta)
{
   int i, encontrada;
   i = 0;
   encontrada = 0;
   while ((!encontrada) && (i < netiqueta))
   {
   if (!strcmp(etiquetas[i].nombre, etiqueta))
   {
   encontrada = 1;
         etiquetas[i].referenciada = 1;
   }
         else
   ++i;
   }
   return (encontrada ? etiquetas[i].instr : -1);
}

canonical_original_code:
int buscar_etiqueta(char *etiqueta)
{
   int i; int encontrada;
   i = 0;
   encontrada = 0;
   while ((!encontrada) && (i < netiqueta))
   {
   if (!strcmp(etiquetas[i].nombre, etiqueta))
   {
   encontrada = 1;
         etiquetas[i].referenciada = 1;
   }
         else
   ++i;
   }
   return (encontrada ? etiquetas[i].instr : -1);
}

variable_types: i int

variable_types: encontrada int


decompiled_code:
int mostrar_etiquetas()
{
int result; // eax
__int64 *v1; // rbx
int v2; // ebp

result = fprintf(stderr, "Etiquetas: %d\n\n", (unsigned int)netiqueta);
if ( netiqueta > 0 )
{
v1 = etiquetas;
v2 = 0;
do
{
result = fprintf(
stderr,
"%d: id: %s, instr: %d, ref: %d\n",
(unsigned int)v2++,
(const char *)*v1,
(unsigned int)*((__int16 *)v1 + 4),
(unsigned int)*((__int16 *)v1 + 5));
v1 += 2;
}
while ( netiqueta > v2 );
}
return result;
}

canonical_decompiled_code:
int func2()
{
int result; // eax
__int64 *v1; // rbx
int v2; // ebp

result = fprintf(stderr, "Etiquetas: %d\n\n", (unsigned int)netiqueta);
if ( netiqueta > 0 )
{
v1 = etiquetas;
v2 = 0;
do
{
result = fprintf(
stderr,
"%d: id: %s, instr: %d, ref: %d\n",
(unsigned int)v2++,
(const char *)*v1,
(unsigned int)*((__int16 *)v1 + 4),
(unsigned int)*((__int16 *)v1 + 5));
v1 += 2;
}
while ( netiqueta > v2 );
}
return result;
}

original_code:
void mostrar_etiquetas ()
{
   int i;
   i = 0;
   fprintf(stderr, "Etiquetas: %d\n\n", netiqueta);
   while (i < netiqueta)
   {
   fprintf(stderr, "%d: id: %s, instr: %d, ref: %d\n", i,
     etiquetas[i].nombre, etiquetas[i].instr,
     etiquetas[i].referenciada);
   ++i;
   }
}

canonical_original_code:
void mostrar_etiquetas()
{
   int i;
   i = 0;
   fprintf(stderr, "Etiquetas: %d\n\n", netiqueta);
   while (i < netiqueta)
   {
   fprintf(stderr, "%d: id: %s, instr: %d, ref: %d\n", i,
     etiquetas[i].nombre, etiquetas[i].instr,
     etiquetas[i].referenciada);
   ++i;
   }
}


decompiled_code:
int mostrar_etiquetas_no_referenciadas()
{
__int64 *v0; // rbx
int v1; // ebp
int result; // eax

if ( netiqueta > 0 )
{
v0 = etiquetas;
v1 = 0;
do
{
if ( !*((_WORD *)v0 + 5) )
result = fprintf(
stderr,
"Etiqueta no referenciada: %s, instruccion: %d\n",
(const char *)*v0,
(unsigned int)*((__int16 *)v0 + 4));
++v1;
v0 += 2;
}
while ( netiqueta > v1 );
}
return result;
}

canonical_decompiled_code:
int func3()
{
__int64 *v0; // rbx
int v1; // ebp
int result; // eax

if ( netiqueta > 0 )
{
v0 = etiquetas;
v1 = 0;
do
{
if ( !*((_WORD *)v0 + 5) )
result = fprintf(
stderr,
"Etiqueta no referenciada: %s, instruccion: %d\n",
(const char *)*v0,
(unsigned int)*((__int16 *)v0 + 4));
++v1;
v0 += 2;
}
while ( netiqueta > v1 );
}
return result;
}

original_code:
void mostrar_etiquetas_no_referenciadas ()
{
   int i;
   i = 0;
   while (i < netiqueta)
   {
   if (!etiquetas[i].referenciada)
      fprintf(stderr, "Etiqueta no referenciada: %s, instruccion: %d\n",
           etiquetas[i].nombre, etiquetas[i].instr);
   ++i;
   }
}

canonical_original_code:
void mostrar_etiquetas_no_referenciadas()
{
   int i;
   i = 0;
   while (i < netiqueta)
   {
   if (!etiquetas[i].referenciada)
      fprintf(stderr, "Etiqueta no referenciada: %s, instruccion: %d\n",
           etiquetas[i].nombre, etiquetas[i].instr);
   ++i;
   }
}


decompiled_code:
__int64 __fastcall spi_flash_read_data(int a1, _BYTE *a2, int a3)
{
_BYTE *v3; // rax
int v4; // edi

if ( a3 )
{
v3 = a2;
v4 = a1 - (_DWORD)a2;
do
{
*v3 = dev[v4 + (_DWORD)v3];
++v3;
}
while ( v3 != &a2[a3 - 1 + 1] );
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, _BYTE *a2, int a3)
{
_BYTE *v3; // rax
int v4; // edi

if ( a3 )
{
v3 = a2;
v4 = a1 - (_DWORD)a2;
do
{
*v3 = dev[v4 + (_DWORD)v3];
++v3;
}
while ( v3 != &a2[a3 - 1 + 1] );
}
return 0LL;
}

original_code:
u32 spi_flash_read_data(u32 addr, u8* data, u32 size)
{
 unsigned int i;
 for(i = 0; i < size; i++)
  data[i]=dev[addr+i];
 return 0;
}

canonical_original_code:
unsigned int spi_flash_read_data(unsigned int addr, unsigned char *data, unsigned int size)
{
 unsigned int i;
 for(i = 0; i < size; i++)
  data[i]=dev[addr+i];
 return 0;
}

variable_types:
addr
unsigned int

variable_types:
data
unsigned char *

variable_types:
size
unsigned int

variable_types:
i
unsigned int

return_type: unsigned int


decompiled_code:
__int64 __fastcall spi_flash_write_scetor(unsigned __int16 a1, char *a2)
{
char *v2; // rdx
char *v3; // rax
int v4; // esi

v2 = a2;
v3 = a2;
v4 = (a1 << 12) - (_DWORD)a2;
do
{
dev[v4 + (_DWORD)v3] = *v3;
++v3;
}
while ( v3 != v2 + 4096 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int16 a1, char *a2)
{
char *v2; // rdx
char *v3; // rax
int v4; // esi

v2 = a2;
v3 = a2;
v4 = (a1 << 12) - (_DWORD)a2;
do
{
dev[v4 + (_DWORD)v3] = *v3;
++v3;
}
while ( v3 != v2 + 4096 );
return 0LL;
}

original_code:
u32 spi_flash_write_scetor(u16 id, u8 *data)
{
 unsigned int i;
 for(i = 0 ; i< 4*1024; i++)
  dev[id * 0x1000 + i] = data[i];
 return 0;
}

canonical_original_code:
unsigned int spi_flash_write_scetor(unsigned short id, unsigned char *data)
{
 unsigned int i;
 for(i = 0 ; i< 4*1024; i++)
  dev[id * 0x1000 + i] = data[i];
 return 0;
}

variable_types:
id
unsigned short


decompiled_code:
__int64 __fastcall spi_flash_erase_sector(unsigned __int16 a1)
{
int v1; // eax
int v2; // ecx

v1 = a1 << 12;
v2 = v1 + 4096;
do
dev[v1++] = -1;
while ( v1 != v2 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int16 a1)
{
int v1; // eax
int v2; // ecx

v1 = a1 << 12;
v2 = v1 + 4096;
do
dev[v1++] = -1;
while ( v1 != v2 );
return 0LL;
}

original_code:
u32 spi_flash_erase_sector(u16 setctor_id)
{
 unsigned int i;
 for(i = 0 ; i< 4*1024; i++)
  dev[setctor_id * 0x1000 + i] = 0xff;
 return 0;
}

canonical_original_code:
unsigned int spi_flash_erase_sector(unsigned short setctor_id)
{
 unsigned int i;
 for(i = 0 ; i< 4*1024; i++)
  dev[setctor_id * 0x1000 + i] = 0xff;
 return 0;
}


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

result = dev;
do
*result++ = -1;
while ( result != (char *)(unsigned int)((_DWORD)dev + 0x800000) );
return result;
}

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

result = dev;
do
*result++ = -1;
while ( result != (char *)(unsigned int)((_DWORD)dev + 0x800000) );
return result;
}

original_code:
void spi_flash_erase_all(void)
{
 unsigned int i;
 for(i = 0 ; i< 8*1024*1024; i++)
  dev[i]= 0xff;
 return 0;
}

canonical_original_code:
void spi_flash_erase_all()
{
 unsigned int i;
 for(i = 0 ; i< 8*1024*1024; i++)
  dev[i]= 0xff;
 return 0;
}


decompiled_code:
__int64 rx_data()
{
if ( abc == 32 )
abc = 0;
return (unsigned int)(unsigned __int8)abc - 85;
}

canonical_decompiled_code:
__int64 func4()
{
if ( abc == 32 )
abc = 0;
return (unsigned int)(unsigned __int8)abc - 85;
}

original_code:
u8 rx_data(void)
{
 if(abc == 0x20)
  abc = 0;
 return (0xab + abc);
}

canonical_original_code:
unsigned char rx_data()
{
 if(abc == 0x20)
  abc = 0;
 return (0xab + abc);
}

return_type: unsigned char


original_code:
u8 rx_data1(void)
{
 return (0xac);
}

canonical_original_code:
unsigned char rx_data1()
{
 return (0xac);
}


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

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

original_code:
u32 get_time()
{
 return 0;
}

canonical_original_code:
unsigned int get_time()
{
 return 0;
}


decompiled_code:
void __fastcall mem_set(_BYTE *a1, char a2, int a3)
{
_BYTE *v3; // rax
__int64 v4; // rdx

if ( a3 )
{
v3 = a1;
v4 = (__int64)&a1[a3 - 1 + 1];
do
*v3++ = a2;
while ( v3 != (_BYTE *)v4 );
}
}

original_code:
void mem_set(u8 *des, u8 data, u32 size)
{
 u32 i;
 for(i = 0 ; i < size; i++)
  des[i] = data;
 return ;
}

canonical_original_code:
void mem_set(unsigned char *des, unsigned char data, unsigned int size)
{
 unsigned int i;
 for(i = 0 ; i < size; i++)
  des[i] = data;
 return ;
}

variable_types:
des
unsigned char *

variable_types:
data
unsigned char


original_code:
void mem_cpy(u8 *des, u8 *src, u32 size)
{
 u32 i;
 for(i = 0 ; i < size; i++)
  des[i] = src[i];
 return ;
}

canonical_original_code:
void mem_cpy(unsigned char *des, unsigned char *src, unsigned int size)
{
 unsigned int i;
 for(i = 0 ; i < size; i++)
  des[i] = src[i];
 return ;
}

variable_types:
src
unsigned char *


decompiled_code:
__int64 __fastcall mem_cmp(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // rax

if ( !a3 )
return 0LL;
v3 = 0LL;
while ( *(_BYTE *)(a1 + v3) == *(_BYTE *)(a2 + v3) )
{
if ( ++v3 == a3 )
return 0LL;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // rax

if ( !a3 )
return 0LL;
v3 = 0LL;
while ( *(_BYTE *)(a1 + v3) == *(_BYTE *)(a2 + v3) )
{
if ( ++v3 == a3 )
return 0LL;
}
return 1LL;
}

original_code:
u8 mem_cmp(u8 *des, u8 *src, u32 size)
{
 u32 i;
 for(i = 0 ; i < size; i++)
  if(des[i] != src[i])
   return 1;
 return 0;
}

canonical_original_code:
unsigned char mem_cmp(unsigned char *des, unsigned char *src, unsigned int size)
{
 unsigned int i;
 for(i = 0 ; i < size; i++)
  if(des[i] != src[i])
   return 1;
 return 0;
}


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // ebx
unsigned int v4; // ebx
unsigned int v5; // ebx

spiflash_fs_init(argc, argv, envp);
puts("--------------1--------");
v3 = 0;
while ( 1 )
{
printf("--------------2-:%08x-------\n", v3);
if ( !(unsigned int)spiflash_add_list(49LL) )
break;
if ( ++v3 == 5 )
goto LABEL_4;
}
puts("-------------full!!!!!-------");
LABEL_4:
puts("--------------test--------");
v4 = 0;
while ( (unsigned int)spiflash_sequence_tx() )
{
spiflash_sequence_del();
if ( ++v4 == 6 )
goto LABEL_7;
}
printf("---i:%d----------tx on list-------\n", v4);
LABEL_7:
v5 = 0;
while ( (unsigned int)spiflash_sequence_del() )
{
spiflash_sequence_nexttx();
if ( ++v5 == 5 )
goto LABEL_10;
}
printf("---i:%d----------del on list-------\n", v5);
LABEL_10:
puts("--break--1-----");
spiflash_final_update();
return puts("--break--2-----");
}

variable_types:
ret
unsigned int

variable_types:
add
unsigned int


start

repo: mmakowski/cs-mimuw

decompiled_code:
// positive sp value has been detected, the output may be wrong!
void __fastcall __noreturn start(__int64 a1, __int64 a2, void (*a3)(void))
{
__int64 v3; // rax
int v4; // esi
__int64 v5; // [rsp-8h] [rbp-8h] BYREF
char *retaddr; // [rsp+0h] [rbp+0h] BYREF

v4 = v5;
v5 = v3;
_libc_start_main(
(int (__fastcall *)(int, char **, char **))main,
v4,
&retaddr,
_libc_csu_init,
_libc_csu_fini,
a3,
&v5);
__halt();
}

canonical_decompiled_code:
void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))
{
__int64 v3; // rax
int v4; // esi
__int64 v5; // [rsp-8h] [rbp-8h] BYREF
char *retaddr; // [rsp+0h] [rbp+0h] BYREF

v4 = v5;
v5 = v3;
_libc_start_main(
(int (__fastcall *)(int, char **, char **))main,
v4,
&retaddr,
_libc_csu_init,
_libc_csu_fini,
a3,
&v5);
__halt();
}

original_code:
void start()
{
  write(all, "start", 5);
}


fibonacci

decompiled_code:
char *__fastcall fibonacci(int a1, char a2)
{
char *v2; // rax
char *v3; // rbx
char *v4; // r12
char *v5; // rbp

v2 = (char *)malloc(0xEAuLL);
v3 = v2;
if ( !v2 )
syserr("malloc", a2);
if ( a1 == 1 )
{
*v2 = 97;
v2[1] = 0;
}
else if ( a1 == 2 )
{
*v2 = 98;
v2[1] = 0;
}
else
{
v4 = (char *)fibonacci((unsigned int)(a1 - 2));
v5 = (char *)fibonacci((unsigned int)(a1 - 1));
strcpy(v3, v4);
strcat(v3, v5);
free(v4);
free(v5);
}
return v3;
}

canonical_decompiled_code:
char *__fastcall func8(int a1, char a2)
{
char *v2; // rax
char *v3; // rbx
char *v4; // r12
char *v5; // rbp

v2 = (char *)malloc(0xEAuLL);
v3 = v2;
if ( !v2 )
func9("malloc", a2);
if ( a1 == 1 )
{
*v2 = 97;
v2[1] = 0;
}
else if ( a1 == 2 )
{
*v2 = 98;
v2[1] = 0;
}
else
{
v4 = (char *)func8((unsigned int)(a1 - 2));
v5 = (char *)func8((unsigned int)(a1 - 1));
strcpy(v3, v4);
strcat(v3, v5);
free(v4);
free(v5);
}
return v3;
}

original_code:
static char *fibonacci(int n)
{
  char *l, *p, *slowo = malloc(234);
  if (slowo == 0)
    syserr("malloc");
  switch (n) {
    case 1:
      slowo[0] = 'a';
      slowo[1] = 0;
      break;
    case 2:
      slowo[0] = 'b';
      slowo[1] = 0;
      break;
    default:
      l = fibonacci(n - 2);
      p = fibonacci(n - 1);
      strcat(strcpy(slowo, l), p);
      free(l);
      free(p);
      break;
  }
  return slowo;
}

canonical_original_code:
static char *fibonacci(int n)
{
  char *l; char *p; char *slowo = malloc(234);
  if (slowo == 0)
    syserr("malloc");
  switch (n) {
    case 1:
      slowo[0] = 'a';
      slowo[1] = 0;
      break;
    case 2:
      slowo[0] = 'b';
      slowo[1] = 0;
      break;
    default:
      l = fibonacci(n - 2);
      p = fibonacci(n - 1);
      strcat(strcpy(slowo, l), p);
      free(l);
      free(p);
      break;
  }
  return slowo;
}

variable_types: n int

variable_types:
l
char *

variable_types:
p
char *

variable_types:
slowo
char *


syserr

decompiled_code:
void __noreturn syserr(char *format, ...)
{
int *v1; // rbx
int v2; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fwrite("ERROR: ", 1uLL, 7uLL, stderr);
vfprintf(stderr, format, arg);
v1 = __errno_location();
fprintf(stderr, " (%d", (unsigned int)*v1);
v2 = *v1;
if ( *v1 > 0 && v2 < sys_nerr )
fprintf(stderr, "; %s)\n", (const char *)sys_errlist[v2]);
else
fwrite(")\n", 1uLL, 2uLL, stderr);
exit(1);
}

canonical_decompiled_code:
void __noreturn func9(char *format, ...)
{
int *v1; // rbx
int v2; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fwrite("ERROR: ", 1uLL, 7uLL, stderr);
vfprintf(stderr, format, arg);
v1 = __errno_location();
fprintf(stderr, " (%d", (unsigned int)*v1);
v2 = *v1;
if ( *v1 > 0 && v2 < sys_nerr )
fprintf(stderr, "; %s)\n", (const char *)sys_errlist[v2]);
else
fwrite(")\n", 1uLL, 2uLL, stderr);
exit(1);
}

original_code:
void syserr(const char *fmt, ...)
{
  va_list fmt_args;
  fprintf(stderr, "ERROR: ");
  __builtin_va_start(fmt_args,fmt);
  vfprintf(stderr, fmt, fmt_args);
  __builtin_va_end(fmt_args);
  fprintf(stderr," (%d", (*__errno_location ()));
  if ((*__errno_location ()) > 0 && (*__errno_location ()) < sys_nerr)
    fprintf(stderr,"; %s)\n", sys_errlist[(*__errno_location ())]);
  else
    fprintf(stderr, ")\n");
  exit(1);
}

canonical_original_code:
void syserr(char *fmt, ...)
{
  __builtin_va_list fmt_args;
  fprintf(stderr, "ERROR: ");
  __builtin_va_start(fmt_args,fmt);
  vfprintf(stderr, fmt, fmt_args);
  __builtin_va_end(fmt_args);
  fprintf(stderr," (%d", (*__errno_location ()));
  if ((*__errno_location ()) > 0 && (*__errno_location ()) < sys_nerr)
    fprintf(stderr,"; %s)\n", sys_errlist[(*__errno_location ())]);
  else
    fprintf(stderr, ")\n");
  exit(1);
}

variable_types:
fmt
char *


fatal

decompiled_code:
void __noreturn fatal(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fwrite("ERROR: ", 1uLL, 7uLL, stderr);
vfprintf(stderr, format, arg);
fputc(10, stderr);
exit(1);
}

canonical_decompiled_code:
void __noreturn func10(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fwrite("ERROR: ", 1uLL, 7uLL, stderr);
vfprintf(stderr, format, arg);
fputc(10, stderr);
exit(1);
}

original_code:
void fatal(const char *fmt, ...)
{
  va_list fmt_args;
  fprintf(stderr, "ERROR: ");
  __builtin_va_start(fmt_args,fmt);
  vfprintf(stderr, fmt, fmt_args);
  __builtin_va_end(fmt_args);
  fprintf(stderr,"\n");
  exit(1);
}

canonical_original_code:
void fatal(char *fmt, ...)
{
  __builtin_va_list fmt_args;
  fprintf(stderr, "ERROR: ");
  __builtin_va_start(fmt_args,fmt);
  vfprintf(stderr, fmt, fmt_args);
  __builtin_va_end(fmt_args);
  fprintf(stderr,"\n");
  exit(1);
}


piszDrzewo

decompiled_code:
ssize_t __fastcall piszDrzewo(int a1, char a2)
{
char buf[12]; // [rsp+Ch] [rbp-Ch] BYREF

buf[0] = a2;
return write(a1, buf, 1uLL);
}

canonical_decompiled_code:
ssize_t __fastcall func11(int a1, char a2)
{
char buf[12]; // [rsp+Ch] [rbp-Ch] BYREF

buf[0] = a2;
return write(a1, buf, 1uLL);
}

original_code:
void piszDrzewo(int wejscieDrzewa, char polecenie)
{
  write(wejscieDrzewa, &polecenie, 1);
}

variable_types: wejscieDrzewa int

variable_types: polecenie char


wstawSlowo

decompiled_code:
ssize_t __fastcall wstawSlowo(int fd, void *buf)
{
size_t v2; // rax
char bufa[26]; // [rsp+Eh] [rbp-1Ah] BYREF

piszDrzewo(fd, 105);
bufa[0] = (unsigned __int16)strlen((const char *)buf) >> 8;
bufa[1] = strlen((const char *)buf);
write(fd, bufa, 2uLL);
v2 = strlen((const char *)buf);
return write(fd, buf, v2);
}

canonical_decompiled_code:
ssize_t __fastcall func12(int fd, void *buf)
{
size_t v2; // rax
char bufa[26]; // [rsp+Eh] [rbp-1Ah] BYREF

func11(fd, 105);
bufa[0] = (unsigned __int16)strlen((const char *)buf) >> 8;
bufa[1] = strlen((const char *)buf);
write(fd, bufa, 2uLL);
v2 = strlen((const char *)buf);
return write(fd, buf, v2);
}

original_code:
void wstawSlowo(int wejscieDrzewa, const char *slowo)
{
  unsigned char dlugosc[2];
  piszDrzewo(wejscieDrzewa, 'i');
  (dlugosc)[0] = (strlen(slowo)) / 256; (dlugosc)[1] = (strlen(slowo)) % 256;;
  write(wejscieDrzewa, dlugosc, 2);
  write(wejscieDrzewa, slowo, strlen(slowo));
}

canonical_original_code:
void wstawSlowo(int wejscieDrzewa, char *slowo)
{
  unsigned char dlugosc[2];
  piszDrzewo(wejscieDrzewa, 'i');
  (dlugosc)[0] = (strlen(slowo)) / 256; (dlugosc)[1] = (strlen(slowo)) % 256;;
  write(wejscieDrzewa, dlugosc, 2);
  write(wejscieDrzewa, slowo, strlen(slowo));
}

variable_types:
dlugosc
unsigned char [2]


opisProgramu

decompiled_code:
void __noreturn opisProgramu()
{
puts("bst (c) Maciek Makowski 2001\n");
puts("program generuje BST zawierajace podana liczbe slow Fibonacciego.\n");
puts("\tSposob uzycia: bst [N]\n");
puts("N - liczba z przedzialu [1, 13] oznaczajaca liczbe");
puts(" slow Fibonacciego do wstawienia\n");
exit(0);
}

canonical_decompiled_code:
void __noreturn func7()
{
puts("bst (c) Maciek Makowski 2001\n");
puts("program generuje BST zawierajace podana liczbe slow Fibonacciego.\n");
puts("\tSposob uzycia: bst [N]\n");
puts("N - liczba z przedzialu [1, 13] oznaczajaca liczbe");
puts(" slow Fibonacciego do wstawienia\n");
exit(0);
}

original_code:
static void opisProgramu()
{
  printf("bst (c) Maciek Makowski 2001\n\n");
  printf("program generuje BST zawierajace podana liczbe slow Fibonacciego.\n\n");
  printf("\tSposob uzycia: bst [N]\n\n");
  printf("N - liczba z przedzialu [1, 13] oznaczajaca liczbe\n");
  printf("    slow Fibonacciego do wstawienia\n\n");
  exit(0);
}


start

canonical_original_code:
void start()
{
  write(all, "start", 5);
}


decompiled_code:
_BOOL8 __fastcall server_closing(caddr_t resp, struct sockaddr_in *raddr)
{
return count-- == 1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func7(caddr_t resp, struct sockaddr_in *raddr)
{
return count-- == 1;
}

original_code:
int server_closing(int *ans, struct sockaddr_in *raddr)
{
  ;
  if (--count == 0)
    return 1;
  return 0;
}

variable_types:
ans
int *

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } *

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }