decompiled_code:
int __fastcall colora_dbg(int a1, int a2, char a3)
{
move(a2 + 1, 2 * a1 + 1);
printw("%c%c", (unsigned int)a3, (unsigned int)a3);
refresh();
return usleep(0x2710u);
}

canonical_decompiled_code:
int __fastcall func4(int a1, int a2, char a3)
{
move(a2 + 1, 2 * a1 + 1);
printw("%c%c", (unsigned int)a3, (unsigned int)a3);
refresh();
return usleep(0x2710u);
}

original_code:
void colora_dbg(int x,int y,char car)
{
    move(y+1,(x*2)+1);
    printw("%c%c",car,car);
    refresh();
    usleep(1000*10);
}

canonical_original_code:
void colora_dbg(int x, int y, char car)
{
    move(y+1,(x*2)+1);
    printw("%c%c",car,car);
    refresh();
    usleep(1000*10);
}

variable_types: x int

variable_types: y int

variable_types: car char


original_code:
void ailog_matrix(char *campo, int alt, int larg)
{
    int x,y;
    for (y=0; y<alt; y++)
        {
        for (x=0; x<larg; x++)
            {
            if (campo[(((y)*(larg))+(x))])ailog("X");
            else ailog("_");
            }
        ailog("\n");
        }
    ailog("\n");
}

canonical_original_code:
void ailog_matrix(char *campo, int alt, int larg)
{
    int x; int y;
    for (y=0; y<alt; y++)
        {
        for (x=0; x<larg; x++)
            {
            if (campo[(((y)*(larg))+(x))])ailog("X");
            else ailog("_");
            }
        ailog("\n");
        }
    ailog("\n");
}

variable_types:
campo
char *

variable_types: alt int

variable_types: larg int

return_type: void


contalibere

decompiled_code:
__int64 __fastcall contalibere(int a1, int a2, __int64 a3, unsigned int a4, unsigned int a5, __int64 a6)
{
unsigned int v8; // er12

v8 = 1;
*(_BYTE *)(a3 + (int)(a1 + a4 * a2)) = 1;
while ( (unsigned int)addcella(a6, a3, a4, a5) )
++v8;
return v8;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, int a2, __int64 a3, unsigned int a4, unsigned int a5, __int64 a6)
{
unsigned int v8; // er12

v8 = 1;
*(_BYTE *)(a3 + (int)(a1 + a4 * a2)) = 1;
while ( (unsigned int)addcella(a6, a3, a4, a5) )
++v8;
return v8;
}

original_code:
int contalibere(int sx, int sy, char *campo, int larg, int alt,vars *varia)
{
    int numlibere=0;
    int fatta=1;
    int ret;
    campo[(((sy)*(larg))+(sx))]=1;
    numlibere++;
    while (fatta)
        {
        ret=addcella(varia,campo,larg,alt);
        if (ret) numlibere++;
        else fatta=0;
        }
    return numlibere;
}

canonical_original_code:
int contalibere(int sx, int sy, char *campo, int larg, int alt, struct vars *varia)
{
    int numlibere = 0;
    int fatta = 1;
    int ret;
    campo[(((sy)*(larg))+(sx))]=1;
    numlibere++;
    while (fatta)
        {
        ret=addcella(varia,campo,larg,alt);
        if (ret) numlibere++;
        else fatta=0;
        }
    return numlibere;
}

variable_types: sx int

variable_types: sy int

variable_types: struct vars { struct campo { struct snake { struct punto { int x; int y; } *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; } serpente; struct punto portale[2]; int numportals; int nextportime; struct punto *powerup; int numpowerups; int larg; int alt; struct punto *toblast; int blastlung; } gioco; struct leaderboard { struct punteggio { int score; char nome[10]; char flags[6]; } *entry; int numentry; int curr; } board; int score; int speed; int quit; int paused; int gameover; int gamemode; int colori; int safe_graph; int game_insane; char playername[10]; } *

variable_types: numlibere int

variable_types: fatta int

variable_types: ret int

return_type: int

user_defined_types: struct vars { struct campo gioco; struct leaderboard board; int score; int speed; int quit; int paused; int gameover; int gamemode; int colori; int safe_graph; int game_insane; char playername[10]; }

user_defined_types: struct campo { struct snake serpente; struct punto portale[2]; int numportals; int nextportime; struct punto *powerup; int numpowerups; int larg; int alt; struct punto *toblast; int blastlung; }

user_defined_types: struct leaderboard { struct punteggio *entry; int numentry; int curr; }

user_defined_types: struct snake { struct punto *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; }


findway

original_code:
int findway(int ex, int ey, int dir1, int dir2, vars *varia)
{
    int sin=0,des=0;
    char *matrix;
    int sx=ex,sy=ey,dx=ex,dy=ey;
    calc_direz(dir1,&sx,&sy);
    calc_direz(dir2,&dx,&dy);
    matrix=(char*)malloc(sizeof(char)*varia->gioco.larg*varia->gioco.alt);
    if (matrix==((void *)0))return -1;
    clearmatrix(matrix,varia->gioco.larg*varia->gioco.alt);
    sin=contalibere(sx,sy,matrix,varia->gioco.larg,varia->gioco.alt,varia);
    clearmatrix(matrix,varia->gioco.larg*varia->gioco.alt);
    des=contalibere(dx,dy,matrix,varia->gioco.larg,varia->gioco.alt,varia);
    free(matrix);
    return (des>sin);
}

canonical_original_code:
int findway(int ex, int ey, int dir1, int dir2, struct vars *varia)
{
    int sin = 0; int des = 0;
    char *matrix;
    int sx = ex; int sy = ey; int dx = ex; int dy = ey;
    calc_direz(dir1,&sx,&sy);
    calc_direz(dir2,&dx,&dy);
    matrix=(char *)malloc(sizeof(char)*varia->gioco.larg*varia->gioco.alt);
    if (matrix==((void *)0))return -1;
    clearmatrix(matrix,varia->gioco.larg*varia->gioco.alt);
    sin=contalibere(sx,sy,matrix,varia->gioco.larg,varia->gioco.alt,varia);
    clearmatrix(matrix,varia->gioco.larg*varia->gioco.alt);
    des=contalibere(dx,dy,matrix,varia->gioco.larg,varia->gioco.alt,varia);
    free(matrix);
    return (des>sin);
}

variable_types: ex int

variable_types: ey int

variable_types: sin int

variable_types: des int

variable_types:
matrix
char *

variable_types: dx int

variable_types: dy int

user_defined_types: struct punteggio { int score; char nome[10]; char flags[6]; }


rotelle

decompiled_code:
__int64 __fastcall rotelle(__int64 a1, int *a2, int *a3, unsigned int a4)
{
__int64 result; // rax
unsigned int v7; // eax
__int64 v8; // rdx
unsigned int v9; // eax
__int64 v10; // rdx
unsigned int v11; // eax
__int64 v12; // rdx
int *v13; // rdx
int v14; // eax
__int64 v15; // r8
int v16; // eax
unsigned int v17; // [rsp+8h] [rbp-40h] BYREF
unsigned int v18; // [rsp+Ch] [rbp-3Ch] BYREF
unsigned int v19; // [rsp+10h] [rbp-38h] BYREF
unsigned int v20; // [rsp+14h] [rbp-34h] BYREF
unsigned int v21; // [rsp+18h] [rbp-30h] BYREF
unsigned int v22; // [rsp+1Ch] [rbp-2Ch]

v17 = *a2;
v18 = *a3;
calc_direz(a4, &v17, &v18);
if ( (unsigned int)morsocoda(a1, v17, v18) || (result = presomuro(a1, v17, v18), (_DWORD)result) )
{
v7 = *a2;
v19 = a4;
v21 = v7;
v22 = *a3;
turnright(&v19);
calc_direz(v19, &v21, v8);
if ( (unsigned int)morsocoda(a1, v21, v22) || (unsigned int)presomuro(a1, v21, v22) )
{
v9 = *a2;
v19 = a4;
v21 = v9;
v22 = *a3;
turnleft(&v19);
calc_direz(v19, &v21, v10);
if ( (unsigned int)morsocoda(a1, v21, v22) )
goto LABEL_5;
v14 = presomuro(a1, v21, v22);
v13 = a3;
if ( v14 )
goto LABEL_5;
}
else
{
v11 = *a2;
v19 = a4;
v21 = v11;
v22 = *a3;
turnleft(&v19);
calc_direz(v19, &v21, v12);
if ( (unsigned int)morsocoda(a1, v21, v22) || (unsigned int)presomuro(a1, v21, v22) )
{
v20 = a4;
turnright(&v20);
LABEL_9:
calc_direz(v20, a2, v13);
*(_DWORD *)(a1 + 12) = v20;
return 1LL;
}
v20 = a4;
turnright(&v20);
v16 = findway(*a2, *a3, v19, v20, v15);
v13 = a3;
if ( v16 )
goto LABEL_9;
}
calc_direz(v19, a2, v13);
*(_DWORD *)(a1 + 12) = v19;
LABEL_5:
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, int *a2, int *a3, unsigned int a4)
{
__int64 result; // rax
unsigned int v7; // eax
__int64 v8; // rdx
unsigned int v9; // eax
__int64 v10; // rdx
unsigned int v11; // eax
__int64 v12; // rdx
int *v13; // rdx
int v14; // eax
__int64 v15; // r8
int v16; // eax
unsigned int v17; // [rsp+8h] [rbp-40h] BYREF
unsigned int v18; // [rsp+Ch] [rbp-3Ch] BYREF
unsigned int v19; // [rsp+10h] [rbp-38h] BYREF
unsigned int v20; // [rsp+14h] [rbp-34h] BYREF
unsigned int v21; // [rsp+18h] [rbp-30h] BYREF
unsigned int v22; // [rsp+1Ch] [rbp-2Ch]

v17 = *a2;
v18 = *a3;
calc_direz(a4, &v17, &v18);
if ( (unsigned int)morsocoda(a1, v17, v18) || (result = presomuro(a1, v17, v18), (_DWORD)result) )
{
v7 = *a2;
v19 = a4;
v21 = v7;
v22 = *a3;
func2(&v19);
calc_direz(v19, &v21, v8);
if ( (unsigned int)morsocoda(a1, v21, v22) || (unsigned int)presomuro(a1, v21, v22) )
{
v9 = *a2;
v19 = a4;
v21 = v9;
v22 = *a3;
func1(&v19);
calc_direz(v19, &v21, v10);
if ( (unsigned int)morsocoda(a1, v21, v22) )
goto LABEL_5;
v14 = presomuro(a1, v21, v22);
v13 = a3;
if ( v14 )
goto LABEL_5;
}
else
{
v11 = *a2;
v19 = a4;
v21 = v11;
v22 = *a3;
func1(&v19);
calc_direz(v19, &v21, v12);
if ( (unsigned int)morsocoda(a1, v21, v22) || (unsigned int)presomuro(a1, v21, v22) )
{
v20 = a4;
func2(&v20);
LABEL_9:
calc_direz(v20, a2, v13);
*(_DWORD *)(a1 + 12) = v20;
return 1LL;
}
v20 = a4;
func2(&v20);
v16 = func7(*a2, *a3, v19, v20, v15);
v13 = a3;
if ( v16 )
goto LABEL_9;
}
calc_direz(v19, a2, v13);
*(_DWORD *)(a1 + 12) = v19;
LABEL_5:
result = 1LL;
}
return result;
}

original_code:
int rotelle(vars *varia, int *px, int *py, int direz)
{
    int newposx=(*px);
    int newposy=(*py);
    snake *serp=&(varia->gioco.serpente);
    int turndir,turndir2,turnposx,turnposy,way;
    calc_direz(direz,&newposx,&newposy);
    if (morsocoda(varia,newposx,newposy) || presomuro(varia,newposx,newposy))
        {
        turnposx=*px;
        turnposy=*py;
        turndir=direz;
        turnright(&turndir);
        calc_direz(turndir,&turnposx,&turnposy);
        if (morsocoda(varia,turnposx,turnposy) || presomuro(varia,turnposx,turnposy))
            {
            turnposx=*px;
            turnposy=*py;
            turndir=direz;
            turnleft(&turndir);
            calc_direz(turndir,&turnposx,&turnposy);
            if (morsocoda(varia,turnposx,turnposy) || presomuro(varia,turnposx,turnposy))
                {
                }
            else
                {
                calc_direz(turndir,px,py);
                serp->direz=turndir;
                }
            }
        else
            {
            turnposx=*px;
            turnposy=*py;
            turndir=direz;
            turnleft(&turndir);
            calc_direz(turndir,&turnposx,&turnposy);
            if (morsocoda(varia,turnposx,turnposy) || presomuro(varia,turnposx,turnposy))
                {
                turndir2=direz;
                turnright(&turndir2);
                calc_direz(turndir2,px,py);
                serp->direz=turndir2;
                }
            else
                {
                turndir2=direz;
                turnright(&turndir2);
                way=findway(*px,*py,turndir,turndir2,varia);
                if (way)
                    {
                    calc_direz(turndir2,px,py);
                    serp->direz=turndir2;
                    }
                else
                    {
                    calc_direz(turndir,px,py);
                    serp->direz=turndir;
                    }
                }
            }
        return 1;
        }
    return 0;
}

canonical_original_code:
int rotelle(struct vars *varia, int *px, int *py, int direz)
{
    int newposx = (*px);
    int newposy = (*py);
    struct snake *serp = &(varia->gioco.serpente);
    int turndir; int turndir2; int turnposx; int turnposy; int way;
    calc_direz(direz,&newposx,&newposy);
    if (morsocoda(varia,newposx,newposy) || presomuro(varia,newposx,newposy))
        {
        turnposx=*px;
        turnposy=*py;
        turndir=direz;
        turnright(&turndir);
        calc_direz(turndir,&turnposx,&turnposy);
        if (morsocoda(varia,turnposx,turnposy) || presomuro(varia,turnposx,turnposy))
            {
            turnposx=*px;
            turnposy=*py;
            turndir=direz;
            turnleft(&turndir);
            calc_direz(turndir,&turnposx,&turnposy);
            if (morsocoda(varia,turnposx,turnposy) || presomuro(varia,turnposx,turnposy))
                {
                }
            else
                {
                calc_direz(turndir,px,py);
                serp->direz=turndir;
                }
            }
        else
            {
            turnposx=*px;
            turnposy=*py;
            turndir=direz;
            turnleft(&turndir);
            calc_direz(turndir,&turnposx,&turnposy);
            if (morsocoda(varia,turnposx,turnposy) || presomuro(varia,turnposx,turnposy))
                {
                turndir2=direz;
                turnright(&turndir2);
                calc_direz(turndir2,px,py);
                serp->direz=turndir2;
                }
            else
                {
                turndir2=direz;
                turnright(&turndir2);
                way=findway(*px,*py,turndir,turndir2,varia);
                if (way)
                    {
                    calc_direz(turndir2,px,py);
                    serp->direz=turndir2;
                    }
                else
                    {
                    calc_direz(turndir,px,py);
                    serp->direz=turndir;
                    }
                }
            }
        return 1;
        }
    return 0;
}

variable_types:
px
int *

variable_types:
py
int *

variable_types: direz int

variable_types: newposx int

variable_types: newposy int

variable_types: struct snake { struct punto { int x; int y; } *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; } *

variable_types: turndir int

variable_types: turnposx int

variable_types: turnposy int

variable_types: way int


decompiled_code:
int __fastcall game_step(__int64 a1, _DWORD *a2, int *a3, _DWORD *a4, __int64 a5)
{
int result; // eax

result = comandi();
if ( *(_DWORD *)(a1 + 136) )
return result;
if ( *a2 >= speed_setting[*(int *)(a1 + 132)] )
{
fisica_serp(a1);
checkwin(a1);
*a2 = 0;
if ( *a3 <= 249 )
goto LABEL_5;
goto LABEL_4;
}
if ( *a3 > 249 )
{
LABEL_4:
*(_DWORD *)(a1 + 20) = *(_DWORD *)(a1 + 20) == 0;
*a3 = 0;
}
LABEL_5:
if ( *a4 >= 1000 * *(_DWORD *)(a1 + 68) )
{
if ( (*(_BYTE *)(a1 + 148) & 0x10) != 0 )
{
timerPortal(a1);
drop_portal(a1);
}
*a4 = 0;
}
droppup(a1);
grafica(a1, 1LL);
blastanim(a1, a5);
wrefresh(stdscr);
*a2 += 10;
*a3 += 10;
*a4 += 10;
return usleep(0x2710u);
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1, _DWORD *a2, int *a3, _DWORD *a4, __int64 a5)
{
int result; // eax

result = comandi();
if ( *(_DWORD *)(a1 + 136) )
return result;
if ( *a2 >= speed_setting[*(int *)(a1 + 132)] )
{
fisica_serp(a1);
checkwin(a1);
*a2 = 0;
if ( *a3 <= 249 )
goto LABEL_5;
goto LABEL_4;
}
if ( *a3 > 249 )
{
LABEL_4:
*(_DWORD *)(a1 + 20) = *(_DWORD *)(a1 + 20) == 0;
*a3 = 0;
}
LABEL_5:
if ( *a4 >= 1000 * *(_DWORD *)(a1 + 68) )
{
if ( (*(_BYTE *)(a1 + 148) & 0x10) != 0 )
{
timerPortal(a1);
drop_portal(a1);
}
*a4 = 0;
}
droppup(a1);
grafica(a1, 1LL);
blastanim(a1, a5);
wrefresh(stdscr);
*a2 += 10;
*a3 += 10;
*a4 += 10;
return usleep(0x2710u);
}

original_code:
void game_step(vars *varia, int *itimer, int *atimer, int *ptimer, int *blaster)
{
    int speed;
    comandi(varia);
    if (!varia->quit)
        {
        speed=speed_setting[varia->speed];
        if ((*itimer) >= speed)
            {
            fisica_serp(varia);
            checkwin(varia);
            (*itimer)=0;
            }
        if ((*atimer) >=250)
            {
            if (varia->gioco.serpente.ciclo_anim==0)varia->gioco.serpente.ciclo_anim=1;
            else varia->gioco.serpente.ciclo_anim=0;
            (*atimer)=0;
            }
        if ((*ptimer) >= (varia->gioco.nextportime*1000))
            {
            if ((varia->gamemode&0b10000)!=0)
                {
                timerPortal(varia);
                drop_portal(varia);
                }
            (*ptimer)=0;
            }
        droppup(varia);
        grafica(varia,1);
        blastanim(varia,blaster);
        wrefresh(stdscr);
        (*itimer)+=10;
        (*atimer)+=10;
        (*ptimer)+=10;
        usleep(1000*10);
        }
}

canonical_original_code:
void game_step(struct vars *varia, int *itimer, int *atimer, int *ptimer, int *blaster)
{
    int speed;
    comandi(varia);
    if (!varia->quit)
        {
        speed=speed_setting[varia->speed];
        if ((*itimer) >= speed)
            {
            fisica_serp(varia);
            checkwin(varia);
            (*itimer)=0;
            }
        if ((*atimer) >=250)
            {
            if (varia->gioco.serpente.ciclo_anim==0)varia->gioco.serpente.ciclo_anim=1;
            else varia->gioco.serpente.ciclo_anim=0;
            (*atimer)=0;
            }
        if ((*ptimer) >= (varia->gioco.nextportime*1000))
            {
            if ((varia->gamemode&0b10000)!=0)
                {
                timerPortal(varia);
                drop_portal(varia);
                }
            (*ptimer)=0;
            }
        droppup(varia);
        grafica(varia,1);
        blastanim(varia,blaster);
        wrefresh(stdscr);
        (*itimer)+=10;
        (*atimer)+=10;
        (*ptimer)+=10;
        usleep(1000*10);
        }
}

variable_types: struct vars { struct campo { struct snake { struct punto { int x; int y; } *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; } serpente; struct punto portale[2]; int numportals; int nextportime; struct punto *powerup; int numpowerups; int larg; int alt; struct punto *toblast; int blastlung; } gioco; struct leaderboard { struct punteggio { int score; char nome[10]; char flags[6]; } *entry; int numentry; int curr; } board; int score; int speed; int quit; int paused; int gameover; int gamemode; int colori; int safe_graph; int game_insane; char playername[10]; } *

variable_types:
itimer
int *

variable_types:
atimer
int *

variable_types:
ptimer
int *

variable_types:
blaster
int *

variable_types: speed int


decompiled_code:
int __fastcall game_pause_step(_DWORD *a1, int *a2, int a3)
{
int v4; // eax
int v5; // eax

if ( a3 && *a2 <= 399 )
grafica(a1, 0LL);
else
grafica(a1, 1LL);
overlay_scritta(a1);
if ( a1[36] )
{
wmove(stdscr, 1, 1);
v4 = a1[36];
switch ( v4 )
{
case -1:
printw("Ti sei morso la coda! ");
break;
case -2:
printw("Ti sei schiantato! ");
break;
case 2:
printw("Hai vinto la partita! ");
break;
default:
printw("Fine della partita! ");
break;
}
printw("| q per chiudere | r per ricominciare");
v5 = a1[40];
if ( (v5 & 1) != 0 )
{
wmove(stdscr, 2, 1);
printw("File salvataggi corrotto! Recupero backup..");
v5 = a1[40];
}
if ( (v5 & 2) != 0 )
printw(" assente / corrotto. D'oh!");
scrivi_punteggi((unsigned int)(a1[22] / 2 + 1), (unsigned int)(a1[21] - 13), 8LL, a1);
}
if ( *a2 > 799 )
*a2 = 0;
wrefresh(stdscr);
comandi_pausa(a1);
*a2 += 10;
return usleep(0x2710u);
}

canonical_decompiled_code:
int __fastcall func1(_DWORD *a1, int *a2, int a3)
{
int v4; // eax
int v5; // eax

if ( a3 && *a2 <= 399 )
grafica(a1, 0LL);
else
grafica(a1, 1LL);
overlay_scritta(a1);
if ( a1[36] )
{
wmove(stdscr, 1, 1);
v4 = a1[36];
switch ( v4 )
{
case -1:
printw("Ti sei morso la coda! ");
break;
case -2:
printw("Ti sei schiantato! ");
break;
case 2:
printw("Hai vinto la partita! ");
break;
default:
printw("Fine della partita! ");
break;
}
printw("| q per chiudere | r per ricominciare");
v5 = a1[40];
if ( (v5 & 1) != 0 )
{
wmove(stdscr, 2, 1);
printw("File salvataggi corrotto! Recupero backup..");
v5 = a1[40];
}
if ( (v5 & 2) != 0 )
printw(" assente / corrotto. D'oh!");
scrivi_punteggi((unsigned int)(a1[22] / 2 + 1), (unsigned int)(a1[21] - 13), 8LL, a1);
}
if ( *a2 > 799 )
*a2 = 0;
wrefresh(stdscr);
comandi_pausa(a1);
*a2 += 10;
return usleep(0x2710u);
}

original_code:
void game_pause_step(vars *varia, int *btimer,int blink)
{
    int tblink=800;
    if (blink)
        {
        if ((*btimer)<tblink/2) grafica(varia,0);
        else if ((*btimer)>=tblink/2) grafica(varia,1);
        }
    else grafica(varia,1);
    overlay_scritta(varia);
    if (varia->gameover!=0)
        {
        wmove(stdscr,(1),(1));
        if (varia->gameover==-1)printw("Ti sei morso la coda! ");
        else if (varia->gameover==-2)printw("Ti sei schiantato! ");
        else if (varia->gameover==2)printw("Hai vinto la partita! ");
        else printw("Fine della partita! ");
        printw("| q per chiudere | r per ricominciare");
        if (varia->game_insane&0b1)
            {
            wmove(stdscr,(2),(1));
            printw("File salvataggi corrotto! Recupero backup..");
            }
        if (varia->game_insane&0b10)
            {
            printw(" assente / corrotto. D'oh!");
            }
        scrivi_punteggi((varia->gioco.alt/2)+4-3,(((varia->gioco.larg*2)+2)/2)-14,8,varia);
        }
    if ((*btimer)>=tblink)(*btimer)=0;
    wrefresh(stdscr);
    comandi_pausa(varia);
    (*btimer)+=10;
    usleep(1000*10);
}

canonical_original_code:
void game_pause_step(struct vars *varia, int *btimer, int blink)
{
    int tblink = 800;
    if (blink)
        {
        if ((*btimer)<tblink/2) grafica(varia,0);
        else if ((*btimer)>=tblink/2) grafica(varia,1);
        }
    else grafica(varia,1);
    overlay_scritta(varia);
    if (varia->gameover!=0)
        {
        wmove(stdscr,(1),(1));
        if (varia->gameover==-1)printw("Ti sei morso la coda! ");
        else if (varia->gameover==-2)printw("Ti sei schiantato! ");
        else if (varia->gameover==2)printw("Hai vinto la partita! ");
        else printw("Fine della partita! ");
        printw("| q per chiudere | r per ricominciare");
        if (varia->game_insane&0b1)
            {
            wmove(stdscr,(2),(1));
            printw("File salvataggi corrotto! Recupero backup..");
            }
        if (varia->game_insane&0b10)
            {
            printw(" assente / corrotto. D'oh!");
            }
        scrivi_punteggi((varia->gioco.alt/2)+4-3,(((varia->gioco.larg*2)+2)/2)-14,8,varia);
        }
    if ((*btimer)>=tblink)(*btimer)=0;
    wrefresh(stdscr);
    comandi_pausa(varia);
    (*btimer)+=10;
    usleep(1000*10);
}

variable_types:
btimer
int *

variable_types: blink int

variable_types: tblink int


decompiled_code:
__int64 __fastcall game_pause_loop(__int64 a1, int a2)
{
int v3[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v3[0] = 0;
do
{
if ( !*(_DWORD *)(a1 + 140) )
break;
game_pause_step((_DWORD *)a1, v3, a2);
}
while ( !*(_DWORD *)(a1 + 136) );
if ( *(_DWORD *)(a1 + 144) )
free(*(void **)(a1 + 112));
return delete_scritta(a1);
}

original_code:
void game_pause_loop(vars *varia, int blink)
{
    int btimer=0;
    while (varia->paused)
        {
        game_pause_step(varia,&btimer,blink);
        if (varia->quit) break;
        }
    if (varia->gameover!=0)
        {
        free(varia->board.entry);
        }
    delete_scritta(varia);
}

canonical_original_code:
void game_pause_loop(struct vars *varia, int blink)
{
    int btimer = 0;
    while (varia->paused)
        {
        game_pause_step(varia,&btimer,blink);
        if (varia->quit) break;
        }
    if (varia->gameover!=0)
        {
        free(varia->board.entry);
        }
    delete_scritta(varia);
}

variable_types: btimer int


decompiled_code:
__int64 __fastcall game_loop(unsigned int *a1)
{
__int64 result; // rax
int v2; // [rsp+0h] [rbp-18h] BYREF
int v3; // [rsp+4h] [rbp-14h] BYREF
int v4; // [rsp+8h] [rbp-10h] BYREF
int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2 = 0;
v3 = 0;
v4 = 0;
v5[0] = 0;
while ( 1 )
{
result = a1[34];
if ( (_DWORD)result )
break;
game_step((__int64)a1, &v2, &v3, &v4, (__int64)v5);
if ( a1[35] )
game_pause_loop((__int64)a1, a1[36] >> 31);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int *a1)
{
__int64 result; // rax
int v2; // [rsp+0h] [rbp-18h] BYREF
int v3; // [rsp+4h] [rbp-14h] BYREF
int v4; // [rsp+8h] [rbp-10h] BYREF
int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2 = 0;
v3 = 0;
v4 = 0;
v5[0] = 0;
while ( 1 )
{
result = a1[34];
if ( (_DWORD)result )
break;
func0((__int64)a1, &v2, &v3, &v4, (__int64)v5);
if ( a1[35] )
func2((__int64)a1, a1[36] >> 31);
}
return result;
}

original_code:
void game_loop(vars *varia)
{
    int itimer=0;
    int atimer=0;
    int ptimer=0;
    int blaster=0;
    while (!varia->quit)
        {
        game_step(varia,&itimer,&atimer,&ptimer,&blaster);
        if (varia->paused)game_pause_loop(varia,(varia->gameover<0 ? 1 : 0));
        }
}

canonical_original_code:
void game_loop(struct vars *varia)
{
    int itimer = 0;
    int atimer = 0;
    int ptimer = 0;
    int blaster = 0;
    while (!varia->quit)
        {
        game_step(varia,&itimer,&atimer,&ptimer,&blaster);
        if (varia->paused)game_pause_loop(varia,(varia->gameover<0 ? 1 : 0));
        }
}

variable_types: itimer int

variable_types: atimer int

variable_types: ptimer int

variable_types: blaster int


decompiled_code:
int __fastcall game_title_step(__int64 a1)
{
comandi_titolo();
wmove(stdscr, 0, 0);
printw("v 1.2 copyleft agentOfChaos informaniac99<AT>gmail<DOT>com");
overlay_scritta(a1);
titlescreen_leftpanel(a1);
titlescreen_rightpanel(a1);
wrefresh(stdscr);
return usleep(0x2710u);
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1)
{
comandi_titolo();
wmove(stdscr, 0, 0);
printw("v 1.2 copyleft agentOfChaos informaniac99<AT>gmail<DOT>com");
overlay_scritta(a1);
titlescreen_leftpanel(a1);
titlescreen_rightpanel(a1);
wrefresh(stdscr);
return usleep(0x2710u);
}

original_code:
void game_title_step(vars *varia)
{
    comandi_titolo(varia);
    wmove(stdscr,(0),(0));
    printw("v 1.2  copyleft  agentOfChaos  informaniac99<AT>gmail<DOT>com");
    overlay_scritta(varia);
    titlescreen_leftpanel(varia);
    titlescreen_rightpanel(varia);
    wrefresh(stdscr);
    usleep(1000*10);
}

canonical_original_code:
void game_title_step(struct vars *varia)
{
    comandi_titolo(varia);
    wmove(stdscr,(0),(0));
    printw("v 1.2  copyleft  agentOfChaos  informaniac99<AT>gmail<DOT>com");
    overlay_scritta(varia);
    titlescreen_leftpanel(varia);
    titlescreen_rightpanel(varia);
    wrefresh(stdscr);
    usleep(1000*10);
}


decompiled_code:
int __fastcall title_loop(__int64 a1)
{
int result; // eax

do
{
result = *(_DWORD *)(a1 + 140);
if ( !result )
break;
result = game_title_step(a1);
}
while ( !*(_DWORD *)(a1 + 136) );
return result;
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1)
{
int result; // eax

do
{
result = *(_DWORD *)(a1 + 140);
if ( !result )
break;
result = func4(a1);
}
while ( !*(_DWORD *)(a1 + 136) );
return result;
}

original_code:
void title_loop(vars *varia)
{
    while (varia->paused)
        {
        game_title_step(varia);
        if (varia->quit) break;
        }
}

canonical_original_code:
void title_loop(struct vars *varia)
{
    while (varia->paused)
        {
        game_title_step(varia);
        if (varia->quit) break;
        }
}


comparaz

decompiled_code:
_BOOL8 __fastcall comparaz(const void *a1, const void *a2)
{
return *(_DWORD *)a1 < *(_DWORD *)a2;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(const void *a1, const void *a2)
{
return *(_DWORD *)a1 < *(_DWORD *)a2;
}

original_code:
int comparaz(const void *a, const void *b)
{
    punteggio *uno=(punteggio *) a;
    punteggio *due=(punteggio *) b;
    return (uno->score<due->score);
}

canonical_original_code:
int comparaz(void *a, void *b)
{
    struct punteggio *uno = (punteggio *) a;
    struct punteggio *due = (punteggio *) b;
    return (uno->score<due->score);
}

variable_types:
a
void *

variable_types:
b
void *

variable_types: struct punteggio { int score; char nome[10]; char flags[6]; } *


trimN

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

result = &a1[(int)strlen(a1) - 1];
if ( *result == 10 )
*result = 0;
return result;
}

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

result = &a1[(int)strlen(a1) - 1];
if ( *result == 10 )
*result = 0;
return result;
}

original_code:
void trimN(char *riga)
{
    int lung=strlen(riga);
    if (riga[lung-1]=='\n')
        riga[lung-1]='\0';
}

canonical_original_code:
void trimN(char *riga)
{
    int lung = strlen(riga);
    if (riga[lung-1]=='\n')
        riga[lung-1]='\0';
}

variable_types:
riga
char *

variable_types: lung int


original_code:
int parse_saveline(leaderboard *board, char *line)
{
    int val;
    board->entry[board->numentry].nome[0]='\0';
    val=sscanf(line,"%s%d%s",&(board->entry[board->numentry].nome),&(board->entry[board->numentry].score),&(board->entry[board->numentry].flags));
    board->numentry++;
    return (val==3);
}

canonical_original_code:
int parse_saveline(struct leaderboard *board, char *line)
{
    int val;
    board->entry[board->numentry].nome[0]='\0';
    val=sscanf(line,"%s%d%s",&(board->entry[board->numentry].nome),&(board->entry[board->numentry].score),&(board->entry[board->numentry].flags));
    board->numentry++;
    return (val==3);
}

variable_types: struct leaderboard { struct punteggio { int score; char nome[10]; char flags[6]; } *entry; int numentry; int curr; } *

variable_types:
line
char *

variable_types: val int


decompiled_code:
int __fastcall md5_4_humans(__int64 a1, char *a2)
{
char *v3; // rbx
__int64 v4; // rdx
char *v5; // rdi
int result; // eax
_BYTE v7[16]; // [rsp+0h] [rbp-28h] BYREF
char v8; // [rsp+10h] [rbp-18h] BYREF

v3 = v7;
MD5_Final(v7, a1);
do
{
v4 = (unsigned __int8)*v3;
v5 = a2;
++v3;
a2 += 2;
result = sprintf(v5, "%02x", v4);
}
while ( v3 != &v8 );
return result;
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, char *a2)
{
char *v3; // rbx
__int64 v4; // rdx
char *v5; // rdi
int result; // eax
_BYTE v7[16]; // [rsp+0h] [rbp-28h] BYREF
char v8; // [rsp+10h] [rbp-18h] BYREF

v3 = v7;
MD5_Final(v7, a1);
do
{
v4 = (unsigned __int8)*v3;
v5 = a2;
++v3;
a2 += 2;
result = sprintf(v5, "%02x", v4);
}
while ( v3 != &v8 );
return result;
}

original_code:
void md5_4_humans(MD5_CTX *c, char* stringa)
{
    unsigned char digest[16];
    int i;
    MD5_Final(digest,c);
    for(i = 0; i < 16; ++i)
        sprintf(&stringa[i*2], "%02x", (unsigned int)digest[i]);
}

canonical_original_code:
void md5_4_humans(struct MD5state_st *c, char *stringa)
{
    unsigned char digest[16];
    int i;
    MD5_Final(digest,c);
    for(i = 0; i < 16; ++i)
        sprintf(&stringa[i*2], "%02x", (unsigned int)digest[i]);
}

variable_types: struct MD5state_st { unsigned int A; unsigned int Nl; unsigned int data[-1]; unsigned int num; } *

variable_types:
stringa
char *

variable_types:
digest
unsigned char [16]

variable_types: i int


printgameflags

original_code:
void printgameflags(vars *varia, char *str)
{
    switch (varia->gamemode&0b1111)
        {
        case 0b01: sprintf(str,"s");
        break;
        case 0b10: sprintf(str,"d");
        break;
        case 0b100: sprintf(str,"e");
        break;
        case 0b1000: sprintf(str,"r");
        break;
        }
    if ((varia->gamemode&0b10000)!=0)
        {
        sprintf(&(str[strlen(str)]),"p");
        }
    if (varia->gioco.serpente.ai&0b1)
        {
        sprintf(&(str[strlen(str)]),"l");
        }
    sprintf(&(str[strlen(str)]),"%d",varia->speed);
    if (varia->gameover==2)
        {
        sprintf(&(str[strlen(str)]),"k");
        }
}

canonical_original_code:
void printgameflags(struct vars *varia, char *str)
{
    switch (varia->gamemode&0b1111)
        {
        case 0b01: sprintf(str,"s");
        break;
        case 0b10: sprintf(str,"d");
        break;
        case 0b100: sprintf(str,"e");
        break;
        case 0b1000: sprintf(str,"r");
        break;
        }
    if ((varia->gamemode&0b10000)!=0)
        {
        sprintf(&(str[strlen(str)]),"p");
        }
    if (varia->gioco.serpente.ai&0b1)
        {
        sprintf(&(str[strlen(str)]),"l");
        }
    sprintf(&(str[strlen(str)]),"%d",varia->speed);
    if (varia->gameover==2)
        {
        sprintf(&(str[strlen(str)]),"k");
        }
}

variable_types: struct vars { struct campo { struct snake { struct punto { int x; int y; } *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; } serpente; struct punto portale[2]; int numportals; int nextportime; struct punto *powerup; int numpowerups; int larg; int alt; struct punto *toblast; int blastlung; } gioco; struct leaderboard { struct punteggio { int score; char nome[10]; char flags[6]; } *entry; int numentry; int curr; } board; int score; int speed; int quit; int paused; int gameover; int gamemode; int colori; int safe_graph; int game_insane; char playername[10]; } *

variable_types:
str
char *


decompiled_code:
void __fastcall sort_punteggi(__int64 a1)
{
qsort(*(void **)a1, *(int *)(a1 + 8), 0x14uLL, (__compar_fn_t)comparaz);
}

canonical_decompiled_code:
void __fastcall func7(__int64 a1)
{
qsort(*(void **)a1, *(int *)(a1 + 8), 0x14uLL, (__compar_fn_t)comparaz);
}

original_code:
void sort_punteggi(leaderboard *board)
{
    qsort(board->entry,board->numentry,sizeof(punteggio),comparaz);
}

canonical_original_code:
void sort_punteggi(struct leaderboard *board)
{
    qsort(board->entry,board->numentry,sizeof(punteggio),comparaz);
}


decompiled_code:
__int64 __fastcall scrivi_punteggi(int a1, int a2, int a3, __int64 a4)
{
__int64 result; // rax
int v8; // ebx
__int64 v9; // r12
int v10; // esi
const char *v11; // rax

wmove(stdscr, a1, a2);
printw("Punteggi migliori:");
result = *(unsigned int *)(a4 + 124);
if ( a3 > 0 )
{
v8 = *(_DWORD *)(a4 + 124);
v9 = 20LL * (int)result;
do
{
if ( *(_DWORD *)(a4 + 120) <= v8 )
break;
v10 = a1 + 1 + v8++;
wmove(stdscr, v10 - result, a2);
v11 = (const char *)(v9 + *(_QWORD *)(a4 + 112));
v9 += 20LL;
printw("%3d)%11s %5d %6s", (unsigned int)v8, v11 + 4, *(unsigned int *)v11, v11 + 14);
result = *(unsigned int *)(a4 + 124);
}
while ( v8 < (int)result + a3 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, int a2, int a3, __int64 a4)
{
__int64 result; // rax
int v8; // ebx
__int64 v9; // r12
int v10; // esi
const char *v11; // rax

wmove(stdscr, a1, a2);
printw("Punteggi migliori:");
result = *(unsigned int *)(a4 + 124);
if ( a3 > 0 )
{
v8 = *(_DWORD *)(a4 + 124);
v9 = 20LL * (int)result;
do
{
if ( *(_DWORD *)(a4 + 120) <= v8 )
break;
v10 = a1 + 1 + v8++;
wmove(stdscr, v10 - result, a2);
v11 = (const char *)(v9 + *(_QWORD *)(a4 + 112));
v9 += 20LL;
printw("%3d)%11s %5d %6s", (unsigned int)v8, v11 + 4, *(unsigned int *)v11, v11 + 14);
result = *(unsigned int *)(a4 + 124);
}
while ( v8 < (int)result + a3 );
}
return result;
}

original_code:
void scrivi_punteggi(int top, int left, int num, vars *varia)
{
    int cont;
    wmove(stdscr,(top+cont),(left));
    printw("Punteggi migliori:");
    for (cont=varia->board.curr; cont<varia->board.curr+num && cont<varia->board.numentry; cont++)
        {
        wmove(stdscr,(top+cont+1-varia->board.curr),(left));
        printw("%3d)%11s %5d %6s",cont+1,varia->board.entry[cont].nome,varia->board.entry[cont].score,varia->board.entry[cont].flags);
        }
}

canonical_original_code:
void scrivi_punteggi(int top, int left, int num, struct vars *varia)
{
    int cont;
    wmove(stdscr,(top+cont),(left));
    printw("Punteggi migliori:");
    for (cont=varia->board.curr; cont<varia->board.curr+num && cont<varia->board.numentry; cont++)
        {
        wmove(stdscr,(top+cont+1-varia->board.curr),(left));
        printw("%3d)%11s %5d %6s",cont+1,varia->board.entry[cont].nome,varia->board.entry[cont].score,varia->board.entry[cont].flags);
        }
}

variable_types: top int

variable_types: left int

variable_types: num int

variable_types: cont int


decompiled_code:
int __fastcall just_print(__int64 a1, int a2)
{
int result; // eax
int v3; // ebx
__int64 v4; // r12
const char *v5; // rax

result = puts("Punteggi migliori:");
v3 = *(_DWORD *)(a1 + 124);
if ( a2 > 0 )
{
result = *(_DWORD *)(a1 + 124);
v4 = 20LL * v3;
do
{
if ( *(_DWORD *)(a1 + 120) <= v3 )
break;
++v3;
v5 = (const char *)(v4 + *(_QWORD *)(a1 + 112));
v4 += 20LL;
printf("%3d)\t%11s\t%5d\t%6s\n", (unsigned int)v3, v5 + 4, *(unsigned int *)v5, v5 + 14);
result = a2 + *(_DWORD *)(a1 + 124);
}
while ( v3 < result );
}
return result;
}

canonical_decompiled_code:
int __fastcall func9(__int64 a1, int a2)
{
int result; // eax
int v3; // ebx
__int64 v4; // r12
const char *v5; // rax

result = puts("Punteggi migliori:");
v3 = *(_DWORD *)(a1 + 124);
if ( a2 > 0 )
{
result = *(_DWORD *)(a1 + 124);
v4 = 20LL * v3;
do
{
if ( *(_DWORD *)(a1 + 120) <= v3 )
break;
++v3;
v5 = (const char *)(v4 + *(_QWORD *)(a1 + 112));
v4 += 20LL;
printf("%3d)\t%11s\t%5d\t%6s\n", (unsigned int)v3, v5 + 4, *(unsigned int *)v5, v5 + 14);
result = a2 + *(_DWORD *)(a1 + 124);
}
while ( v3 < result );
}
return result;
}

original_code:
void just_print(vars *varia, int num)
{
    int cont;
    printf("Punteggi migliori:\n");
    for (cont=varia->board.curr; cont<varia->board.curr+num && cont<varia->board.numentry; cont++)
        {
        printf("%3d)\t%11s\t%5d\t%6s\n",cont+1,varia->board.entry[cont].nome,varia->board.entry[cont].score,varia->board.entry[cont].flags);
        }
}

canonical_original_code:
void just_print(struct vars *varia, int num)
{
    int cont;
    printf("Punteggi migliori:\n");
    for (cont=varia->board.curr; cont<varia->board.curr+num && cont<varia->board.numentry; cont++)
        {
        printf("%3d)\t%11s\t%5d\t%6s\n",cont+1,varia->board.entry[cont].nome,varia->board.entry[cont].score,varia->board.entry[cont].flags);
        }
}


printNexit

decompiled_code:
void __fastcall __noreturn printNexit(__int64 a1, int a2)
{
int v2; // eax

end_gioco();
endNcurses();
v2 = open_savefile(a1 + 112, "scoreboard.txt");
if ( v2 == -3 )
{
puts("File salvataggi corrotto!");
}
else if ( v2 )
{
just_print(a1, a2);
}
else
{
puts("Errore.");
}
free(*(void **)(a1 + 112));
exit(0);
}

canonical_decompiled_code:
void __fastcall __noreturn func11(__int64 a1, int a2)
{
int v2; // eax

end_gioco();
endNcurses();
v2 = func10(a1 + 112, "scoreboard.txt");
if ( v2 == -3 )
{
puts("File salvataggi corrotto!");
}
else if ( v2 )
{
func9(a1, a2);
}
else
{
puts("Errore.");
}
free(*(void **)(a1 + 112));
exit(0);
}

original_code:
void printNexit(vars *varia, int num)
{
    int ret;
    end_gioco(varia);
    endNcurses();
    ret=open_savefile(&(varia->board),"scoreboard.txt");
    if (ret==-3)
        {
        printf("File salvataggi corrotto!\n");
        }
    else if (ret)
        {
        just_print(varia,num);
        }
    else
        {
        printf("Errore.\n");
        }
    free(varia->board.entry);
    exit(0);
}

canonical_original_code:
void printNexit(struct vars *varia, int num)
{
    int ret;
    end_gioco(varia);
    endNcurses();
    ret=open_savefile(&(varia->board),"scoreboard.txt");
    if (ret==-3)
        {
        printf("File salvataggi corrotto!\n");
        }
    else if (ret)
        {
        just_print(varia,num);
        }
    else
        {
        printf("Errore.\n");
        }
    free(varia->board.entry);
    exit(0);
}

variable_types: ret int


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

result = *(unsigned int *)(a1 + 12);
if ( (_DWORD)result == 1 )
{
if ( a2 != 3 )
goto LABEL_4;
}
else if ( (_DWORD)result )
{
if ( (_DWORD)result == 3 )
{
if ( a2 != 1 )
goto LABEL_4;
}
else if ( (_DWORD)result != 2 || a2 )
{
goto LABEL_4;
}
}
else if ( a2 != 2 )
{
LABEL_4:
*(_DWORD *)(a1 + 16) = a2;
return result;
}
return result;
}

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

result = *(unsigned int *)(a1 + 12);
if ( (_DWORD)result == 1 )
{
if ( a2 != 3 )
goto LABEL_4;
}
else if ( (_DWORD)result )
{
if ( (_DWORD)result == 3 )
{
if ( a2 != 1 )
goto LABEL_4;
}
else if ( (_DWORD)result != 2 || a2 )
{
goto LABEL_4;
}
}
else if ( a2 != 2 )
{
LABEL_4:
*(_DWORD *)(a1 + 16) = a2;
return result;
}
return result;
}

original_code:
void snake_direz(snake *chi, int facing)
{
    if (chi->direz==1 && facing==3) return;
    if (chi->direz==0 && facing==2) return;
    if (chi->direz==3 && facing==1) return;
    if (chi->direz==2 && facing==0) return;
    chi->scheduledir=facing;
}

canonical_original_code:
void snake_direz(struct snake *chi, int facing)
{
    if (chi->direz==1 && facing==3) return;
    if (chi->direz==0 && facing==2) return;
    if (chi->direz==3 && facing==1) return;
    if (chi->direz==2 && facing==0) return;
    chi->scheduledir=facing;
}

variable_types: struct snake { struct punto { int x; int y; } *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; } *

variable_types: facing int


comandi

decompiled_code:
wint_t __fastcall comandi(__int64 a1)
{
wint_t result; // eax
wint_t v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = wget_wch(stdscr, v2);
if ( result != -1 )
{
result = v2[0];
if ( (int)v2[0] > 119 )
{
if ( v2[0] == 260 )
{
LABEL_14:
result = snake_direz(a1, 3);
}
else if ( (int)v2[0] <= 260 )
{
if ( v2[0] == 258 )
{
LABEL_13:
result = snake_direz(a1, 2);
}
else if ( v2[0] == 259 )
{
LABEL_12:
result = snake_direz(a1, 0);
}
}
else if ( v2[0] == 261 )
{
LABEL_8:
result = snake_direz(a1, 1);
}
}
else if ( (int)v2[0] > 96 )
{
result = v2[0] - 97;
switch ( v2[0] )
{
case 'a':
goto LABEL_14;
case 'd':
goto LABEL_8;
case 'p':
result = *(_DWORD *)(a1 + 140) == 0;
*(_DWORD *)(a1 + 140) = result;
break;
case 'q':
*(_DWORD *)(a1 + 136) = 1;
break;
case 's':
goto LABEL_13;
case 'w':
goto LABEL_12;
default:
return result;
}
}
}
return result;
}

canonical_decompiled_code:
wint_t __fastcall func1(__int64 a1)
{
wint_t result; // eax
wint_t v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = wget_wch(stdscr, v2);
if ( result != -1 )
{
result = v2[0];
if ( (int)v2[0] > 119 )
{
if ( v2[0] == 260 )
{
LABEL_14:
result = func0(a1, 3);
}
else if ( (int)v2[0] <= 260 )
{
if ( v2[0] == 258 )
{
LABEL_13:
result = func0(a1, 2);
}
else if ( v2[0] == 259 )
{
LABEL_12:
result = func0(a1, 0);
}
}
else if ( v2[0] == 261 )
{
LABEL_8:
result = func0(a1, 1);
}
}
else if ( (int)v2[0] > 96 )
{
result = v2[0] - 97;
switch ( v2[0] )
{
case 'a':
goto LABEL_14;
case 'd':
goto LABEL_8;
case 'p':
result = *(_DWORD *)(a1 + 140) == 0;
*(_DWORD *)(a1 + 140) = result;
break;
case 'q':
*(_DWORD *)(a1 + 136) = 1;
break;
case 's':
goto LABEL_13;
case 'w':
goto LABEL_12;
default:
return result;
}
}
}
return result;
}

original_code:
void comandi(vars *varia)
{
    wchar_t ch;
    int esit;
    esit=wget_wch(stdscr,((wint_t*)&ch));
    if (esit==(-1))
        {
        }
    else
        {
        switch (ch)
            {
            case 0404: snake_direz(&(varia->gioco.serpente),3); break;
            case 0405: snake_direz(&(varia->gioco.serpente),1); break;
            case 0403: snake_direz(&(varia->gioco.serpente),0); break;
            case 0402: snake_direz(&(varia->gioco.serpente),2); break;
            case 'a': snake_direz(&(varia->gioco.serpente),3); break;
            case 'd': snake_direz(&(varia->gioco.serpente),1); break;
            case 'w': snake_direz(&(varia->gioco.serpente),0); break;
            case 's': snake_direz(&(varia->gioco.serpente),2); break;
            case 'q': varia->quit=1; break;
            case 'p': if (varia->paused)varia->paused=0; else varia->paused=1; break;
            default:
            break;
            }
        }
}

canonical_original_code:
void comandi(struct vars *varia)
{
    int ch;
    int esit;
    esit=wget_wch(stdscr,((unsigned int *)&ch));
    if (esit==(-1))
        {
        }
    else
        {
        switch (ch)
            {
            case 0404: snake_direz(&(varia->gioco.serpente),3); break;
            case 0405: snake_direz(&(varia->gioco.serpente),1); break;
            case 0403: snake_direz(&(varia->gioco.serpente),0); break;
            case 0402: snake_direz(&(varia->gioco.serpente),2); break;
            case 'a': snake_direz(&(varia->gioco.serpente),3); break;
            case 'd': snake_direz(&(varia->gioco.serpente),1); break;
            case 'w': snake_direz(&(varia->gioco.serpente),0); break;
            case 's': snake_direz(&(varia->gioco.serpente),2); break;
            case 'q': varia->quit=1; break;
            case 'p': if (varia->paused)varia->paused=0; else varia->paused=1; break;
            default:
            break;
            }
        }
}

variable_types: ch int

variable_types: esit int


decompiled_code:
int __fastcall comandi_pausa(_DWORD *a1)
{
int result; // eax
wint_t v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = wget_wch(stdscr, v2);
if ( result != -1 )
{
result = v2[0];
if ( v2[0] == 114 )
{
result = a1[36];
if ( result < 0 )
result = riprova(a1);
}
else if ( (int)v2[0] <= 114 )
{
if ( v2[0] == 112 )
{
if ( (int)a1[36] >= 0 )
{
result = a1[35] == 0;
a1[35] = result;
}
}
else if ( v2[0] == 113 )
{
a1[34] = 1;
}
}
else if ( v2[0] == 258 )
{
result = a1[31];
if ( result + 8 < a1[30] )
a1[31] = ++result;
}
else if ( v2[0] == 259 )
{
result = a1[31];
if ( result > 0 )
a1[31] = --result;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(_DWORD *a1)
{
int result; // eax
wint_t v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = wget_wch(stdscr, v2);
if ( result != -1 )
{
result = v2[0];
if ( v2[0] == 114 )
{
result = a1[36];
if ( result < 0 )
result = riprova(a1);
}
else if ( (int)v2[0] <= 114 )
{
if ( v2[0] == 112 )
{
if ( (int)a1[36] >= 0 )
{
result = a1[35] == 0;
a1[35] = result;
}
}
else if ( v2[0] == 113 )
{
a1[34] = 1;
}
}
else if ( v2[0] == 258 )
{
result = a1[31];
if ( result + 8 < a1[30] )
a1[31] = ++result;
}
else if ( v2[0] == 259 )
{
result = a1[31];
if ( result > 0 )
a1[31] = --result;
}
}
return result;
}

original_code:
void comandi_pausa(vars *varia)
{
    wchar_t ch;
    int esit;
    esit=wget_wch(stdscr,((wint_t*)&ch));
    if (esit==(-1))
        {
        }
    else
        {
        switch (ch)
            {
            case 0403:
                if (varia->board.curr>0) varia->board.curr--;
            break;
            case 0402:
                if (varia->board.curr+8<(varia->board.numentry)) varia->board.curr++;
            break;
            case 'q': varia->quit=1; break;
            case 'p':
                if (varia->gameover>=0)
                    {
                    if (varia->paused)varia->paused=0;
                    else varia->paused=1;
                    }
            break;
            case 'r':
                if (varia->gameover<0)
                    {
                    riprova(varia);
                    }
            break;
            default:
            break;
            }
        }
}

canonical_original_code:
void comandi_pausa(struct vars *varia)
{
    int ch;
    int esit;
    esit=wget_wch(stdscr,((unsigned int *)&ch));
    if (esit==(-1))
        {
        }
    else
        {
        switch (ch)
            {
            case 0403:
                if (varia->board.curr>0) varia->board.curr--;
            break;
            case 0402:
                if (varia->board.curr+8<(varia->board.numentry)) varia->board.curr++;
            break;
            case 'q': varia->quit=1; break;
            case 'p':
                if (varia->gameover>=0)
                    {
                    if (varia->paused)varia->paused=0;
                    else varia->paused=1;
                    }
            break;
            case 'r':
                if (varia->gameover<0)
                    {
                    riprova(varia);
                    }
            break;
            default:
            break;
            }
        }
}


decompiled_code:
int __fastcall comandi_titolo(_DWORD *a1)
{
int result; // eax
int v2; // edx
wint_t v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = wget_wch(stdscr, v3);
if ( result != -1 )
{
result = v3[0] - 99;
switch ( v3[0] )
{
case 'c':
result = a1[33] + 1;
if ( result > 4 )
result = 0;
a1[33] = result;
break;
case 'd':
a1[37] += 2;
a1[35] = 0;
break;
case 'e':
a1[37] += 4;
a1[35] = 0;
break;
case 'l':
result = a1[9];
if ( result )
{
if ( result == 1 )
a1[9] = 0;
}
else
{
a1[9] = 1;
}
break;
case 'p':
v2 = a1[37];
result = v2 - 16;
if ( (v2 & 0x10) == 0 )
result = v2 + 16;
a1[37] = result;
break;
case 'q':
a1[34] = 1;
break;
case 'r':
a1[37] += 8;
a1[35] = 0;
break;
case 's':
++a1[37];
a1[35] = 0;
break;
default:
return result;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func3(_DWORD *a1)
{
int result; // eax
int v2; // edx
wint_t v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = wget_wch(stdscr, v3);
if ( result != -1 )
{
result = v3[0] - 99;
switch ( v3[0] )
{
case 'c':
result = a1[33] + 1;
if ( result > 4 )
result = 0;
a1[33] = result;
break;
case 'd':
a1[37] += 2;
a1[35] = 0;
break;
case 'e':
a1[37] += 4;
a1[35] = 0;
break;
case 'l':
result = a1[9];
if ( result )
{
if ( result == 1 )
a1[9] = 0;
}
else
{
a1[9] = 1;
}
break;
case 'p':
v2 = a1[37];
result = v2 - 16;
if ( (v2 & 0x10) == 0 )
result = v2 + 16;
a1[37] = result;
break;
case 'q':
a1[34] = 1;
break;
case 'r':
a1[37] += 8;
a1[35] = 0;
break;
case 's':
++a1[37];
a1[35] = 0;
break;
default:
return result;
}
}
return result;
}

original_code:
void comandi_titolo(vars *varia)
{
    wchar_t ch;
    int esit;
    esit=wget_wch(stdscr,((wint_t*)&ch));
    if (esit==(-1))
        {
        }
    else
        {
        switch (ch)
            {
            case 'q': varia->quit=1; break;
            case 's':
                varia->gamemode+=0b01;
                varia->paused=0;
            break;
            case 'd':
                varia->gamemode+=0b10;
                varia->paused=0;
            break;
            case 'e':
                varia->gamemode+=0b100;
                varia->paused=0;
            break;
            case 'r':
                varia->gamemode+=0b1000;
                varia->paused=0;
            break;
            case 'p':
                if ((varia->gamemode&0b10000)!=0)varia->gamemode-=0b10000;
                else varia->gamemode+=0b10000;
            break;
            case 'l':
                if ((varia->gioco.serpente.ai==0b0))varia->gioco.serpente.ai=0b1;
                else if ((varia->gioco.serpente.ai==0b1))varia->gioco.serpente.ai=0b0;
            break;
            case 'c':
                varia->speed++;
                if (varia->speed>=5)varia->speed=0;
            break;
            default:
            break;
            }
        }
}

canonical_original_code:
void comandi_titolo(struct vars *varia)
{
    int ch;
    int esit;
    esit=wget_wch(stdscr,((unsigned int *)&ch));
    if (esit==(-1))
        {
        }
    else
        {
        switch (ch)
            {
            case 'q': varia->quit=1; break;
            case 's':
                varia->gamemode+=0b01;
                varia->paused=0;
            break;
            case 'd':
                varia->gamemode+=0b10;
                varia->paused=0;
            break;
            case 'e':
                varia->gamemode+=0b100;
                varia->paused=0;
            break;
            case 'r':
                varia->gamemode+=0b1000;
                varia->paused=0;
            break;
            case 'p':
                if ((varia->gamemode&0b10000)!=0)varia->gamemode-=0b10000;
                else varia->gamemode+=0b10000;
            break;
            case 'l':
                if ((varia->gioco.serpente.ai==0b0))varia->gioco.serpente.ai=0b1;
                else if ((varia->gioco.serpente.ai==0b1))varia->gioco.serpente.ai=0b0;
            break;
            case 'c':
                varia->speed++;
                if (varia->speed>=5)varia->speed=0;
            break;
            default:
            break;
            }
        }
}


timerPortal

decompiled_code:
__int64 __fastcall timerPortal(__int64 a1)
{
int v1; // edx
__int64 result; // rax

v1 = rand();
result = (unsigned int)(35 * (v1 / 35));
*(_DWORD *)(a1 + 68) = v1 % 35 + 10;
return result;
}

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

v1 = rand();
result = (unsigned int)(35 * (v1 / 35));
*(_DWORD *)(a1 + 68) = v1 % 35 + 10;
return result;
}

original_code:
void timerPortal(vars *varia)
{
    varia->gioco.nextportime=10 +(rand()%(45 -10));
}

canonical_original_code:
void timerPortal(struct vars *varia)
{
    varia->gioco.nextportime=10 +(rand()%(45 -10));
}


removepup

decompiled_code:
void *__fastcall removepup(__int64 a1, int a2)
{
__int64 v2; // r12
void *result; // rax
int v4; // er13

v2 = 8LL * a2;
wmove(stdscr, *(_DWORD *)(v2 + *(_QWORD *)(a1 + 72) + 4) + 1, 2 * *(_DWORD *)(v2 + *(_QWORD *)(a1 + 72)) + 1);
wprintw(stdscr, " ");
result = (void *)*(unsigned int *)(a1 + 80);
v4 = (_DWORD)result - 1;
if ( a2 < (int)result - 1 )
result = memmove(
(void *)(v2 + *(_QWORD *)(a1 + 72)),
(const void *)(*(_QWORD *)(a1 + 72) + v2 + 8),
8LL * (unsigned int)((_DWORD)result - a2 - 2) + 8);
*(_DWORD *)(a1 + 80) = v4;
return result;
}

canonical_decompiled_code:
void *__fastcall func1(__int64 a1, int a2)
{
__int64 v2; // r12
void *result; // rax
int v4; // er13

v2 = 8LL * a2;
wmove(stdscr, *(_DWORD *)(v2 + *(_QWORD *)(a1 + 72) + 4) + 1, 2 * *(_DWORD *)(v2 + *(_QWORD *)(a1 + 72)) + 1);
wprintw(stdscr, " ");
result = (void *)*(unsigned int *)(a1 + 80);
v4 = (_DWORD)result - 1;
if ( a2 < (int)result - 1 )
result = memmove(
(void *)(v2 + *(_QWORD *)(a1 + 72)),
(const void *)(*(_QWORD *)(a1 + 72) + v2 + 8),
8LL * (unsigned int)((_DWORD)result - a2 - 2) + 8);
*(_DWORD *)(a1 + 80) = v4;
return result;
}

original_code:
void removepup(campo *dove, int indice)
{
    int cont;
    wmove(stdscr,(dove->powerup[indice].y+1),((dove->powerup[indice].x*2)+1));
    wprintw(stdscr,"  ");
    for (cont=indice; cont<dove->numpowerups-1; cont++)
        {
        dove->powerup[cont]=dove->powerup[cont+1];
        }
    dove->numpowerups--;
}

canonical_original_code:
void removepup(struct campo *dove, int indice)
{
    int cont;
    wmove(stdscr,(dove->powerup[indice].y+1),((dove->powerup[indice].x*2)+1));
    wprintw(stdscr,"  ");
    for (cont=indice; cont<dove->numpowerups-1; cont++)
        {
        dove->powerup[cont]=dove->powerup[cont+1];
        }
    dove->numpowerups--;
}

variable_types: struct campo { struct snake { struct punto { int x; int y; } *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; } serpente; struct punto portale[2]; int numportals; int nextportime; struct punto *powerup; int numpowerups; int larg; int alt; struct punto *toblast; int blastlung; } *

variable_types: indice int


droppup

original_code:
void droppup(vars *varia)
{
    int x,y,safe=0;
    if (varia->gioco.numpowerups<2)
        {
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && safe<2500);
        varia->gioco.powerup[varia->gioco.numpowerups].x=x;
        varia->gioco.powerup[varia->gioco.numpowerups].y=y;
        varia->gioco.numpowerups++;
        }
}

canonical_original_code:
void droppup(struct vars *varia)
{
    int x; int y; int safe = 0;
    if (varia->gioco.numpowerups<2)
        {
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && safe<2500);
        varia->gioco.powerup[varia->gioco.numpowerups].x=x;
        varia->gioco.powerup[varia->gioco.numpowerups].y=y;
        varia->gioco.numpowerups++;
        }
}

variable_types: x int

variable_types: y int

variable_types: safe int


mangiacibo

decompiled_code:
__int64 __fastcall mangiacibo(__int64 a1)
{
__int64 result; // rax
double v2; // xmm0_8
__int64 v3; // rdx
__int64 v4; // rsi

result = *(_DWORD *)(a1 + 148) & 0xF;
if ( (_DWORD)result == 4 )
{
v2 = pow(2.0, (double)*(int *)(a1 + 28));
++*(_DWORD *)(a1 + 28);
result = (unsigned int)(int)v2;
*(_DWORD *)(a1 + 24) += result;
return result;
}
if ( (*(_DWORD *)(a1 + 148) & 0xFu) > 4 )
{
if ( (_DWORD)result != 8 )
return result;
result = (unsigned int)__ROR4__(-1431655765 * rand() + 715827882, 1);
if ( (unsigned int)result <= 0x2AAAAAAA )
{
nuovoblast(a1, *(_QWORD *)a1 + 8LL, (unsigned int)(*(_DWORD *)(a1 + 8) - 1));
v3 = *(unsigned int *)(a1 + 88);
v4 = *(unsigned int *)(a1 + 84);
*(_DWORD *)(a1 + 8) = 1;
return regen_snacache(a1, v4, v3);
}
LABEL_9:
++*(_DWORD *)(a1 + 24);
return result;
}
if ( (_DWORD)result == 1 )
goto LABEL_9;
if ( (_DWORD)result == 2 )
*(_DWORD *)(a1 + 24) += 2;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
__int64 result; // rax
double v2; // xmm0_8
__int64 v3; // rdx
__int64 v4; // rsi

result = *(_DWORD *)(a1 + 148) & 0xF;
if ( (_DWORD)result == 4 )
{
v2 = pow(2.0, (double)*(int *)(a1 + 28));
++*(_DWORD *)(a1 + 28);
result = (unsigned int)(int)v2;
*(_DWORD *)(a1 + 24) += result;
return result;
}
if ( (*(_DWORD *)(a1 + 148) & 0xFu) > 4 )
{
if ( (_DWORD)result != 8 )
return result;
result = (unsigned int)__ROR4__(-1431655765 * rand() + 715827882, 1);
if ( (unsigned int)result <= 0x2AAAAAAA )
{
nuovoblast(a1, *(_QWORD *)a1 + 8LL, (unsigned int)(*(_DWORD *)(a1 + 8) - 1));
v3 = *(unsigned int *)(a1 + 88);
v4 = *(unsigned int *)(a1 + 84);
*(_DWORD *)(a1 + 8) = 1;
return regen_snacache(a1, v4, v3);
}
LABEL_9:
++*(_DWORD *)(a1 + 24);
return result;
}
if ( (_DWORD)result == 1 )
goto LABEL_9;
if ( (_DWORD)result == 2 )
*(_DWORD *)(a1 + 24) += 2;
return result;
}

original_code:
void mangiacibo(vars *varia)
{
    switch (varia->gamemode&0b1111)
        {
        case 0b01:
            varia->gioco.serpente.ate+=1;
        break;
        case 0b10:
            varia->gioco.serpente.ate+=2;
        break;
        case 0b100:
            varia->gioco.serpente.ate+=abs(pow(2,varia->gioco.serpente.keepexp));
            varia->gioco.serpente.keepexp++;
        break;
        case 0b1000:
            if (rand()%6 == 0)
                {
                nuovoblast(varia,&(varia->gioco.serpente.sezioni[1]),varia->gioco.serpente.numsezioni-1);
                varia->gioco.serpente.numsezioni=1;
                regen_snacache(&(varia->gioco.serpente),varia->gioco.larg,varia->gioco.alt);
                }
            else varia->gioco.serpente.ate+=1;
        break;
        }
}

canonical_original_code:
void mangiacibo(struct vars *varia)
{
    switch (varia->gamemode&0b1111)
        {
        case 0b01:
            varia->gioco.serpente.ate+=1;
        break;
        case 0b10:
            varia->gioco.serpente.ate+=2;
        break;
        case 0b100:
            varia->gioco.serpente.ate+=abs(pow(2,varia->gioco.serpente.keepexp));
            varia->gioco.serpente.keepexp++;
        break;
        case 0b1000:
            if (rand()%6 == 0)
                {
                nuovoblast(varia,&(varia->gioco.serpente.sezioni[1]),varia->gioco.serpente.numsezioni-1);
                varia->gioco.serpente.numsezioni=1;
                regen_snacache(&(varia->gioco.serpente),varia->gioco.larg,varia->gioco.alt);
                }
            else varia->gioco.serpente.ate+=1;
        break;
        }
}


decompiled_code:
__int64 __fastcall drop_portal(__int64 a1)
{
int v1; // er12
int v2; // ebx
int v3; // eax
unsigned int v4; // er13
unsigned int v5; // er14
int v6; // eax
unsigned int v7; // er14
unsigned int v8; // er13
__int64 result; // rax
int v10; // eax
int v11; // ebx
int v12; // er14
__int64 v13; // r15
int v14; // eax
unsigned int v15; // er13
unsigned int v16; // er12
int v17; // eax
__int64 v18; // rdx
__int64 v19; // rsi

v1 = *(_DWORD *)(a1 + 64);
if ( !v1 )
{
v2 = 0;
do
{
++v2;
v4 = rand() % *(_DWORD *)(a1 + 84);
v5 = rand() % *(_DWORD *)(a1 + 88);
if ( !(unsigned int)morsocoda(a1, v4) )
break;
v3 = presopup(a1, v4, v5);
if ( v2 == 2500 )
break;
}
while ( v3 );
*(_DWORD *)(a1 + 48) = v4;
*(_DWORD *)(a1 + 52) = v5;
do
{
++v1;
v7 = rand() % *(_DWORD *)(a1 + 84);
v8 = rand() % *(_DWORD *)(a1 + 88);
if ( !(unsigned int)morsocoda(a1, v7) )
break;
if ( !(unsigned int)presopup(a1, v7, v8) )
break;
v6 = presoportal(a1, v7, v8);
if ( v1 == 2500 )
break;
}
while ( v6 == 1 );
result = *(int *)(a1 + 32);
*(_DWORD *)(a1 + 56) = v7;
*(_DWORD *)(a1 + 60) = v8;
*(_DWORD *)(a1 + 64) = 2;
if ( !(_DWORD)result )
return result;
LABEL_19:
nuovoblast(a1, *(_QWORD *)a1 + 8 * result, (unsigned int)(*(_DWORD *)(a1 + 8) - result));
v17 = *(_DWORD *)(a1 + 32);
v18 = *(unsigned int *)(a1 + 88);
*(_DWORD *)(a1 + 32) = 0;
v19 = *(unsigned int *)(a1 + 84);
*(_DWORD *)(a1 + 8) = v17;
*(_DWORD *)(a1 + 24) = 0;
return regen_snacache(a1, v19, v18);
}
v10 = rand();
v11 = 0;
v12 = 2 - (v10 & 1);
v13 = a1 + 8LL * (v10 % 2);
wmove(stdscr, *(_DWORD *)(v13 + 52) + 1, 2 * *(_DWORD *)(v13 + 48) + 1);
printw(" ");
do
{
++v11;
v15 = rand() % *(_DWORD *)(a1 + 84);
v16 = rand() % *(_DWORD *)(a1 + 88);
if ( !(unsigned int)morsocoda(a1, v15) )
break;
if ( !(unsigned int)presopup(a1, v15, v16) )
break;
v14 = presoportal(a1, v15, v16);
if ( v11 == 2500 )
break;
}
while ( v14 == v12 );
*(_DWORD *)(v13 + 48) = v15;
*(_DWORD *)(v13 + 52) = v16;
result = *(int *)(a1 + 32);
if ( (_DWORD)result )
goto LABEL_19;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
int v1; // er12
int v2; // ebx
int v3; // eax
unsigned int v4; // er13
unsigned int v5; // er14
int v6; // eax
unsigned int v7; // er14
unsigned int v8; // er13
__int64 result; // rax
int v10; // eax
int v11; // ebx
int v12; // er14
__int64 v13; // r15
int v14; // eax
unsigned int v15; // er13
unsigned int v16; // er12
int v17; // eax
__int64 v18; // rdx
__int64 v19; // rsi

v1 = *(_DWORD *)(a1 + 64);
if ( !v1 )
{
v2 = 0;
do
{
++v2;
v4 = rand() % *(_DWORD *)(a1 + 84);
v5 = rand() % *(_DWORD *)(a1 + 88);
if ( !(unsigned int)morsocoda(a1, v4) )
break;
v3 = presopup(a1, v4, v5);
if ( v2 == 2500 )
break;
}
while ( v3 );
*(_DWORD *)(a1 + 48) = v4;
*(_DWORD *)(a1 + 52) = v5;
do
{
++v1;
v7 = rand() % *(_DWORD *)(a1 + 84);
v8 = rand() % *(_DWORD *)(a1 + 88);
if ( !(unsigned int)morsocoda(a1, v7) )
break;
if ( !(unsigned int)presopup(a1, v7, v8) )
break;
v6 = presoportal(a1, v7, v8);
if ( v1 == 2500 )
break;
}
while ( v6 == 1 );
result = *(int *)(a1 + 32);
*(_DWORD *)(a1 + 56) = v7;
*(_DWORD *)(a1 + 60) = v8;
*(_DWORD *)(a1 + 64) = 2;
if ( !(_DWORD)result )
return result;
LABEL_19:
nuovoblast(a1, *(_QWORD *)a1 + 8 * result, (unsigned int)(*(_DWORD *)(a1 + 8) - result));
v17 = *(_DWORD *)(a1 + 32);
v18 = *(unsigned int *)(a1 + 88);
*(_DWORD *)(a1 + 32) = 0;
v19 = *(unsigned int *)(a1 + 84);
*(_DWORD *)(a1 + 8) = v17;
*(_DWORD *)(a1 + 24) = 0;
return regen_snacache(a1, v19, v18);
}
v10 = rand();
v11 = 0;
v12 = 2 - (v10 & 1);
v13 = a1 + 8LL * (v10 % 2);
wmove(stdscr, *(_DWORD *)(v13 + 52) + 1, 2 * *(_DWORD *)(v13 + 48) + 1);
printw(" ");
do
{
++v11;
v15 = rand() % *(_DWORD *)(a1 + 84);
v16 = rand() % *(_DWORD *)(a1 + 88);
if ( !(unsigned int)morsocoda(a1, v15) )
break;
if ( !(unsigned int)presopup(a1, v15, v16) )
break;
v14 = presoportal(a1, v15, v16);
if ( v11 == 2500 )
break;
}
while ( v14 == v12 );
*(_DWORD *)(v13 + 48) = v15;
*(_DWORD *)(v13 + 52) = v16;
result = *(int *)(a1 + 32);
if ( (_DWORD)result )
goto LABEL_19;
return result;
}

original_code:
void drop_portal(vars *varia)
{
    int x,y,safe=0,nuovo,altro;
    if (varia->gioco.numportals==0)
        {
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && presopup(varia,x,y) && safe<2500);
        varia->gioco.portale[0].x=x;
        varia->gioco.portale[0].y=y;
        safe=0;
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && presopup(varia,x,y) && (presoportal(varia,x,y)==1) && safe<2500);
        varia->gioco.portale[1].x=x;
        varia->gioco.portale[1].y=y;
        varia->gioco.numportals=2;
        }
    else
        {
        nuovo=rand()%2;
        if (nuovo==0)altro=2;
        else altro=1;
        wmove(stdscr,(varia->gioco.portale[nuovo].y+1),((varia->gioco.portale[nuovo].x*2)+1));
        printw("  ");
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && presopup(varia,x,y) && (presoportal(varia,x,y)==altro) && safe<2500);
        varia->gioco.portale[nuovo].x=x;
        varia->gioco.portale[nuovo].y=y;
        }
    if (varia->gioco.serpente.portalcross!=0)
        {
        nuovoblast(varia,&(varia->gioco.serpente.sezioni[varia->gioco.serpente.portalcross]),varia->gioco.serpente.numsezioni-varia->gioco.serpente.portalcross);
        varia->gioco.serpente.numsezioni=varia->gioco.serpente.portalcross;
        varia->gioco.serpente.portalcross=0;
        varia->gioco.serpente.ate=0;
        regen_snacache(&(varia->gioco.serpente),varia->gioco.larg,varia->gioco.alt);
        }
}

canonical_original_code:
void drop_portal(struct vars *varia)
{
    int x; int y; int safe = 0; int nuovo; int altro;
    if (varia->gioco.numportals==0)
        {
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && presopup(varia,x,y) && safe<2500);
        varia->gioco.portale[0].x=x;
        varia->gioco.portale[0].y=y;
        safe=0;
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && presopup(varia,x,y) && (presoportal(varia,x,y)==1) && safe<2500);
        varia->gioco.portale[1].x=x;
        varia->gioco.portale[1].y=y;
        varia->gioco.numportals=2;
        }
    else
        {
        nuovo=rand()%2;
        if (nuovo==0)altro=2;
        else altro=1;
        wmove(stdscr,(varia->gioco.portale[nuovo].y+1),((varia->gioco.portale[nuovo].x*2)+1));
        printw("  ");
        do {
            x=rand()%varia->gioco.larg;
            y=rand()%varia->gioco.alt;
            safe++;
            } while (morsocoda(varia,x,y) && presopup(varia,x,y) && (presoportal(varia,x,y)==altro) && safe<2500);
        varia->gioco.portale[nuovo].x=x;
        varia->gioco.portale[nuovo].y=y;
        }
    if (varia->gioco.serpente.portalcross!=0)
        {
        nuovoblast(varia,&(varia->gioco.serpente.sezioni[varia->gioco.serpente.portalcross]),varia->gioco.serpente.numsezioni-varia->gioco.serpente.portalcross);
        varia->gioco.serpente.numsezioni=varia->gioco.serpente.portalcross;
        varia->gioco.serpente.portalcross=0;
        varia->gioco.serpente.ate=0;
        regen_snacache(&(varia->gioco.serpente),varia->gioco.larg,varia->gioco.alt);
        }
}

variable_types: nuovo int

variable_types: altro int


nuovoblast

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

if ( *(_QWORD *)(a1 + 96) )
{
result = wclear(stdscr);
*(_QWORD *)(a1 + 96) = a2;
*(_DWORD *)(a1 + 104) = a3;
}
else
{
*(_QWORD *)(a1 + 96) = a2;
*(_DWORD *)(a1 + 104) = a3;
}
return result;
}

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

if ( *(_QWORD *)(a1 + 96) )
{
result = wclear(stdscr);
*(_QWORD *)(a1 + 96) = a2;
*(_DWORD *)(a1 + 104) = a3;
}
else
{
*(_QWORD *)(a1 + 96) = a2;
*(_DWORD *)(a1 + 104) = a3;
}
return result;
}

original_code:
void nuovoblast(vars *varia,punto *dove, int lung)
{
    if (varia->gioco.toblast!=((void *)0))
        {
        wclear(stdscr);
        varia->gioco.toblast=dove;
        varia->gioco.blastlung=lung;
        }
    else
        {
        varia->gioco.toblast=dove;
        varia->gioco.blastlung=lung;
        }
}

canonical_original_code:
void nuovoblast(struct vars *varia, struct punto *dove, int lung)
{
    if (varia->gioco.toblast!=((void *)0))
        {
        wclear(stdscr);
        varia->gioco.toblast=dove;
        varia->gioco.blastlung=lung;
        }
    else
        {
        varia->gioco.toblast=dove;
        varia->gioco.blastlung=lung;
        }
}

variable_types: struct vars { struct campo { struct snake { struct punto { int x; int y; } *sezioni; int numsezioni; int direz; int scheduledir; int ciclo_anim; int ate; int keepexp; int portalcross; int ai; char **cache; } serpente; struct punto portale[2]; int numportals; int nextportime; struct punto *powerup; int numpowerups; int larg; int alt; struct punto *toblast; int blastlung; } gioco; struct leaderboard { struct punteggio { int score; char nome[10]; char flags[6]; } *entry; int numentry; int curr; } board; int score; int speed; int quit; int paused; int gameover; int gamemode; int colori; int safe_graph; int game_insane; char playername[10]; } *

variable_types:
dove
struct punto *

variable_types: lung int


usage

decompiled_code:
void __noreturn usage()
{
fwrite("usage: re regexp string...\n", 1uLL, 0x1BuLL, stderr);
exit(2);
}

canonical_decompiled_code:
void __noreturn func0()
{
fwrite("usage: re regexp string...\n", 1uLL, 0x1BuLL, stderr);
exit(2);
}

original_code:
void
usage(void)
{
 fprintf(stderr, "usage: re regexp string...\n");
 exit(2);
}

canonical_original_code:
void usage()
{
 fprintf(stderr, "usage: re regexp string...\n");
 exit(2);
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v3; // rbp
const char *v4; // rdx
int v5; // ecx
char *v6; // r15
const char **v7; // r12
__int64 v8; // r13
__int64 v9; // rax
char *v10; // rbx
char *v11; // r14
__int64 v12; // rsi
unsigned int v14; // [rsp+8h] [rbp-E0h]
int v15; // [rsp+Ch] [rbp-DCh]
char v16[216]; // [rsp+10h] [rbp-D8h] BYREF

v15 = argc;
if ( argc <= 1 )
usage(argc, argv, envp);
v3 = (char *)parse(argv[1], argv, envp);
printre(v3);
putchar(10);
v6 = compile(v3, (char *)argv, v4, v5);
printprog(v6);
if ( v15 != 2 )
{
v14 = 2;
v7 = argv + 2;
do
{
v8 = 0LL;
printf("#%d %s\n", v14, *v7);
do
{
while ( 1 )
{
printf("%s ", (&tab)[v8]);
memset(v16, 0, 0xA0uLL);
if ( ((unsigned int (__fastcall *)(char *, const char *, char *, __int64))(&tab)[v8 + 1])(v6, *v7, v16, 20LL) )
break;
v8 += 2LL;
puts("-no match-");
if ( v8 == 10 )
goto LABEL_19;
}
printf("match");
v9 = 20LL;
while ( !*((_QWORD *)&v14 + v9) )
{
if ( !--v9 )
goto LABEL_18;
}
v10 = v16;
v11 = &v16[16 * ((unsigned int)(v9 - 1) >> 1) + 16];
do
{
printf(" (");
if ( *(_QWORD *)v10 )
printf("%d", *(_QWORD *)v10 - (_QWORD)*v7);
else
putchar(63);
putchar(44);
v12 = *((_QWORD *)v10 + 1);
if ( v12 )
printf("%d", v12 - (_QWORD)*v7);
else
putchar(63);
v10 += 16;
putchar(41);
}
while ( v10 != v11 );
LABEL_18:
v8 += 2LL;
putchar(10);
}
while ( v8 != 10 );
LABEL_19:
++v14;
++v7;
}
while ( v15 != v14 );
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v3; // rbp
const char *v4; // rdx
int v5; // ecx
char *v6; // r15
const char **v7; // r12
__int64 v8; // r13
__int64 v9; // rax
char *v10; // rbx
char *v11; // r14
__int64 v12; // rsi
unsigned int v14; // [rsp+8h] [rbp-E0h]
int v15; // [rsp+Ch] [rbp-DCh]
char v16[216]; // [rsp+10h] [rbp-D8h] BYREF

v15 = argc;
if ( argc <= 1 )
func0(argc, argv, envp);
v3 = (char *)parse(argv[1], argv, envp);
printre(v3);
putchar(10);
v6 = compile(v3, (char *)argv, v4, v5);
printprog(v6);
if ( v15 != 2 )
{
v14 = 2;
v7 = argv + 2;
do
{
v8 = 0LL;
printf("#%d %s\n", v14, *v7);
do
{
while ( 1 )
{
printf("%s ", (&tab)[v8]);
memset(v16, 0, 0xA0uLL);
if ( ((unsigned int (__fastcall *)(char *, const char *, char *, __int64))(&tab)[v8 + 1])(v6, *v7, v16, 20LL) )
break;
v8 += 2LL;
puts("-no match-");
if ( v8 == 10 )
goto LABEL_19;
}
printf("match");
v9 = 20LL;
while ( !*((_QWORD *)&v14 + v9) )
{
if ( !--v9 )
goto LABEL_18;
}
v10 = v16;
v11 = &v16[16 * ((unsigned int)(v9 - 1) >> 1) + 16];
do
{
printf(" (");
if ( *(_QWORD *)v10 )
printf("%d", *(_QWORD *)v10 - (_QWORD)*v7);
else
putchar(63);
putchar(44);
v12 = *((_QWORD *)v10 + 1);
if ( v12 )
printf("%d", v12 - (_QWORD)*v7);
else
putchar(63);
v10 += 16;
putchar(41);
}
while ( v10 != v11 );
LABEL_18:
v8 += 2LL;
putchar(10);
}
while ( v8 != 10 );
LABEL_19:
++v14;
++v7;
}
while ( v15 != v14 );
}
return 0;
}

original_code:
int
main(int argc, char **argv)
{
 int i, j, k, l;
 Regexp *re;
 Prog *prog;
 char *sub[MAXSUB];
 if(argc < 2)
  usage();
 re = parse(argv[1]);
 printre(re);
 printf("\n");
 prog = compile(re);
 printprog(prog);
 for(i=2; i<argc; i++) {
  printf("#%d %s\n", i, argv[i]);
  for(j=0; j<(sizeof(tab)/sizeof((tab)[0])); j++) {
   printf("%s ", tab[j].name);
   memset(sub, 0, sizeof sub);
   if(!tab[j].fn(prog, argv[i], sub, (sizeof(sub)/sizeof((sub)[0])))) {
    printf("-no match-\n");
    continue;
   }
   printf("match");
   for(k=MAXSUB; k>0; k--)
    if(sub[k-1])
     break;
   for(l=0; l<k; l+=2) {
    printf(" (");
    if(sub[l] == ((void*)0))
     printf("?");
    else
     printf("%d", (int)(sub[l] - argv[i]));
    printf(",");
    if(sub[l+1] == ((void*)0))
     printf("?");
    else
     printf("%d", (int)(sub[l+1] - argv[i]));
    printf(")");
   }
   printf("\n");
  }
 }
 return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
 int i; int j; int k; int l;
 struct Regexp *re;
 struct Prog *prog;
 char *sub[-1];
 if(argc < 2)
  usage();
 re = parse(argv[1]);
 printre(re);
 printf("\n");
 prog = compile(re);
 printprog(prog);
 for(i=2; i<argc; i++) {
  printf("#%d %s\n", i, argv[i]);
  for(j=0; j<(sizeof(tab)/sizeof((tab)[0])); j++) {
   printf("%s ", tab[j].name);
   memset(sub, 0, sizeof sub);
   if(!tab[j].fn(prog, argv[i], sub, (sizeof(sub)/sizeof((sub)[0])))) {
    printf("-no match-\n");
    continue;
   }
   printf("match");
   for(k=MAXSUB; k>0; k--)
    if(sub[k-1])
     break;
   for(l=0; l<k; l+=2) {
    printf(" (");
    if(sub[l] == ((void *)0))
     printf("?");
    else
     printf("%d", (int)(sub[l] - argv[i]));
    printf(",");
    if(sub[l+1] == ((void *)0))
     printf("?");
    else
     printf("%d", (int)(sub[l+1] - argv[i]));
    printf(")");
   }
   printf("\n");
  }
 }
 return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: i int

variable_types: j int

variable_types: k int

variable_types: l int

variable_types: struct Regexp { int type; int n; int ch; struct Regexp *left; struct Regexp *right; } *

variable_types: struct Prog { struct Inst { int opcode; int c; int n; struct Inst *x; struct Inst *y; int gen; } *start; int len; } *

variable_types:
sub
char *[-1]

user_defined_types: struct Prog { struct Inst *start; int len; }


fatal

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

va_start(arg, format);
fwrite("fatal error: ", 1uLL, 0xDuLL, stderr);
vfprintf(stderr, format, arg);
fputc(10, stderr);
exit(2);
}

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

va_start(arg, format);
fwrite("fatal error: ", 1uLL, 0xDuLL, stderr);
vfprintf(stderr, format, arg);
fputc(10, stderr);
exit(2);
}

original_code:
void
fatal(char *fmt, ...)
{
 va_list arg;
 __builtin_va_start(arg,fmt);
 fprintf(stderr, "fatal error: ");
 vfprintf(stderr, fmt, arg);
 fprintf(stderr, "\n");
 __builtin_va_end(arg);
 exit(2);
}

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

variable_types:
fmt
char *


yyparse

decompiled_code:
__int64 yyparse()
{
__int64 v0; // r15
unsigned __int64 v1; // rbp
__int64 *v2; // r13
__int16 *v3; // rbx
__int16 *v4; // r14
unsigned int v5; // er12
int v6; // eax
__int16 *v7; // rdx
unsigned __int64 v8; // rax
__int64 v9; // rbx
__int16 *v10; // rax
__int16 *v11; // r12
size_t v12; // r13
char *v13; // r10
int v14; // eax
unsigned __int8 v15; // di
unsigned __int64 v16; // rcx
_QWORD *v17; // rax
__int64 *v18; // rdi
int v19; // esi
int v20; // eax
int v21; // ecx
unsigned int v22; // eax
_QWORD *v23; // rax
_QWORD *v24; // rax
__int64 v25; // rsi
int v26; // edi
_QWORD *v27; // rax
__int64 v28; // rsi
int v29; // edi
_QWORD *v30; // rax
_QWORD *v31; // rax
_QWORD *v32; // rax
__int64 result; // rax
__int64 v34; // rdx
char *v35; // [rsp+8h] [rbp-820h]
char *v36; // [rsp+8h] [rbp-820h]
unsigned int v37; // [rsp+8h] [rbp-820h]
unsigned __int64 v38; // [rsp+10h] [rbp-818h]
void *ptr; // [rsp+18h] [rbp-810h]
__int16 src[200]; // [rsp+20h] [rbp-808h] BYREF
char v41[1656]; // [rsp+1B0h] [rbp-678h] BYREF

v0 = 0LL;
v1 = 200LL;
yynerrs = 0;
v2 = (__int64 *)v41;
v3 = src;
src[0] = 0;
yychar = -2;
v4 = src;
v35 = v41;
do
{
v5 = yypact[v0];
if ( v5 == -8 )
{
LABEL_23:
if ( !yydefact[v0] )
{
++yynerrs;
yyerror("syntax error");
}
v15 = yyr2[(unsigned __int8)yydefact[v0]];
v16 = v2[1 - v15];
switch ( v0 )
{
case 1LL:
v23 = reg(3, 0LL, 0LL);
v18 = v2 - 1;
v7 = v3 - 1;
v19 = 6;
v16 = (unsigned __int64)v23;
*((_DWORD *)v23 + 2) = *(_DWORD *)v2;
v20 = -8;
goto LABEL_26;
case 2LL:
v18 = v2;
v19 = 5;
++nparen;
v7 = v3;
v16 = (unsigned int)nparen | v16 & 0xFFFFFFFF00000000LL;
v20 = -8;
goto LABEL_26;
case 3LL:
v17 = reg(4, 0LL, 0LL);
v18 = v2 - 1;
v7 = v3 - 1;
v19 = 6;
v16 = (unsigned __int64)v17;
v20 = -8;
goto LABEL_26;
case 12LL:
parsed_regexp = *(v2 - 1);
return 1LL;
case 14LL:
v31 = reg(2, *(v2 - 1), *v2);
v18 = v2 - 2;
v7 = v3 - 2;
v19 = 3;
v16 = (unsigned __int64)v31;
v20 = 6;
goto LABEL_26;
case 15LL:
v28 = *(v2 - 1);
v29 = 7;
goto LABEL_36;
case 16LL:
v28 = *(v2 - 1);
v29 = 6;
goto LABEL_36;
case 17LL:
v28 = *(v2 - 1);
v29 = 8;
LABEL_36:
v30 = reg(v29, v28, 0LL);
v18 = v2 - 2;
v7 = v3 - 2;
v19 = 4;
v16 = (unsigned __int64)v30;
v20 = -6;
goto LABEL_26;
case 20LL:
v32 = reg(1, *(v2 - 2), *v2);
v18 = v2 - 3;
v7 = v3 - 3;
v19 = 2;
v16 = (unsigned __int64)v32;
v20 = -7;
goto LABEL_26;
case 21LL:
v25 = *(v2 - 2);
v26 = 7;
goto LABEL_34;
case 22LL:
v25 = *(v2 - 2);
v26 = 6;
goto LABEL_34;
case 23LL:
v25 = *(v2 - 2);
v26 = 8;
LABEL_34:
v27 = reg(v26, v25, 0LL);
v18 = v2 - 3;
v7 = v3 - 3;
v19 = 4;
*((_DWORD *)v27 + 1) = 1;
v16 = (unsigned __int64)v27;
v20 = -6;
break;
case 25LL:
v24 = reg(5, *(v2 - 1), 0LL);
v18 = v2 - 4;
v7 = v3 - 4;
v19 = 6;
v16 = (unsigned __int64)v24;
*((_DWORD *)v24 + 1) = *((_DWORD *)v2 - 4);
v20 = -8;
break;
case 26LL:
v16 = *(v2 - 1);
v18 = v2 - 5;
v7 = v3 - 5;
v19 = 6;
v20 = -8;
break;
default:
v34 = v15;
v19 = (unsigned __int8)yyr1[(unsigned __int8)yydefact[v0]] - 13;
v18 = &v2[-v15];
v20 = yypgoto[v19];
v7 = &v3[-v34];
break;
}
goto LABEL_26;
}
v14 = yychar;
if ( yychar == -2 )
{
v14 = yylex();
yychar = v14;
}
if ( v14 > 0 )
{
if ( v14 <= 259 )
{
v6 = (unsigned __int8)yytranslate[v14];
v5 += v6;
}
else
{
v5 += 2;
v6 = 2;
}
if ( v5 > 0x16 )
goto LABEL_23;
}
else
{
yychar = 0;
v6 = 0;
if ( v5 > 0x16 )
goto LABEL_23;
}
if ( (unsigned __int8)yycheck[v5] != v6 )
goto LABEL_23;
v0 = (unsigned __int8)yytable[v5];
if ( yytable[v5] )
{
++v2;
v7 = v3;
yychar = -2;
*v2 = yylval;
goto LABEL_8;
}
v16 = v2[1];
v7 = v3;
v18 = v2;
v19 = -13;
v20 = 17;
LABEL_26:
v18[1] = v16;
v21 = *v7;
v2 = v18 + 1;
v22 = v21 + v20;
if ( v22 <= 0x16 && v21 == (unsigned __int8)yycheck[v22] )
v0 = (unsigned __int8)yytable[v22];
else
v0 = yydefgoto[v19];
LABEL_8:
v8 = 2 * v1;
v7[1] = v0;
v3 = v7 + 1;
if ( v7 + 1 >= &v4[v1 - 1] )
{
v9 = (char *)v3 - (char *)v4;
if ( v1 > 0x270F )
goto LABEL_53;
v1 = 10000LL;
if ( v8 <= 0x2710 )
v1 = v8;
v10 = (__int16 *)malloc(10 * v1 + 7);
v11 = v10;
if ( !v10 )
LABEL_53:
yyerror("memory exhausted");
ptr = v10;
memcpy(v10, v4, v9 + 2);
v12 = 8 * ((v9 >> 1) + 1);
v38 = 2 * v1;
v13 = (char *)memcpy(&v11[v1], v35, v12);
if ( v4 != src )
{
v36 = v13;
free(v4);
v13 = v36;
}
v3 = (__int16 *)((char *)v11 + v9);
v2 = (__int64 *)&v13[v12 - 8];
if ( v3 >= &v11[v38 / 2 - 1] )
{
LODWORD(result) = 1;
goto LABEL_50;
}
v35 = v13;
v4 = v11;
}
}
while ( (_DWORD)v0 != 11 );
result = 0LL;
if ( v4 == src )
return result;
ptr = v4;
LABEL_50:
v37 = result;
free(ptr);
return v37;
}

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

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen];
  ;
  switch (yyn)
    {
        case 2:
    {
  parsed_regexp = (yyvsp[-1].re);
  return 1;
 }
    break;
  case 4:
    {
  (yyval.re) = reg(Alt, (yyvsp[-2].re), (yyvsp[0].re));
 }
    break;
  case 6:
    {
  (yyval.re) = reg(Cat, (yyvsp[-1].re), (yyvsp[0].re));
 }
    break;
  case 8:
    {
  (yyval.re) = reg(Star, (yyvsp[-1].re), ((void*)0));
 }
    break;
  case 9:
    {
  (yyval.re) = reg(Star, (yyvsp[-2].re), ((void*)0));
  (yyval.re)->n = 1;
 }
    break;
  case 10:
    {
  (yyval.re) = reg(Plus, (yyvsp[-1].re), ((void*)0));
 }
    break;
  case 11:
    {
  (yyval.re) = reg(Plus, (yyvsp[-2].re), ((void*)0));
  (yyval.re)->n = 1;
 }
    break;
  case 12:
    {
  (yyval.re) = reg(Quest, (yyvsp[-1].re), ((void*)0));
 }
    break;
  case 13:
    {
  (yyval.re) = reg(Quest, (yyvsp[-2].re), ((void*)0));
  (yyval.re)->n = 1;
 }
    break;
  case 14:
    {
  (yyval.nparen) = ++nparen;
 }
    break;
  case 15:
    {
  (yyval.re) = reg(Paren, (yyvsp[-1].re), ((void*)0));
  (yyval.re)->n = (yyvsp[-2].nparen);
 }
    break;
  case 16:
    {
  (yyval.re) = (yyvsp[-1].re);
 }
    break;
  case 17:
    {
  (yyval.re) = reg(Lit, ((void*)0), ((void*)0));
  (yyval.re)->ch = (yyvsp[0].c);
 }
    break;
  case 18:
    {
  (yyval.re) = reg(Dot, ((void*)0), ((void*)0));
 }
    break;
      default: break;
    }
  ;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  *++yyvsp = yyval;
  {
    const int yylhs = yyr1[yyn] - 13;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 22 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned) (yychar) <= 259 ? yytranslate[yychar] : 2);
  if (!yyerrstatus)
    {
      ++yynerrs;
      yyerror ("syntax error");
    }
  if (yyerrstatus == 3)
    {
      if (yychar <= 0)
        {
          if (yychar == 0)
            goto yyabortlab;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = (-2);
        }
    }
  goto yyerrlab1;
yyerrorlab:
  if (0)
    goto yyerrorlab;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-8))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 22 && yycheck[yyn] == 1)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }
      if (yyssp == yyss)
        goto yyabortlab;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
      yystate = *yyssp;
      ;
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

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

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

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

  goto yynewstate;
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen];
  ;
  switch (yyn)
    {
        case 2:
    {
  parsed_regexp = (yyvsp[-1].re);
  return 1;
 }
    break;
  case 4:
    {
  (yyval.re) = reg(Alt, (yyvsp[-2].re), (yyvsp[0].re));
 }
    break;
  case 6:
    {
  (yyval.re) = reg(Cat, (yyvsp[-1].re), (yyvsp[0].re));
 }
    break;
  case 8:
    {
  (yyval.re) = reg(Star, (yyvsp[-1].re), ((void *)0));
 }
    break;
  case 9:
    {
  (yyval.re) = reg(Star, (yyvsp[-2].re), ((void *)0));
  (yyval.re)->n = 1;
 }
    break;
  case 10:
    {
  (yyval.re) = reg(Plus, (yyvsp[-1].re), ((void *)0));
 }
    break;
  case 11:
    {
  (yyval.re) = reg(Plus, (yyvsp[-2].re), ((void *)0));
  (yyval.re)->n = 1;
 }
    break;
  case 12:
    {
  (yyval.re) = reg(Quest, (yyvsp[-1].re), ((void *)0));
 }
    break;
  case 13:
    {
  (yyval.re) = reg(Quest, (yyvsp[-2].re), ((void *)0));
  (yyval.re)->n = 1;
 }
    break;
  case 14:
    {
  (yyval.nparen) = ++nparen;
 }
    break;
  case 15:
    {
  (yyval.re) = reg(Paren, (yyvsp[-1].re), ((void *)0));
  (yyval.re)->n = (yyvsp[-2].nparen);
 }
    break;
  case 16:
    {
  (yyval.re) = (yyvsp[-1].re);
 }
    break;
  case 17:
    {
  (yyval.re) = reg(Lit, ((void *)0), ((void *)0));
  (yyval.re)->ch = (yyvsp[0].c);
 }
    break;
  case 18:
    {
  (yyval.re) = reg(Dot, ((void *)0), ((void *)0));
 }
    break;
      default: break;
    }
  ;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  *++yyvsp = yyval;
  {
    int yylhs = yyr1[yyn] - 13;
    int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= 22 && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }
  goto yynewstate;
yyerrlab:
  yytoken = yychar == (-2) ? (-2) : ((unsigned int) (yychar) <= 259 ? yytranslate[yychar] : 2);
  if (!yyerrstatus)
    {
      ++yynerrs;
      yyerror ("syntax error");
    }
  if (yyerrstatus == 3)
    {
      if (yychar <= 0)
        {
          if (yychar == 0)
            goto yyabortlab;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = (-2);
        }
    }
  goto yyerrlab1;
yyerrorlab:
  if (0)
    goto yyerrorlab;
  (yyvsp -= (yylen), yyssp -= (yylen));
  yylen = 0;
  ;
  yystate = *yyssp;
  goto yyerrlab1;
yyerrlab1:
  yyerrstatus = 3;
  for (;;)
    {
      yyn = yypact[yystate];
      if (!(!!((yyn) == (-8))))
        {
          yyn += 1;
          if (0 <= yyn && yyn <= 22 && yycheck[yyn] == 1)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }
      if (yyssp == yyss)
        goto yyabortlab;
      yydestruct ("Error: popping",
                  yystos[yystate], yyvsp);
      (yyvsp -= (1), yyssp -= (1));
      yystate = *yyssp;
      ;
    }

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop

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

variable_types: yystate int

variable_types: yyerrstatus int

variable_types:
yyssa
short [200]

variable_types:
yyss
short *

variable_types:
yyssp
short *

variable_types: union YYSTYPE { struct Regexp { int type; int n; int ch; struct Regexp *left; struct Regexp *right; } *re; int c; int nparen; } [200]

variable_types: union YYSTYPE { struct Regexp { int type; int n; int ch; struct Regexp *left; struct Regexp *right; } *re; int c; int nparen; } *

variable_types:
yystacksize
unsigned long

variable_types: yyn int

variable_types: yyresult int

variable_types: yytoken int

variable_types: yylen int

variable_types:
yysize
unsigned long

variable_types: union yyalloc { short yyss_alloc; union YYSTYPE { struct Regexp { int type; int n; int ch; struct Regexp *left; struct Regexp *right; } *re; int c; int nparen; } yyvs_alloc; } *

variable_types:
yynewbytes
unsigned long

variable_types: yylhs int

variable_types: yyi int

user_defined_types: union YYSTYPE { struct Regexp *re; int c; int nparen; }

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


printre

decompiled_code:
int __fastcall printre(__int64 a1)
{
int result; // eax

switch ( *(_DWORD *)a1 )
{
case 1:
printf("Alt(");
goto LABEL_7;
case 2:
printf("Cat(");
LABEL_7:
printre(*(_QWORD *)(a1 + 16));
printf(", ");
printre(*(_QWORD *)(a1 + 24));
return putchar(41);
case 3:
return printf("Lit(%c)", *(unsigned int *)(a1 + 8));
case 4:
return printf("Dot");
case 5:
printf("Paren(%d, ", *(unsigned int *)(a1 + 4));
goto LABEL_5;
case 6:
if ( *(_DWORD *)(a1 + 4) )
printf("Ng");
printf("Quest(");
goto LABEL_5;
case 7:
if ( *(_DWORD *)(a1 + 4) )
printf("Ng");
printf("Star(");
goto LABEL_5;
case 8:
if ( *(_DWORD *)(a1 + 4) )
printf("Ng");
printf("Plus(");
LABEL_5:
printre(*(_QWORD *)(a1 + 16));
result = putchar(41);
break;
default:
result = printf("???");
break;
}
return result;
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1)
{
int result; // eax

switch ( *(_DWORD *)a1 )
{
case 1:
printf("Alt(");
goto LABEL_7;
case 2:
printf("Cat(");
LABEL_7:
func5(*(_QWORD *)(a1 + 16));
printf(", ");
func5(*(_QWORD *)(a1 + 24));
return putchar(41);
case 3:
return printf("Lit(%c)", *(unsigned int *)(a1 + 8));
case 4:
return printf("Dot");
case 5:
printf("Paren(%d, ", *(unsigned int *)(a1 + 4));
goto LABEL_5;
case 6:
if ( *(_DWORD *)(a1 + 4) )
printf("Ng");
printf("Quest(");
goto LABEL_5;
case 7:
if ( *(_DWORD *)(a1 + 4) )
printf("Ng");
printf("Star(");
goto LABEL_5;
case 8:
if ( *(_DWORD *)(a1 + 4) )
printf("Ng");
printf("Plus(");
LABEL_5:
func5(*(_QWORD *)(a1 + 16));
result = putchar(41);
break;
default:
result = printf("???");
break;
}
return result;
}

original_code:
void
printre(Regexp *r)
{
 switch(r->type) {
 default:
  printf("???");
  break;
 case Alt:
  printf("Alt(");
  printre(r->left);
  printf(", ");
  printre(r->right);
  printf(")");
  break;
 case Cat:
  printf("Cat(");
  printre(r->left);
  printf(", ");
  printre(r->right);
  printf(")");
  break;
 case Lit:
  printf("Lit(%c)", r->ch);
  break;
 case Dot:
  printf("Dot");
  break;
 case Paren:
  printf("Paren(%d, ", r->n);
  printre(r->left);
  printf(")");
  break;
 case Star:
  if(r->n)
   printf("Ng");
  printf("Star(");
  printre(r->left);
  printf(")");
  break;
 case Plus:
  if(r->n)
   printf("Ng");
  printf("Plus(");
  printre(r->left);
  printf(")");
  break;
 case Quest:
  if(r->n)
   printf("Ng");
  printf("Quest(");
  printre(r->left);
  printf(")");
  break;
 }
}

canonical_original_code:
void printre(struct Regexp *r)
{
 switch(r->type) {
 default:
  printf("???");
  break;
 case Alt:
  printf("Alt(");
  printre(r->left);
  printf(", ");
  printre(r->right);
  printf(")");
  break;
 case Cat:
  printf("Cat(");
  printre(r->left);
  printf(", ");
  printre(r->right);
  printf(")");
  break;
 case Lit:
  printf("Lit(%c)", r->ch);
  break;
 case Dot:
  printf("Dot");
  break;
 case Paren:
  printf("Paren(%d, ", r->n);
  printre(r->left);
  printf(")");
  break;
 case Star:
  if(r->n)
   printf("Ng");
  printf("Star(");
  printre(r->left);
  printf(")");
  break;
 case Plus:
  if(r->n)
   printf("Ng");
  printf("Plus(");
  printre(r->left);
  printf(")");
  break;
 case Quest:
  if(r->n)
   printf("Ng");
  printf("Quest(");
  printre(r->left);
  printf(")");
  break;
 }
}

variable_types: struct Regexp { int type; int n; int ch; struct Regexp *left; struct Regexp *right; } *


yylex

decompiled_code:
__int64 yylex()
{
char v0; // dl
unsigned int v1; // er12

if ( !input )
return 259LL;
v0 = *(_BYTE *)input;
v1 = 259;
if ( !*(_BYTE *)input )
return v1;
v1 = v0;
++input;
if ( strchr("|*+?():.", v0) )
return v1;
LODWORD(yylval) = v1;
return 258LL;
}

canonical_decompiled_code:
__int64 func0()
{
char v0; // dl
unsigned int v1; // er12

if ( !input )
return 259LL;
v0 = *(_BYTE *)input;
v1 = 259;
if ( !*(_BYTE *)input )
return v1;
v1 = v0;
++input;
if ( strchr("|*+?():.", v0) )
return v1;
LODWORD(yylval) = v1;
return 258LL;
}

original_code:
static int
yylex(void)
{
 int c;
 if(input == ((void *)0) || *input == 0)
  return 259;
 c = *input++;
 if(strchr("|*+?():.", c))
  return c;
 yylval.c = c;
 return 258;
}

canonical_original_code:
static int yylex()
{
 int c;
 if(input == ((void *)0) || *input == 0)
  return 259;
 c = *input++;
 if(strchr("|*+?():.", c))
  return c;
 yylval.c = c;
 return 258;
}

variable_types: c int


yyerror

decompiled_code:
void __fastcall __noreturn yyerror(const char *a1)
{
fatal("%s", a1);
}

canonical_decompiled_code:
void __fastcall __noreturn func2(const char *a1)
{
func1("%s", a1);
}

original_code:
static void
yyerror(char *s)
{
 fatal("%s", s);
}

variable_types:
s
char *


mal

decompiled_code:
void *__fastcall mal(int a1)
{
void *result; // rax

result = calloc(a1, 1uLL);
if ( !result )
fatal("out of memory");
return result;
}

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

result = calloc(a1, 1uLL);
if ( !result )
func1("out of memory");
return result;
}

original_code:
void*
mal(int n)
{
 void *v;
 v = malloc(n);
 if(v == ((void*)0))
  fatal("out of memory");
 memset(v, 0, n);
 return v;
}

canonical_original_code:
void *mal(int n)
{
 void *v;
 v = malloc(n);
 if(v == ((void *)0))
  fatal("out of memory");
 memset(v, 0, n);
 return v;
}

variable_types: n int

variable_types:
v
void *

return_type: void *