isnonretcall

decompiled_code:
__int64 __fastcall isnonretcall(__int64 a1)
{
int v1; // er8
__int64 result; // rax

v1 = exprop();
result = 0LL;
if ( v1 == 51 )
result = (unsigned int)*(char *)(*(_QWORD *)(decls + 8LL * *(_QWORD *)(a1 + 56)) + 120LL);
return result;
}

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

v1 = exprop();
result = 0LL;
if ( v1 == 51 )
result = (unsigned int)*(char *)(*(_QWORD *)(decls + 8LL * *(_QWORD *)(a1 + 56)) + 120LL);
return result;
}

original_code:
static int
isnonretcall(Node *fn)
{
 Node *dcl;
 if (exprop(fn) != Ovar)
  return 0;
 dcl = decls[fn->expr.did];
 return dcl->decl.isnoret;
}

canonical_original_code:
static int isnonretcall(struct Node *fn)
{
 struct Node *dcl;
 if (exprop(fn) != Ovar)
  return 0;
 dcl = decls[fn->expr.did];
 return dcl->decl.isnoret;
}

user_defined_types: enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 }

user_defined_types: enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 }

user_defined_types: enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 }

user_defined_types: enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 }

user_defined_types: struct Str { unsigned long len; char *buf; }

user_defined_types: struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; }

user_defined_types: enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 }

user_defined_types: struct Bitset { unsigned long nchunks; unsigned long *chunks; }

user_defined_types: struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; }

user_defined_types: struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; }

user_defined_types: struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; }


islabel

repo: oridb/mc

decompiled_code:
_BOOL8 __fastcall islabel(__int64 a1)
{
__int64 v2; // rax

if ( *(_DWORD *)(a1 + 8) != 8 )
return 0LL;
if ( (unsigned int)exprop() == 53 )
{
v2 = **(_QWORD **)(a1 + 80);
if ( *(_DWORD *)(v2 + 8) == 9 )
return *(_DWORD *)(v2 + 24) == 6;
}
return 0LL;
}

original_code:
static int
islabel(Node *n)
{
 Node *l;
 if (n->type != Nexpr)
  return 0;
 if (exprop(n) != Olit)
  return 0;
 l = n->expr.args[0];
 if (l->type != Nlit)
  return 0;
 if (l->lit.littype != Llbl)
  return 0;
 return 1;
}

canonical_original_code:
static int islabel(struct Node *n)
{
 struct Node *l;
 if (n->type != Nexpr)
  return 0;
 if (exprop(n) != Olit)
  return 0;
 l = n->expr.args[0];
 if (l->type != Nlit)
  return 0;
 if (l->lit.littype != Llbl)
  return 0;
 return 1;
}

variable_types: struct Node { struct Srcloc { int line; int file; } loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv { struct Tyenv *super; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *tab; } *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } *

return_type: int

user_defined_types: struct Node { struct Srcloc loc; enum Ntype type; int nid; char inferred; union { struct { enum Op op; struct Type *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis vis; char isproto; char isextern; } impl; }; }

user_defined_types: struct Type { enum Ty type; unsigned int tid; struct Srcloc loc; enum Vis vis; struct Traitspec **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; }

user_defined_types: struct Trait { int uid; struct Srcloc loc; enum Vis vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; }

user_defined_types: struct Tyenv { struct Tyenv *super; struct Htab *tab; }


addnode

decompiled_code:
__int64 __fastcall addnode(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int v6; // eax
__int64 v7; // rsi
__int64 v8; // rdi

v6 = exprop(a3);
v7 = a2 + 32;
v8 = a2 + 24;
if ( v6 != 59 )
{
if ( v6 > 0x3B )
{
if ( v6 != 62 )
{
LABEL_8:
lappend(v8, v7, a3);
return 0LL;
}
}
else
{
if ( v6 == 45 )
{
lappend(v8, v7, a3);
return isnonretcall(**(_QWORD **)(a3 + 80));
}
if ( v6 - 47 > 1 )
goto LABEL_8;
}
lappend(v8, v7, a3);
lappend(a1 + 56, a1 + 64, a3);
lappend(a1 + 72, a1 + 80, a2);
return 1LL;
}
lappend(v8, v7, a3);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int v6; // eax
__int64 v7; // rsi
__int64 v8; // rdi

v6 = exprop(a3);
v7 = a2 + 32;
v8 = a2 + 24;
if ( v6 != 59 )
{
if ( v6 > 0x3B )
{
if ( v6 != 62 )
{
LABEL_8:
lappend(v8, v7, a3);
return 0LL;
}
}
else
{
if ( v6 == 45 )
{
lappend(v8, v7, a3);
return func2(**(_QWORD **)(a3 + 80));
}
if ( v6 - 47 > 1 )
goto LABEL_8;
}
lappend(v8, v7, a3);
lappend(a1 + 56, a1 + 64, a3);
lappend(a1 + 72, a1 + 80, a2);
return 1LL;
}
lappend(v8, v7, a3);
return 1LL;
}

original_code:
static int
addnode(Cfg *cfg, Bb *bb, Node *n)
{
 switch (exprop(n)) {
 case Ojmp:
 case Ocjmp:
 case Oret:
  lappend(&bb->nl, &bb->nnl, n);
  lappend(&cfg->fixjmp, &cfg->nfixjmp, n);
  lappend(&cfg->fixblk, &cfg->nfixblk, bb);
  return 1;
 case Ocall:
  lappend(&bb->nl, &bb->nnl, n);
  return isnonretcall(n->expr.args[0]);
 case Odead:
  lappend(&bb->nl, &bb->nnl, n);
  return 1;
 default:
  lappend(&bb->nl, &bb->nnl, n);
  break;
 }
 return 0;
}

canonical_original_code:
static int addnode(struct Cfg *cfg, struct Bb *bb, struct Node *n)
{
 switch (exprop(n)) {
 case Ojmp:
 case Ocjmp:
 case Oret:
  lappend(&bb->nl, &bb->nnl, n);
  lappend(&cfg->fixjmp, &cfg->nfixjmp, n);
  lappend(&cfg->fixblk, &cfg->nfixblk, bb);
  return 1;
 case Ocall:
  lappend(&bb->nl, &bb->nnl, n);
  return isnonretcall(n->expr.args[0]);
 case Odead:
  lappend(&bb->nl, &bb->nnl, n);
  return 1;
 default:
  lappend(&bb->nl, &bb->nnl, n);
  break;
 }
 return 0;
}

variable_types: struct Cfg { struct Node { struct Srcloc { int line; int file; } loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv { struct Tyenv *super; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *tab; } *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } *fn; struct Bb { int id; char **lbls; unsigned long nlbls; struct Node **nl; unsigned long nnl; struct Bitset *pred; struct Bitset *succ; } **bb; struct Bb *start; struct Bb *end; unsigned long nbb; int nextbbid; struct Htab *lblmap; struct Node **fixjmp; unsigned long nfixjmp; struct Bb **fixblk; unsigned long nfixblk; } *

variable_types:
bb
struct Bb *

variable_types:
n
struct Node *

user_defined_types: struct Cfg { struct Node *fn; struct Bb **bb; struct Bb *start; struct Bb *end; unsigned long nbb; int nextbbid; struct Htab *lblmap; struct Node **fixjmp; unsigned long nfixjmp; struct Bb **fixblk; unsigned long nfixblk; }


label

decompiled_code:
__int64 __fastcall label(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rax

v4 = lblstr(a2);
return strlabel(a1, v4, a3);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rax

v4 = lblstr(a2);
return func1(a1, v4, a3);
}

original_code:
static void
label(Cfg *cfg, Node *lbl, Bb *bb)
{
 strlabel(cfg, lblstr(lbl), bb);
}

canonical_original_code:
static void label(struct Cfg *cfg, struct Node *lbl, struct Bb *bb)
{
 strlabel(cfg, lblstr(lbl), bb);
}

variable_types:
lbl
struct Node *

return_type: void

user_defined_types: struct Bb { int id; char **lbls; unsigned long nlbls; struct Node **nl; unsigned long nnl; struct Bitset *pred; struct Bitset *succ; }


mkbb

original_code:
static Bb *
mkbb(Cfg *cfg)
{
 Bb *bb;
 bb = zalloc(sizeof(Bb));
 bb->id = cfg->nextbbid++;
 bb->pred = mkbs();
 bb->succ = mkbs();
 lappend(&cfg->bb, &cfg->nbb, bb);
 return bb;
}

canonical_original_code:
static struct Bb *mkbb(struct Cfg *cfg)
{
 struct Bb *bb;
 bb = zalloc(sizeof(Bb));
 bb->id = cfg->nextbbid++;
 bb->pred = mkbs();
 bb->succ = mkbs();
 lappend(&cfg->bb, &cfg->nbb, bb);
 return bb;
}

variable_types: struct Cfg { struct Node *fn; struct Bb **bb; struct Bb *start; struct Bb *end; unsigned long nbb; int nextbbid; struct Htab *lblmap; struct Node **fixjmp; unsigned long nfixjmp; struct Bb **fixblk; unsigned long nfixblk; } *

variable_types: struct Bb { int id; char **lbls; unsigned long nlbls; struct Node { struct Srcloc { int line; int file; } loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv { struct Tyenv *super; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *tab; } *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } **nl; unsigned long nnl; struct Bitset *pred; struct Bitset *succ; } *


addlabel

original_code:
static Bb *
addlabel(Cfg *cfg, Bb *bb, Node **nl, size_t i, Srcloc loc)
{
 if (i > 0 && nl[i - 1]->type == Nexpr) {
  if (exprop(nl[i - 1]) != Ocjmp && exprop(nl[i - 1]) != Ojmp)
   addnode(cfg, bb, mkexpr(loc, Ojmp, mklbl(loc, lblstr(nl[i])), ((void *)0)));
 }
 if (bb->nnl)
  bb = mkbb(cfg);
 label(cfg, nl[i], bb);
 return bb;
}

canonical_original_code:
static struct Bb *addlabel(struct Cfg *cfg, struct Bb *bb, struct Node **nl, unsigned long i, struct Srcloc loc)
{
 if (i > 0 && nl[i - 1]->type == Nexpr) {
  if (exprop(nl[i - 1]) != Ocjmp && exprop(nl[i - 1]) != Ojmp)
   addnode(cfg, bb, mkexpr(loc, Ojmp, mklbl(loc, lblstr(nl[i])), ((void *)0)));
 }
 if (bb->nnl)
  bb = mkbb(cfg);
 label(cfg, nl[i], bb);
 return bb;
}

variable_types:
nl
struct Node **

variable_types:
i
unsigned long

variable_types:
loc
struct Srcloc

return_type: struct Bb { int id; char **lbls; unsigned long nlbls; struct Node { struct Srcloc { int line; int file; } loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv { struct Tyenv *super; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *tab; } *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } **nl; unsigned long nnl; struct Bitset *pred; struct Bitset *succ; } *


noexit

decompiled_code:
__int64 __fastcall noexit(__int64 a1, int *a2)
{
__int64 v3[4]; // [rsp+8h] [rbp-20h] BYREF

v3[0] = 0LL;
while ( (unsigned int)bsiter(*((_QWORD *)a2 + 6), v3) )
bsdel(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v3[0]++) + 40LL), *a2);
return bsclear(*((_QWORD *)a2 + 6));
}

original_code:
void
noexit(Cfg *cfg, Bb *bb)
{
 size_t i;
 for (i = 0; bsiter(bb->succ, &i); i++)
  bsdel(cfg->bb[i]->pred, bb->id);
 bsclear(bb->succ);
}

canonical_original_code:
void noexit(struct Cfg *cfg, struct Bb *bb)
{
 unsigned long i;
 for (i = 0; bsiter(bb->succ, &i); i++)
  bsdel(cfg->bb[i]->pred, bb->id);
 bsclear(bb->succ);
}

user_defined_types: enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 }


trimdead

decompiled_code:
void __fastcall trimdead(__int64 a1, __int64 a2)
{
__int64 v2; // rbp
unsigned int v3; // eax

if ( !a2 || !*(_QWORD *)(a2 + 32) )
return;
v2 = 0LL;
while ( 1 )
{
v3 = exprop(*(_QWORD *)(*(_QWORD *)(a2 + 24) + 8 * v2));
if ( v3 == 59 )
break;
if ( v3 > 0x3B )
{
if ( v3 == 62 )
goto LABEL_11;
goto LABEL_8;
}
if ( v3 == 45 )
{
if ( (unsigned int)isnonretcall(**(_QWORD **)(*(_QWORD *)(*(_QWORD *)(a2 + 24) + 8 * v2) + 80LL)) )
break;
LABEL_8:
if ( *(_QWORD *)(a2 + 32) <= (unsigned __int64)++v2 )
return;
}
else
{
if ( v3 - 47 <= 1 )
goto LABEL_11;
if ( *(_QWORD *)(a2 + 32) <= (unsigned __int64)++v2 )
return;
}
}
noexit(a1, (int *)a2);
LABEL_11:
*(_QWORD *)(a2 + 32) = v2 + 1;
}

original_code:
void
trimdead(Cfg *cfg, Bb *bb)
{
 size_t i;
 if (!bb)
  return;
 for (i = 0; i < bb->nnl; i++) {
  switch (exprop(bb->nl[i])) {
  case Ojmp:
  case Ocjmp:
  case Oret:
   bb->nnl = i + 1;
   return;
  case Odead:
   noexit(cfg, bb);
   bb->nnl = i + 1;
   return;
  case Ocall:
   if (isnonretcall(bb->nl[i]->expr.args[0])) {
    noexit(cfg, bb);
    bb->nnl = i + 1;
    return;
   }
   break;
  default:
   break;
  }
 }
}

canonical_original_code:
void trimdead(struct Cfg *cfg, struct Bb *bb)
{
 unsigned long i;
 if (!bb)
  return;
 for (i = 0; i < bb->nnl; i++) {
  switch (exprop(bb->nl[i])) {
  case Ojmp:
  case Ocjmp:
  case Oret:
   bb->nnl = i + 1;
   return;
  case Odead:
   noexit(cfg, bb);
   bb->nnl = i + 1;
   return;
  case Ocall:
   if (isnonretcall(bb->nl[i]->expr.args[0])) {
    noexit(cfg, bb);
    bb->nnl = i + 1;
    return;
   }
   break;
  default:
   break;
  }
 }
}

user_defined_types: enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 }


trim

decompiled_code:
void __fastcall trim(_QWORD *a1)
{
int v1; // er13
unsigned __int64 v2; // r12
unsigned __int64 v3; // rdx
_QWORD *v4; // rbp

v1 = 0;
v2 = 0LL;
v3 = a1[4];
LABEL_2:
if ( v3 <= v2 )
goto LABEL_8;
do
{
do
{
while ( 1 )
{
v4 = *(_QWORD **)(a1[1] + 8 * v2++);
if ( (_QWORD *)a1[2] == v4 || (_QWORD *)a1[3] == v4 )
goto LABEL_2;
trimdead((__int64)a1, (__int64)v4);
if ( !v4 || !(unsigned int)bsisempty(v4[5]) )
break;
v1 = 1;
delete(a1, v4);
v3 = a1[4];
if ( v3 <= v2 )
goto LABEL_9;
}
v3 = a1[4];
}
while ( v3 > v2 );
LABEL_8:
if ( !v1 )
return;
LABEL_9:
v2 = 0LL;
v1 = 0;
}
while ( v3 );
}

canonical_decompiled_code:
void __fastcall func11(_QWORD *a1)
{
int v1; // er13
unsigned __int64 v2; // r12
unsigned __int64 v3; // rdx
_QWORD *v4; // rbp

v1 = 0;
v2 = 0LL;
v3 = a1[4];
LABEL_2:
if ( v3 <= v2 )
goto LABEL_8;
do
{
do
{
while ( 1 )
{
v4 = *(_QWORD **)(a1[1] + 8 * v2++);
if ( (_QWORD *)a1[2] == v4 || (_QWORD *)a1[3] == v4 )
goto LABEL_2;
func10((__int64)a1, (__int64)v4);
if ( !v4 || !(unsigned int)bsisempty(v4[5]) )
break;
v1 = 1;
func8(a1, v4);
v3 = a1[4];
if ( v3 <= v2 )
goto LABEL_9;
}
v3 = a1[4];
}
while ( v3 > v2 );
LABEL_8:
if ( !v1 )
return;
LABEL_9:
v2 = 0LL;
v1 = 0;
}
while ( v3 );
}

original_code:
void
trim(Cfg *cfg)
{
 Bb *bb;
 size_t i;
 int deleted;
 deleted = 1;
 while (deleted) {
  deleted = 0;
  for (i = 0; i < cfg->nbb; i++) {
   bb = cfg->bb[i];
   if (bb == cfg->start || bb == cfg->end)
    continue;
   trimdead(cfg, bb);
   if (bb && bsisempty(bb->pred)) {
    delete(cfg, bb);
    deleted = 1;
   }
  }
 }
}

canonical_original_code:
void trim(struct Cfg *cfg)
{
 struct Bb *bb;
 unsigned long i;
 int deleted;
 deleted = 1;
 while (deleted) {
  deleted = 0;
  for (i = 0; i < cfg->nbb; i++) {
   bb = cfg->bb[i];
   if (bb == cfg->start || bb == cfg->end)
    continue;
   trimdead(cfg, bb);
   if (bb && bsisempty(bb->pred)) {
    delete(cfg, bb);
    deleted = 1;
   }
  }
 }
}

variable_types: deleted int

user_defined_types: enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 }


islocal

decompiled_code:
_BOOL8 __fastcall islocal(__int64 a1)
{
_BOOL8 result; // rax

result = 0LL;
if ( !*(_BYTE *)(a1 + 112) )
result = (*(_DWORD *)(a1 + 116) & 0xFF0000FF) == 0;
return result;
}

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

result = 0LL;
if ( !*(_BYTE *)(a1 + 112) )
result = (*(_DWORD *)(a1 + 116) & 0xFF0000FF) == 0;
return result;
}

original_code:
static int
islocal(Node *dcl)
{
 if (dcl->decl.vis != Visintern)
  return 0;
 if (dcl->decl.isimport || dcl->decl.isextern)
  return 0;
 return 1;
}

canonical_original_code:
static int islocal(struct Node *dcl)
{
 if (dcl->decl.vis != Visintern)
  return 0;
 if (dcl->decl.isimport || dcl->decl.isextern)
  return 0;
 return 1;
}

user_defined_types: enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 }


genlocallblstr

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

if ( asmsyntax == 2 )
result = genlblstr(a1, 128LL, "<>");
else
result = genlblstr(a1, 128LL, &unk_562);
return result;
}

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

if ( asmsyntax == 2 )
result = genlblstr(a1, 128LL, "<>");
else
result = genlblstr(a1, 128LL, &unk_562);
return result;
}

original_code:
char *
genlocallblstr(char *buf, size_t sz)
{
 if (asmsyntax == Plan9)
  return genlblstr(buf, 128, "<>");
 else
  return genlblstr(buf, 128, "");
}

canonical_original_code:
char *genlocallblstr(char *buf, unsigned long sz)
{
 if (asmsyntax == Plan9)
  return genlblstr(buf, 128, "<>");
 else
  return genlblstr(buf, 128, "");
}

variable_types:
buf
char *

variable_types:
sz
unsigned long

return_type: char *


asmname

decompiled_code:
char *__fastcall asmname(__int64 a1)
{
__int64 v1; // rax
const char *v2; // rdx
const char *v3; // r8
const char *v4; // rcx
const char *v5; // r9
char s[1032]; // [rsp+0h] [rbp-408h] BYREF

v1 = *(_QWORD *)(a1 + 32);
v2 = (const char *)&unk_562;
v3 = *(const char **)(v1 + 24);
v4 = *(const char **)(v1 + 32);
if ( asmsyntax == 2 && islocal(a1) )
v2 = "<>";
if ( !v3 || (v5 = "$", !*v3) )
{
v5 = (const char *)&unk_562;
v3 = (const char *)&unk_562;
}
bprintf(s, 1024LL, "%s%s%s%s%s", (const char *)&unk_562, v3, v5, v4, v2);
return strdup(s);
}

canonical_decompiled_code:
char *__fastcall func4(__int64 a1)
{
__int64 v1; // rax
const char *v2; // rdx
const char *v3; // r8
const char *v4; // rcx
const char *v5; // r9
char s[1032]; // [rsp+0h] [rbp-408h] BYREF

v1 = *(_QWORD *)(a1 + 32);
v2 = (const char *)&unk_562;
v3 = *(const char **)(v1 + 24);
v4 = *(const char **)(v1 + 32);
if ( asmsyntax == 2 && func0(a1) )
v2 = "<>";
if ( !v3 || (v5 = "$", !*v3) )
{
v5 = (const char *)&unk_562;
v3 = (const char *)&unk_562;
}
bprintf(s, 1024LL, "%s%s%s%s%s", (const char *)&unk_562, v3, v5, v4, v2);
return strdup(s);
}

original_code:
char *
asmname(Node *dcl)
{
 char buf[1024];
 char *vis, *pf, *ns, *name, *sep;
 Node *n;
 n = dcl->decl.name;
 pf = "";
 ns = n->name.ns;
 name = n->name.name;
 vis = "";
 sep = "";
 if (asmsyntax == Plan9)
  if (islocal(dcl))
   vis = "<>";
 if (!ns || !ns[0])
  ns = "";
 else
  sep = "$";
 if (name[0] == '.')
  pf = "";
 bprintf(buf, sizeof buf, "%s%s%s%s%s", pf, ns, sep, name, vis);
 return strdup(buf);
}

canonical_original_code:
char *asmname(struct Node *dcl)
{
 char buf[1024];
 char *vis; char *pf; char *ns; char *name; char *sep;
 struct Node *n;
 n = dcl->decl.name;
 pf = "";
 ns = n->name.ns;
 name = n->name.name;
 vis = "";
 sep = "";
 if (asmsyntax == Plan9)
  if (islocal(dcl))
   vis = "<>";
 if (!ns || !ns[0])
  ns = "";
 else
  sep = "$";
 if (name[0] == '.')
  pf = "";
 bprintf(buf, sizeof buf, "%s%s%s%s%s", pf, ns, sep, name, vis);
 return strdup(buf);
}

variable_types:
buf
char [1024]

variable_types:
vis
char *

variable_types:
pf
char *

variable_types:
ns
char *

variable_types:
name
char *

variable_types:
sep
char *

user_defined_types: struct Str { unsigned long len; char *buf; }


fillglobls

decompiled_code:
void __fastcall fillglobls(__int64 a1, __int64 a2)
{
_QWORD *v3; // r13
unsigned __int64 i; // rbx
char *v5; // rax
__int64 v6; // rbp
unsigned __int64 v7; // r13
__int64 v8; // r14
_QWORD *v9; // r15
unsigned __int64 v10; // rbx
__int64 v11; // rsi
__int64 v12; // rbp
char *v13; // rax
_QWORD *ptr; // [rsp+8h] [rbp-50h]
unsigned __int64 v15; // [rsp+10h] [rbp-48h] BYREF
unsigned __int64 v16[8]; // [rsp+18h] [rbp-40h] BYREF

v3 = (_QWORD *)htkeys(*(_QWORD *)(a1 + 24), &v15);
if ( v15 )
{
for ( i = 0LL; i < v15; ++i )
{
v6 = htget(*(_QWORD *)(a1 + 24), v3[i]);
if ( (unsigned int)isconstfn(v6) )
*(_QWORD *)(v6 + 40) = codetype();
v5 = asmname(v6);
htput(a2, v6, v5);
}
}
free(v3);
ptr = (_QWORD *)htkeys(file[20], v16);
if ( v16[0] )
{
v7 = 0LL;
do
{
v8 = htget(file[20], ptr[v7]);
v9 = (_QWORD *)htkeys(*(_QWORD *)(v8 + 24), &v15);
if ( v15 )
{
v10 = 0LL;
do
{
v11 = v9[v10++];
v12 = htget(*(_QWORD *)(v8 + 24), v11);
v13 = asmname(v12);
htput(a2, v12, v13);
}
while ( v15 > v10 );
}
++v7;
free(v9);
}
while ( v16[0] > v7 );
}
free(ptr);
}

original_code:
void
fillglobls(Stab *st, Htab *globls)
{
 size_t i, j, nk, nns;
 void **k, **ns;
 Stab *stab;
 Node *s;
 k = htkeys(st->dcl, &nk);
 for (i = 0; i < nk; i++) {
  s = htget(st->dcl, k[i]);
  if (isconstfn(s))
   s->decl.type = codetype(s->decl.type);
  htput(globls, s, asmname(s));
 }
 free(k);
 ns = htkeys(file.ns, &nns);
 for (j = 0; j < nns; j++) {
  stab = htget(file.ns, ns[j]);
  k = htkeys(stab->dcl, &nk);
  for (i = 0; i < nk; i++) {
   s = htget(stab->dcl, k[i]);
   htput(globls, s, asmname(s));
  }
  free(k);
 }
 free(ns);
}

canonical_original_code:
void fillglobls(struct Stab *st, struct Htab *globls)
{
 unsigned long i; unsigned long j; unsigned long nk; unsigned long nns;
 void **k; void **ns;
 struct Stab *stab;
 struct Node *s;
 k = htkeys(st->dcl, &nk);
 for (i = 0; i < nk; i++) {
  s = htget(st->dcl, k[i]);
  if (isconstfn(s))
   s->decl.type = codetype(s->decl.type);
  htput(globls, s, asmname(s));
 }
 free(k);
 ns = htkeys(file.ns, &nns);
 for (j = 0; j < nns; j++) {
  stab = htget(file.ns, ns[j]);
  k = htkeys(stab->dcl, &nk);
  for (i = 0; i < nk; i++) {
   s = htget(stab->dcl, k[i]);
   htput(globls, s, asmname(s));
  }
  free(k);
 }
 free(ns);
}

variable_types: struct Stab { struct Stab *super; char *name; char isfunc; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node { struct Srcloc { int line; int file; } loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv { struct Tyenv *super; struct Htab *tab; } *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *

variable_types:
globls
struct Htab *

variable_types:
j
unsigned long

variable_types:
nk
unsigned long

variable_types:
nns
unsigned long

variable_types:
k
void **

variable_types:
ns
void **

variable_types: struct Node { struct Srcloc { int line; int file; } loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv { struct Tyenv *super; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *tab; } *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } *


initconsts

decompiled_code:
__int64 __fastcall initconsts(__int64 a1)
{
__int64 v1; // rax
_DWORD *v2; // rax
_DWORD *v3; // r12
__int64 v4; // r13
__int64 v5; // rax
__int64 v6; // rbx
char *v7; // rax
__int64 result; // rax
__int64 v9; // rdx

tyintptr = mktype(0xFFFFFFFFLL, 14LL);
tyword = mktype(0xFFFFFFFFLL, 12LL);
tyvoid = mktype(0xFFFFFFFFLL, 1LL);
v1 = mktype(0xFFFFFFFFLL, 1LL);
v2 = (_DWORD *)mktyfunc(0xFFFFFFFFLL, 0LL, 0LL, v1);
*v2 = 30;
v3 = v2;
v4 = mknsname(0xFFFFFFFFLL, "_rt", "abort_oob");
v5 = mkdecl(0xFFFFFFFFLL, v4, v3);
*(_BYTE *)(v5 + 114) = 1;
v6 = v5;
*(_BYTE *)(v5 + 116) = 1;
v7 = asmname(v5);
htput(a1, v6, v7);
result = mkexpr(0xFFFFFFFFLL, 51LL, v4, 0LL);
v9 = *(_QWORD *)(v6 + 24);
*(_QWORD *)(result + 32) = v3;
*(_QWORD *)(result + 56) = v9;
*(_DWORD *)(result + 48) = 1;
abortoob = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
__int64 v1; // rax
_DWORD *v2; // rax
_DWORD *v3; // r12
__int64 v4; // r13
__int64 v5; // rax
__int64 v6; // rbx
char *v7; // rax
__int64 result; // rax
__int64 v9; // rdx

tyintptr = mktype(0xFFFFFFFFLL, 14LL);
tyword = mktype(0xFFFFFFFFLL, 12LL);
tyvoid = mktype(0xFFFFFFFFLL, 1LL);
v1 = mktype(0xFFFFFFFFLL, 1LL);
v2 = (_DWORD *)mktyfunc(0xFFFFFFFFLL, 0LL, 0LL, v1);
*v2 = 30;
v3 = v2;
v4 = mknsname(0xFFFFFFFFLL, "_rt", "abort_oob");
v5 = mkdecl(0xFFFFFFFFLL, v4, v3);
*(_BYTE *)(v5 + 114) = 1;
v6 = v5;
*(_BYTE *)(v5 + 116) = 1;
v7 = func4(v5);
htput(a1, v6, v7);
result = mkexpr(0xFFFFFFFFLL, 51LL, v4, 0LL);
v9 = *(_QWORD *)(v6 + 24);
*(_QWORD *)(result + 32) = v3;
*(_QWORD *)(result + 56) = v9;
*(_DWORD *)(result + 48) = 1;
abortoob = result;
return result;
}

original_code:
void
initconsts(Htab *globls)
{
 Type *ty;
 Node *name;
 Node *dcl;
 tyintptr = mktype(((Srcloc){-1, 0}), Tyuint64);
 tyword = mktype(((Srcloc){-1, 0}), Tyuint);
 tyvoid = mktype(((Srcloc){-1, 0}), Tyvoid);
 ty = mktyfunc(((Srcloc){-1, 0}), ((void *)0), 0, mktype(((Srcloc){-1, 0}), Tyvoid));
 ty->type = Tycode;
 name = mknsname(((Srcloc){-1, 0}), "_rt", "abort_oob");
 dcl = mkdecl(((Srcloc){-1, 0}), name, ty);
 dcl->decl.isconst = 1;
 dcl->decl.isextern = 1;
 htput(globls, dcl, asmname(dcl));
 abortoob = mkexpr(((Srcloc){-1, 0}), Ovar, name, ((void *)0));
 abortoob->expr.type = ty;
 abortoob->expr.did = dcl->decl.did;
 abortoob->expr.isconst = 1;
}

canonical_original_code:
void initconsts(struct Htab *globls)
{
 struct Type *ty;
 struct Node *name;
 struct Node *dcl;
 tyintptr = mktype(((struct Srcloc){-1, 0}), Tyuint64);
 tyword = mktype(((struct Srcloc){-1, 0}), Tyuint);
 tyvoid = mktype(((struct Srcloc){-1, 0}), Tyvoid);
 ty = mktyfunc(((struct Srcloc){-1, 0}), ((void *)0), 0, mktype(((struct Srcloc){-1, 0}), Tyvoid));
 ty->type = Tycode;
 name = mknsname(((struct Srcloc){-1, 0}), "_rt", "abort_oob");
 dcl = mkdecl(((struct Srcloc){-1, 0}), name, ty);
 dcl->decl.isconst = 1;
 dcl->decl.isextern = 1;
 htput(globls, dcl, asmname(dcl));
 abortoob = mkexpr(((struct Srcloc){-1, 0}), Ovar, name, ((void *)0));
 abortoob->expr.type = ty;
 abortoob->expr.did = dcl->decl.did;
 abortoob->expr.isconst = 1;
}

variable_types: struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc { int line; int file; } loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node { struct Srcloc loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab { struct Stab *super; char *name; char isfunc; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv { struct Tyenv *super; struct Htab *tab; } *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *

user_defined_types: struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; }


tydescid

original_code:
char *
tydescid(char *buf, size_t bufsz, Type *ty)
{
 char *sep, *ns;
 char *p, *end;
 size_t i;
 sep = "";
 ns = "";
 p = buf;
 end = buf + bufsz;
 ty = tydedup(ty);
 if (ty->type == Tyname) {
  if (ty->name->name.ns) {
   ns = ty->name->name.ns;
   sep = "$";
  }
  if (ty->vis != Visintern || ty->isimport)
   p += bprintf(p, end - p, "_tydesc$%s%s%s", ns, sep, ty->name->name.name, ty->tid);
  else
   p += bprintf(p, end - p, "_tydesc$%s%s%s$%d", ns, sep, ty->name->name.name, ty->tid);
  for (i = 0; i < ty->narg; i++)
   p += tyidfmt(p, end - p, ty->arg[i]);
 } else {
  if (file.globls->name) {
   ns = file.globls->name;
   sep = "$";
  }
  bprintf(buf, bufsz, "_tydesc%s%s$%d",sep, ns, ty->tid);
 }
 return buf;
}

canonical_original_code:
char *tydescid(char *buf, unsigned long bufsz, struct Type *ty)
{
 char *sep; char *ns;
 char *p; char *end;
 unsigned long i;
 sep = "";
 ns = "";
 p = buf;
 end = buf + bufsz;
 ty = tydedup(ty);
 if (ty->type == Tyname) {
  if (ty->name->name.ns) {
   ns = ty->name->name.ns;
   sep = "$";
  }
  if (ty->vis != Visintern || ty->isimport)
   p += bprintf(p, end - p, "_tydesc$%s%s%s", ns, sep, ty->name->name.name, ty->tid);
  else
   p += bprintf(p, end - p, "_tydesc$%s%s%s$%d", ns, sep, ty->name->name.name, ty->tid);
  for (i = 0; i < ty->narg; i++)
   p += tyidfmt(p, end - p, ty->arg[i]);
 } else {
  if (file.globls->name) {
   ns = file.globls->name;
   sep = "$";
  }
  bprintf(buf, bufsz, "_tydesc%s%s$%d",sep, ns, ty->tid);
 }
 return buf;
}

variable_types:
buf
char *

variable_types:
bufsz
unsigned long

variable_types:
p
char *

variable_types:
end
char *

variable_types:
i
unsigned long

user_defined_types: enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 }


firstbit

variable_types:
b
unsigned long

variable_types: n int

variable_types:
bits
char []


mkbs

decompiled_code:
_QWORD *mkbs()
{
_QWORD *v0; // rax
_QWORD *v1; // r12

v0 = (_QWORD *)xalloc(16LL);
*v0 = 1LL;
v1 = v0;
v0[1] = zalloc(8LL);
return v1;
}

canonical_decompiled_code:
_QWORD *func2()
{
_QWORD *v0; // rax
_QWORD *v1; // r12

v0 = (_QWORD *)xalloc(16LL);
*v0 = 1LL;
v1 = v0;
v0[1] = zalloc(8LL);
return v1;
}

original_code:
Bitset *
mkbs()
{
 Bitset *bs;
 bs = xalloc(sizeof(Bitset));
 bs->nchunks = 1;
 bs->chunks = zalloc(1 * sizeof(size_t));
 return bs;
}

canonical_original_code:
struct Bitset *mkbs()
{
 struct Bitset *bs;
 bs = xalloc(sizeof(Bitset));
 bs->nchunks = 1;
 bs->chunks = zalloc(1 * sizeof(unsigned long));
 return bs;
}

variable_types: struct Bitset { unsigned long nchunks; unsigned long *chunks; } *


bsfree

decompiled_code:
void __fastcall bsfree(void *ptr)
{
if ( ptr )
{
free(*((void **)ptr + 1));
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
if ( ptr )
{
free(*((void **)ptr + 1));
free(ptr);
}
}

original_code:
void
bsfree(Bitset *bs)
{
 if (!bs)
  return;
 free(bs->chunks);
 free(bs);
}

canonical_original_code:
void bsfree(struct Bitset *bs)
{
 if (!bs)
  return;
 free(bs->chunks);
 free(bs);
}

user_defined_types: struct Bitset { unsigned long nchunks; unsigned long *chunks; }


bsclear

decompiled_code:
unsigned __int64 *__fastcall bsclear(unsigned __int64 *a1)
{
unsigned __int64 v1; // rdx
unsigned __int64 v2; // rax

if ( !a1 )
return mkbs();
if ( *a1 )
{
v1 = a1[1];
v2 = 0LL;
do
*(_QWORD *)(v1 + 8 * v2++) = 0LL;
while ( *a1 > v2 );
}
return a1;
}

canonical_decompiled_code:
unsigned __int64 *__fastcall func4(unsigned __int64 *a1)
{
unsigned __int64 v1; // rdx
unsigned __int64 v2; // rax

if ( !a1 )
return func2();
if ( *a1 )
{
v1 = a1[1];
v2 = 0LL;
do
*(_QWORD *)(v1 + 8 * v2++) = 0LL;
while ( *a1 > v2 );
}
return a1;
}

original_code:
Bitset *
bsclear(Bitset *bs)
{
 size_t i;
 if (!bs)
  return mkbs();
 for (i = 0; i < bs->nchunks; i++)
  bs->chunks[i] = 0;
 return bs;
}

canonical_original_code:
struct Bitset *bsclear(struct Bitset *bs)
{
 unsigned long i;
 if (!bs)
  return mkbs();
 for (i = 0; i < bs->nchunks; i++)
  bs->chunks[i] = 0;
 return bs;
}

variable_types:
bs
struct Bitset *

return_type: struct Bitset { unsigned long nchunks; unsigned long *chunks; } *


bscount

original_code:
size_t
bscount(Bitset *bs)
{
 size_t i, j, n;
 n = 0;
 for (i = 0; i < bs->nchunks; i++)
  for (j = 0; j < sizeof(size_t) * 8; j++)
   if (bs->chunks[i] & 1ULL << j)
    n++;
 return n;
}

canonical_original_code:
unsigned long bscount(struct Bitset *bs)
{
 unsigned long i; unsigned long j; unsigned long n;
 n = 0;
 for (i = 0; i < bs->nchunks; i++)
  for (j = 0; j < sizeof(unsigned long) * 8; j++)
   if (bs->chunks[i] & 1ULL << j)
    n++;
 return n;
}

variable_types:
j
unsigned long

variable_types:
n
unsigned long

return_type: unsigned long


bsiter

decompiled_code:
__int64 __fastcall bsiter(unsigned __int64 *a1, __int64 *a2)
{
__int64 v2; // rcx
unsigned __int64 v3; // rax
unsigned int v4; // er9
unsigned __int64 v5; // rsi
unsigned __int64 v6; // rdx
__int64 v7; // rdi
int v8; // eax
_QWORD *v9; // r8

v2 = *a2;
v3 = *a1;
v4 = 0;
v5 = (unsigned __int64)*a2 >> 6;
if ( *a1 <= v5 )
return v4;
v6 = a1[1];
v7 = *(_QWORD *)(v6 + 8 * v5) & -(1LL << v2);
if ( !v7 )
{
if ( v3 <= ++v5 )
return v4;
while ( 1 )
{
v7 = *(_QWORD *)(v6 + 8 * v5);
if ( v7 )
break;
if ( v3 == ++v5 )
return 0LL;
}
}
v8 = firstbit(v7);
v4 = 1;
*v9 = v8 + (v5 << 6);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func6(unsigned __int64 *a1, __int64 *a2)
{
__int64 v2; // rcx
unsigned __int64 v3; // rax
unsigned int v4; // er9
unsigned __int64 v5; // rsi
unsigned __int64 v6; // rdx
__int64 v7; // rdi
int v8; // eax
_QWORD *v9; // r8

v2 = *a2;
v3 = *a1;
v4 = 0;
v5 = (unsigned __int64)*a2 >> 6;
if ( *a1 <= v5 )
return v4;
v6 = a1[1];
v7 = *(_QWORD *)(v6 + 8 * v5) & -(1LL << v2);
if ( !v7 )
{
if ( v3 <= ++v5 )
return v4;
while ( 1 )
{
v7 = *(_QWORD *)(v6 + 8 * v5);
if ( v7 )
break;
if ( v3 == ++v5 )
return 0LL;
}
}
v8 = func0(v7);
v4 = 1;
*v9 = v8 + (v5 << 6);
return v4;
}

original_code:
int
bsiter(Bitset *bs, size_t *elt)
{
 size_t b, t, i;
 i = *elt;
 t = i/(8 * sizeof(size_t));
 if (t >= bs->nchunks)
  return 0;
 b = bs->chunks[t];
 b &= ~((1ull << (i%(8 * sizeof(size_t)))) - 1);
 while (!b) {
  ++t;
  if (t >= bs->nchunks)
   return 0;
  b = bs->chunks[t];
 }
 *elt = (8 * sizeof(size_t))*t + firstbit(b);
 return 1;
}

canonical_original_code:
int bsiter(struct Bitset *bs, unsigned long *elt)
{
 unsigned long b; unsigned long t; unsigned long i;
 i = *elt;
 t = i/(8 * sizeof(unsigned long));
 if (t >= bs->nchunks)
  return 0;
 b = bs->chunks[t];
 b &= ~((1ull << (i%(8 * sizeof(unsigned long)))) - 1);
 while (!b) {
  ++t;
  if (t >= bs->nchunks)
   return 0;
  b = bs->chunks[t];
 }
 *elt = (8 * sizeof(unsigned long))*t + firstbit(b);
 return 1;
}

variable_types:
elt
unsigned long *

variable_types:
t
unsigned long


bsmax

decompiled_code:
__int64 __fastcall bsmax(_QWORD *a1)
{
return *a1 << 6;
}

canonical_decompiled_code:
__int64 __fastcall func7(_QWORD *a1)
{
return *a1 << 6;
}

original_code:
size_t
bsmax(Bitset *bs) { return bs->nchunks * (8 * sizeof(size_t)); }

canonical_original_code: unsigned long bsmax(struct Bitset *bs) { return bs->nchunks * (8 * sizeof(unsigned long)); }


bsunion

decompiled_code:
void __fastcall bsunion(unsigned __int64 *a1, unsigned __int64 *a2)
{
unsigned __int64 v2; // rdx
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax

eqsz(a1, a2);
if ( *a1 )
{
v2 = a1[1];
v3 = a2[1];
v4 = 0LL;
do
{
*(_QWORD *)(v2 + 8 * v4) |= *(_QWORD *)(v3 + 8 * v4);
++v4;
}
while ( *a1 > v4 );
}
}

canonical_decompiled_code:
void __fastcall func10(unsigned __int64 *a1, unsigned __int64 *a2)
{
unsigned __int64 v2; // rdx
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax

func1(a1, a2);
if ( *a1 )
{
v2 = a1[1];
v3 = a2[1];
v4 = 0LL;
do
{
*(_QWORD *)(v2 + 8 * v4) |= *(_QWORD *)(v3 + 8 * v4);
++v4;
}
while ( *a1 > v4 );
}
}

original_code:
void
bsunion(Bitset *a, Bitset *b)
{
 size_t i;
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++)
  a->chunks[i] |= b->chunks[i];
}

canonical_original_code:
void bsunion(struct Bitset *a, struct Bitset *b)
{
 unsigned long i;
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++)
  a->chunks[i] |= b->chunks[i];
}

variable_types:
b
struct Bitset *


bsintersect

decompiled_code:
void __fastcall bsintersect(unsigned __int64 *a1, unsigned __int64 *a2)
{
unsigned __int64 v2; // rdx
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax

eqsz(a1, a2);
if ( *a1 )
{
v2 = a1[1];
v3 = a2[1];
v4 = 0LL;
do
{
*(_QWORD *)(v2 + 8 * v4) &= *(_QWORD *)(v3 + 8 * v4);
++v4;
}
while ( *a1 > v4 );
}
}

canonical_decompiled_code:
void __fastcall func11(unsigned __int64 *a1, unsigned __int64 *a2)
{
unsigned __int64 v2; // rdx
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax

func1(a1, a2);
if ( *a1 )
{
v2 = a1[1];
v3 = a2[1];
v4 = 0LL;
do
{
*(_QWORD *)(v2 + 8 * v4) &= *(_QWORD *)(v3 + 8 * v4);
++v4;
}
while ( *a1 > v4 );
}
}

original_code:
void
bsintersect(Bitset *a, Bitset *b)
{
 size_t i;
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++)
  a->chunks[i] &= b->chunks[i];
}

canonical_original_code:
void bsintersect(struct Bitset *a, struct Bitset *b)
{
 unsigned long i;
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++)
  a->chunks[i] &= b->chunks[i];
}


bshash

decompiled_code:
__int64 __fastcall bshash(_QWORD *a1)
{
__int64 result; // rax

if ( a1 )
result = murmurhash2(a1[1], 8LL * *a1);
else
result = 14247517LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(_QWORD *a1)
{
__int64 result; // rax

if ( a1 )
result = murmurhash2(a1[1], 8LL * *a1);
else
result = 14247517LL;
return result;
}

original_code:
ulong
bshash(Bitset *bs)
{
 if (!bs)
  return 14247517;
 else
  return murmurhash2(bs->chunks, bs->nchunks * sizeof(size_t));
}

canonical_original_code:
unsigned long bshash(struct Bitset *bs)
{
 if (!bs)
  return 14247517;
 else
  return murmurhash2(bs->chunks, bs->nchunks * sizeof(unsigned long));
}


bsdiff

decompiled_code:
void __fastcall bsdiff(unsigned __int64 *a1, unsigned __int64 *a2)
{
unsigned __int64 v2; // rcx
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax

eqsz(a1, a2);
if ( *a1 )
{
v2 = a1[1];
v3 = a2[1];
v4 = 0LL;
do
{
*(_QWORD *)(v2 + 8 * v4) &= ~*(_QWORD *)(v3 + 8 * v4);
++v4;
}
while ( *a1 > v4 );
}
}

canonical_decompiled_code:
void __fastcall func13(unsigned __int64 *a1, unsigned __int64 *a2)
{
unsigned __int64 v2; // rcx
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax

func1(a1, a2);
if ( *a1 )
{
v2 = a1[1];
v3 = a2[1];
v4 = 0LL;
do
{
*(_QWORD *)(v2 + 8 * v4) &= ~*(_QWORD *)(v3 + 8 * v4);
++v4;
}
while ( *a1 > v4 );
}
}

original_code:
void
bsdiff(Bitset *a, Bitset *b)
{
 size_t i;
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++)
  a->chunks[i] &= ~b->chunks[i];
}

canonical_original_code:
void bsdiff(struct Bitset *a, struct Bitset *b)
{
 unsigned long i;
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++)
  a->chunks[i] &= ~b->chunks[i];
}


bsissubset

decompiled_code:
__int64 __fastcall bsissubset(unsigned __int64 *a1, unsigned __int64 *a2)
{
__int64 v2; // rax
__int64 v3; // rdx

eqsz(a1, a2);
if ( !*a1 )
return 1LL;
v2 = 0LL;
while ( 1 )
{
v3 = *(_QWORD *)(a1[1] + 8 * v2);
if ( v3 != (v3 & *(_QWORD *)(a2[1] + 8 * v2)) )
break;
if ( ++v2 == *a1 )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func14(unsigned __int64 *a1, unsigned __int64 *a2)
{
__int64 v2; // rax
__int64 v3; // rdx

func1(a1, a2);
if ( !*a1 )
return 1LL;
v2 = 0LL;
while ( 1 )
{
v3 = *(_QWORD *)(a1[1] + 8 * v2);
if ( v3 != (v3 & *(_QWORD *)(a2[1] + 8 * v2)) )
break;
if ( ++v2 == *a1 )
return 1LL;
}
return 0LL;
}

original_code:
int
bsissubset(Bitset *set, Bitset *sub)
{
 size_t i;
 eqsz(set, sub);
 for (i = 0; i < set->nchunks; i++)
  if ((sub->chunks[i] & set->chunks[i]) != set->chunks[i])
   return 0;
 return 1;
}

canonical_original_code:
int bsissubset(struct Bitset *set, struct Bitset *sub)
{
 unsigned long i;
 eqsz(set, sub);
 for (i = 0; i < set->nchunks; i++)
  if ((sub->chunks[i] & set->chunks[i]) != set->chunks[i])
   return 0;
 return 1;
}

variable_types:
sub
struct Bitset *


bsisempty

decompiled_code:
__int64 __fastcall bsisempty(_QWORD *a1)
{
__int64 v1; // rax

if ( !a1 || !*a1 )
return 1LL;
v1 = 0LL;
while ( !*(_QWORD *)(a1[1] + 8 * v1) )
{
if ( ++v1 == *a1 )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func15(_QWORD *a1)
{
__int64 v1; // rax

if ( !a1 || !*a1 )
return 1LL;
v1 = 0LL;
while ( !*(_QWORD *)(a1[1] + 8 * v1) )
{
if ( ++v1 == *a1 )
return 1LL;
}
return 0LL;
}

original_code:
int
bsisempty(Bitset *set)
{
 size_t i;
 if (!set)
  return 1;
 for (i = 0; i < set->nchunks; i++)
  if (set->chunks[i])
   return 0;
 return 1;
}

canonical_original_code:
int bsisempty(struct Bitset *set)
{
 unsigned long i;
 if (!set)
  return 1;
 for (i = 0; i < set->nchunks; i++)
  if (set->chunks[i])
   return 0;
 return 1;
}


bseq

decompiled_code:
_BOOL8 __fastcall bseq(unsigned __int64 *a1, unsigned __int64 *a2)
{
__int64 v2; // rax
_BOOL8 result; // rax

if ( a1 && a2 )
{
eqsz(a1, a2);
if ( *a1 )
{
v2 = 0LL;
while ( *(_QWORD *)(a1[1] + 8 * v2) == *(_QWORD *)(a2[1] + 8 * v2) )
{
if ( ++v2 == *a1 )
goto LABEL_10;
}
return 0LL;
}
LABEL_10:
result = 1LL;
}
else
{
if ( !(unsigned int)bsisempty(a1) )
return 0LL;
result = (unsigned int)bsisempty(a2) != 0;
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func16(unsigned __int64 *a1, unsigned __int64 *a2)
{
__int64 v2; // rax
_BOOL8 result; // rax

if ( a1 && a2 )
{
func1(a1, a2);
if ( *a1 )
{
v2 = 0LL;
while ( *(_QWORD *)(a1[1] + 8 * v2) == *(_QWORD *)(a2[1] + 8 * v2) )
{
if ( ++v2 == *a1 )
goto LABEL_10;
}
return 0LL;
}
LABEL_10:
result = 1LL;
}
else
{
if ( !(unsigned int)func15(a1) )
return 0LL;
result = (unsigned int)func15(a2) != 0;
}
return result;
}

original_code:
int
bseq(Bitset *a, Bitset *b)
{
 size_t i;
 if (!a || !b)
  return bsisempty(a) && bsisempty(b);
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++) {
  if (a->chunks[i] != b->chunks[i])
   return 0;
 }
 return 1;
}

canonical_original_code:
int bseq(struct Bitset *a, struct Bitset *b)
{
 unsigned long i;
 if (!a || !b)
  return bsisempty(a) && bsisempty(b);
 eqsz(a, b);
 for (i = 0; i < a->nchunks; i++) {
  if (a->chunks[i] != b->chunks[i])
   return 0;
 }
 return 1;
}


nopjmp

original_code:
static void
nopjmp(Isel *s, Asmbb *bb, size_t idx)
{
 Insn *jmp;
 Loc *targ;
 Asmbb *nextbb;
 size_t i;
 if (!bb || !bb->ni)
  return;
 targ = ((void *)0);
 if (bb->il[bb->ni - 1]->op == Ijmp) {
  jmp = bb->il[bb->ni - 1];
  if (jmp->args[0]->type == Loclbl)
   targ = jmp->args[0];
 }
 if (!targ)
  return;
 nextbb = ((void *)0);
 for (i = idx + 1; i < s->nbb; i++) {
  nextbb = s->bb[i];
  if (nextbb)
   break;
 }
 if (!nextbb)
  return;
 for (i = 0; i < nextbb->nlbls; i++) {
  if (!strcmp(nextbb->lbls[i], targ->lbl)) {
   bb->ni--;
   break;
  }
 }
}

canonical_original_code:
static void nopjmp(struct Isel *s, struct Asmbb *bb, unsigned long idx)
{
 struct Insn *jmp;
 struct Loc *targ;
 struct Asmbb *nextbb;
 unsigned long i;
 if (!bb || !bb->ni)
  return;
 targ = ((void *)0);
 if (bb->il[bb->ni - 1]->op == Ijmp) {
  jmp = bb->il[bb->ni - 1];
  if (jmp->args[0]->type == Loclbl)
   targ = jmp->args[0];
 }
 if (!targ)
  return;
 nextbb = ((void *)0);
 for (i = idx + 1; i < s->nbb; i++) {
  nextbb = s->bb[i];
  if (nextbb)
   break;
 }
 if (!nextbb)
  return;
 for (i = 0; i < nextbb->nlbls; i++) {
  if (!strcmp(nextbb->lbls[i], targ->lbl)) {
   bb->ni--;
   break;
  }
 }
}

variable_types: struct Isel { char *name; char *cwd; struct Cfg { struct Node { struct Srcloc { int line; int file; } loc; enum Ntype { Nnone=0, Nblock=1, Nifstmt=2, Nloopstmt=3, Niterstmt=4, Nmatchstmt=5, Nmatch=6, Nuse=7, Nexpr=8, Nlit=9, Nname=10, Ndecl=11, Nfunc=12, Nimpl=13 } type; int nid; char inferred; union { struct { enum Op { Obad=0, Oauto=1, Oadd=2, Osub=3, Omul=4, Odiv=5, Omod=6, Oneg=7, Obor=8, Oband=9, Obxor=10, Obsl=11, Obsr=12, Obnot=13, Opreinc=14, Opostinc=15, Opredec=16, Opostdec=17, Oaddr=18, Oderef=19, Olor=20, Oland=21, Olnot=22, Oeq=23, One=24, Ogt=25, Oge=26, Olt=27, Ole=28, Oasn=29, Oaddeq=30, Osubeq=31, Omuleq=32, Odiveq=33, Omodeq=34, Oboreq=35, Obandeq=36, Obxoreq=37, Obsleq=38, Obsreq=39, Oidx=40, Oslice=41, Omemb=42, Otupmemb=43, Osize=44, Ocall=45, Ocast=46, Oret=47, Ojmp=48, Obreak=49, Ocontinue=50, Ovar=51, Ogap=52, Olit=53, Oucon=54, Otup=55, Ostruct=56, Oarr=57, Otern=58, Odead=59, Oundef=60, Odef=61, Ocjmp=62, Ovjmp=63, Oset=64, Osllen=65, Oslbase=66, Outag=67, Oudata=68, Otupget=69, Oblit=70, Oclear=71, Ocallind=72, Otrunc=73, Ozwiden=74, Oswiden=75, Oflt2int=76, Oint2flt=77, Oflt2flt=78, Ofadd=79, Ofsub=80, Ofmul=81, Ofdiv=82, Ofneg=83, Ofeq=84, Ofne=85, Ofgt=86, Ofge=87, Oflt=88, Ofle=89, Oueq=90, Oune=91, Ougt=92, Ouge=93, Oult=94, Oule=95, Numops=96 } op; struct Type { enum Ty { Tybad=0, Tyvoid=1, Tybool=2, Tychar=3, Tyint8=4, Tyint16=5, Tyint=6, Tyint32=7, Tyint64=8, Tybyte=9, Tyuint8=10, Tyuint16=11, Tyuint=12, Tyuint32=13, Tyuint64=14, Tyflt32=15, Tyflt64=16, Tyvalist=17, Typtr=18, Tyfunc=19, Tyslice=20, Tyarray=21, Tytuple=22, Tystruct=23, Tyunion=24, Tyvar=25, Typaram=26, Tyunres=27, Tyname=28, Tygeneric=29, Tycode=30, Ntypes=31 } type; unsigned int tid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; } **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv { struct Tyenv *super; struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; } *tab; } *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; } **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; } *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype { Lchr=0, Lbool=1, Lint=2, Lflt=3, Lstr=4, Lfunc=5, Llbl=6, Lvoid=7 } littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str { unsigned long len; char *buf; } strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab { struct Stab *super; char *name; char isfunc; struct Htab *dcl; struct Htab *env; struct Htab *ty; struct Htab *tr; struct Htab *uc; struct Htab *lbl; struct Htab *impl; struct Node **autotmp; unsigned long nautotmp; struct Node *exit[-1]; unsigned long ndisposed[-1]; } *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait { int uid; struct Srcloc loc; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; struct Node *name; struct Type *param; struct Type **aux; unsigned long naux; struct Node **proto; unsigned long nproto; struct Tyenv *env; char isproto; char ishidden; char isimport; } *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis { Visintern=0, Visexport=1, Vishidden=2, Visbuiltin=3 } vis; char isproto; char isextern; } impl; }; } *fn; struct Bb { int id; char **lbls; unsigned long nlbls; struct Node **nl; unsigned long nnl; struct Bitset *pred; struct Bitset *succ; } **bb; struct Bb *start; struct Bb *end; unsigned long nbb; int nextbbid; struct Htab *lblmap; struct Node **fixjmp; unsigned long nfixjmp; struct Bb **fixblk; unsigned long nfixblk; } *cfg; struct Asmbb { int id; char **lbls; unsigned long nlbls; struct Insn { unsigned long uid; enum AsmOp { Inone=0, Imov=1, Imovt=2, Imovzx=3, Imovsx=4, Ilea=5, Iadd=6, Isub=7, Iimul=8, Iimul_r=9, Imul=10, Idiv=11, Iidiv=12, Icwd=13, Icdq=14, Icqo=15, Ineg=16, Iand=17, Ior=18, Ixor=19, Inot=20, Ishl=21, Isar=22, Ishr=23, Irol=24, Itest=25, Icmp=26, Ipush=27, Ipop=28, Isetz=29, Isetnz=30, Isetl=31, Isetle=32, Isetg=33, Isetge=34, Isetb=35, Isetbe=36, Iseta=37, Isetae=38, Imovs=39, Icvttsd2si=40, Icvttsi2sd=41, Icvttsd2ss=42, Icvttss2sd=43, Iadds=44, Isubs=45, Imuls=46, Idivs=47, Icomis=48, Ixorp=49, Icall=50, Icallind=51, Ijmp=52, Ijz=53, Ijnz=54, Ijl=55, Ijle=56, Ijg=57, Ijge=58, Ijb=59, Ijbe=60, Ija=61, Ijae=62, Iret=63, Ilbl=64, Ifile=65, Iloc=66, Icomment=67 } op; struct Loc { enum Loctype { Locnone=0, Loclbl=1, Locreg=2, Locmem=3, Locmeml=4, Loclit=5, Loclitl=6 } type; enum Mode { ModeNone=0, ModeB=1, ModeW=2, ModeL=3, ModeQ=4, ModeF=5, ModeD=6, Nmode=7 } mode; void *list; union { char *lbl; struct { unsigned long id; enum Reg { Rnone=0, Ral=1, Rcl=2, Rdl=3, Rbl=4, Rsil=5, Rdil=6, Rspl=7, Rbpl=8, Rr8b=9, Rr9b=10, Rr10b=11, Rr11b=12, Rr12b=13, Rr13b=14, Rr14b=15, Rr15b=16, Rah=17, Rch=18, Rdh=19, Rbh=20, Rax=21, Rcx=22, Rdx=23, Rbx=24, Rsi=25, Rdi=26, Rsp=27, Rbp=28, Rr8w=29, Rr9w=30, Rr10w=31, Rr11w=32, Rr12w=33, Rr13w=34, Rr14w=35, Rr15w=36, Reax=37, Recx=38, Redx=39, Rebx=40, Resi=41, Redi=42, Resp=43, Rebp=44, Rr8d=45, Rr9d=46, Rr10d=47, Rr11d=48, Rr12d=49, Rr13d=50, Rr14d=51, Rr15d=52, Rrax=53, Rrcx=54, Rrdx=55, Rrbx=56, Rrsi=57, Rrdi=58, Rrsp=59, Rrbp=60, Rr8=61, Rr9=62, Rr10=63, Rr11=64, Rr12=65, Rr13=66, Rr14=67, Rr15=68, Rxmm0f=69, Rxmm1f=70, Rxmm2f=71, Rxmm3f=72, Rxmm4f=73, Rxmm5f=74, Rxmm6f=75, Rxmm7f=76, Rxmm8f=77, Rxmm9f=78, Rxmm10f=79, Rxmm11f=80, Rxmm12f=81, Rxmm13f=82, Rxmm14f=83, Rxmm15f=84, Rxmm0d=85, Rxmm1d=86, Rxmm2d=87, Rxmm3d=88, Rxmm4d=89, Rxmm5d=90, Rxmm6d=91, Rxmm7d=92, Rxmm8d=93, Rxmm9d=94, Rxmm10d=95, Rxmm11d=96, Rxmm12d=97, Rxmm13d=98, Rxmm14d=99, Rxmm15d=100, Rrip=101, Nreg=102 } colour; } reg; long lit; struct { char *lbldisp; long constdisp; int scale; struct Loc *base; struct Loc *idx; } mem; }; } *args[4]; unsigned long nargs; } **il; unsigned long ni; struct Bitset *pred; struct Bitset *succ; struct Bitset *use; struct Bitset *def; struct Bitset *livein; struct Bitset *liveout; } **bb; unsigned long nbb; struct Asmbb *curbb; struct Node *ret; enum ArgType { ArgVoid=0, ArgReg=1, ArgAggrI=2, ArgAggrF=3, ArgAggrII=4, ArgAggrFI=5, ArgAggrIF=6, ArgAggrFF=7, ArgBig=8 } rettype; struct Htab *spillslots; struct Htab *reglocs; struct Htab *stkoff; struct Htab *envoff; struct Htab *globls; struct Loc *envp; struct Loc *stksz; struct Loc *calleesave[-1]; unsigned long nsaved; unsigned long *gbits; unsigned long **gadj; unsigned long *ngadj; unsigned long *gadjsz; unsigned long nreg; int *degree; int *nuses; struct Loc **aliasmap; struct Bitset *shouldspill; struct Bitset *neverspill; struct Insn ***rmoves; unsigned long *nrmoves; struct Insn **mcoalesced; unsigned long nmcoalesced; struct Insn **mconstrained; unsigned long nmconstrained; struct Insn **mfrozen; unsigned long nmfrozen; struct Bitset *mactiveset; struct Insn **mactive; unsigned long nmactive; struct Bitset *wlmoveset; struct Insn **wlmove; unsigned long nwlmove; struct Loc **wlspill; unsigned long nwlspill; struct Loc **wlfreeze; unsigned long nwlfreeze; struct Loc **wlsimp; unsigned long nwlsimp; struct Loc **selstk; unsigned long nselstk; struct Bitset *coalesced; struct Bitset *spilled; struct Bitset *prepainted; struct Bitset *initial; } *

variable_types:
bb
struct Asmbb *

variable_types:
idx
unsigned long

variable_types: struct Asmbb { int id; char **lbls; unsigned long nlbls; struct Insn { unsigned long uid; enum AsmOp { Inone=0, Imov=1, Imovt=2, Imovzx=3, Imovsx=4, Ilea=5, Iadd=6, Isub=7, Iimul=8, Iimul_r=9, Imul=10, Idiv=11, Iidiv=12, Icwd=13, Icdq=14, Icqo=15, Ineg=16, Iand=17, Ior=18, Ixor=19, Inot=20, Ishl=21, Isar=22, Ishr=23, Irol=24, Itest=25, Icmp=26, Ipush=27, Ipop=28, Isetz=29, Isetnz=30, Isetl=31, Isetle=32, Isetg=33, Isetge=34, Isetb=35, Isetbe=36, Iseta=37, Isetae=38, Imovs=39, Icvttsd2si=40, Icvttsi2sd=41, Icvttsd2ss=42, Icvttss2sd=43, Iadds=44, Isubs=45, Imuls=46, Idivs=47, Icomis=48, Ixorp=49, Icall=50, Icallind=51, Ijmp=52, Ijz=53, Ijnz=54, Ijl=55, Ijle=56, Ijg=57, Ijge=58, Ijb=59, Ijbe=60, Ija=61, Ijae=62, Iret=63, Ilbl=64, Ifile=65, Iloc=66, Icomment=67 } op; struct Loc { enum Loctype { Locnone=0, Loclbl=1, Locreg=2, Locmem=3, Locmeml=4, Loclit=5, Loclitl=6 } type; enum Mode { ModeNone=0, ModeB=1, ModeW=2, ModeL=3, ModeQ=4, ModeF=5, ModeD=6, Nmode=7 } mode; void *list; union { char *lbl; struct { unsigned long id; enum Reg { Rnone=0, Ral=1, Rcl=2, Rdl=3, Rbl=4, Rsil=5, Rdil=6, Rspl=7, Rbpl=8, Rr8b=9, Rr9b=10, Rr10b=11, Rr11b=12, Rr12b=13, Rr13b=14, Rr14b=15, Rr15b=16, Rah=17, Rch=18, Rdh=19, Rbh=20, Rax=21, Rcx=22, Rdx=23, Rbx=24, Rsi=25, Rdi=26, Rsp=27, Rbp=28, Rr8w=29, Rr9w=30, Rr10w=31, Rr11w=32, Rr12w=33, Rr13w=34, Rr14w=35, Rr15w=36, Reax=37, Recx=38, Redx=39, Rebx=40, Resi=41, Redi=42, Resp=43, Rebp=44, Rr8d=45, Rr9d=46, Rr10d=47, Rr11d=48, Rr12d=49, Rr13d=50, Rr14d=51, Rr15d=52, Rrax=53, Rrcx=54, Rrdx=55, Rrbx=56, Rrsi=57, Rrdi=58, Rrsp=59, Rrbp=60, Rr8=61, Rr9=62, Rr10=63, Rr11=64, Rr12=65, Rr13=66, Rr14=67, Rr15=68, Rxmm0f=69, Rxmm1f=70, Rxmm2f=71, Rxmm3f=72, Rxmm4f=73, Rxmm5f=74, Rxmm6f=75, Rxmm7f=76, Rxmm8f=77, Rxmm9f=78, Rxmm10f=79, Rxmm11f=80, Rxmm12f=81, Rxmm13f=82, Rxmm14f=83, Rxmm15f=84, Rxmm0d=85, Rxmm1d=86, Rxmm2d=87, Rxmm3d=88, Rxmm4d=89, Rxmm5d=90, Rxmm6d=91, Rxmm7d=92, Rxmm8d=93, Rxmm9d=94, Rxmm10d=95, Rxmm11d=96, Rxmm12d=97, Rxmm13d=98, Rxmm14d=99, Rxmm15d=100, Rrip=101, Nreg=102 } colour; } reg; long lit; struct { char *lbldisp; long constdisp; int scale; struct Loc *base; struct Loc *idx; } mem; }; } *args[4]; unsigned long nargs; } **il; unsigned long ni; struct Bitset { unsigned long nchunks; unsigned long *chunks; } *pred; struct Bitset *succ; struct Bitset *use; struct Bitset *def; struct Bitset *livein; struct Bitset *liveout; } *

user_defined_types: struct Isel { char *name; char *cwd; struct Cfg *cfg; struct Asmbb **bb; unsigned long nbb; struct Asmbb *curbb; struct Node *ret; enum ArgType rettype; struct Htab *spillslots; struct Htab *reglocs; struct Htab *stkoff; struct Htab *envoff; struct Htab *globls; struct Loc *envp; struct Loc *stksz; struct Loc *calleesave[-1]; unsigned long nsaved; unsigned long *gbits; unsigned long **gadj; unsigned long *ngadj; unsigned long *gadjsz; unsigned long nreg; int *degree; int *nuses; struct Loc **aliasmap; struct Bitset *shouldspill; struct Bitset *neverspill; struct Insn ***rmoves; unsigned long *nrmoves; struct Insn **mcoalesced; unsigned long nmcoalesced; struct Insn **mconstrained; unsigned long nmconstrained; struct Insn **mfrozen; unsigned long nmfrozen; struct Bitset *mactiveset; struct Insn **mactive; unsigned long nmactive; struct Bitset *wlmoveset; struct Insn **wlmove; unsigned long nwlmove; struct Loc **wlspill; unsigned long nwlspill; struct Loc **wlfreeze; unsigned long nwlfreeze; struct Loc **wlsimp; unsigned long nwlsimp; struct Loc **selstk; unsigned long nselstk; struct Bitset *coalesced; struct Bitset *spilled; struct Bitset *prepainted; struct Bitset *initial; }

user_defined_types: struct Insn { unsigned long uid; enum AsmOp op; struct Loc *args[4]; unsigned long nargs; }

user_defined_types: struct Loc { enum Loctype type; enum Mode mode; void *list; union { char *lbl; struct { unsigned long id; enum Reg colour; } reg; long lit; struct { char *lbldisp; long constdisp; int scale; struct Loc *base; struct Loc *idx; } mem; }; }

user_defined_types: struct Asmbb { int id; char **lbls; unsigned long nlbls; struct Insn **il; unsigned long ni; struct Bitset *pred; struct Bitset *succ; struct Bitset *use; struct Bitset *def; struct Bitset *livein; struct Bitset *liveout; }


peep

original_code:
void
peep(Isel *s)
{
 size_t i;
 for (i = 0; i < s->nbb; i++) {
  deadcode(s, s->bb[i]);
  nopjmp(s, s->bb[i], i);
 }
}

canonical_original_code:
void peep(struct Isel *s)
{
 unsigned long i;
 for (i = 0; i < s->nbb; i++) {
  deadcode(s, s->bb[i]);
  nopjmp(s, s->bb[i], i);
 }
}

user_defined_types: enum ArgType { ArgVoid=0, ArgReg=1, ArgAggrI=2, ArgAggrF=3, ArgAggrII=4, ArgAggrFI=5, ArgAggrIF=6, ArgAggrFF=7, ArgBig=8 }

user_defined_types: struct Node { struct Srcloc loc; enum Ntype type; int nid; char inferred; union { struct { enum Op op; struct Type *type; struct Type *param; int isconst; int ispat; unsigned long did; unsigned long nargs; struct Node *idx; struct Node **args; } expr; struct { char *ns; char *name; } name; struct { int islocal; char *name; } use; struct { enum Littype littype; struct Type *type; unsigned long nelt; union { unsigned long long intval; double fltval; unsigned int chrval; struct Str strval; struct { char *lblval; char *lblname; }; int boolval; struct Node *fnval; }; } lit; struct { struct Node *init; struct Node *cond; struct Node *step; struct Node *body; struct Stab *scope; } loopstmt; struct { struct Node *elt; struct Node *seq; struct Node *body; } iterstmt; struct { struct Node *cond; struct Node *iftrue; struct Node *iffalse; } ifstmt; struct { struct Node *val; unsigned long nmatches; struct Node **matches; } matchstmt; struct { struct Node *pat; struct Node *block; } match; struct { struct Stab *scope; unsigned long nstmts; struct Node **stmts; } block; struct { unsigned long did; struct Node *name; struct Type *type; struct Node *init; struct Tyenv *env; struct Trait *trait; struct Htab *impls; struct Node **gimpl; unsigned long ngimpl; struct Node **gtype; unsigned long ngtype; char vis; char isglobl; char isconst; char isgeneric; char isextern; char ispkglocal; char ishidden; char isimport; char isnoret; char isexportval; char isinit; char isfini; } decl; struct { struct Tyenv *env; struct Stab *scope; struct Type *type; unsigned long nargs; struct Node **args; struct Node *body; } func; struct { struct Node *traitname; struct Trait *trait; struct Type *type; struct Type **aux; struct Tyenv *env; unsigned long naux; struct Node **decls; unsigned long ndecls; enum Vis vis; char isproto; char isextern; } impl; }; }

user_defined_types: enum AsmOp { Inone=0, Imov=1, Imovt=2, Imovzx=3, Imovsx=4, Ilea=5, Iadd=6, Isub=7, Iimul=8, Iimul_r=9, Imul=10, Idiv=11, Iidiv=12, Icwd=13, Icdq=14, Icqo=15, Ineg=16, Iand=17, Ior=18, Ixor=19, Inot=20, Ishl=21, Isar=22, Ishr=23, Irol=24, Itest=25, Icmp=26, Ipush=27, Ipop=28, Isetz=29, Isetnz=30, Isetl=31, Isetle=32, Isetg=33, Isetge=34, Isetb=35, Isetbe=36, Iseta=37, Isetae=38, Imovs=39, Icvttsd2si=40, Icvttsi2sd=41, Icvttsd2ss=42, Icvttss2sd=43, Iadds=44, Isubs=45, Imuls=46, Idivs=47, Icomis=48, Ixorp=49, Icall=50, Icallind=51, Ijmp=52, Ijz=53, Ijnz=54, Ijl=55, Ijle=56, Ijg=57, Ijge=58, Ijb=59, Ijbe=60, Ija=61, Ijae=62, Iret=63, Ilbl=64, Ifile=65, Iloc=66, Icomment=67 }

user_defined_types: struct Type { enum Ty type; unsigned int tid; struct Srcloc loc; enum Vis vis; struct Traitspec **spec; unsigned long nspec; struct Type *seqaux; struct Type **gparam; unsigned long ngparam; struct Type **arg; unsigned long narg; struct Type **inst; unsigned long ninst; struct Tyenv *env; struct Type **sub; unsigned long nsub; unsigned long nmemb; struct Bitset *trneed; union { struct Node *name; struct Node *asize; char *pname; struct Node **sdecls; struct Ucon **udecls; }; char hasparams; char isenum; char ishidden; char ispkglocal; char isimport; char isreflect; char isemitted; char resolved; char fixed; char tagged; }

user_defined_types: enum Loctype { Locnone=0, Loclbl=1, Locreg=2, Locmem=3, Locmeml=4, Loclit=5, Loclitl=6 }

user_defined_types: enum Mode { ModeNone=0, ModeB=1, ModeW=2, ModeL=3, ModeQ=4, ModeF=5, ModeD=6, Nmode=7 }

user_defined_types: struct Traitspec { struct Node **trait; unsigned long ntrait; struct Type *param; struct Type *aux; }

user_defined_types: struct Htab { unsigned long nelt; unsigned long ndead; unsigned long sz; unsigned long (*hash)(void *k); int (*cmp)(void *a, void *b); void **keys; void **vals; unsigned long *hashes; char *dead; }

user_defined_types: struct Ucon { struct Srcloc loc; unsigned long id; int synth; struct Node *name; struct Type *utype; struct Type *etype; }


mkblobi

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

result = zalloc(56LL);
*(_DWORD *)result = a1;
*(_QWORD *)(result + 32) = a2;
return result;
}

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

result = zalloc(56LL);
*(_DWORD *)result = a1;
*(_QWORD *)(result + 32) = a2;
return result;
}

original_code:
Blob *
mkblobi(Blobtype type, uint64_t ival)
{
 Blob *b;
 b = zalloc(sizeof(Blob));
 b->type = type;
 b->ival = ival;
 return b;
}

canonical_original_code:
struct Blob *mkblobi(enum Blobtype type, unsigned long ival)
{
 struct Blob *b;
 b = zalloc(sizeof(Blob));
 b->type = type;
 b->ival = ival;
 return b;
}

variable_types:
ival
unsigned long

variable_types: struct Blob { enum Blobtype { Bti8=0, Bti16=1, Bti32=2, Bti64=3, Btimin=4, Btref=5, Btbytes=6, Btseq=7, Btpad=8 } type; unsigned long align; char *lbl; char isglobl; char iscomdat; union { unsigned long long npad; unsigned long long ival; struct { char *str; char isextern; unsigned long off; } ref; struct { unsigned long len; char *buf; } bytes; struct { unsigned long nsub; struct Blob **sub; } seq; }; } *

user_defined_types: struct Blob { enum Blobtype type; unsigned long align; char *lbl; char isglobl; char iscomdat; union { unsigned long long npad; unsigned long long ival; struct { char *str; char isextern; unsigned long off; } ref; struct { unsigned long len; char *buf; } bytes; struct { unsigned long nsub; struct Blob **sub; } seq; }; }