decompiled_code:
int __fastcall print_banner(int a1, __int64 a2, char *a3, const char *a4, const char *a5, int a6)
{
unsigned int v11; // eax
const char *v12; // r14
const char *v13; // rbx
const char *v14; // r13
unsigned int v15; // eax
__int64 v16; // rbx
const char *v17; // rdx
__int64 v18; // rsi
unsigned int v20; // eax
const char *v21; // r14
const char *v22; // rbx
const char *v23; // r13
unsigned int v24; // eax

if ( a6 )
{
v20 = get_bits();
printf("%s%s (%d) version %s, %s.\n", "% ", a3, v20, a4, a5);
v21 = (const char *)get_date();
v22 = (const char *)hostname();
v23 = (const char *)username();
v24 = my_process_id();
printf("%sProcess %d was started by %s on %s,\n%s%s", "% ", v24, v23, v22, "% ", v21);
printf("%sThe command was \"", "% ");
if ( a1 <= 0 )
{
puts("\".");
return fflush(stdout);
}
}
else
{
print_separator(stdout, a3, 0);
v11 = get_bits();
printf("%s%s (%d) version %s, %s.\n", (const char *)&unk_2AA, a3, v11, a4, a5);
v12 = (const char *)get_date();
v13 = (const char *)hostname();
v14 = (const char *)username();
v15 = my_process_id();
printf(
"%sProcess %d was started by %s on %s,\n%s%s",
(const char *)&unk_2AA,
v15,
v14,
v13,
(const char *)&unk_2AA,
v12);
printf("%sThe command was \"", (const char *)&unk_2AA);
if ( a1 <= 0 )
{
puts("\".");
LABEL_12:
print_separator(stdout, "end of head", 0);
return fflush(stdout);
}
}
v16 = 0LL;
do
{
v17 = " ";
v18 = *(_QWORD *)(a2 + 8 * v16);
if ( a1 - 1 <= (int)v16 )
v17 = (const char *)&unk_2AA;
++v16;
printf("%s%s", v18, v17);
}
while ( a1 > (int)v16 );
puts("\".");
if ( !a6 )
goto LABEL_12;
return fflush(stdout);
}

canonical_decompiled_code:
int __fastcall func1(int a1, __int64 a2, char *a3, const char *a4, const char *a5, int a6)
{
unsigned int v11; // eax
const char *v12; // r14
const char *v13; // rbx
const char *v14; // r13
unsigned int v15; // eax
__int64 v16; // rbx
const char *v17; // rdx
__int64 v18; // rsi
unsigned int v20; // eax
const char *v21; // r14
const char *v22; // rbx
const char *v23; // r13
unsigned int v24; // eax

if ( a6 )
{
v20 = get_bits();
printf("%s%s (%d) version %s, %s.\n", "% ", a3, v20, a4, a5);
v21 = (const char *)get_date();
v22 = (const char *)hostname();
v23 = (const char *)username();
v24 = my_process_id();
printf("%sProcess %d was started by %s on %s,\n%s%s", "% ", v24, v23, v22, "% ", v21);
printf("%sThe command was \"", "% ");
if ( a1 <= 0 )
{
puts("\".");
return fflush(stdout);
}
}
else
{
func0(stdout, a3, 0);
v11 = get_bits();
printf("%s%s (%d) version %s, %s.\n", (const char *)&unk_2AA, a3, v11, a4, a5);
v12 = (const char *)get_date();
v13 = (const char *)hostname();
v14 = (const char *)username();
v15 = my_process_id();
printf(
"%sProcess %d was started by %s on %s,\n%s%s",
(const char *)&unk_2AA,
v15,
v14,
v13,
(const char *)&unk_2AA,
v12);
printf("%sThe command was \"", (const char *)&unk_2AA);
if ( a1 <= 0 )
{
puts("\".");
LABEL_12:
func0(stdout, "end of head", 0);
return fflush(stdout);
}
}
v16 = 0LL;
do
{
v17 = " ";
v18 = *(_QWORD *)(a2 + 8 * v16);
if ( a1 - 1 <= (int)v16 )
v17 = (const char *)&unk_2AA;
++v16;
printf("%s%s", v18, v17);
}
while ( a1 > (int)v16 );
puts("\".");
if ( !a6 )
goto LABEL_12;
return fflush(stdout);
}

original_code:
void print_banner(int argc, char **argv,
    char *name, char *version, char *date,
    BOOL as_comments)
{
  int i;
  char *com = (as_comments ? "% " : "");
  if (!as_comments)
    print_separator(stdout, name, FALSE);
  printf("%s%s (%d) version %s, %s.\n",
  com, name, get_bits(), version, date);
  printf("%sProcess %d was started by %s on %s,\n%s%s",
  com, my_process_id(), username(), hostname(), com, get_date());
  printf("%sThe command was \"", com);
  for(i = 0; i < argc; i++)
    printf("%s%s", argv[i], (i < argc-1 ? " " : ""));
  printf("\".\n");
  if (!as_comments)
    print_separator(stdout, "end of head", FALSE);
  fflush(stdout);
}

canonical_original_code:
void print_banner(int argc, char **argv, char *name, char *version, char *date, enum BOOL as_comments)
{
  int i;
  char *com = (as_comments ? "% " : "");
  if (!as_comments)
    print_separator(stdout, name, FALSE);
  printf("%s%s (%d) version %s, %s.\n",
  com, name, get_bits(), version, date);
  printf("%sProcess %d was started by %s on %s,\n%s%s",
  com, my_process_id(), username(), hostname(), com, get_date());
  printf("%sThe command was \"", com);
  for(i = 0; i < argc; i++)
    printf("%s%s", argv[i], (i < argc-1 ? " " : ""));
  printf("\".\n");
  if (!as_comments)
    print_separator(stdout, "end of head", FALSE);
  fflush(stdout);
}

variable_types:
name
char *

variable_types:
version
char *

variable_types:
date
char *

variable_types:
com
char *


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

if ( a1 <= 64 )
result = (unsigned int)(a1 - 48);
else
result = (unsigned int)(char)(a1 - 55);
return result;
}

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

if ( a1 <= 64 )
result = (unsigned int)(a1 - 48);
else
result = (unsigned int)(char)(a1 - 55);
return result;
}

original_code:
static unsigned int asc_to_int(char a)
{
 if (a >= 'A')
  return (a - 'A') + 10;
 else
  return a - '0';
}

variable_types: a char

return_type: unsigned int


decompiled_code:
__int64 __fastcall hex_to_int(char *a1)
{
__int64 v1; // rcx
int v2; // eax
int v3; // edx

asc_to_int(*a1);
v2 = asc_to_int(*(_BYTE *)(v1 + 1));
return (unsigned int)(16 * v3 + v2);
}

canonical_decompiled_code:
__int64 __fastcall func8(char *a1)
{
__int64 v1; // rcx
int v2; // eax
int v3; // edx

func7(*a1);
v2 = func7(*(_BYTE *)(v1 + 1));
return (unsigned int)(16 * v3 + v2);
}

original_code:
static unsigned int hex_to_int(const char *h)
{
 return asc_to_int(*h) * 0x10 + asc_to_int(*(h + 1));
}

canonical_original_code:
static unsigned int hex_to_int(char *h)
{
 return asc_to_int(*h) * 0x10 + asc_to_int(*(h + 1));
}

variable_types:
h
char *


decompiled_code:
__int64 __fastcall lhex_to_int(char *a1)
{
__int64 v1; // r8
int v2; // esi

v2 = hex_to_int(a1);
return (v2 << 8) + (unsigned int)hex_to_int((char *)(v1 + 2));
}

canonical_decompiled_code:
__int64 __fastcall func9(char *a1)
{
__int64 v1; // r8
int v2; // esi

v2 = func8(a1);
return (v2 << 8) + (unsigned int)func8((char *)(v1 + 2));
}

original_code:
static unsigned int lhex_to_int(const char *h)
{
 return hex_to_int(h) * 0x100 + hex_to_int(h + 2);
}

canonical_original_code:
static unsigned int lhex_to_int(char *h)
{
 return hex_to_int(h) * 0x100 + hex_to_int(h + 2);
}


decompiled_code:
_BOOL8 __fastcall check_sum(__int64 a1, int a2)
{
__int64 v2; // r9
int v3; // er10
int v4; // er8
char *v5; // rsi
char *v6; // rdi
char v7; // al
int v8; // er10
char v9; // r8
char v10; // r8
char *v11; // r9

v3 = hex_to_int((char *)(a1 + a2 - 2));
if ( v4 <= 3 )
return v3 == 0;
v5 = (char *)(v2 + 1);
do
{
v6 = v5;
v5 += 2;
v7 = hex_to_int(v6);
v10 = v7 + v9;
}
while ( v11 != v5 );
return v8 == (unsigned __int8)-v10;
}

original_code:
static int check_sum(const char *str, int len)
{
 unsigned int sum, cal;
 int i;
 sum = hex_to_int(str + len - 2);
 for (cal = 0, i = 1; i < len - 2; i += 2)
  cal += hex_to_int(str + i);
 cal = 0x100 - cal & 0xFF;
 return sum == cal;
}

canonical_original_code:
static int check_sum(char *str, int len)
{
 unsigned int sum; unsigned int cal;
 int i;
 sum = hex_to_int(str + len - 2);
 for (cal = 0, i = 1; i < len - 2; i += 2)
  cal += hex_to_int(str + i);
 cal = 0x100 - cal & 0xFF;
 return sum == cal;
}

variable_types:
str
char *

variable_types: len int

variable_types:
sum
unsigned int

variable_types:
cal
unsigned int

variable_types: i int

return_type: int


decompiled_code:
_BOOL8 __fastcall check_hex_line(_BYTE *a1, int a2)
{
_BOOL8 result; // rax
__int64 v3; // r11

if ( *a1 != 58 )
return 0LL;
result = 0LL;
if ( a2 > 10 )
{
result = check_sum((__int64)a1, a2);
if ( result )
result = 2 * (unsigned int)hex_to_int((char *)(v3 + 1)) + 11 == a2;
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func11(_BYTE *a1, int a2)
{
_BOOL8 result; // rax
__int64 v3; // r11

if ( *a1 != 58 )
return 0LL;
result = 0LL;
if ( a2 > 10 )
{
result = func10((__int64)a1, a2);
if ( result )
result = 2 * (unsigned int)func8((char *)(v3 + 1)) + 11 == a2;
}
return result;
}

original_code:
static int check_hex_line(const char *str, int len)
{
 if ((str[0] != ':') || (len < 11) || !check_sum(str, len) ||
  (hex_to_int(str + 1) * 2 + 11 != len))
  return 0;
 return 1;
}

canonical_original_code:
static int check_hex_line(char *str, int len)
{
 if ((str[0] != ':') || (len < 11) || !check_sum(str, len) ||
  (hex_to_int(str + 1) * 2 + 11 != len))
  return 0;
 return 1;
}


findloc

repo: jezze/gaz

decompiled_code:
__int64 __fastcall findloc(char *s1)
{
unsigned int v1; // er12
__int64 *i; // rbx

v1 = Locs;
if ( Locs > 1023 )
return 0LL;
for ( i = &symbols[5 * Locs]; *((_BYTE *)i + 24) == 7 || *s1 != *(_BYTE *)*i || strcmp(s1, (const char *)*i); i += 5 )
{
if ( ++v1 == 1024 )
return 0LL;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s1)
{
unsigned int v1; // er12
__int64 *i; // rbx

v1 = Locs;
if ( Locs > 1023 )
return 0LL;
for ( i = &symbols[5 * Locs]; *((_BYTE *)i + 24) == 7 || *s1 != *(_BYTE *)*i || strcmp(s1, (const char *)*i); i += 5 )
{
if ( ++v1 == 1024 )
return 0LL;
}
return v1;
}

original_code:
static int findloc(char *s)
{
    int i;
    for (i = Locs; i < 1024; i++)
    {
        if (symbols[i].stcl != CMEMBER && *s == *symbols[i].name && !strcmp(s, symbols[i].name))
            return i;
    }
    return 0;
}

variable_types:
s
char *


findglob

decompiled_code:
__int64 __fastcall findglob(char *s1)
{
int v1; // ebp
__int64 *v2; // rbx
unsigned int v3; // er12

v1 = Globs;
if ( Globs <= 0 )
return 0LL;
v2 = symbols;
v3 = 0;
while ( *((_BYTE *)v2 + 24) == 7 || *s1 != *(_BYTE *)*v2 || strcmp(s1, (const char *)*v2) )
{
++v3;
v2 += 5;
if ( v3 == v1 )
return 0LL;
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *s1)
{
int v1; // ebp
__int64 *v2; // rbx
unsigned int v3; // er12

v1 = Globs;
if ( Globs <= 0 )
return 0LL;
v2 = symbols;
v3 = 0;
while ( *((_BYTE *)v2 + 24) == 7 || *s1 != *(_BYTE *)*v2 || strcmp(s1, (const char *)*v2) )
{
++v3;
v2 += 5;
if ( v3 == v1 )
return 0LL;
}
return v3;
}

original_code:
static int findglob(char *s)
{
    int i;
    for (i = 0; i < Globs; i++)
    {
        if (symbols[i].stcl != CMEMBER && *s == *symbols[i].name && !strcmp(s, symbols[i].name))
            return i;
    }
    return 0;
}


newglob

decompiled_code:
__int64 newglob()
{
unsigned int v0; // er12

v0 = Globs;
if ( Globs++ >= Locs )
fatal("too many global symbols");
return v0;
}

canonical_decompiled_code:
__int64 func2()
{
unsigned int v0; // er12

v0 = Globs;
if ( Globs++ >= Locs )
fatal("too many global symbols");
return v0;
}

original_code:
static int newglob(void)
{
    int p;
    if ((p = Globs++) >= Locs)
        fatal("too many global symbols");
    return p;
}

canonical_original_code:
static int newglob()
{
    int p;
    if ((p = Globs++) >= Locs)
        fatal("too many global symbols");
    return p;
}

variable_types: p int


newloc

decompiled_code:
__int64 newloc()
{
unsigned int v0; // er12

v0 = --Locs;
if ( Locs <= Globs )
fatal("too many local symbols");
return v0;
}

canonical_decompiled_code:
__int64 func3()
{
unsigned int v0; // er12

v0 = --Locs;
if ( Locs <= Globs )
fatal("too many local symbols");
return v0;
}

original_code:
static int newloc(void)
{
    int p;
    if ((p = --Locs) <= Globs)
        fatal("too many local symbols");
    return p;
}

canonical_original_code:
static int newloc()
{
    int p;
    if ((p = --Locs) <= Globs)
        fatal("too many local symbols");
    return p;
}


redeclare

decompiled_code:
__int64 __fastcall redeclare(int errnum, int a2, const char *a3)
{
unsigned int v3; // er12

v3 = (unsigned int)a3;
if ( a2 == 3 )
{
if ( (_DWORD)a3 == 6 )
return 3;
if ( (_DWORD)a3 == 3 )
goto LABEL_14;
v3 = 3;
error((int)"static symbol redeclared extern: %s", errnum, a3);
return v3;
}
if ( a2 > 3 )
{
if ( a2 == 6 )
{
if ( (_DWORD)a3 != 3 && (_DWORD)a3 != 6 )
error((int)"static symbol redeclared extern: %s", errnum, a3);
return v3;
}
goto LABEL_14;
}
if ( a2 == 1 )
{
if ( (_DWORD)a3 == 2 )
return 1;
if ( (_DWORD)a3 == 1 )
goto LABEL_14;
v3 = 1;
error((int)"extern symbol redeclared static: %s", errnum, a3);
return v3;
}
if ( a2 == 2 )
{
if ( (unsigned int)((_DWORD)a3 - 1) > 1 )
error((int)"extern symbol redeclared static: %s", errnum, a3);
return v3;
}
LABEL_14:
error((int)"redefined symbol: %s", errnum, a3);
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func4(int errnum, int a2, const char *a3)
{
unsigned int v3; // er12

v3 = (unsigned int)a3;
if ( a2 == 3 )
{
if ( (_DWORD)a3 == 6 )
return 3;
if ( (_DWORD)a3 == 3 )
goto LABEL_14;
v3 = 3;
error((int)"static symbol redeclared extern: %s", errnum, a3);
return v3;
}
if ( a2 > 3 )
{
if ( a2 == 6 )
{
if ( (_DWORD)a3 != 3 && (_DWORD)a3 != 6 )
error((int)"static symbol redeclared extern: %s", errnum, a3);
return v3;
}
goto LABEL_14;
}
if ( a2 == 1 )
{
if ( (_DWORD)a3 == 2 )
return 1;
if ( (_DWORD)a3 == 1 )
goto LABEL_14;
v3 = 1;
error((int)"extern symbol redeclared static: %s", errnum, a3);
return v3;
}
if ( a2 == 2 )
{
if ( (unsigned int)((_DWORD)a3 - 1) > 1 )
error((int)"extern symbol redeclared static: %s", errnum, a3);
return v3;
}
LABEL_14:
error((int)"redefined symbol: %s", errnum, a3);
return v3;
}

original_code:
static int redeclare(char *name, int oldcls, int newcls)
{
    switch (oldcls)
    {
    case CEXTERN:
        if (newcls != CPUBLIC && newcls != CEXTERN)
            error("extern symbol redeclared static: %s", name);
        return newcls;
    case CPUBLIC:
        if (CEXTERN == newcls)
            return CPUBLIC;
        if (newcls != CPUBLIC)
        {
            error("extern symbol redeclared static: %s", name);
            return CPUBLIC;
        }
        break;
    case CSPROTO:
        if (newcls != CSTATIC && newcls != CSPROTO)
            error("static symbol redeclared extern: %s", name);
        return newcls;
    case CSTATIC:
        if (CSPROTO == newcls)
            return CSTATIC;
        if (newcls != CSTATIC)
        {
            error("static symbol redeclared extern: %s", name);
            return CSTATIC;
        }
        break;
    }
    error("redefined symbol: %s", name);
    return newcls;
}

variable_types: oldcls int

variable_types: newcls int


locname

decompiled_code:
char *__fastcall locname(char *src)
{
int v1; // ebx
int v2; // eax

v1 = strlen(src) + 1;
v2 = Ntop;
if ( v1 + Nbot >= Ntop )
{
fatal("out of space for symbol names");
v2 = Ntop;
}
Ntop = v2 - v1;
return strcpy(&Nlist[v2 - v1], src);
}

canonical_decompiled_code:
char *__fastcall func5(char *src)
{
int v1; // ebx
int v2; // eax

v1 = strlen(src) + 1;
v2 = Ntop;
if ( v1 + Nbot >= Ntop )
{
fatal("out of space for symbol names");
v2 = Ntop;
}
Ntop = v2 - v1;
return strcpy(&Nlist[v2 - v1], src);
}

original_code:
static char *locname(char *s)
{
    int k = strlen(s) + 1;
    int p;
    if (Nbot + k >= Ntop)
        fatal("out of space for symbol names");
    Ntop -= k;
    p = Ntop;
    strcpy(&Nlist[p], s);
    return &Nlist[p];
}

variable_types: k int

return_type: char *


findsym

decompiled_code:
__int64 __fastcall findsym(char *s1)
{
__int64 result; // rax

result = findloc(s1);
if ( !(_DWORD)result )
result = findglob(s1);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(char *s1)
{
__int64 result; // rax

result = func0(s1);
if ( !(_DWORD)result )
result = func1(s1);
return result;
}

original_code:
int findsym(char *s)
{
    int y;
    if ((y = findloc(s)) != 0)
        return y;
    return findglob(s);
}

variable_types: y int


findstruct

decompiled_code:
__int64 __fastcall findstruct(char *s1)
{
unsigned int v1; // er12
__int64 *v2; // rbx
int v4; // er13
__int64 *v5; // rbx

v1 = Locs;
if ( Locs <= 1023 )
{
v2 = &symbols[5 * Locs];
while ( *((_BYTE *)v2 + 12) != 5 || *s1 != *(_BYTE *)*v2 || strcmp(s1, (const char *)*v2) )
{
++v1;
v2 += 5;
if ( v1 == 1024 )
goto LABEL_8;
}
return v1;
}
LABEL_8:
v4 = Globs;
if ( Globs > 0 )
{
v5 = symbols;
v1 = 0;
while ( 1 )
{
while ( *((_BYTE *)v5 + 12) != 5 || *s1 != *(_BYTE *)*v5 )
{
++v1;
v5 += 5;
if ( v4 == v1 )
return 0LL;
}
if ( !strcmp(s1, (const char *)*v5) )
break;
++v1;
v5 += 5;
if ( v4 == v1 )
return 0LL;
}
return v1;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *s1)
{
unsigned int v1; // er12
__int64 *v2; // rbx
int v4; // er13
__int64 *v5; // rbx

v1 = Locs;
if ( Locs <= 1023 )
{
v2 = &symbols[5 * Locs];
while ( *((_BYTE *)v2 + 12) != 5 || *s1 != *(_BYTE *)*v2 || strcmp(s1, (const char *)*v2) )
{
++v1;
v2 += 5;
if ( v1 == 1024 )
goto LABEL_8;
}
return v1;
}
LABEL_8:
v4 = Globs;
if ( Globs > 0 )
{
v5 = symbols;
v1 = 0;
while ( 1 )
{
while ( *((_BYTE *)v5 + 12) != 5 || *s1 != *(_BYTE *)*v5 )
{
++v1;
v5 += 5;
if ( v4 == v1 )
return 0LL;
}
if ( !strcmp(s1, (const char *)*v5) )
break;
++v1;
v5 += 5;
if ( v4 == v1 )
return 0LL;
}
return v1;
}
return 0LL;
}

original_code:
int findstruct(char *s)
{
    int i;
    for (i = Locs; i < 1024; i++)
        if (TSTRUCT == symbols[i].type && *s == *symbols[i].name && !strcmp(s, symbols[i].name))
            return i;
    for (i = 0; i < Globs; i++)
        if (TSTRUCT == symbols[i].type && *s == *symbols[i].name && !strcmp(s, symbols[i].name))
            return i;
    return 0;
}


findmem

decompiled_code:
__int64 __fastcall findmem(int a1, const char *a2)
{
int v2; // er14
int v3; // er13
int v4; // er12
__int64 *i; // rbx

v2 = Locs;
v3 = Globs;
v4 = a1 + 1;
for ( i = &symbols[5 * a1 + 5]; v3 > v4 || v4 <= 1023 && v2 <= v4 && *((_BYTE *)i + 24) == 7; i += 5 )
{
if ( *a2 == *(_BYTE *)*i && !strcmp(a2, (const char *)*i) )
return (unsigned int)v4;
++v4;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, const char *a2)
{
int v2; // er14
int v3; // er13
int v4; // er12
__int64 *i; // rbx

v2 = Locs;
v3 = Globs;
v4 = a1 + 1;
for ( i = &symbols[5 * a1 + 5]; v3 > v4 || v4 <= 1023 && v2 <= v4 && *((_BYTE *)i + 24) == 7; i += 5 )
{
if ( *a2 == *(_BYTE *)*i && !strcmp(a2, (const char *)*i) )
return (unsigned int)v4;
++v4;
}
return 0LL;
}

original_code:
int findmem(int y, char *s)
{
    y++;
    while (y < Globs || y >= Locs && y < 1024 && CMEMBER == symbols[y].stcl)
    {
        if (*s == *symbols[y].name && !strcmp(s, symbols[y].name))
            return y;
        y++;
    }
    return 0;
}


galloc

decompiled_code:
char *__fastcall galloc(int a1)
{
__int64 v1; // rax
char *result; // rax

v1 = Nbot;
if ( Nbot + a1 >= Ntop )
{
fatal("out of space for symbol names");
result = &Nlist[Nbot];
Nbot += a1;
}
else
{
Nbot += a1;
result = &Nlist[v1];
}
return result;
}

canonical_decompiled_code:
char *__fastcall func9(int a1)
{
__int64 v1; // rax
char *result; // rax

v1 = Nbot;
if ( Nbot + a1 >= Ntop )
{
fatal("out of space for symbol names");
result = &Nlist[Nbot];
Nbot += a1;
}
else
{
Nbot += a1;
result = &Nlist[v1];
}
return result;
}

original_code:
char *galloc(int k)
{
    int p;
    if (Nbot + k >= Ntop)
        fatal("out of space for symbol names");
    p = Nbot;
    Nbot += k;
    return &Nlist[p];
}


globname

decompiled_code:
char *__fastcall globname(char *src)
{
int v1; // eax
char *v2; // rax

v1 = strlen(src);
v2 = galloc(v1 + 1);
return strcpy(v2, src);
}

canonical_decompiled_code:
char *__fastcall func10(char *src)
{
int v1; // eax
char *v2; // rax

v1 = strlen(src);
v2 = func9(v1 + 1);
return strcpy(v2, src);
}

original_code:
static char *globname(char *s)
{
    char *p = galloc(strlen(s) + 1);
    strcpy(p, s);
    return p;
}

variable_types:
p
char *


clrlocs

decompiled_code:
void clrlocs()
{
Ntop = 0x4000;
Locs = 1024;
}

original_code:
void clrlocs(void)
{
    Ntop = 16384;
    Locs = 1024;
}

canonical_original_code:
void clrlocs()
{
    Ntop = 16384;
    Locs = 1024;
}

return_type: void


objsize

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

if ( a1 == 2 )
{
result = arch_intsize();
goto LABEL_9;
}
result = 1LL;
if ( a1 == 1 )
goto LABEL_9;
if ( (unsigned int)(a1 - 8) > 1 && (unsigned int)(a1 - 3) > 3 )
{
v5 = a1 & 0xE000;
if ( ((v5 - 24576) & 0xFFFFC000) != 0 && ((v5 - 40960) & 0xFFFFC000) != 0 )
{
if ( ((v5 - 0x2000) & 0xFFFFC000) == 0 )
{
result = LODWORD(symbols[5 * (int)(a1 & 0xFFFF1FFF) + 2]);
goto LABEL_9;
}
if ( a1 != 10 )
{
result = 0LL;
LABEL_9:
if ( (unsigned int)(a2 - 3) > 1 )
goto LABEL_10;
return 0LL;
}
}
}
result = arch_pointersize();
if ( (unsigned int)(a2 - 3) <= 1 )
return 0LL;
LABEL_10:
if ( a2 == 2 )
result = (unsigned int)(a3 * result);
return result;
}

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

if ( a1 == 2 )
{
result = arch_intsize();
goto LABEL_9;
}
result = 1LL;
if ( a1 == 1 )
goto LABEL_9;
if ( (unsigned int)(a1 - 8) > 1 && (unsigned int)(a1 - 3) > 3 )
{
v5 = a1 & 0xE000;
if ( ((v5 - 24576) & 0xFFFFC000) != 0 && ((v5 - 40960) & 0xFFFFC000) != 0 )
{
if ( ((v5 - 0x2000) & 0xFFFFC000) == 0 )
{
result = LODWORD(symbols[5 * (int)(a1 & 0xFFFF1FFF) + 2]);
goto LABEL_9;
}
if ( a1 != 10 )
{
result = 0LL;
LABEL_9:
if ( (unsigned int)(a2 - 3) > 1 )
goto LABEL_10;
return 0LL;
}
}
}
result = arch_pointersize();
if ( (unsigned int)(a2 - 3) <= 1 )
return 0LL;
LABEL_10:
if ( a2 == 2 )
result = (unsigned int)(a3 * result);
return result;
}

original_code:
int objsize(int prim, int type, int size)
{
    int k = 0;
    int sp = prim & STCMASK;
    if (PINT == prim)
        k = arch_intsize();
    else if (PCHAR == prim)
        k = 1;
    else if (INTPTR == prim || CHARPTR == prim || VOIDPTR == prim)
        k = arch_pointersize();
    else if (INTPP == prim || CHARPP == prim || VOIDPP == prim)
        k = arch_pointersize();
    else if (STCPTR == sp || STCPP == sp)
        k = arch_pointersize();
    else if (UNIPTR == sp || UNIPP == sp)
        k = arch_pointersize();
    else if (PSTRUCT == sp || PUNION == sp)
        k = symbols[prim & ~STCMASK].size;
    else if (FUNPTR == prim)
        k = arch_pointersize();
    if (TFUNCTION == type || TCONSTANT == type)
        return 0;
    if (TARRAY == type)
        k *= size;
    return k;
}

variable_types: prim int

variable_types: type int

variable_types: size int

variable_types: sp int


defglob

decompiled_code:
__int64 __fastcall defglob(__int64 a1, int a2, int a3, unsigned int a4, unsigned int a5, int a6, int a7)
{
__int64 result; // rax
int v12; // edx
int v13; // esi
unsigned int v14; // ebp
__int64 v15; // rdi
int v16; // eax
__int64 v17; // rdi

result = (unsigned int)(a3 - 3);
if ( (unsigned int)result > 1 )
{
result = gendata();
if ( a6 == 1 )
{
result = genpublic(a1);
if ( !a7 )
goto LABEL_6;
}
else if ( !a7 )
{
goto LABEL_6;
}
if ( a3 == 2 )
return result;
LABEL_6:
if ( a3 == 2 )
{
if ( (a2 & 0xE000) != 0 )
{
v12 = a4;
v13 = 2;
goto LABEL_8;
}
if ( a2 == 1 )
{
LABEL_20:
v17 = gsym(a1);
return genbss(v17, a4);
}
}
else
{
v12 = a4;
v13 = 1;
if ( (a2 & 0xE000) != 0 )
{
LABEL_8:
v14 = objsize(a2, v13, v12);
v15 = gsym(a1);
return genbss(v15, v14);
}
genname(a1, 1LL, a4);
if ( a2 == 1 )
{
gendefb(a5);
return genalign(1LL);
}
}
if ( a2 == 2 )
{
if ( a3 != 2 )
return gendefw(a5);
v16 = arch_intsize();
}
else
{
if ( a3 != 2 )
return gendefp(a5);
v16 = arch_pointersize();
}
a4 *= v16;
goto LABEL_20;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, int a2, int a3, unsigned int a4, unsigned int a5, int a6, int a7)
{
__int64 result; // rax
int v12; // edx
int v13; // esi
unsigned int v14; // ebp
__int64 v15; // rdi
int v16; // eax
__int64 v17; // rdi

result = (unsigned int)(a3 - 3);
if ( (unsigned int)result > 1 )
{
result = gendata();
if ( a6 == 1 )
{
result = genpublic(a1);
if ( !a7 )
goto LABEL_6;
}
else if ( !a7 )
{
goto LABEL_6;
}
if ( a3 == 2 )
return result;
LABEL_6:
if ( a3 == 2 )
{
if ( (a2 & 0xE000) != 0 )
{
v12 = a4;
v13 = 2;
goto LABEL_8;
}
if ( a2 == 1 )
{
LABEL_20:
v17 = gsym(a1);
return genbss(v17, a4);
}
}
else
{
v12 = a4;
v13 = 1;
if ( (a2 & 0xE000) != 0 )
{
LABEL_8:
v14 = func12(a2, v13, v12);
v15 = gsym(a1);
return genbss(v15, v14);
}
genname(a1, 1LL, a4);
if ( a2 == 1 )
{
gendefb(a5);
return genalign(1LL);
}
}
if ( a2 == 2 )
{
if ( a3 != 2 )
return gendefw(a5);
v16 = arch_intsize();
}
else
{
if ( a3 != 2 )
return gendefp(a5);
v16 = arch_pointersize();
}
a4 *= v16;
goto LABEL_20;
}
return result;
}

original_code:
static void defglob(char *name, int prim, int type, int size, int val, int scls, int init)
{
    if (TCONSTANT == type || TFUNCTION == type)
        return;
    gendata();
    if (CPUBLIC == scls)
        genpublic(name);
    if (init && TARRAY == type)
        return;
    if (TARRAY != type && !(prim & STCMASK))
        genname(name);
    if (prim & STCMASK)
    {
        if (TARRAY == type)
            genbss(gsym(name), objsize(prim, TARRAY, size));
        else
            genbss(gsym(name), objsize(prim, TVARIABLE, size));
    }
    else if (PCHAR == prim)
    {
        if (TARRAY == type)
        {
            genbss(gsym(name), size);
        }
        else
        {
            gendefb(val);
            genalign(1);
        }
    }
    else if (PINT == prim)
    {
        if (TARRAY == type)
            genbss(gsym(name), size*arch_intsize());
        else
            gendefw(val);
    }
    else
    {
        if (TARRAY == type)
            genbss(gsym(name), size*arch_pointersize());
        else
            gendefp(val);
    }
}

variable_types:
name
char *

variable_types: val int

variable_types: scls int

variable_types: init int


addglob

decompiled_code:
__int64 __fastcall addglob(char *src, int a2, int a3, unsigned int a4, unsigned int a5, unsigned int a6, __int64 a7, int a8)
{
unsigned int v11; // eax
unsigned int v12; // er12
char *v13; // rax
__int64 v14; // r11
__int64 *v15; // rax
unsigned int v17; // eax
const char *v18; // rdx
__int64 *v20; // [rsp+10h] [rbp-48h]
__int64 v21; // [rsp+10h] [rbp-48h]
__int64 v22; // [rsp+18h] [rbp-40h]

v11 = findglob(src);
if ( v11 )
{
v12 = v11;
v22 = (int)v11;
v20 = &symbols[5 * (int)v11];
v17 = redeclare((int)src, *((char *)v20 + 24), (const char *)a4);
v14 = v22;
a4 = v17;
if ( *((_BYTE *)v20 + 12) == 3 )
{
a7 = v20[4];
if ( *((_DWORD *)v20 + 2) != a2 || a3 != 3 )
{
error((int)"redefinition does not match prior type: %s", (int)src, v18);
v14 = v22;
if ( (a4 & 0xFFFFFFFD) != 1 )
goto LABEL_4;
LABEL_9:
v21 = v14;
defglob((__int64)src, a2, a3, a5, a6, a4, a8);
v14 = v21;
goto LABEL_4;
}
}
}
else
{
v12 = newglob();
v13 = globname(src);
v14 = (int)v12;
symbols[5 * (int)v12] = (__int64)v13;
}
if ( (a4 & 0xFFFFFFFD) == 1 )
goto LABEL_9;
LABEL_4:
v15 = &symbols[5 * v14];
*((_DWORD *)v15 + 2) = a2;
*((_BYTE *)v15 + 12) = a3;
*((_BYTE *)v15 + 24) = a4;
*((_DWORD *)v15 + 4) = a5;
*((_DWORD *)v15 + 5) = a6;
v15[4] = a7;
return v12;
}

original_code:
int addglob(char *name, int prim, int type, int scls, int size, int val, char *mtext, int init)
{
    int y;
    if ((y = findglob(name)) != 0)
    {
        scls = redeclare(name, symbols[y].stcl, scls);
        if (TFUNCTION == symbols[y].type)
            mtext = symbols[y].mtext;
    }
    if (0 == y)
    {
        y = newglob();
        symbols[y].name = globname(name);
    }
    else if (TFUNCTION == symbols[y].type)
    {
        if (symbols[y].prims != prim || symbols[y].type != type)
            error("redefinition does not match prior type: %s", name);
    }
    if (CPUBLIC == scls || CSTATIC == scls)
        defglob(name, prim, type, size, val, scls, init);
    symbols[y].prims = prim;
    symbols[y].type = type;
    symbols[y].stcl = scls;
    symbols[y].size = size;
    symbols[y].value = val;
    symbols[y].mtext = mtext;
    return y;
}

variable_types:
mtext
char *


defloc

decompiled_code:
__int64 __fastcall defloc(int a1, int a2, unsigned int a3, unsigned int a4, unsigned int a5)
{
int v8; // edx
int v9; // esi
unsigned int v10; // ebp
__int64 v11; // rax
__int64 result; // rax
int v13; // eax
__int64 v14; // rax

gendata();
if ( a2 == 2 )
{
if ( (a1 & 0xE000) != 0 )
{
v8 = a3;
v9 = 2;
goto LABEL_3;
}
if ( a1 != 1 )
{
if ( a1 == 2 )
v13 = arch_intsize();
else
v13 = arch_pointersize();
a3 *= v13;
}
v14 = labname(a4);
result = genbss(v14, a3);
}
else
{
v8 = a3;
v9 = 1;
if ( (a1 & 0xE000) != 0 )
{
LABEL_3:
v10 = objsize(a1, v9, v8);
v11 = labname(a4);
return genbss(v11, v10);
}
genlab(a4, 1LL, a3);
if ( a1 == 1 )
{
gendefb(a5);
result = genalign(1LL);
}
else if ( a1 == 2 )
{
result = gendefw(a5);
}
else
{
result = gendefp(a5);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(int a1, int a2, unsigned int a3, unsigned int a4, unsigned int a5)
{
int v8; // edx
int v9; // esi
unsigned int v10; // ebp
__int64 v11; // rax
__int64 result; // rax
int v13; // eax
__int64 v14; // rax

gendata();
if ( a2 == 2 )
{
if ( (a1 & 0xE000) != 0 )
{
v8 = a3;
v9 = 2;
goto LABEL_3;
}
if ( a1 != 1 )
{
if ( a1 == 2 )
v13 = arch_intsize();
else
v13 = arch_pointersize();
a3 *= v13;
}
v14 = labname(a4);
result = genbss(v14, a3);
}
else
{
v8 = a3;
v9 = 1;
if ( (a1 & 0xE000) != 0 )
{
LABEL_3:
v10 = func12(a1, v9, v8);
v11 = labname(a4);
return genbss(v11, v10);
}
genlab(a4, 1LL, a3);
if ( a1 == 1 )
{
gendefb(a5);
result = genalign(1LL);
}
else if ( a1 == 2 )
{
result = gendefw(a5);
}
else
{
result = gendefp(a5);
}
}
return result;
}

original_code:
static void defloc(int prim, int type, int size, int val, int init)
{
    gendata();
    if (type != TARRAY && !(prim &STCMASK))
        genlab(val);
    if (prim & STCMASK)
    {
        if (TARRAY == type)
            genbss(labname(val), objsize(prim, TARRAY, size));
        else
            genbss(labname(val), objsize(prim, TVARIABLE, size));
    }
    else if (PCHAR == prim)
    {
        if (TARRAY == type)
        {
            genbss(labname(val), size);
        }
        else
        {
            gendefb(init);
            genalign(1);
        }
    }
    else if (PINT == prim)
    {
        if (TARRAY == type)
            genbss(labname(val), size*arch_intsize());
        else
            gendefw(init);
    }
    else
    {
        if (TARRAY == type)
            genbss(labname(val), size*arch_pointersize());
        else
            gendefp(init);
    }
}


addloc

decompiled_code:
__int64 __fastcall addloc(char *src, int a2, int a3, int a4, unsigned int a5, unsigned int a6, int a7)
{
const char *v10; // rdx
unsigned int v11; // er12
char *v12; // r8
__int64 v13; // rax

if ( (unsigned int)findloc(src) )
{
error((int)"redefinition of: %s", (int)src, v10);
v11 = newloc();
if ( a4 != 4 )
goto LABEL_3;
LABEL_5:
defloc(a2, a3, a5, a6, a7);
goto LABEL_3;
}
v11 = newloc();
if ( a4 == 4 )
goto LABEL_5;
LABEL_3:
v12 = locname(src);
v13 = 5LL * (int)v11;
LOBYTE(symbols[v13 + 3]) = a4;
LODWORD(symbols[v13 + 1]) = a2;
BYTE4(symbols[v13 + 1]) = a3;
LODWORD(symbols[v13 + 2]) = a5;
HIDWORD(symbols[v13 + 2]) = a6;
symbols[v13] = (__int64)v12;
return v11;
}

canonical_decompiled_code:
__int64 __fastcall func16(char *src, int a2, int a3, int a4, unsigned int a5, unsigned int a6, int a7)
{
const char *v10; // rdx
unsigned int v11; // er12
char *v12; // r8
__int64 v13; // rax

if ( (unsigned int)func0(src) )
{
error((int)"redefinition of: %s", (int)src, v10);
v11 = func3();
if ( a4 != 4 )
goto LABEL_3;
LABEL_5:
func15(a2, a3, a5, a6, a7);
goto LABEL_3;
}
v11 = func3();
if ( a4 == 4 )
goto LABEL_5;
LABEL_3:
v12 = func5(src);
v13 = 5LL * (int)v11;
LOBYTE(symbols[v13 + 3]) = a4;
LODWORD(symbols[v13 + 1]) = a2;
BYTE4(symbols[v13 + 1]) = a3;
LODWORD(symbols[v13 + 2]) = a5;
HIDWORD(symbols[v13 + 2]) = a6;
symbols[v13] = (__int64)v12;
return v11;
}

original_code:
int addloc(char *name, int prim, int type, int scls, int size, int val, int init)
{
    int y;
    if (findloc(name))
        error("redefinition of: %s", name);
    y = newloc();
    if (CLSTATC == scls)
        defloc(prim, type, size, val, init);
    symbols[y].name = locname(name);
    symbols[y].prims = prim;
    symbols[y].type = type;
    symbols[y].stcl = scls;
    symbols[y].size = size;
    symbols[y].value = val;
    return y;
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
Line = 1;
Putback = 10;
Rejected = -1;
Errors = 0;
Syntoken = 0;
Globs = 0;
Locs = 1024;
Nbot = 0;
Ntop = 0x4000;
Bsp = 0;
Csp = 0;
Q_type = 0;
Q_cmp = 0;
File = (__int64)"(stdin)";
addglob(&unk_E6B0, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL);
genprelude();
Token = scan();
while ( Token != 71 )
top();
genpostlude();
return 0;
}

original_code:
int main(int argc, char *argv[])
{
    Line = 1;
    Putback = '\n';
    Rejected = -1;
    Errors = 0;
    Syntoken = 0;
    Globs = 0;
    Locs = 1024;
    Nbot = 0;
    Ntop = 16384;
    Bsp = 0;
    Csp = 0;
    Q_type = empty;
    Q_cmp = none;
    File = "(stdin)";
    addglob("", 0, 0, 0, 0, 0, ((void *)0), 0);
    genprelude();
    Token = scan();
    while (XEOF != Token)
        top();
    genpostlude();
    return 0;
}

variable_types: argc int

variable_types:
argv
char *[]


copyname

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

result = strncpy(a1, a2, 0x10uLL);
result[16] = 0;
return result;
}

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

result = strncpy(a1, a2, 0x10uLL);
result[16] = 0;
return result;
}

original_code:
void copyname(char *name, char *s)
{
    strncpy(name, s, 16);
    name[16] = 0;
}

variable_types:
s
char *


inttype

decompiled_code:
_BOOL8 __fastcall inttype(int a1)
{
return (unsigned int)(a1 - 1) <= 1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(int a1)
{
return (unsigned int)(a1 - 1) <= 1;
}

original_code:
int inttype(int p)
{
    return PINT == p || PCHAR == p;
}

variable_types: p int


comptype

decompiled_code:
_BOOL8 __fastcall comptype(__int16 a1)
{
return (((a1 & 0xE000) - 0x2000) & 0xFFFFC000) == 0;
}

original_code:
int comptype(int p)
{
    p &= STCMASK;
    return p == PSTRUCT || p == PUNION;
}


fatal

decompiled_code:
void __fastcall __noreturn fatal(char *a1)
{
error(a1);
error("fatal error, stop");
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func3(char *a1)
{
func4(a1);
func4("fatal error, stop");
exit(1);
}

original_code:
void fatal(char *s)
{
    error(s, ((void *)0));
    error("fatal error, stop", ((void *)0));
    exit(1);
}


error

decompiled_code:
__int64 __fastcall error(char *format, __int64 a2)
{
__int64 result; // rax

result = (unsigned int)Syntoken;
if ( !Syntoken )
{
fprintf(stderr, "error: %s: %d: ", (const char *)File, (unsigned int)Line);
fprintf(stderr, format, a2);
fputc(10, stderr);
result = (unsigned int)(Errors + 1);
Errors = result;
if ( (int)result > 10 )
{
Errors = 0;
fatal("too many errors");
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(char *format, __int64 a2)
{
__int64 result; // rax

result = (unsigned int)Syntoken;
if ( !Syntoken )
{
fprintf(stderr, "error: %s: %d: ", (const char *)File, (unsigned int)Line);
fprintf(stderr, format, a2);
fputc(10, stderr);
result = (unsigned int)(Errors + 1);
Errors = result;
if ( (int)result > 10 )
{
Errors = 0;
func3("too many errors");
}
}
return result;
}

original_code:
void error(char *s, char *a)
{
    if (Syntoken)
        return;
    fprintf(stderr, "error: %s: %d: ", File, Line);
    fprintf(stderr, s, a);
    fprintf(stderr, "\n");
    if (++Errors > 10)
    {
        Errors = 0;
        fatal("too many errors");
    }
}

variable_types:
a
char *


match

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

if ( Token != a1 )
return error("%s expected", a2);
result = scan();
Token = result;
return result;
}

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

if ( Token != a1 )
return func4("%s expected", a2);
result = scan();
Token = result;
return result;
}

original_code:
void match(int t, char *what)
{
    if (Token == t)
    {
        Token = scan();
    }
    else
    {
        error("%s expected", what);
    }
}

variable_types: t int

variable_types:
what
char *


lparen

original_code:
void lparen(void)
{
    match(LPAREN, "'('");
}

canonical_original_code:
void lparen()
{
    match(LPAREN, "'('");
}


rparen

original_code:
void rparen(void)
{
    match(RPAREN, "')'");
}

canonical_original_code:
void rparen()
{
    match(RPAREN, "')'");
}


lbrace

original_code:
void lbrace(void)
{
    match(LBRACE, "'{'");
}

canonical_original_code:
void lbrace()
{
    match(LBRACE, "'{'");
}


rbrace

original_code:
void rbrace(void)
{
    match(RBRACE, "'}'");
}

canonical_original_code:
void rbrace()
{
    match(RBRACE, "'}'");
}


rbrack

original_code:
void rbrack(void)
{
    match(RBRACK, "']'");
}

canonical_original_code:
void rbrack()
{
    match(RBRACK, "']'");
}


semi

original_code:
void semi(void)
{
    match(SEMI, "';'");
}

canonical_original_code:
void semi()
{
    match(SEMI, "';'");
}


colon

original_code:
void colon(void)
{
    match(COLON, "':'");
}

canonical_original_code:
void colon()
{
    match(COLON, "':'");
}


ident

decompiled_code:
__int64 ident()
{
return match(46, (__int64)"identifier");
}

canonical_decompiled_code:
__int64 func13()
{
return func5(46, (__int64)"identifier");
}

original_code:
void ident(void)
{
    match(IDENT, "identifier");
}

canonical_original_code:
void ident()
{
    match(IDENT, "identifier");
}


eofcheck

decompiled_code:
__int64 eofcheck()
{
if ( Token != 71 )
return 0LL;
error("missing '}'", 0LL);
return 1LL;
}

canonical_decompiled_code:
__int64 func14()
{
if ( Token != 71 )
return 0LL;
func4("missing '}'", 0LL);
return 1LL;
}

original_code:
int eofcheck(void)
{
    if (XEOF == Token)
    {
        error("missing '}'", ((void *)0));
        return 1;
    }
    return 0;
}

canonical_original_code:
int eofcheck()
{
    if (XEOF == Token)
    {
        error("missing '}'", ((void *)0));
        return 1;
    }
    return 0;
}


cerror

decompiled_code:
__int64 __fastcall cerror(char *format, unsigned int a2)
{
char v3[56]; // [rsp+0h] [rbp-38h] BYREF

if ( isprint(a2) )
sprintf(v3, "'%c' (\\x%x)", a2, a2);
else
sprintf(v3, "\\x%x", a2);
return error(format, (__int64)v3);
}

canonical_decompiled_code:
__int64 __fastcall func15(char *format, unsigned int a2)
{
char v3[56]; // [rsp+0h] [rbp-38h] BYREF

if ( isprint(a2) )
sprintf(v3, "'%c' (\\x%x)", a2, a2);
else
sprintf(v3, "\\x%x", a2);
return func4(format, (__int64)v3);
}

original_code:
void cerror(char *s, int c)
{
    char buf[32];
    if (isprint(c))
        sprintf(buf, "'%c' (\\x%x)", c, c);
    else
        sprintf(buf, "\\x%x", c);
    error(s, buf);
}

variable_types: c int

variable_types:
buf
char [32]


synch

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

LODWORD(result) = scan();
if ( (_DWORD)result == a1 )
{
result = a1;
}
else
{
do
{
if ( (_DWORD)result == -1 )
fatal("error recovery failed");
result = next();
}
while ( a1 != (_DWORD)result );
}
Syntoken = a1;
return result;
}

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

LODWORD(result) = scan();
if ( (_DWORD)result == a1 )
{
result = a1;
}
else
{
do
{
if ( (_DWORD)result == -1 )
func3("error recovery failed");
result = next();
}
while ( a1 != (_DWORD)result );
}
Syntoken = a1;
return result;
}

original_code:
int synch(int syn)
{
    int t = scan();
    while (t != syn)
    {
        if ((-1) == t)
            fatal("error recovery failed");
        t = next();
    }
    Syntoken = syn;
    return t;
}

variable_types: syn int


genraw

decompiled_code:
int __fastcall genraw(const char *a1)
{
return fputs(a1, stdout);
}

canonical_decompiled_code:
int __fastcall func17(const char *a1)
{
return fputs(a1, stdout);
}

original_code:
void genraw(char *s)
{
    fprintf(stdout, "%s", s);
}


gen

decompiled_code:
int __fastcall gen(const char *a1)
{
return fprintf(stdout, "\t%s\n", a1);
}

canonical_decompiled_code:
int __fastcall func18(const char *a1)
{
return fprintf(stdout, "\t%s\n", a1);
}

original_code:
void gen(char *s)
{
    fprintf(stdout, "\t%s\n", s);
}


ngen

decompiled_code:
int __fastcall ngen(char *format, __int64 a2, unsigned int a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3);
return fputc(10, stdout);
}

canonical_decompiled_code:
int __fastcall func19(char *format, __int64 a2, unsigned int a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3);
return fputc(10, stdout);
}

original_code:
void ngen(char *s, char *inst, int n)
{
    fputc('\t', stdout);
    fprintf(stdout, s, inst, n);
    fputc('\n', stdout);
}

variable_types:
inst
char *

variable_types: n int


decompiled_code:
int __fastcall ngen2(char *format, __int64 a2, unsigned int a3, unsigned int a4)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3, a4);
return fputc(10, stdout);
}

canonical_decompiled_code:
int __fastcall func20(char *format, __int64 a2, unsigned int a3, unsigned int a4)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3, a4);
return fputc(10, stdout);
}

original_code:
void ngen2(char *s, char *inst, int n, int a)
{
    fputc('\t', stdout);
    fprintf(stdout, s, inst, n, a);
    fputc('\n', stdout);
}

variable_types: a int


lgen

decompiled_code:
int __fastcall lgen(char *format, __int64 a2, unsigned int a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, 76LL, a3);
return fputc(10, stdout);
}

canonical_decompiled_code:
int __fastcall func21(char *format, __int64 a2, unsigned int a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, 76LL, a3);
return fputc(10, stdout);
}

original_code:
void lgen(char *s, char *inst, int n) {
    fputc('\t', stdout);
    fprintf(stdout, s, inst, 'L', n);
    fputc('\n', stdout);
}


decompiled_code:
int __fastcall lgen2(char *format, unsigned int a2, unsigned int a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, 76LL, a3);
return fputc(10, stdout);
}

canonical_decompiled_code:
int __fastcall func22(char *format, unsigned int a2, unsigned int a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, 76LL, a3);
return fputc(10, stdout);
}

original_code:
void lgen2(char *s, int v1, int v2)
{
    fputc('\t', stdout);
    fprintf(stdout, s, v1, 'L', v2);
    fputc('\n', stdout);
}


sgen

decompiled_code:
int __fastcall sgen(char *format, __int64 a2, __int64 a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3);
return fputc(10, stdout);
}

canonical_decompiled_code:
int __fastcall func23(char *format, __int64 a2, __int64 a3)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3);
return fputc(10, stdout);
}

original_code:
void sgen(char *s, char *inst, char *s2)
{
    fputc('\t', stdout);
    fprintf(stdout, s, inst, s2);
    fputc('\n', stdout);
}


decompiled_code:
int __fastcall sgen2(char *format, __int64 a2, unsigned int a3, __int64 a4)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3, a4);
return fputc(10, stdout);
}

canonical_decompiled_code:
int __fastcall func24(char *format, __int64 a2, unsigned int a3, __int64 a4)
{
fputc(9, stdout);
fprintf(stdout, format, a2, a3, a4);
return fputc(10, stdout);
}

original_code:
void sgen2(char *s, char *inst, int v, char *s2)
{
    fputc('\t', stdout);
    fprintf(stdout, s, inst, v, s2);
    fputc('\n', stdout);
}

variable_types: v int


genlab

decompiled_code:
int __fastcall genlab(unsigned int a1)
{
return fprintf(stdout, "%c%d:\n", 76LL, a1);
}

canonical_decompiled_code:
int __fastcall func25(unsigned int a1)
{
return fprintf(stdout, "%c%d:\n", 76LL, a1);
}

original_code:
void genlab(int id)
{
    fprintf(stdout, "%c%d:\n", 'L', id);
}

variable_types: id int


putback

decompiled_code:
void __fastcall putback(int a1)
{
Putback = a1;
}

canonical_decompiled_code:
void __fastcall func0(int a1)
{
Putback = a1;
}

original_code:
static void putback(int c)
{
    Putback = c;
}


next

decompiled_code:
int next()
{
int result; // eax

result = Putback;
if ( Putback )
{
Putback = 0;
}
else
{
result = fgetc(stdin);
if ( result == 10 )
++Line;
}
return result;
}

canonical_decompiled_code:
int func3()
{
int result; // eax

result = Putback;
if ( Putback )
{
Putback = 0;
}
else
{
result = fgetc(stdin);
if ( result == 10 )
++Line;
}
return result;
}

original_code:
int next(void)
{
    int c;
    if (Putback)
    {
        c = Putback;
        Putback = 0;
        return c;
    }
    c = fgetc(stdin);
    if ('\n' == c)
        Line++;
    return c;
}

canonical_original_code:
int next()
{
    int c;
    if (Putback)
    {
        c = Putback;
        Putback = 0;
        return c;
    }
    c = fgetc(stdin);
    if ('\n' == c)
        Line++;
    return c;
}


skip

decompiled_code:
void skip()
{
unsigned int v0; // eax
__int64 v1; // rbx
unsigned __int64 i; // r12
int v3; // eax
int v4; // eax
int v5; // er12
unsigned int v6; // eax

v0 = next();
if ( v0 == -1 )
{
LABEL_11:
strcpy(Text, "<EOF>");
return;
}
v1 = 0x100003600LL;
LABEL_3:
for ( i = v0; (unsigned int)i <= 0x20; i = (unsigned int)next() )
{
if ( !_bittest64(&v1, i) )
return;
}
if ( (_DWORD)i == 47 )
{
v3 = next();
if ( v3 != 42 )
{
putback(v3);
return;
}
v4 = 0;
while ( 1 )
{
v5 = v4;
v4 = next();
if ( v4 == -1 )
goto LABEL_11;
if ( v4 == 47 && v5 == 42 )
{
v6 = next();
i = v6;
if ( v6 != -1 )
goto LABEL_3;
goto LABEL_11;
}
}
}
}

canonical_decompiled_code:
void func4()
{
unsigned int v0; // eax
__int64 v1; // rbx
unsigned __int64 i; // r12
int v3; // eax
int v4; // eax
int v5; // er12
unsigned int v6; // eax

v0 = func3();
if ( v0 == -1 )
{
LABEL_11:
strcpy(Text, "<EOF>");
return;
}
v1 = 0x100003600LL;
LABEL_3:
for ( i = v0; (unsigned int)i <= 0x20; i = (unsigned int)func3() )
{
if ( !_bittest64(&v1, i) )
return;
}
if ( (_DWORD)i == 47 )
{
v3 = func3();
if ( v3 != 42 )
{
func0(v3);
return;
}
v4 = 0;
while ( 1 )
{
v5 = v4;
v4 = func3();
if ( v4 == -1 )
goto LABEL_11;
if ( v4 == 47 && v5 == 42 )
{
v6 = func3();
i = v6;
if ( v6 != -1 )
goto LABEL_3;
goto LABEL_11;
}
}
}
}

variable_types: nl int


hexchar

decompiled_code:
__int64 hexchar()
{
int v0; // er12
int i; // ebx
int v2; // eax
int v3; // edi
const char *v4; // rdx

v0 = 0;
for ( i = 0; ; i = 1 )
{
v3 = next();
if ( !isxdigit(v3) )
break;
v2 = tolower(v3);
v0 = chrpos_constprop_0(v2) + 16 * v0;
}
putback(v3);
if ( i )
{
if ( v0 <= 255 )
return (unsigned int)v0;
}
else
{
error((int)"missing digits after '\\x'", 0, v4);
if ( v0 <= 255 )
return (unsigned int)v0;
}
error((int)"value out of range after '\\x'", 0, v4);
return (unsigned int)v0;
}

canonical_decompiled_code:
__int64 func5()
{
int v0; // er12
int i; // ebx
int v2; // eax
int v3; // edi
const char *v4; // rdx

v0 = 0;
for ( i = 0; ; i = 1 )
{
v3 = func3();
if ( !isxdigit(v3) )
break;
v2 = tolower(v3);
v0 = func2(v2) + 16 * v0;
}
func0(v3);
if ( i )
{
if ( v0 <= 255 )
return (unsigned int)v0;
}
else
{
error((int)"missing digits after '\\x'", 0, v4);
if ( v0 <= 255 )
return (unsigned int)v0;
}
error((int)"value out of range after '\\x'", 0, v4);
return (unsigned int)v0;
}

original_code:
static int hexchar(void)
{
    int c, h, n = 0, f = 0;
    while (isxdigit(c = next()))
    {
        h = chrpos("0123456789abcdef", tolower(c));
        n = n * 16 + h;
        f = 1;
    }
    putback(c);
    if (!f)
        error("missing digits after '\\x'", ((void *)0));
    if (n > 255)
        error("value out of range after '\\x'", ((void *)0));
    return n;
}

canonical_original_code:
static int hexchar()
{
    int c; int h; int n = 0; int f = 0;
    while (isxdigit(c = next()))
    {
        h = chrpos("0123456789abcdef", tolower(c));
        n = n * 16 + h;
        f = 1;
    }
    putback(c);
    if (!f)
        error("missing digits after '\\x'", ((void *)0));
    if (n > 255)
        error("value out of range after '\\x'", ((void *)0));
    return n;
}

variable_types: h int

variable_types: f int


scanch

decompiled_code:
void scanch()
{
unsigned int v0; // eax
int v1; // ebx
int v2; // edx
int v3; // eax

if ( next() == 92 )
{
v0 = next();
switch ( v0 )
{
case '"':
case '\'':
case '\\':
case 'a':
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case 'v':
return;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
v1 = 0;
v2 = v0 - 48;
do
{
v1 = v2 + 8 * v1;
v3 = next();
v2 = v3 - 48;
}
while ( (unsigned int)(v3 - 48) <= 7 );
putback(v3);
break;
case 'x':
hexchar();
break;
default:
cerror("unknown escape sequence: %s", (const char *)v0);
break;
}
}
}

canonical_decompiled_code:
void func6()
{
unsigned int v0; // eax
int v1; // ebx
int v2; // edx
int v3; // eax

if ( func3() == 92 )
{
v0 = func3();
switch ( v0 )
{
case '"':
case '\'':
case '\\':
case 'a':
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case 'v':
return;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
v1 = 0;
v2 = v0 - 48;
do
{
v1 = v2 + 8 * v1;
v3 = func3();
v2 = v3 - 48;
}
while ( (unsigned int)(v3 - 48) <= 7 );
func0(v3);
break;
case 'x':
func5();
break;
default:
cerror("unknown escape sequence: %s", (const char *)v0);
break;
}
}
}

original_code:
static int scanch(void)
{
    int c = next();
    int c2;
    if ('\\' == c)
    {
        switch (c = next())
        {
        case 'a':
            return '\a';
        case 'b':
            return '\b';
        case 'f':
            return '\f';
        case 'n':
            return '\n';
        case 'r':
            return '\r';
        case 't':
            return '\t';
        case 'v':
            return '\v';
        case '\\':
            return '\\';
        case '"':
            return '"' | 256;
        case '\'':
            return '\'';
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            for (c2 = 0; isdigit(c) && c < '8'; c = next())
                c2 = c2 * 8 + (c - '0');
            putback(c);
            return c2;
        case 'x':
            return hexchar();
        default:
            cerror("unknown escape sequence: %s", c);
            return ' ';
        }
    }
    return c;
}

canonical_original_code:
static int scanch()
{
    int c = next();
    int c2;
    if ('\\' == c)
    {
        switch (c = next())
        {
        case 'a':
            return '\a';
        case 'b':
            return '\b';
        case 'f':
            return '\f';
        case 'n':
            return '\n';
        case 'r':
            return '\r';
        case 't':
            return '\t';
        case 'v':
            return '\v';
        case '\\':
            return '\\';
        case '"':
            return '"' | 256;
        case '\'':
            return '\'';
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            for (c2 = 0; isdigit(c) && c < '8'; c = next())
                c2 = c2 * 8 + (c - '0');
            putback(c);
            return c2;
        case 'x':
            return hexchar();
        default:
            cerror("unknown escape sequence: %s", c);
            return ' ';
        }
    }
    return c;
}


scanint

decompiled_code:
void __fastcall scanint(int c)
{
unsigned int v1; // er15
int v2; // er13
__int64 v3; // rbp
int i; // er12
int v5; // eax
int v6; // ebx

v1 = c;
v2 = 10;
v3 = 0LL;
if ( c == 48 )
{
Text[0] = 48;
v3 = 1LL;
v2 = 8;
v1 = next();
if ( v1 == 120 )
{
Text[1] = 120;
v3 = 2LL;
v2 = 16;
v1 = next();
}
}
for ( i = 0; ; i = v6 + v2 * i )
{
v5 = tolower(v1);
v6 = chrpos_constprop_0(v5);
if ( v6 < 0 )
break;
Text[v3] = v1;
if ( v6 >= v2 )
cerror("invalid digit in integer literal: %s", (const char *)v1);
++v3;
v1 = next();
}
putback(v1);
Text[(int)v3] = 0;
}

canonical_decompiled_code:
void __fastcall func8(int c)
{
unsigned int v1; // er15
int v2; // er13
__int64 v3; // rbp
int i; // er12
int v5; // eax
int v6; // ebx

v1 = c;
v2 = 10;
v3 = 0LL;
if ( c == 48 )
{
Text[0] = 48;
v3 = 1LL;
v2 = 8;
v1 = func3();
if ( v1 == 120 )
{
Text[1] = 120;
v3 = 2LL;
v2 = 16;
v1 = func3();
}
}
for ( i = 0; ; i = v6 + v2 * i )
{
v5 = tolower(v1);
v6 = func2(v5);
if ( v6 < 0 )
break;
Text[v3] = v1;
if ( v6 >= v2 )
cerror("invalid digit in integer literal: %s", (const char *)v1);
++v3;
v1 = func3();
}
func0(v1);
Text[(int)v3] = 0;
}

original_code:
static int scanint(int c)
{
    int val = 0;
    int radix = 10;
    int k, i = 0;
    if ('0' == c)
    {
        Text[i++] = '0';
        if ((c = next()) == 'x')
        {
            radix = 16;
            Text[i++] = c;
            c = next();
        }
        else
        {
            radix = 8;
        }
    }
    while ((k = chrpos("0123456789abcdef", tolower(c))) >= 0)
    {
        Text[i++] = c;
        if (k >= radix)
            cerror("invalid digit in integer literal: %s", c);
        val = val * radix + k;
        c = next();
    }
    putback(c);
    Text[i] = 0;
    return val;
}

canonical_original_code:
static int scanint(int c)
{
    int val = 0;
    int radix = 10;
    int k; int i = 0;
    if ('0' == c)
    {
        Text[i++] = '0';
        if ((c = next()) == 'x')
        {
            radix = 16;
            Text[i++] = c;
            c = next();
        }
        else
        {
            radix = 8;
        }
    }
    while ((k = chrpos("0123456789abcdef", tolower(c))) >= 0)
    {
        Text[i++] = c;
        if (k >= radix)
            cerror("invalid digit in integer literal: %s", c);
        val = val * radix + k;
        c = next();
    }
    putback(c);
    Text[i] = 0;
    return val;
}

variable_types: val int

variable_types: radix int

variable_types: k int

variable_types: i int


scanident

decompiled_code:
__int64 __fastcall scanident(int a1, __int64 a2, unsigned int a3)
{
unsigned int v4; // er12
int v6; // ebx
__int64 v7; // rax
const char *v8; // rdx
__int64 v9; // rax

v4 = 0;
v6 = a3 - 1;
while ( isalpha(a1) || (unsigned int)(a1 - 48) <= 9 || a1 == 95 )
{
if ( v6 == v4 )
{
v4 = a3;
error((int)"identifier too long", 0, v8);
}
else if ( v6 > (int)v4 )
{
v7 = (int)v4++;
*(_BYTE *)(a2 + v7) = a1;
}
a1 = next();
}
putback(a1);
*(_BYTE *)(a2 + v9) = 0;
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func9(int a1, __int64 a2, unsigned int a3)
{
unsigned int v4; // er12
int v6; // ebx
__int64 v7; // rax
const char *v8; // rdx
__int64 v9; // rax

v4 = 0;
v6 = a3 - 1;
while ( isalpha(a1) || (unsigned int)(a1 - 48) <= 9 || a1 == 95 )
{
if ( v6 == v4 )
{
v4 = a3;
error((int)"identifier too long", 0, v8);
}
else if ( v6 > (int)v4 )
{
v7 = (int)v4++;
*(_BYTE *)(a2 + v7) = a1;
}
a1 = func3();
}
func0(a1);
*(_BYTE *)(a2 + v9) = 0;
return v4;
}

original_code:
static int scanident(int c, char *buf, int lim)
{
    int i = 0;
    while (isalpha(c) || isdigit(c) || '_' == c)
    {
        if (lim - 1 == i)
        {
            error("identifier too long", ((void *)0));
            i++;
        }
        else if (i < lim - 1)
        {
            buf[i++] = c;
        }
        c = next();
    }
    putback(c);
    buf[i] = 0;
    return i;
}

variable_types:
buf
char *

variable_types: lim int


scanpp

decompiled_code:
__int64 __fastcall scanpp(const char *a1, __int64 a2)
{
unsigned int v2; // er12
int v3; // eax
unsigned int v4; // er12
int v6; // edi
int v7; // eax
const char *v8; // rdx
int v9; // edi
int v10; // eax
int v11; // edi
int v12; // eax
int v13; // eax
const char *v14; // rdx
int v15; // eax
int v16; // edi
int v17; // edi
const char *v18; // rdx
int v19; // edi
int v20; // edi
int v21; // eax
int v22; // edi
int v23; // eax
int v24; // eax
int v25; // edi
int v26; // edi
int v27; // eax

v2 = Rejected;
if ( Rejected == -1 )
{
while ( 2 )
{
Value = 0;
skip();
Text[3] = 0;
Text[0] = v3;
v4 = v3;
*(_WORD *)&Text[1] = 0;
switch ( v3 )
{
case -1:
v2 = 71;
strcpy(Text, "<EOF>");
break;
case 33:
v6 = next();
if ( v6 == 61 )
{
Text[1] = 61;
v2 = 12;
}
else
{
putback(v6);
v2 = 72;
}
break;
case 34:
v2 = 64;
Value = scanstr_constprop_0((__int64)a1, a2);
break;
case 35:
v13 = next();
scanident(v13, (unsigned int)((_DWORD)Text + 1), 0x1FFu);
v2 = keyword_constprop_0();
if ( !v2 )
{
v2 = 46;
error((int)"unknown preprocessor command: %s", (int)Text, v14);
}
break;
case 37:
v11 = next();
if ( v11 == 61 )
{
Text[1] = 61;
v2 = 23;
}
else
{
putback(v11);
v2 = 2;
}
break;
case 38:
v12 = next();
if ( v12 == 38 )
{
Text[1] = 38;
v2 = 16;
}
else if ( v12 == 61 )
{
Text[1] = 61;
v2 = 19;
}
else
{
putback(v12);
v2 = 13;
}
break;
case 39:
scanch();
Value = v7;
Text[1] = v7;
if ( next() != 39 )
error((int)"expected '\\'' at end of char literal", 0, v8);
Text[2] = 39;
v2 = 50;
break;
case 40:
v2 = 53;
break;
case 41:
v2 = 60;
break;
case 42:
v9 = next();
if ( v9 == 61 )
{
Text[1] = 61;
v2 = 28;
}
else
{
putback(v9);
v2 = 1;
}
break;
case 43:
v10 = next();
if ( v10 == 43 )
{
Text[1] = 43;
v2 = 48;
}
else if ( v10 == 61 )
{
Text[1] = 61;
v2 = 25;
}
else
{
putback(v10);
v2 = 3;
}
break;
case 44:
v2 = 35;
break;
case 45:
v15 = next();
switch ( v15 )
{
case '-':
Text[1] = 45;
v2 = 37;
break;
case '=':
Text[1] = 61;
v2 = 22;
break;
case '>':
Text[1] = 62;
v2 = 18;
break;
default:
v2 = 4;
putback(v15);
break;
}
break;
case 46:
v16 = next();
if ( v16 == 46 )
{
Text[1] = 46;
v2 = 41;
*(_WORD *)&Text[2] = 46;
v17 = next();
if ( v17 != 46 )
{
putback(v17);
error((int)"incomplete '...'", 0, v18);
}
}
else
{
putback(v16);
v2 = 40;
}
break;
case 47:
v19 = next();
if ( v19 == 61 )
{
Text[1] = 61;
v2 = 27;
}
else
{
putback(v19);
v2 = 0;
}
break;
case 58:
v2 = 34;
break;
case 59:
v2 = 61;
break;
case 60:
v21 = next();
if ( v21 == 60 )
{
Text[1] = 60;
v25 = next();
if ( v25 == 61 )
{
Text[2] = 61;
v2 = 21;
}
else
{
putback(v25);
v2 = 5;
}
}
else if ( v21 == 61 )
{
Text[1] = 61;
v2 = 10;
}
else
{
v2 = 9;
putback(v21);
}
break;
case 61:
v22 = next();
if ( v22 == 61 )
{
Text[1] = 61;
v2 = 11;
}
else
{
putback(v22);
v2 = 29;
}
break;
case 62:
v23 = next();
if ( v23 == 62 )
{
Text[1] = 62;
v26 = next();
if ( v26 == 61 )
{
Text[1] = 61;
v2 = 26;
}
else
{
putback(v26);
v2 = 6;
}
}
else if ( v23 == 61 )
{
Text[1] = 61;
v2 = 8;
}
else
{
v2 = 7;
putback(v23);
}
break;
case 63:
v2 = 55;
break;
case 91:
v2 = 52;
break;
case 93:
v2 = 57;
break;
case 94:
v20 = next();
if ( v20 == 61 )
{
Text[1] = 61;
v2 = 20;
}
else
{
putback(v20);
v2 = 14;
}
break;
case 123:
v2 = 51;
break;
case 124:
v24 = next();
if ( v24 == 124 )
{
Text[1] = 124;
v2 = 17;
}
else if ( v24 == 61 )
{
Text[1] = 61;
v2 = 24;
}
else
{
putback(v24);
v2 = 15;
}
break;
case 125:
v2 = 56;
break;
case 126:
v2 = 67;
break;
default:
if ( (unsigned int)(v3 - 48) <= 9 )
{
scanint(v3);
v2 = 50;
Value = v27;
}
else
{
if ( !isalpha(v3) && v4 != 95 )
{
a2 = v4;
a1 = "funny input character: %s";
cerror("funny input character: %s", (const char *)v4);
continue;
}
Value = scanident(v4, (__int64)Text, 0x200u);
v2 = keyword_constprop_0();
if ( !v2 )
v2 = 46;
}
break;
}
break;
}
}
else
{
Rejected = -1;
strcpy(Text, Rejtext);
Value = Rejval;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func10(const char *a1, __int64 a2)
{
unsigned int v2; // er12
int v3; // eax
unsigned int v4; // er12
int v6; // edi
int v7; // eax
const char *v8; // rdx
int v9; // edi
int v10; // eax
int v11; // edi
int v12; // eax
int v13; // eax
const char *v14; // rdx
int v15; // eax
int v16; // edi
int v17; // edi
const char *v18; // rdx
int v19; // edi
int v20; // edi
int v21; // eax
int v22; // edi
int v23; // eax
int v24; // eax
int v25; // edi
int v26; // edi
int v27; // eax

v2 = Rejected;
if ( Rejected == -1 )
{
while ( 2 )
{
Value = 0;
func4();
Text[3] = 0;
Text[0] = v3;
v4 = v3;
*(_WORD *)&Text[1] = 0;
switch ( v3 )
{
case -1:
v2 = 71;
strcpy(Text, "<EOF>");
break;
case 33:
v6 = func3();
if ( v6 == 61 )
{
Text[1] = 61;
v2 = 12;
}
else
{
func0(v6);
v2 = 72;
}
break;
case 34:
v2 = 64;
Value = func7((__int64)a1, a2);
break;
case 35:
v13 = func3();
func9(v13, (unsigned int)((_DWORD)Text + 1), 0x1FFu);
v2 = func1();
if ( !v2 )
{
v2 = 46;
error((int)"unknown preprocessor command: %s", (int)Text, v14);
}
break;
case 37:
v11 = func3();
if ( v11 == 61 )
{
Text[1] = 61;
v2 = 23;
}
else
{
func0(v11);
v2 = 2;
}
break;
case 38:
v12 = func3();
if ( v12 == 38 )
{
Text[1] = 38;
v2 = 16;
}
else if ( v12 == 61 )
{
Text[1] = 61;
v2 = 19;
}
else
{
func0(v12);
v2 = 13;
}
break;
case 39:
func6();
Value = v7;
Text[1] = v7;
if ( func3() != 39 )
error((int)"expected '\\'' at end of char literal", 0, v8);
Text[2] = 39;
v2 = 50;
break;
case 40:
v2 = 53;
break;
case 41:
v2 = 60;
break;
case 42:
v9 = func3();
if ( v9 == 61 )
{
Text[1] = 61;
v2 = 28;
}
else
{
func0(v9);
v2 = 1;
}
break;
case 43:
v10 = func3();
if ( v10 == 43 )
{
Text[1] = 43;
v2 = 48;
}
else if ( v10 == 61 )
{
Text[1] = 61;
v2 = 25;
}
else
{
func0(v10);
v2 = 3;
}
break;
case 44:
v2 = 35;
break;
case 45:
v15 = func3();
switch ( v15 )
{
case '-':
Text[1] = 45;
v2 = 37;
break;
case '=':
Text[1] = 61;
v2 = 22;
break;
case '>':
Text[1] = 62;
v2 = 18;
break;
default:
v2 = 4;
func0(v15);
break;
}
break;
case 46:
v16 = func3();
if ( v16 == 46 )
{
Text[1] = 46;
v2 = 41;
*(_WORD *)&Text[2] = 46;
v17 = func3();
if ( v17 != 46 )
{
func0(v17);
error((int)"incomplete '...'", 0, v18);
}
}
else
{
func0(v16);
v2 = 40;
}
break;
case 47:
v19 = func3();
if ( v19 == 61 )
{
Text[1] = 61;
v2 = 27;
}
else
{
func0(v19);
v2 = 0;
}
break;
case 58:
v2 = 34;
break;
case 59:
v2 = 61;
break;
case 60:
v21 = func3();
if ( v21 == 60 )
{
Text[1] = 60;
v25 = func3();
if ( v25 == 61 )
{
Text[2] = 61;
v2 = 21;
}
else
{
func0(v25);
v2 = 5;
}
}
else if ( v21 == 61 )
{
Text[1] = 61;
v2 = 10;
}
else
{
v2 = 9;
func0(v21);
}
break;
case 61:
v22 = func3();
if ( v22 == 61 )
{
Text[1] = 61;
v2 = 11;
}
else
{
func0(v22);
v2 = 29;
}
break;
case 62:
v23 = func3();
if ( v23 == 62 )
{
Text[1] = 62;
v26 = func3();
if ( v26 == 61 )
{
Text[1] = 61;
v2 = 26;
}
else
{
func0(v26);
v2 = 6;
}
}
else if ( v23 == 61 )
{
Text[1] = 61;
v2 = 8;
}
else
{
v2 = 7;
func0(v23);
}
break;
case 63:
v2 = 55;
break;
case 91:
v2 = 52;
break;
case 93:
v2 = 57;
break;
case 94:
v20 = func3();
if ( v20 == 61 )
{
Text[1] = 61;
v2 = 20;
}
else
{
func0(v20);
v2 = 14;
}
break;
case 123:
v2 = 51;
break;
case 124:
v24 = func3();
if ( v24 == 124 )
{
Text[1] = 124;
v2 = 17;
}
else if ( v24 == 61 )
{
Text[1] = 61;
v2 = 24;
}
else
{
func0(v24);
v2 = 15;
}
break;
case 125:
v2 = 56;
break;
case 126:
v2 = 67;
break;
default:
if ( (unsigned int)(v3 - 48) <= 9 )
{
func8(v3);
v2 = 50;
Value = v27;
}
else
{
if ( !isalpha(v3) && v4 != 95 )
{
a2 = v4;
a1 = "funny input character: %s";
cerror("funny input character: %s", (const char *)v4);
continue;
}
Value = func9(v4, (__int64)Text, 0x200u);
v2 = func1();
if ( !v2 )
v2 = 46;
}
break;
}
break;
}
}
else
{
Rejected = -1;
strcpy(Text, Rejtext);
Value = Rejval;
}
return v2;
}

original_code:
static int scanpp(void)
{
    int c, t;
    if (Rejected != -1)
    {
        t = Rejected;
        Rejected = -1;
        strcpy(Text, Rejtext);
        Value = Rejval;
        return t;
    }
    for (;;)
    {
        Value = 0;
        c = skip();
        memset(Text, 0, 4);
        Text[0] = c;
        switch (c)
        {
        case '!':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return NOTEQ;
            }
            else
            {
                putback(c);
                return XMARK;
            }
        case '%':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASMOD;
            }
            else
            {
                putback(c);
                return MOD;
            }
        case '&':
            if ((c = next()) == '&')
            {
                Text[1] = '&';
                return LOGAND;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASAND;
            }
            else
            {
                putback(c);
                return AMPER;
            }
        case '(':
            return LPAREN;
        case ')':
            return RPAREN;
        case '*':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASMUL;
            }
            else
            {
                putback(c);
                return STAR;
            }
        case '+':
            if ((c = next()) == '+')
            {
                Text[1] = '+';
                return INCR;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASPLUS;
            }
            else
            {
                putback(c);
                return PLUS;
            }
        case ',':
            return COMMA;
        case '-':
            if ((c = next()) == '-')
            {
                Text[1] = '-';
                return DECR;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASMINUS;
            }
            else if ('>' == c)
            {
                Text[1] = '>';
                return ARROW;
            }
            else
            {
                putback(c);
                return MINUS;
            }
        case '/':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASDIV;
            }
            else
            {
                putback(c);
                return SLASH;
            }
        case ':':
            return COLON;
        case ';':
            return SEMI;
        case '<':
            if ((c = next()) == '<')
            {
                Text[1] = '<';
                if ((c = next()) == '=')
                {
                    Text[2] = '=';
                    return ASLSHIFT;
                }
                else
                {
                    putback(c);
                    return LSHIFT;
                }
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return LTEQ;
            }
            else
            {
                putback(c);
                return LESS;
            }
        case '=':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return EQUAL;
            }
            else
            {
                putback(c);
                return ASSIGN;
            }
        case '>':
            if ((c = next()) == '>')
            {
                Text[1] = '>';
                if ((c = next()) == '=')
                {
                    Text[1] = '=';
                    return ASRSHIFT;
                }
                else
                {
                    putback(c);
                    return RSHIFT;
                }
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return GTEQ;
            }
            else
            {
                putback(c);
                return GREATER;
            }
        case '?':
            return QMARK;
        case '[':
            return LBRACK;
        case ']':
            return RBRACK;
        case '^':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASXOR;
            }
            else
            {
                putback(c);
                return CARET;
            }
        case '{':
            return LBRACE;
        case '|':
            if ((c = next()) == '|')
            {
                Text[1] = '|';
                return LOGOR;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASOR;
            }
            else
            {
                putback(c);
                return PIPE;
            }
        case '}':
            return RBRACE;
        case '~':
            return TILDE;
        case (-1):
            strcpy(Text, "<EOF>");
            return XEOF;
        case '\'':
            Text[1] = Value = scanch();
            if ((c = next()) != '\'')
                error("expected '\\'' at end of char literal", ((void *)0));
            Text[2] = '\'';
            return INTLIT;
        case '"':
            Value = scanstr(Text);
            return STRLIT;
        case '#':
            Text[0] = '#';
            scanident(next(), &Text[1], 512 -1);
            if ((t = keyword(Text)) != 0)
                return t;
            error("unknown preprocessor command: %s", Text);
            return IDENT;
        case '.':
            if ((c = next()) == '.')
            {
                Text[1] = Text[2] = '.';
                Text[3] = 0;
                if ((c = next()) == '.')
                    return ELLIPSIS;
                putback(c);
                error("incomplete '...'", ((void *)0));
                return ELLIPSIS;
            }
            putback(c);
            return DOT;
        default:
            if (isdigit(c))
            {
                Value = scanint(c);
                return INTLIT;
            }
            else if (isalpha(c) || '_' == c)
            {
                Value = scanident(c, Text, 512);
                if ((t = keyword(Text)) != 0)
                    return t;
                return IDENT;
            }
            else
            {
                cerror("funny input character: %s", c);
                break;
            }
        }
    }
}

canonical_original_code:
static int scanpp()
{
    int c; int t;
    if (Rejected != -1)
    {
        t = Rejected;
        Rejected = -1;
        strcpy(Text, Rejtext);
        Value = Rejval;
        return t;
    }
    for (;;)
    {
        Value = 0;
        c = skip();
        memset(Text, 0, 4);
        Text[0] = c;
        switch (c)
        {
        case '!':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return NOTEQ;
            }
            else
            {
                putback(c);
                return XMARK;
            }
        case '%':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASMOD;
            }
            else
            {
                putback(c);
                return MOD;
            }
        case '&':
            if ((c = next()) == '&')
            {
                Text[1] = '&';
                return LOGAND;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASAND;
            }
            else
            {
                putback(c);
                return AMPER;
            }
        case '(':
            return LPAREN;
        case ')':
            return RPAREN;
        case '*':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASMUL;
            }
            else
            {
                putback(c);
                return STAR;
            }
        case '+':
            if ((c = next()) == '+')
            {
                Text[1] = '+';
                return INCR;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASPLUS;
            }
            else
            {
                putback(c);
                return PLUS;
            }
        case ',':
            return COMMA;
        case '-':
            if ((c = next()) == '-')
            {
                Text[1] = '-';
                return DECR;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASMINUS;
            }
            else if ('>' == c)
            {
                Text[1] = '>';
                return ARROW;
            }
            else
            {
                putback(c);
                return MINUS;
            }
        case '/':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASDIV;
            }
            else
            {
                putback(c);
                return SLASH;
            }
        case ':':
            return COLON;
        case ';':
            return SEMI;
        case '<':
            if ((c = next()) == '<')
            {
                Text[1] = '<';
                if ((c = next()) == '=')
                {
                    Text[2] = '=';
                    return ASLSHIFT;
                }
                else
                {
                    putback(c);
                    return LSHIFT;
                }
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return LTEQ;
            }
            else
            {
                putback(c);
                return LESS;
            }
        case '=':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return EQUAL;
            }
            else
            {
                putback(c);
                return ASSIGN;
            }
        case '>':
            if ((c = next()) == '>')
            {
                Text[1] = '>';
                if ((c = next()) == '=')
                {
                    Text[1] = '=';
                    return ASRSHIFT;
                }
                else
                {
                    putback(c);
                    return RSHIFT;
                }
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return GTEQ;
            }
            else
            {
                putback(c);
                return GREATER;
            }
        case '?':
            return QMARK;
        case '[':
            return LBRACK;
        case ']':
            return RBRACK;
        case '^':
            if ((c = next()) == '=')
            {
                Text[1] = '=';
                return ASXOR;
            }
            else
            {
                putback(c);
                return CARET;
            }
        case '{':
            return LBRACE;
        case '|':
            if ((c = next()) == '|')
            {
                Text[1] = '|';
                return LOGOR;
            }
            else if ('=' == c)
            {
                Text[1] = '=';
                return ASOR;
            }
            else
            {
                putback(c);
                return PIPE;
            }
        case '}':
            return RBRACE;
        case '~':
            return TILDE;
        case (-1):
            strcpy(Text, "<EOF>");
            return XEOF;
        case '\'':
            Text[1] = Value = scanch();
            if ((c = next()) != '\'')
                error("expected '\\'' at end of char literal", ((void *)0));
            Text[2] = '\'';
            return INTLIT;
        case '"':
            Value = scanstr(Text);
            return STRLIT;
        case '#':
            Text[0] = '#';
            scanident(next(), &Text[1], 512 -1);
            if ((t = keyword(Text)) != 0)
                return t;
            error("unknown preprocessor command: %s", Text);
            return IDENT;
        case '.':
            if ((c = next()) == '.')
            {
                Text[1] = Text[2] = '.';
                Text[3] = 0;
                if ((c = next()) == '.')
                    return ELLIPSIS;
                putback(c);
                error("incomplete '...'", ((void *)0));
                return ELLIPSIS;
            }
            putback(c);
            return DOT;
        default:
            if (isdigit(c))
            {
                Value = scanint(c);
                return INTLIT;
            }
            else if (isalpha(c) || '_' == c)
            {
                Value = scanident(c, Text, 512);
                if ((t = keyword(Text)) != 0)
                    return t;
                return IDENT;
            }
            else
            {
                cerror("funny input character: %s", c);
                break;
            }
        }
    }
}

variable_types: c int

variable_types: t int


scan

decompiled_code:
__int64 __fastcall scan(const char *a1, __int64 a2)
{
__int64 result; // rax

result = scanpp(a1, a2);
if ( Syntoken == (_DWORD)result )
Syntoken = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(const char *a1, __int64 a2)
{
__int64 result; // rax

result = func10(a1, a2);
if ( Syntoken == (_DWORD)result )
Syntoken = 0;
return result;
}

original_code:
int scan(void)
{
    int t = scanpp();
    if (t == Syntoken)
        Syntoken = 0;
    return t;
}

canonical_original_code:
int scan()
{
    int t = scanpp();
    if (t == Syntoken)
        Syntoken = 0;
    return t;
}


reject

decompiled_code:
char *reject()
{
Rejected = Token;
Rejval = Value;
return strcpy(Rejtext, Text);
}

canonical_decompiled_code:
char *func12()
{
Rejected = Token;
Rejval = Value;
return strcpy(Rejtext, Text);
}

original_code:
void reject(void)
{
    Rejected = Token;
    Rejval = Value;
    strcpy(Rejtext, Text);
}

canonical_original_code:
void reject()
{
    Rejected = Token;
    Rejval = Value;
    strcpy(Rejtext, Text);
}


decompiled_code:
__int64 break_stmt()
{
const char *v0; // rdx
int v1; // eax

Token = scan();
v1 = Bsp;
if ( !Bsp )
{
error((int)"'break' not in loop/switch context", 0, v0);
v1 = Bsp;
}
genjump((unsigned int)Breakstk[v1 - 1]);
return semi();
}

canonical_decompiled_code:
__int64 func0()
{
const char *v0; // rdx
int v1; // eax

Token = scan();
v1 = Bsp;
if ( !Bsp )
{
error((int)"'break' not in loop/switch context", 0, v0);
v1 = Bsp;
}
genjump((unsigned int)Breakstk[v1 - 1]);
return semi();
}

original_code:
static void break_stmt(void)
{
    Token = scan();
    if (!Bsp)
        error("'break' not in loop/switch context", ((void *)0));
    genjump(Breakstk[Bsp - 1]);
    semi();
}

canonical_original_code:
static void break_stmt()
{
    Token = scan();
    if (!Bsp)
        error("'break' not in loop/switch context", ((void *)0));
    genjump(Breakstk[Bsp - 1]);
    semi();
}


decompiled_code:
__int64 continue_stmt()
{
const char *v0; // rdx
int v1; // eax

Token = scan();
v1 = Csp;
if ( !Csp )
{
error((int)"'continue' not in loop context", 0, v0);
v1 = Csp;
}
genjump((unsigned int)Contstk[v1 - 1]);
return semi();
}

canonical_decompiled_code:
__int64 func1()
{
const char *v0; // rdx
int v1; // eax

Token = scan();
v1 = Csp;
if ( !Csp )
{
error((int)"'continue' not in loop context", 0, v0);
v1 = Csp;
}
genjump((unsigned int)Contstk[v1 - 1]);
return semi();
}

original_code:
static void continue_stmt(void)
{
    Token = scan();
    if (!Csp)
        error("'continue' not in loop context", ((void *)0));
    genjump(Contstk[Csp - 1]);
    semi();
}

canonical_original_code:
static void continue_stmt()
{
    Token = scan();
    if (!Csp)
        error("'continue' not in loop context", ((void *)0));
    genjump(Contstk[Csp - 1]);
    semi();
}


pushbrk

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

result = Bsp;
if ( Bsp > 15 )
{
fatal("too many nested loops/switches");
result = Bsp;
}
Breakstk[result] = a1;
Bsp = result + 1;
return result;
}

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

result = Bsp;
if ( Bsp > 15 )
{
fatal("too many nested loops/switches");
result = Bsp;
}
Breakstk[result] = a1;
Bsp = result + 1;
return result;
}

original_code:
static void pushbrk(int id)
{
    if (Bsp >= 16)
        fatal("too many nested loops/switches");
    Breakstk[Bsp++] = id;
}


pushcont

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

result = Csp;
if ( Csp > 15 )
{
fatal("too many nested loops/switches");
result = Csp;
}
Contstk[result] = a1;
Csp = result + 1;
return result;
}

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

result = Csp;
if ( Csp > 15 )
{
fatal("too many nested loops/switches");
result = Csp;
}
Contstk[result] = a1;
Csp = result + 1;
return result;
}

original_code:
static void pushcont(int id)
{
    if (Csp >= 16)
        fatal("too many nested loops/switches");
    Contstk[Csp++] = id;
}


decompiled_code:
__int64 return_stmt()
{
const char *v0; // rdx
const char *v2; // rdx
char v3[4]; // [rsp+8h] [rbp-10h] BYREF
unsigned int v4; // [rsp+Ch] [rbp-Ch]

Token = scan();
if ( Token == 61 )
{
if ( symbols[10 * Thisfn + 2] != 7 )
error((int)"missing value after 'return'", 0, v0);
}
else
{
if ( (unsigned int)expr(v3) )
rvalue(v3);
if ( !(unsigned int)typematch(v4, (unsigned int)symbols[10 * Thisfn + 2]) )
error((int)"incompatible type in 'return'", 0, v2);
}
genjump((unsigned int)Retlab);
return semi();
}

canonical_decompiled_code:
__int64 func4()
{
const char *v0; // rdx
const char *v2; // rdx
char v3[4]; // [rsp+8h] [rbp-10h] BYREF
unsigned int v4; // [rsp+Ch] [rbp-Ch]

Token = scan();
if ( Token == 61 )
{
if ( symbols[10 * Thisfn + 2] != 7 )
error((int)"missing value after 'return'", 0, v0);
}
else
{
if ( (unsigned int)expr(v3) )
rvalue(v3);
if ( !(unsigned int)typematch(v4, (unsigned int)symbols[10 * Thisfn + 2]) )
error((int)"incompatible type in 'return'", 0, v2);
}
genjump((unsigned int)Retlab);
return semi();
}

original_code:
static void return_stmt(void)
{
    int lv[LV];
    Token = scan();
    if (Token != SEMI)
    {
        if (expr(lv))
            rvalue(lv);
        if (!typematch(lv[LVPRIM], symbols[Thisfn].prims))
            error("incompatible type in 'return'", ((void *)0));
    }
    else
    {
        if (symbols[Thisfn].prims != PVOID)
            error("missing value after 'return'", ((void *)0));
    }
    genjump(Retlab);
    semi();
}

canonical_original_code:
static void return_stmt()
{
    int lv[-1];
    Token = scan();
    if (Token != SEMI)
    {
        if (expr(lv))
            rvalue(lv);
        if (!typematch(lv[LVPRIM], symbols[Thisfn].prims))
            error("incompatible type in 'return'", ((void *)0));
    }
    else
    {
        if (symbols[Thisfn].prims != PVOID)
            error("missing value after 'return'", ((void *)0));
    }
    genjump(Retlab);
    semi();
}

variable_types:
lv
int [-1]


compound

decompiled_code:
__int64 __fastcall compound(int a1)
{
int v1; // eax
__int64 result; // rax

v1 = Token;
if ( a1 )
{
v1 = scan();
Token = v1;
}
if ( v1 == 56 )
{
LABEL_8:
result = scan();
Token = result;
}
else
{
while ( 1 )
{
result = eofcheck();
if ( (_DWORD)result )
break;
stmt();
if ( Token == 56 )
goto LABEL_8;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1)
{
int v1; // eax
__int64 result; // rax

v1 = Token;
if ( a1 )
{
v1 = scan();
Token = v1;
}
if ( v1 == 56 )
{
LABEL_8:
result = scan();
Token = result;
}
else
{
while ( 1 )
{
result = eofcheck();
if ( (_DWORD)result )
break;
func7();
if ( Token == 56 )
goto LABEL_8;
}
}
return result;
}

original_code:
void compound(int lbr)
{
    if (lbr)
        Token = scan();
    while (RBRACE != Token)
    {
        if (eofcheck())
            return;
        stmt();
    }
    Token = scan();
}

variable_types: lbr int


stmt

decompiled_code:
int __fastcall stmt(__int64 a1, __int64 a2, const char *a3)
{
switch ( Token )
{
case 31:
break_stmt();
break;
case 32:
wrong_ctx(32, a2, a3);
break;
case 36:
continue_stmt();
break;
case 38:
wrong_ctx(38, a2, a3);
break;
case 39:
do_stmt();
break;
case 45:
for_stmt();
break;
case 47:
if_stmt();
break;
case 51:
compound(1);
break;
case 59:
return_stmt();
break;
case 61:
Token = scan();
break;
case 66:
switch_stmt();
break;
case 70:
while_stmt();
break;
default:
rexpr(0LL);
semi();
break;
}
return clear();
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1, __int64 a2, const char *a3)
{
switch ( Token )
{
case 31:
func0();
break;
case 32:
func5(32, a2, a3);
break;
case 36:
func1();
break;
case 38:
func5(38, a2, a3);
break;
case 39:
func8();
break;
case 45:
func9();
break;
case 47:
func10();
break;
case 51:
func6(1);
break;
case 59:
func4();
break;
case 61:
Token = scan();
break;
case 66:
func12();
break;
case 70:
func13();
break;
default:
rexpr(0LL);
semi();
break;
}
return clear();
}

original_code:
static void stmt(void)
{
    switch (Token)
    {
    case BREAK:
        break_stmt();
        break;
    case CONTINUE:
        continue_stmt();
        break;
    case DO:
        do_stmt();
        break;
    case FOR:
        for_stmt();
        break;
    case IF:
        if_stmt();
        break;
    case RETURN:
        return_stmt();
        break;
    case SWITCH:
        switch_stmt();
        break;
    case WHILE:
        while_stmt();
        break;
    case LBRACE:
        compound(1);
        break;
    case SEMI:
        Token = scan();
        break;
    case DEFAULT:
        wrong_ctx(DEFAULT);
        break;
    case CASE:
        wrong_ctx(CASE);
        break;
    default:
        rexpr(0);
        semi();
        break;
    }
    clear(1);
}

canonical_original_code:
static void stmt()
{
    switch (Token)
    {
    case BREAK:
        break_stmt();
        break;
    case CONTINUE:
        continue_stmt();
        break;
    case DO:
        do_stmt();
        break;
    case FOR:
        for_stmt();
        break;
    case IF:
        if_stmt();
        break;
    case RETURN:
        return_stmt();
        break;
    case SWITCH:
        switch_stmt();
        break;
    case WHILE:
        while_stmt();
        break;
    case LBRACE:
        compound(1);
        break;
    case SEMI:
        Token = scan();
        break;
    case DEFAULT:
        wrong_ctx(DEFAULT);
        break;
    case CASE:
        wrong_ctx(CASE);
        break;
    default:
        rexpr(0);
        semi();
        break;
    }
    clear(1);
}


decompiled_code:
__int64 __fastcall do_stmt(__int64 a1, __int64 a2)
{
unsigned int v2; // er12
unsigned int v3; // ebp
unsigned int v4; // er13
const char *v5; // rdx
__int64 result; // rax

Token = scan();
v2 = label();
v3 = label();
pushbrk(v3);
v4 = label();
pushcont(v4);
genlab(v2);
stmt(v2, a2, v5);
match(70LL, "'while'");
lparen();
genlab(v4);
rexpr(0LL);
genbrtrue(v2);
clear();
genlab(v3);
rparen();
result = semi();
--Bsp;
--Csp;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2)
{
unsigned int v2; // er12
unsigned int v3; // ebp
unsigned int v4; // er13
const char *v5; // rdx
__int64 result; // rax

Token = scan();
v2 = label();
v3 = label();
func2(v3);
v4 = label();
func3(v4);
genlab(v2);
func7(v2, a2, v5);
match(70LL, "'while'");
lparen();
genlab(v4);
rexpr(0LL);
genbrtrue(v2);
clear();
genlab(v3);
rparen();
result = semi();
--Bsp;
--Csp;
return result;
}

original_code:
static void do_stmt(void)
{
    int ls, lb, lc;
    Token = scan();
    ls = label();
    pushbrk(lb = label());
    pushcont(lc = label());
    genlab(ls);
    stmt();
    match(WHILE, "'while'");
    lparen();
    genlab(lc);
    rexpr(0);
    genbrtrue(ls);
    clear(1);
    genlab(lb);
    rparen();
    semi();
    Bsp--;
    Csp--;
}

canonical_original_code:
static void do_stmt()
{
    int ls; int lb; int lc;
    Token = scan();
    ls = label();
    pushbrk(lb = label());
    pushcont(lc = label());
    genlab(ls);
    stmt();
    match(WHILE, "'while'");
    lparen();
    genlab(lc);
    rexpr(0);
    genbrtrue(ls);
    clear(1);
    genlab(lb);
    rparen();
    semi();
    Bsp--;
    Csp--;
}

variable_types: ls int

variable_types: lb int

variable_types: lc int


decompiled_code:
__int64 __fastcall for_stmt(__int64 a1, __int64 a2)
{
unsigned int v2; // er14
unsigned int v3; // er13
unsigned int v4; // er12
unsigned int v5; // ebp
const char *v6; // rdx
__int64 result; // rax

Token = scan();
v2 = label();
v3 = label();
v4 = label();
pushbrk(v4);
v5 = label();
pushcont(v5);
lparen();
if ( Token != 61 )
{
rexpr(0LL);
clear();
}
semi();
genlab(v2);
if ( Token != 61 )
{
rexpr(0LL);
genbrfalse(v4);
clear();
}
genjump(v3);
semi();
genlab(v5);
if ( Token != 60 )
rexpr(0LL);
clear();
genjump(v2);
rparen();
genlab(v3);
stmt(v3, a2, v6);
genjump(v5);
result = genlab(v4);
--Bsp;
--Csp;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2)
{
unsigned int v2; // er14
unsigned int v3; // er13
unsigned int v4; // er12
unsigned int v5; // ebp
const char *v6; // rdx
__int64 result; // rax

Token = scan();
v2 = label();
v3 = label();
v4 = label();
func2(v4);
v5 = label();
func3(v5);
lparen();
if ( Token != 61 )
{
rexpr(0LL);
clear();
}
semi();
genlab(v2);
if ( Token != 61 )
{
rexpr(0LL);
genbrfalse(v4);
clear();
}
genjump(v3);
semi();
genlab(v5);
if ( Token != 60 )
rexpr(0LL);
clear();
genjump(v2);
rparen();
genlab(v3);
func7(v3, a2, v6);
genjump(v5);
result = genlab(v4);
--Bsp;
--Csp;
return result;
}

original_code:
static void for_stmt(void)
{
    int ls, lbody, lb, lc;
    Token = scan();
    ls = label();
    lbody = label();
    pushbrk(lb = label());
    pushcont(lc = label());
    lparen();
    if (Token != SEMI)
    {
        rexpr(0);
        clear(1);
    }
    semi();
    genlab(ls);
    if (Token != SEMI)
    {
        rexpr(0);
        genbrfalse(lb);
        clear(1);
    }
    genjump(lbody);
    semi();
    genlab(lc);
    if (Token != RPAREN)
        rexpr(0);
    clear(1);
    genjump(ls);
    rparen();
    genlab(lbody);
    stmt();
    genjump(lc);
    genlab(lb);
    Bsp--;
    Csp--;
}

canonical_original_code:
static void for_stmt()
{
    int ls; int lbody; int lb; int lc;
    Token = scan();
    ls = label();
    lbody = label();
    pushbrk(lb = label());
    pushcont(lc = label());
    lparen();
    if (Token != SEMI)
    {
        rexpr(0);
        clear(1);
    }
    semi();
    genlab(ls);
    if (Token != SEMI)
    {
        rexpr(0);
        genbrfalse(lb);
        clear(1);
    }
    genjump(lbody);
    semi();
    genlab(lc);
    if (Token != RPAREN)
        rexpr(0);
    clear(1);
    genjump(ls);
    rparen();
    genlab(lbody);
    stmt();
    genjump(lc);
    genlab(lb);
    Bsp--;
    Csp--;
}

variable_types: lbody int


decompiled_code:
__int64 __fastcall if_stmt(__int64 a1, __int64 a2)
{
__int64 v2; // rbp
const char *v3; // rdx
__int64 v5; // rbx
const char *v6; // rdx

Token = scan();
lparen();
rexpr(0LL);
v2 = (unsigned int)label();
genbrfalse(v2);
clear();
rparen(1LL);
stmt(1LL, a2, v3);
if ( Token != 42 )
return genlab((unsigned int)v2);
v5 = (unsigned int)label();
genjump(v5);
genlab((unsigned int)v2);
Token = scan();
stmt((unsigned int)v2, a2, v6);
return genlab((unsigned int)v5);
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2)
{
__int64 v2; // rbp
const char *v3; // rdx
__int64 v5; // rbx
const char *v6; // rdx

Token = scan();
lparen();
rexpr(0LL);
v2 = (unsigned int)label();
genbrfalse(v2);
clear();
rparen(1LL);
func7(1LL, a2, v3);
if ( Token != 42 )
return genlab((unsigned int)v2);
v5 = (unsigned int)label();
genjump(v5);
genlab((unsigned int)v2);
Token = scan();
func7((unsigned int)v2, a2, v6);
return genlab((unsigned int)v5);
}

original_code:
static void if_stmt(void)
{
    int l1, l2;
    Token = scan();
    lparen();
    rexpr(0);
    l1 = label();
    genbrfalse(l1);
    clear(1);
    rparen();
    stmt();
    if (ELSE == Token)
    {
        l2 = label();
        genjump(l2);
        genlab(l1);
        l1 = l2;
        Token = scan();
        stmt();
    }
    genlab(l1);
}

canonical_original_code:
static void if_stmt()
{
    int l1; int l2;
    Token = scan();
    lparen();
    rexpr(0);
    l1 = label();
    genbrfalse(l1);
    clear(1);
    rparen();
    stmt();
    if (ELSE == Token)
    {
        l2 = label();
        genjump(l2);
        genlab(l1);
        l1 = l2;
        Token = scan();
        stmt();
    }
    genlab(l1);
}


decompiled_code:
__int64 __fastcall switch_block(__int64 a1, __int64 a2)
{
unsigned int v2; // ebp
__int64 v3; // rdi
unsigned int v4; // er14
const char *v5; // rdx
int v6; // er12
unsigned int v7; // er13
__int64 result; // rax
const char *v9; // rdx
int v10; // eax
__int64 v11; // rbx
unsigned int v12; // eax
int v13[256]; // [rsp+0h] [rbp-828h] BYREF
int v14[266]; // [rsp+400h] [rbp-428h] BYREF

Token = scan();
v2 = label();
pushbrk(v2);
v3 = (unsigned int)label();
v4 = v3;
genjump(v3);
if ( Token != 56 )
{
v6 = 0;
v7 = 0;
while ( 1 )
{
result = eofcheck();
if ( (_DWORD)result )
return result;
v10 = Token;
LOBYTE(v9) = Token == 38;
if ( (Token == 38 || Token == 32) && v6 > 255 )
{
a2 = 0LL;
v3 = (__int64)"too many 'case's in 'switch'";
v6 = 0;
error((int)"too many 'case's in 'switch'", 0, v9);
v10 = Token;
}
if ( v10 == 32 )
break;
if ( v10 == 38 )
{
Token = scan();
v3 = (unsigned int)label();
v7 = v3;
genlab(v3);
colon();
if ( Token == 56 )
{
LABEL_12:
if ( v6 )
{
genjump(v2);
genlab(v4);
if ( !v7 )
v7 = v2;
}
else
{
if ( !v7 )
goto LABEL_20;
v13[0] = 0;
v6 = 1;
v14[0] = v7;
genjump(v2);
genlab(v4);
}
goto LABEL_15;
}
}
else
{
stmt(v3, a2, v9);
LABEL_4:
if ( Token == 56 )
goto LABEL_12;
}
}
v11 = v6++;
Token = scan();
v13[v11] = constexpr();
v12 = label();
v3 = v12;
v14[v11] = v12;
genlab(v12);
colon();
goto LABEL_4;
}
LABEL_20:
v7 = v2;
v6 = 0;
error((int)"empty switch", 0, v5);
genjump(v2);
genlab(v4);
LABEL_15:
genswitch(v13, v14, (unsigned int)v6, v7);
gentext();
genlab(v2);
result = scan();
--Bsp;
Token = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, __int64 a2)
{
unsigned int v2; // ebp
__int64 v3; // rdi
unsigned int v4; // er14
const char *v5; // rdx
int v6; // er12
unsigned int v7; // er13
__int64 result; // rax
const char *v9; // rdx
int v10; // eax
__int64 v11; // rbx
unsigned int v12; // eax
int v13[256]; // [rsp+0h] [rbp-828h] BYREF
int v14[266]; // [rsp+400h] [rbp-428h] BYREF

Token = scan();
v2 = label();
func2(v2);
v3 = (unsigned int)label();
v4 = v3;
genjump(v3);
if ( Token != 56 )
{
v6 = 0;
v7 = 0;
while ( 1 )
{
result = eofcheck();
if ( (_DWORD)result )
return result;
v10 = Token;
LOBYTE(v9) = Token == 38;
if ( (Token == 38 || Token == 32) && v6 > 255 )
{
a2 = 0LL;
v3 = (__int64)"too many 'case's in 'switch'";
v6 = 0;
error((int)"too many 'case's in 'switch'", 0, v9);
v10 = Token;
}
if ( v10 == 32 )
break;
if ( v10 == 38 )
{
Token = scan();
v3 = (unsigned int)label();
v7 = v3;
genlab(v3);
colon();
if ( Token == 56 )
{
LABEL_12:
if ( v6 )
{
genjump(v2);
genlab(v4);
if ( !v7 )
v7 = v2;
}
else
{
if ( !v7 )
goto LABEL_20;
v13[0] = 0;
v6 = 1;
v14[0] = v7;
genjump(v2);
genlab(v4);
}
goto LABEL_15;
}
}
else
{
func7(v3, a2, v9);
LABEL_4:
if ( Token == 56 )
goto LABEL_12;
}
}
v11 = v6++;
Token = scan();
v13[v11] = constexpr();
v12 = label();
v3 = v12;
v14[v11] = v12;
genlab(v12);
colon();
goto LABEL_4;
}
LABEL_20:
v7 = v2;
v6 = 0;
error((int)"empty switch", 0, v5);
genjump(v2);
genlab(v4);
LABEL_15:
genswitch(v13, v14, (unsigned int)v6, v7);
gentext();
genlab(v2);
result = scan();
--Bsp;
Token = result;
return result;
}

original_code:
static void switch_block(void)
{
    int lb, ls, ldflt = 0;
    int cval[256];
    int clab[256];
    int nc = 0;
    Token = scan();
    pushbrk(lb = label());
    ls = label();
    genjump(ls);
    while (RBRACE != Token)
    {
        if (eofcheck())
            return;
        if ((CASE == Token || DEFAULT == Token) && nc >= 256)
        {
            error("too many 'case's in 'switch'", ((void *)0));
            nc = 0;
        }
        if (CASE == Token)
        {
            Token = scan();
            cval[nc] = constexpr();
            genlab(clab[nc++] = label());
            colon();
        }
        else if (DEFAULT == Token)
        {
            Token = scan();
            ldflt = label();
            genlab(ldflt);
            colon();
        }
        else
        {
            stmt();
        }
    }
    if (!nc)
    {
        if (ldflt)
        {
            cval[nc] = 0;
            clab[nc++] = ldflt;
        }
        else
        {
            error("empty switch", ((void *)0));
        }
    }
    genjump(lb);
    genlab(ls);
    genswitch(cval, clab, nc, ldflt? ldflt: lb);
    gentext();
    genlab(lb);
    Token = scan();
    Bsp--;
}

canonical_original_code:
static void switch_block()
{
    int lb; int ls; int ldflt = 0;
    int cval[256];
    int clab[256];
    int nc = 0;
    Token = scan();
    pushbrk(lb = label());
    ls = label();
    genjump(ls);
    while (RBRACE != Token)
    {
        if (eofcheck())
            return;
        if ((CASE == Token || DEFAULT == Token) && nc >= 256)
        {
            error("too many 'case's in 'switch'", ((void *)0));
            nc = 0;
        }
        if (CASE == Token)
        {
            Token = scan();
            cval[nc] = constexpr();
            genlab(clab[nc++] = label());
            colon();
        }
        else if (DEFAULT == Token)
        {
            Token = scan();
            ldflt = label();
            genlab(ldflt);
            colon();
        }
        else
        {
            stmt();
        }
    }
    if (!nc)
    {
        if (ldflt)
        {
            cval[nc] = 0;
            clab[nc++] = ldflt;
        }
        else
        {
            error("empty switch", ((void *)0));
        }
    }
    genjump(lb);
    genlab(ls);
    genswitch(cval, clab, nc, ldflt? ldflt: lb);
    gentext();
    genlab(lb);
    Token = scan();
    Bsp--;
}

variable_types: ldflt int

variable_types:
cval
int [256]

variable_types:
clab
int [256]

variable_types: nc int


decompiled_code:
__int64 __fastcall switch_stmt(__int64 a1, __int64 a2)
{
const char *v2; // rdi
const char *v3; // rdx

Token = scan();
lparen();
rexpr(1LL);
v2 = 0LL;
clear();
rparen(0LL);
if ( Token != 51 )
{
a2 = 0LL;
v2 = "'{' expected after 'switch'";
error((int)"'{' expected after 'switch'", 0, v3);
}
return switch_block((__int64)v2, a2);
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1, __int64 a2)
{
const char *v2; // rdi
const char *v3; // rdx

Token = scan();
lparen();
rexpr(1LL);
v2 = 0LL;
clear();
rparen(0LL);
if ( Token != 51 )
{
a2 = 0LL;
v2 = "'{' expected after 'switch'";
error((int)"'{' expected after 'switch'", 0, v3);
}
return func11((__int64)v2, a2);
}

original_code:
static void switch_stmt(void)
{
    Token = scan();
    lparen();
    rexpr(1);
    clear(0);
    rparen();
    if (Token != LBRACE)
        error("'{' expected after 'switch'", ((void *)0));
    switch_block();
}

canonical_original_code:
static void switch_stmt()
{
    Token = scan();
    lparen();
    rexpr(1);
    clear(0);
    rparen();
    if (Token != LBRACE)
        error("'{' expected after 'switch'", ((void *)0));
    switch_block();
}


decompiled_code:
__int64 __fastcall while_stmt(__int64 a1, __int64 a2)
{
unsigned int v2; // ebp
unsigned int v3; // er12
const char *v4; // rdx
__int64 result; // rax

Token = scan();
v2 = label();
pushbrk(v2);
v3 = label();
pushcont(v3);
genlab(v3);
lparen();
rexpr(0LL);
genbrfalse(v2);
clear();
rparen(1LL);
stmt(1LL, a2, v4);
genjump(v3);
result = genlab(v2);
--Bsp;
--Csp;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2)
{
unsigned int v2; // ebp
unsigned int v3; // er12
const char *v4; // rdx
__int64 result; // rax

Token = scan();
v2 = label();
func2(v2);
v3 = label();
func3(v3);
genlab(v3);
lparen();
rexpr(0LL);
genbrfalse(v2);
clear();
rparen(1LL);
func7(1LL, a2, v4);
genjump(v3);
result = genlab(v2);
--Bsp;
--Csp;
return result;
}

original_code:
static void while_stmt(void)
{
    int lb, lc;
    Token = scan();
    pushbrk(lb = label());
    pushcont(lc = label());
    genlab(lc);
    lparen();
    rexpr(0);
    genbrfalse(lb);
    clear(1);
    rparen();
    stmt();
    genjump(lc);
    genlab(lb);
    Bsp--;
    Csp--;
}

canonical_original_code:
static void while_stmt()
{
    int lb; int lc;
    Token = scan();
    pushbrk(lb = label());
    pushcont(lc = label());
    genlab(lc);
    lparen();
    rexpr(0);
    genbrfalse(lb);
    clear(1);
    rparen();
    stmt();
    genjump(lc);
    genlab(lb);
    Bsp--;
    Csp--;
}