coreg

original_code:
Loc *
coreg(Reg r, Mode m)
{
 ((void) sizeof ((m != ModeNone) ? 1 : 0), __extension__ ({ if (m != ModeNone) ; else __assert_fail ("m != ModeNone", "locs.c", 179, __extension__ __PRETTY_FUNCTION__); }));
 Reg crtab[][Nmode + 1] = {
  [Ral] = {Rnone, Ral, Rax, Reax, Rrax},
  [Rcl] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Rdl] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rbl] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Rsil] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Rdil] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8b] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9b] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10b] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11b] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12b] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13b] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14b] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15b] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Rax] = {Rnone, Ral, Rax, Reax, Rrax},
  [Rcx] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Rdx] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rbx] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Rsi] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Rdi] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8w] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9w] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10w] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11w] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12w] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13w] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14w] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15w] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Reax] = {Rnone, Ral, Rax, Reax, Rrax},
  [Recx] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Redx] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rebx] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Resi] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Redi] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8d] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9d] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10d] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11d] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12d] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13d] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14d] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15d] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Rrax] = {Rnone, Ral, Rax, Reax, Rrax},
  [Rrcx] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Rrdx] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rrbx] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Rrsi] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Rrdi] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Rxmm0f] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm1f] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm2f] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm3f] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm4f] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm5f] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
  [Rxmm6f] = {[ModeF] = Rxmm6f, [ModeD] = Rxmm6d},
  [Rxmm7f] = {[ModeF] = Rxmm7f, [ModeD] = Rxmm7d},
  [Rxmm8f] = {[ModeF] = Rxmm8f, [ModeD] = Rxmm8d},
  [Rxmm9f] = {[ModeF] = Rxmm9f, [ModeD] = Rxmm9d},
  [Rxmm10f] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm11f] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm12f] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm13f] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm14f] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm15f] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
  [Rxmm0d] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm1d] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm2d] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm3d] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm4d] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm5d] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
  [Rxmm6d] = {[ModeF] = Rxmm6f, [ModeD] = Rxmm6d},
  [Rxmm7d] = {[ModeF] = Rxmm7f, [ModeD] = Rxmm7d},
  [Rxmm8d] = {[ModeF] = Rxmm8f, [ModeD] = Rxmm8d},
  [Rxmm9d] = {[ModeF] = Rxmm9f, [ModeD] = Rxmm9d},
  [Rxmm10d] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm11d] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm12d] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm13d] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm14d] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm15d] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
 };
 ((void) sizeof ((crtab[r][m] != Rnone) ? 1 : 0), __extension__ ({ if (crtab[r][m] != Rnone) ; else __assert_fail ("crtab[r][m] != Rnone", "locs.c", 277, __extension__ __PRETTY_FUNCTION__); }));
 return locphysreg(crtab[r][m]);
}

canonical_original_code:
struct Loc *coreg(enum Reg r, enum Mode m)
{
 ((void) sizeof ((m != ModeNone) ? 1 : 0), __extension__ ({ if (m != ModeNone) ; else __assert_fail ("m != ModeNone", "locs.c", 179, __extension__ __PRETTY_FUNCTION__); }));
 enum Reg crtab[][-1] = {
  [Ral] = {Rnone, Ral, Rax, Reax, Rrax},
  [Rcl] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Rdl] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rbl] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Rsil] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Rdil] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8b] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9b] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10b] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11b] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12b] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13b] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14b] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15b] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Rax] = {Rnone, Ral, Rax, Reax, Rrax},
  [Rcx] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Rdx] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rbx] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Rsi] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Rdi] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8w] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9w] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10w] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11w] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12w] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13w] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14w] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15w] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Reax] = {Rnone, Ral, Rax, Reax, Rrax},
  [Recx] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Redx] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rebx] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Resi] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Redi] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8d] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9d] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10d] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11d] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12d] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13d] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14d] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15d] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Rrax] = {Rnone, Ral, Rax, Reax, Rrax},
  [Rrcx] = {Rnone, Rcl, Rcx, Recx, Rrcx},
  [Rrdx] = {Rnone, Rdl, Rdx, Redx, Rrdx},
  [Rrbx] = {Rnone, Rbl, Rbx, Rebx, Rrbx},
  [Rrsi] = {Rnone, Rsil, Rsi, Resi, Rrsi},
  [Rrdi] = {Rnone, Rdil, Rdi, Redi, Rrdi},
  [Rr8] = {Rnone, Rr8b, Rr8w, Rr8d, Rr8},
  [Rr9] = {Rnone, Rr9b, Rr9w, Rr9d, Rr9},
  [Rr10] = {Rnone, Rr10b, Rr10w, Rr10d, Rr10},
  [Rr11] = {Rnone, Rr11b, Rr11w, Rr11d, Rr11},
  [Rr12] = {Rnone, Rr12b, Rr12w, Rr12d, Rr12},
  [Rr13] = {Rnone, Rr13b, Rr13w, Rr13d, Rr13},
  [Rr14] = {Rnone, Rr14b, Rr14w, Rr14d, Rr14},
  [Rr15] = {Rnone, Rr15b, Rr15w, Rr15d, Rr15},
  [Rxmm0f] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm1f] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm2f] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm3f] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm4f] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm5f] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
  [Rxmm6f] = {[ModeF] = Rxmm6f, [ModeD] = Rxmm6d},
  [Rxmm7f] = {[ModeF] = Rxmm7f, [ModeD] = Rxmm7d},
  [Rxmm8f] = {[ModeF] = Rxmm8f, [ModeD] = Rxmm8d},
  [Rxmm9f] = {[ModeF] = Rxmm9f, [ModeD] = Rxmm9d},
  [Rxmm10f] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm11f] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm12f] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm13f] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm14f] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm15f] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
  [Rxmm0d] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm1d] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm2d] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm3d] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm4d] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm5d] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
  [Rxmm6d] = {[ModeF] = Rxmm6f, [ModeD] = Rxmm6d},
  [Rxmm7d] = {[ModeF] = Rxmm7f, [ModeD] = Rxmm7d},
  [Rxmm8d] = {[ModeF] = Rxmm8f, [ModeD] = Rxmm8d},
  [Rxmm9d] = {[ModeF] = Rxmm9f, [ModeD] = Rxmm9d},
  [Rxmm10d] = {[ModeF] = Rxmm0f, [ModeD] = Rxmm0d},
  [Rxmm11d] = {[ModeF] = Rxmm1f, [ModeD] = Rxmm1d},
  [Rxmm12d] = {[ModeF] = Rxmm2f, [ModeD] = Rxmm2d},
  [Rxmm13d] = {[ModeF] = Rxmm3f, [ModeD] = Rxmm3d},
  [Rxmm14d] = {[ModeF] = Rxmm4f, [ModeD] = Rxmm4d},
  [Rxmm15d] = {[ModeF] = Rxmm5f, [ModeD] = Rxmm5d},
 };
 ((void) sizeof ((crtab[r][m] != Rnone) ? 1 : 0), __extension__ ({ if (crtab[r][m] != Rnone) ; else __assert_fail ("crtab[r][m] != Rnone", "locs.c", 277, __extension__ __PRETTY_FUNCTION__); }));
 return locphysreg(crtab[r][m]);
}


foldcast

repo: oridb/mc

decompiled_code:
__int64 __fastcall foldcast(__int64 a1)
{
__int64 v1; // rbx
__int64 v2; // r12
__int64 v3; // rbp
__int64 v4; // r13
unsigned int v5; // eax
unsigned int v7; // eax
int v8; // er13

v1 = a1;
v2 = **(_QWORD **)(a1 + 80);
v3 = ((__int64 (*)(void))exprtype)();
v4 = exprtype(v2);
v5 = *(_DWORD *)tybase(v3);
if ( v5 > 0xE )
{
if ( v5 != 18 )
return v1;
}
else if ( v5 <= 1 )
{
return v1;
}
v7 = *(_DWORD *)tybase(v4);
if ( v7 > 0xE )
{
if ( v7 != 18 )
return v1;
}
else if ( v7 <= 1 )
{
return v1;
}
if ( (unsigned int)exprop(v2) == 53 || (v8 = *(_DWORD *)tybase(v4), v8 == *(_DWORD *)tybase(v3)) )
{
*(_QWORD *)(v2 + 32) = v3;
v1 = v2;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
__int64 v1; // rbx
__int64 v2; // r12
__int64 v3; // rbp
__int64 v4; // r13
unsigned int v5; // eax
unsigned int v7; // eax
int v8; // er13

v1 = a1;
v2 = **(_QWORD **)(a1 + 80);
v3 = ((__int64 (*)(void))exprtype)();
v4 = exprtype(v2);
v5 = *(_DWORD *)tybase(v3);
if ( v5 > 0xE )
{
if ( v5 != 18 )
return v1;
}
else if ( v5 <= 1 )
{
return v1;
}
v7 = *(_DWORD *)tybase(v4);
if ( v7 > 0xE )
{
if ( v7 != 18 )
return v1;
}
else if ( v7 <= 1 )
{
return v1;
}
if ( (unsigned int)exprop(v2) == 53 || (v8 = *(_DWORD *)tybase(v4), v8 == *(_DWORD *)tybase(v3)) )
{
*(_QWORD *)(v2 + 32) = v3;
v1 = v2;
}
return v1;
}

original_code:
static Node *
foldcast(Node *n)
{
 Type *to, *from;
 Node *sub;
 sub = n->expr.args[0];
 to = exprtype(n);
 from = exprtype(sub);
 switch (tybase(to)->type) {
 case Tybool:
 case Tyint8: case Tyint16: case Tyint32: case Tyint64:
 case Tyuint8: case Tyuint16: case Tyuint32: case Tyuint64:
 case Tyint: case Tyuint: case Tychar: case Tybyte:
 case Typtr:
  switch (tybase(from)->type) {
  case Tybool:
  case Tyint8: case Tyint16: case Tyint32: case Tyint64:
  case Tyuint8: case Tyuint16: case Tyuint32: case Tyuint64:
  case Tyint: case Tyuint: case Tychar: case Tybyte:
  case Typtr:
   if (exprop(sub) == Olit || tybase(from)->type == tybase(to)->type) {
    sub->expr.type = to;
    return sub;
   } else {
    return n;
   }
  default:
   return n;
  }
 default:
  return n;
 }
 return n;
}

canonical_original_code:
static struct Node *foldcast(struct Node *n)
{
 struct Type *to; struct Type *from;
 struct Node *sub;
 sub = n->expr.args[0];
 to = exprtype(n);
 from = exprtype(sub);
 switch (tybase(to)->type) {
 case Tybool:
 case Tyint8: case Tyint16: case Tyint32: case Tyint64:
 case Tyuint8: case Tyuint16: case Tyuint32: case Tyuint64:
 case Tyint: case Tyuint: case Tychar: case Tybyte:
 case Typtr:
  switch (tybase(from)->type) {
  case Tybool:
  case Tyint8: case Tyint16: case Tyint32: case Tyint64:
  case Tyuint8: case Tyuint16: case Tyuint32: case Tyuint64:
  case Tyint: case Tyuint: case Tychar: case Tybyte:
  case Typtr:
   if (exprop(sub) == Olit || tybase(from)->type == tybase(to)->type) {
    sub->expr.type = to;
    return sub;
   } else {
    return n;
   }
  default:
   return n;
  }
 default:
  return n;
 }
 return n;
}

variable_types:
n
struct Node *

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; } *

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; }; } *

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 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 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; }


val

decompiled_code:
__int64 __fastcall val(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rbp
__int64 result; // rax

v4 = mkint();
result = mkexpr(a1, 53LL, v4, 0LL);
*(_QWORD *)(v4 + 32) = a3;
*(_QWORD *)(result + 32) = a3;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rbp
__int64 result; // rax

v4 = mkint();
result = mkexpr(a1, 53LL, v4, 0LL);
*(_QWORD *)(v4 + 32) = a3;
*(_QWORD *)(result + 32) = a3;
return result;
}

original_code:
static Node *
val(Srcloc loc, vlong val, Type *t)
{
 Node *l, *n;
 l = mkint(loc, val);
 n = mkexpr(loc, Olit, l, ((void *)0));
 l->lit.type = t;
 n->expr.type = t;
 return n;
}

canonical_original_code:
static struct Node *val(struct Srcloc loc, long long val, struct Type *t)
{
 struct Node *l; struct Node *n;
 l = mkint(loc, val);
 n = mkexpr(loc, Olit, l, ((void *)0));
 l->lit.type = t;
 n->expr.type = t;
 return n;
}

variable_types:
loc
struct Srcloc

variable_types:
val
long long

variable_types:
t
struct Type *

return_type: 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; }; } *

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


getintlit

decompiled_code:
__int64 __fastcall getintlit(__int64 a1, _QWORD *a2)
{
int v2; // edx
__int64 result; // rax
__int64 *v4; // rax
__int64 v5; // rdx
int v6; // ecx

v2 = exprop(a1);
result = 0LL;
if ( v2 == 53 )
{
v4 = *(__int64 **)(a1 + 80);
v5 = *v4;
v6 = *(_DWORD *)(*v4 + 24);
if ( v6 == 2 )
{
*a2 = *(_QWORD *)(v5 + 48);
result = 1LL;
}
else
{
result = 0LL;
if ( !v6 )
{
*a2 = *(unsigned int *)(v5 + 48);
result = 1LL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, _QWORD *a2)
{
int v2; // edx
__int64 result; // rax
__int64 *v4; // rax
__int64 v5; // rdx
int v6; // ecx

v2 = exprop(a1);
result = 0LL;
if ( v2 == 53 )
{
v4 = *(__int64 **)(a1 + 80);
v5 = *v4;
v6 = *(_DWORD *)(*v4 + 24);
if ( v6 == 2 )
{
*a2 = *(_QWORD *)(v5 + 48);
result = 1LL;
}
else
{
result = 0LL;
if ( !v6 )
{
*a2 = *(unsigned int *)(v5 + 48);
result = 1LL;
}
}
}
return result;
}

original_code:
int
getintlit(Node *n, vlong *v)
{
 Node *l;
 if (exprop(n) != Olit)
  return 0;
 l = n->expr.args[0];
 if (l->lit.littype == Lint)
  *v = l->lit.intval;
 else if (l->lit.littype == Lchr)
  *v = l->lit.chrval;
 else
  return 0;
 return 1;
}

canonical_original_code:
int getintlit(struct Node *n, long long *v)
{
 struct Node *l;
 if (exprop(n) != Olit)
  return 0;
 l = n->expr.args[0];
 if (l->lit.littype == Lint)
  *v = l->lit.intval;
 else if (l->lit.littype == Lchr)
  *v = l->lit.chrval;
 else
  return 0;
 return 1;
}

variable_types:
v
long long *

return_type: int

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; }


idxcmp

decompiled_code:
__int64 __fastcall idxcmp(const void *a1, const void *a2)
{
__int64 v2; // rbx
__int64 result; // rax
__int64 v4; // [rsp+0h] [rbp-18h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v2 = *(_QWORD *)a2;
if ( !(unsigned int)getintlit(*(_QWORD *)(*(_QWORD *)a1 + 72LL), &v5) )
_assert_fail("getintlit(a->expr.idx, &av)", "fold.c", 0x77u, "idxcmp");
if ( !(unsigned int)getintlit(*(_QWORD *)(v2 + 72), &v4) )
_assert_fail("getintlit(b->expr.idx, &bv)", "fold.c", 0x78u, "idxcmp");
result = 0xFFFFFFFFLL;
if ( v5 >= v4 )
result = v5 != v4;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(const void *a1, const void *a2)
{
__int64 v2; // rbx
__int64 result; // rax
__int64 v4; // [rsp+0h] [rbp-18h] BYREF
__int64 v5; // [rsp+8h] [rbp-10h] BYREF

v2 = *(_QWORD *)a2;
if ( !(unsigned int)func3(*(_QWORD *)(*(_QWORD *)a1 + 72LL), &v5) )
_assert_fail("getintlit(a->expr.idx, &av)", "fold.c", 0x77u, "idxcmp");
if ( !(unsigned int)func3(*(_QWORD *)(v2 + 72), &v4) )
_assert_fail("getintlit(b->expr.idx, &bv)", "fold.c", 0x78u, "idxcmp");
result = 0xFFFFFFFFLL;
if ( v5 >= v4 )
result = v5 != v4;
return result;
}

original_code:
int
idxcmp(const void *pa, const void *pb)
{
 Node *a, *b;
 vlong av, bv;
 a = *(Node **)pa;
 b = *(Node **)pb;
 ((void) sizeof ((getintlit(a->expr.idx, &av)) ? 1 : 0), __extension__ ({ if (getintlit(a->expr.idx, &av)) ; else __assert_fail ("getintlit(a->expr.idx, &av)", "fold.c", 119, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((getintlit(b->expr.idx, &bv)) ? 1 : 0), __extension__ ({ if (getintlit(b->expr.idx, &bv)) ; else __assert_fail ("getintlit(b->expr.idx, &bv)", "fold.c", 120, __extension__ __PRETTY_FUNCTION__); }));
 if (av < bv)
  return -1;
 else if (av == bv)
  return 0;
 else
  return 1;
}

canonical_original_code:
int idxcmp(void *pa, void *pb)
{
 struct Node *a; struct Node *b;
 long long av; long long bv;
 a = *(struct Node **)pa;
 b = *(struct Node **)pb;
 ((void) sizeof ((getintlit(a->expr.idx, &av)) ? 1 : 0), __extension__ ({ if (getintlit(a->expr.idx, &av)) ; else __assert_fail ("getintlit(a->expr.idx, &av)", "fold.c", 119, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((getintlit(b->expr.idx, &bv)) ? 1 : 0), __extension__ ({ if (getintlit(b->expr.idx, &bv)) ; else __assert_fail ("getintlit(b->expr.idx, &bv)", "fold.c", 120, __extension__ __PRETTY_FUNCTION__); }));
 if (av < bv)
  return -1;
 else if (av == bv)
  return 0;
 else
  return 1;
}

variable_types:
pa
void *

variable_types:
pb
void *

variable_types:
av
long long

variable_types:
bv
long long


isintval

decompiled_code:
__int64 __fastcall isintval(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

result = getintlit(a1, &v3);
if ( (_DWORD)result )
result = v3 == a2;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

result = func3(a1, &v3);
if ( (_DWORD)result )
result = v3 == a2;
return result;
}

original_code:
static int
isintval(Node *n, vlong val)
{
 vlong v;
 if (!getintlit(n, &v))
  return 0;
 return v == val;
}

canonical_original_code:
static int isintval(struct Node *n, long long val)
{
 long long v;
 if (!getintlit(n, &v))
  return 0;
 return v == val;
}

variable_types:
v
long long


htidx

original_code:
static ssize_t
htidx(Htab *ht, void *k)
{
 ssize_t i;
 ulong h;
 int di;
 di = 0;
 h = hash(ht, k);
 i = h & (ht->sz - 1);
 while (ht->hashes[i] && !ht->dead[i] && ht->hashes[i] != h) {
searchmore:
  di++;
  i = (h + di) & (ht->sz - 1);
 }
 if (!ht->hashes[i])
  return -1;
 if ((ht->hashes[i] == h && ht->dead[i]) || !ht->cmp(ht->keys[i], k))
  goto searchmore;
 return i;
}

canonical_original_code:
static long htidx(struct Htab *ht, void *k)
{
 long i;
 unsigned long h;
 int di;
 di = 0;
 h = hash(ht, k);
 i = h & (ht->sz - 1);
 while (ht->hashes[i] && !ht->dead[i] && ht->hashes[i] != h) {
searchmore:
  di++;
  i = (h + di) & (ht->sz - 1);
 }
 if (!ht->hashes[i])
  return -1;
 if ((ht->hashes[i] == h && ht->dead[i]) || !ht->cmp(ht->keys[i], k))
  goto searchmore;
 return i;
}

variable_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; } *

variable_types:
k
void *

variable_types: i long

variable_types:
h
unsigned long

variable_types: di int

return_type: long


htfree

decompiled_code:
void __fastcall htfree(void *ptr)
{
if ( ptr )
{
free(*((void **)ptr + 5));
free(*((void **)ptr + 6));
free(*((void **)ptr + 7));
free(*((void **)ptr + 8));
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func2(void *ptr)
{
if ( ptr )
{
free(*((void **)ptr + 5));
free(*((void **)ptr + 6));
free(*((void **)ptr + 7));
free(*((void **)ptr + 8));
free(ptr);
}
}

original_code:
void
htfree(Htab *ht)
{
 if (!ht)
  return;
 free(ht->keys);
 free(ht->vals);
 free(ht->hashes);
 free(ht->dead);
 free(ht);
}

canonical_original_code:
void htfree(struct Htab *ht)
{
 if (!ht)
  return;
 free(ht->keys);
 free(ht->vals);
 free(ht->hashes);
 free(ht->dead);
 free(ht);
}

return_type: void


htput

original_code:
int
htput(Htab *ht, void *k, void *v)
{
 int i;
 ulong h;
 int di;
 di = 0;
 h = hash(ht, k);
 i = h & (ht->sz - 1);
 while (ht->hashes[i] && !ht->dead[i]) {
  if (ht->hashes[i] == h) {
   if (ht->dead[i])
    break;
   else if (ht->cmp(ht->keys[i], k))
    goto conflicted;
  }
  di++;
  i = (h + di) & (ht->sz - 1);
 }
 ht->nelt++;
conflicted:
 if (ht->dead[i])
  ht->ndead--;
 ht->hashes[i] = h;
 ht->keys[i] = k;
 ht->vals[i] = v;
 ht->dead[i] = 0;
 if (ht->sz < ht->nelt * 2)
  grow(ht, ht->sz * 2);
 if (ht->sz < ht->ndead * 4)
  grow(ht, ht->sz);
 return 1;
}

canonical_original_code:
int htput(struct Htab *ht, void *k, void *v)
{
 int i;
 unsigned long h;
 int di;
 di = 0;
 h = hash(ht, k);
 i = h & (ht->sz - 1);
 while (ht->hashes[i] && !ht->dead[i]) {
  if (ht->hashes[i] == h) {
   if (ht->dead[i])
    break;
   else if (ht->cmp(ht->keys[i], k))
    goto conflicted;
  }
  di++;
  i = (h + di) & (ht->sz - 1);
 }
 ht->nelt++;
conflicted:
 if (ht->dead[i])
  ht->ndead--;
 ht->hashes[i] = h;
 ht->keys[i] = k;
 ht->vals[i] = v;
 ht->dead[i] = 0;
 if (ht->sz < ht->nelt * 2)
  grow(ht, ht->sz * 2);
 if (ht->sz < ht->ndead * 4)
  grow(ht, ht->sz);
 return 1;
}

variable_types:
v
void *

variable_types: i int


grow

original_code:
static void
grow(Htab *ht, int sz)
{
 void **oldk;
 void **oldv;
 ulong *oldh;
 char *oldd;
 int oldsz;
 int i;
 oldk = ht->keys;
 oldv = ht->vals;
 oldh = ht->hashes;
 oldd = ht->dead;
 oldsz = ht->sz;
 ht->nelt = 0;
 ht->ndead = 0;
 ht->sz = sz;
 ht->keys = zalloc(sz * sizeof(void *));
 ht->vals = zalloc(sz * sizeof(void *));
 ht->hashes = zalloc(sz * sizeof(void *));
 ht->dead = zalloc(sz * sizeof(void *));
 for (i = 0; i < oldsz; i++)
  if (oldh[i] && !oldd[i])
   htput(ht, oldk[i], oldv[i]);
 free(oldh);
 free(oldk);
 free(oldv);
 free(oldd);
}

canonical_original_code:
static void grow(struct Htab *ht, int sz)
{
 void **oldk;
 void **oldv;
 unsigned long *oldh;
 char *oldd;
 int oldsz;
 int i;
 oldk = ht->keys;
 oldv = ht->vals;
 oldh = ht->hashes;
 oldd = ht->dead;
 oldsz = ht->sz;
 ht->nelt = 0;
 ht->ndead = 0;
 ht->sz = sz;
 ht->keys = zalloc(sz * sizeof(void *));
 ht->vals = zalloc(sz * sizeof(void *));
 ht->hashes = zalloc(sz * sizeof(void *));
 ht->dead = zalloc(sz * sizeof(void *));
 for (i = 0; i < oldsz; i++)
  if (oldh[i] && !oldd[i])
   htput(ht, oldk[i], oldv[i]);
 free(oldh);
 free(oldk);
 free(oldv);
 free(oldd);
}

variable_types: sz int

variable_types:
oldk
void **

variable_types:
oldv
void **

variable_types:
oldh
unsigned long *

variable_types:
oldd
char *

variable_types: oldsz int


htget

original_code:
void *
htget(Htab *ht, void *k)
{
 ssize_t i;
 i = htidx(ht, k);
 if (i < 0)
  return ((void *)0);
 else
  return ht->vals[i];
}

canonical_original_code:
void *htget(struct Htab *ht, void *k)
{
 long i;
 i = htidx(ht, k);
 if (i < 0)
  return ((void *)0);
 else
  return ht->vals[i];
}

return_type: void *


htdel

decompiled_code:
__int64 __fastcall htdel(_QWORD *a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v3; // rdx

result = htidx((__int64)a1, a2);
if ( result >= 0 )
{
v3 = (_BYTE *)(a1[8] + result);
if ( *v3 )
_assert_fail("!ht->dead[i]", "htab.c", 0xBEu, "htdel");
if ( !*(_QWORD *)(a1[7] + 8 * result) )
_assert_fail("ht->hashes[i]", "htab.c", 0xBFu, "htdel");
*v3 = 1;
--*a1;
++a1[1];
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(_QWORD *a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v3; // rdx

result = func1((__int64)a1, a2);
if ( result >= 0 )
{
v3 = (_BYTE *)(a1[8] + result);
if ( *v3 )
_assert_fail("!ht->dead[i]", "htab.c", 0xBEu, "htdel");
if ( !*(_QWORD *)(a1[7] + 8 * result) )
_assert_fail("ht->hashes[i]", "htab.c", 0xBFu, "htdel");
*v3 = 1;
--*a1;
++a1[1];
}
return result;
}

original_code:
void
htdel(Htab *ht, void *k)
{
 ssize_t i;
 i = htidx(ht, k);
 if (i < 0)
  return;
 ((void) sizeof ((!ht->dead[i]) ? 1 : 0), __extension__ ({ if (!ht->dead[i]) ; else __assert_fail ("!ht->dead[i]", "htab.c", 190, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((ht->hashes[i]) ? 1 : 0), __extension__ ({ if (ht->hashes[i]) ; else __assert_fail ("ht->hashes[i]", "htab.c", 191, __extension__ __PRETTY_FUNCTION__); }));
 ht->dead[i] = 1;
 ht->nelt--;
 ht->ndead++;
}

canonical_original_code:
void htdel(struct Htab *ht, void *k)
{
 long i;
 i = htidx(ht, k);
 if (i < 0)
  return;
 ((void) sizeof ((!ht->dead[i]) ? 1 : 0), __extension__ ({ if (!ht->dead[i]) ; else __assert_fail ("!ht->dead[i]", "htab.c", 190, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((ht->hashes[i]) ? 1 : 0), __extension__ ({ if (ht->hashes[i]) ; else __assert_fail ("ht->hashes[i]", "htab.c", 191, __extension__ __PRETTY_FUNCTION__); }));
 ht->dead[i] = 1;
 ht->nelt--;
 ht->ndead++;
}


hthas

decompiled_code:
_BOOL8 __fastcall hthas(__int64 a1, __int64 a2)
{
return htidx(a1, a2) >= 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func7(__int64 a1, __int64 a2)
{
return func1(a1, a2) >= 0;
}

original_code:
int
hthas(Htab *ht, void *k) { return htidx(ht, k) >= 0; }

canonical_original_code: int hthas(struct Htab *ht, void *k) { return htidx(ht, k) >= 0; }


htkeys

original_code:
void **
htkeys(Htab *ht, size_t *nkeys)
{
 void **k;
 size_t i, j;
 j = 0;
 k = xalloc(sizeof(void *) * ht->nelt);
 for (i = 0; i < ht->sz; i++)
  if (ht->hashes[i] && !ht->dead[i])
   k[j++] = ht->keys[i];
 *nkeys = ht->nelt;
 return k;
}

canonical_original_code:
void **htkeys(struct Htab *ht, unsigned long *nkeys)
{
 void **k;
 unsigned long i; unsigned long j;
 j = 0;
 k = xalloc(sizeof(void *) * ht->nelt);
 for (i = 0; i < ht->sz; i++)
  if (ht->hashes[i] && !ht->dead[i])
   k[j++] = ht->keys[i];
 *nkeys = ht->nelt;
 return k;
}

variable_types:
nkeys
unsigned long *

variable_types:
k
void **

variable_types:
i
unsigned long

variable_types:
j
unsigned long

return_type: void **


streq

decompiled_code:
_BOOL8 __fastcall streq(const char *a1, const char *a2)
{
if ( a1 == a2 )
return 1LL;
if ( a1 && a2 )
return strcmp(a1, a2) == 0;
return 0LL;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(const char *a1, const char *a2)
{
if ( a1 == a2 )
return 1LL;
if ( a1 && a2 )
return strcmp(a1, a2) == 0;
return 0LL;
}

original_code:
int
streq(void *a, void *b)
{
 if (a == b)
  return 1;
 if (a == ((void *)0) || b == ((void *)0))
  return 0;
 return !strcmp(a, b);
}

variable_types:
a
void *

variable_types:
b
void *


strliteq

decompiled_code:
_BOOL8 __fastcall strliteq(__int64 a1, __int64 a2)
{
_BOOL8 result; // rax

if ( a1 == a2 )
return 1LL;
if ( !a1 || !a2 )
return 0LL;
result = 0LL;
if ( *(_QWORD *)a1 == *(_QWORD *)a2 )
result = memcmp(*(const void **)(a1 + 8), *(const void **)(a2 + 8), *(_QWORD *)a1) == 0;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func10(__int64 a1, __int64 a2)
{
_BOOL8 result; // rax

if ( a1 == a2 )
return 1LL;
if ( !a1 || !a2 )
return 0LL;
result = 0LL;
if ( *(_QWORD *)a1 == *(_QWORD *)a2 )
result = memcmp(*(const void **)(a1 + 8), *(const void **)(a2 + 8), *(_QWORD *)a1) == 0;
return result;
}

original_code:
int
strliteq(void *_a, void *_b)
{
 Str *a, *b;
 a = _a;
 b = _b;
 if (a == b)
  return 1;
 if (a == ((void *)0) || b == ((void *)0))
  return 0;
 if (a->len != b->len)
  return 0;
 return !memcmp(a->buf, b->buf, a->len);
}

canonical_original_code:
int strliteq(void *_a, void *_b)
{
 struct Str *a; struct Str *b;
 a = _a;
 b = _b;
 if (a == b)
  return 1;
 if (a == ((void *)0) || b == ((void *)0))
  return 0;
 if (a->len != b->len)
  return 0;
 return !memcmp(a->buf, b->buf, a->len);
}

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


inteq

decompiled_code:
_BOOL8 __fastcall inteq(__int64 a1, __int64 a2)
{
return a1 == a2;
}

canonical_decompiled_code:
_BOOL8 __fastcall func11(__int64 a1, __int64 a2)
{
return a1 == a2;
}

original_code:
int
inteq(uint64_t a, uint64_t b)
{
 return a == b;
}

canonical_original_code:
int inteq(unsigned long a, unsigned long b)
{
 return a == b;
}

variable_types:
a
unsigned long

variable_types:
b
unsigned long


ptreq

decompiled_code:
_BOOL8 __fastcall ptreq(__int64 a1, __int64 a2)
{
return a2 == a1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func12(__int64 a1, __int64 a2)
{
return a2 == a1;
}

original_code:
int
ptreq(void *a, void *b)
{
 return a == b;
}


canonical_original_code:
unsigned long murmurhash2(void *ptr, unsigned long len)
{
 unsigned int m = 0x5bd1e995;
 unsigned int r = 24;
 unsigned int h; unsigned int k; unsigned int n;
 unsigned char *p; unsigned char *end;
 h = 2928213749 ^ len;
 n = len & ~0x3ull;
 end = ptr;
 end += n;
 for (p = ptr; p != end; p += 4) {
  k = (p[0] << 0) |
   (p[1] << 8) |
   (p[2] << 16) |
   (p[3] << 24);
  k *= m;
  k ^= k >> r;
  k *= m;
  h *= m;
  h ^= k;
 }
 switch (len & 0x3) {
 case 3: h ^= p[2] << 16;
 case 2: h ^= p[1] << 8;
 case 1: h ^= p[0] << 0;
  h *= m;
 }
 h ^= h >> 13;
 h *= m;
 h ^= h >> 15;
 return h;
}

variable_types:
ptr
void *

variable_types:
len
unsigned long

variable_types:
m
unsigned int

variable_types:
r
unsigned int

variable_types:
h
unsigned int

variable_types:
k
unsigned int

variable_types:
n
unsigned int

variable_types:
p
unsigned char *

variable_types:
end
unsigned char *

return_type: unsigned long


strhash

decompiled_code:
__int64 __fastcall strhash(char *a1)
{
__int64 result; // rax
int v2; // eax

result = 2928213749LL;
if ( a1 )
{
v2 = strlen(a1);
result = murmurhash2((unsigned __int8 *)a1, v2);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(char *a1)
{
__int64 result; // rax
int v2; // eax

result = 2928213749LL;
if ( a1 )
{
v2 = strlen(a1);
result = func13((unsigned __int8 *)a1, v2);
}
return result;
}

original_code:
ulong
strhash(void *_s)
{
 char *s;
 s = _s;
 if (!s)
  return 2928213749;
 return murmurhash2(_s, strlen(_s));
}

canonical_original_code:
unsigned long strhash(void *_s)
{
 char *s;
 s = _s;
 if (!s)
  return 2928213749;
 return murmurhash2(_s, strlen(_s));
}

variable_types:
s
char *


strlithash

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

result = 2928213749LL;
if ( a1 )
result = murmurhash2(*(unsigned __int8 **)(a1 + 8), *(_QWORD *)a1);
return result;
}

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

result = 2928213749LL;
if ( a1 )
result = func13(*(unsigned __int8 **)(a1 + 8), *(_QWORD *)a1);
return result;
}

original_code:
ulong
strlithash(void *_s)
{
 Str *s;
 s = _s;
 if (!s)
  return 2928213749;
 return murmurhash2(s->buf, s->len);
}

canonical_original_code:
unsigned long strlithash(void *_s)
{
 struct Str *s;
 s = _s;
 if (!s)
  return 2928213749;
 return murmurhash2(s->buf, s->len);
}


inthash

decompiled_code:
__int64 __fastcall inthash(__int64 a1)
{
__int64 v2; // [rsp+0h] [rbp-8h] BYREF

v2 = a1;
return murmurhash2((unsigned __int8 *)&v2, 8);
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1)
{
__int64 v2; // [rsp+0h] [rbp-8h] BYREF

v2 = a1;
return func13((unsigned __int8 *)&v2, 8);
}

original_code:
ulong
inthash(uint64_t key)
{
 return murmurhash2(&key, sizeof key);
}

canonical_original_code:
unsigned long inthash(unsigned long key)
{
 return murmurhash2(&key, sizeof key);
}

variable_types:
key
unsigned long


ptrhash

decompiled_code:
// attributes: thunk
__int64 __fastcall ptrhash(__int64 a1)
{
return inthash(a1);
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1)
{
return func16(a1);
}

original_code:
ulong
ptrhash(void *key)
{
 return inthash((uintptr_t)key);
}

canonical_original_code:
unsigned long ptrhash(void *key)
{
 return inthash((unsigned long)key);
}

variable_types:
key
void *


assignee

original_code:
Node *
assignee(Node *n)
{
 Node *a;
 switch (exprop(n)) {
 case Oundef: case Odef:
 case Oset:
 case Oasn: case Oaddeq:
 case Osubeq: case Omuleq:
 case Odiveq: case Omodeq:
 case Oboreq: case Obandeq:
 case Obxoreq: case Obsleq:
 case Obsreq:
  return n->expr.args[0];
  break;
 case Oblit:
 case Oclear:
  a = n->expr.args[0];
  if (exprop(a) != Oaddr)
   break;
  a = a->expr.args[0];
  if (exprop(a) != Ovar)
   break;
  return a;
 default:
  break;
 }
 return ((void *)0);
}

canonical_original_code:
struct Node *assignee(struct Node *n)
{
 struct Node *a;
 switch (exprop(n)) {
 case Oundef: case Odef:
 case Oset:
 case Oasn: case Oaddeq:
 case Osubeq: case Omuleq:
 case Odiveq: case Omodeq:
 case Oboreq: case Obandeq:
 case Obxoreq: case Obsleq:
 case Obsreq:
  return n->expr.args[0];
  break;
 case Oblit:
 case Oclear:
  a = n->expr.args[0];
  if (exprop(a) != Oaddr)
   break;
  a = a->expr.args[0];
  if (exprop(a) != Ovar)
   break;
  return a;
 default:
  break;
 }
 return ((void *)0);
}

variable_types:
n
struct Node *

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; }; } *


collectdefs

original_code:
static void
collectdefs(Cfg *cfg, size_t **defs, size_t *ndefs)
{
 size_t i, j, did;
 Node *n;
 Bb *bb;
 for (i = 0; i < cfg->nbb; i++) {
  bb = cfg->bb[i];
  if (!bb)
   continue;
  for (j = 0; j < bb->nnl; j++) {
   n = assignee(bb->nl[j]);
   if (n && exprop(n) == Ovar) {
    did = n->expr.did;
    ndefs[did]++;
    defs[did] = xrealloc(defs[did], ndefs[did] * sizeof(size_t));
    defs[did][ndefs[did] - 1] = bb->nl[j]->nid;
   }
  }
 }
}

canonical_original_code:
static void collectdefs(struct Cfg *cfg, unsigned long **defs, unsigned long *ndefs)
{
 unsigned long i; unsigned long j; unsigned long did;
 struct Node *n;
 struct Bb *bb;
 for (i = 0; i < cfg->nbb; i++) {
  bb = cfg->bb[i];
  if (!bb)
   continue;
  for (j = 0; j < bb->nnl; j++) {
   n = assignee(bb->nl[j]);
   if (n && exprop(n) == Ovar) {
    did = n->expr.did;
    ndefs[did]++;
    defs[did] = xrealloc(defs[did], ndefs[did] * sizeof(unsigned long));
    defs[did][ndefs[did] - 1] = bb->nl[j]->nid;
   }
  }
 }
}

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:
defs
unsigned long **

variable_types:
ndefs
unsigned long *

variable_types:
i
unsigned long

variable_types:
j
unsigned long

variable_types:
did
unsigned long

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; } *

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; }


genkill

original_code:
static void
genkill(Bb *bb, size_t **defs, size_t *ndefs, Bitset *gen, Bitset *kill)
{
 size_t i, j, did;
 Node *n;
 for (i = 0; i < bb->nnl; i++) {
  n = assignee(bb->nl[i]);
  if (!n)
   continue;
  did = n->expr.did;
  for (j = 0; j < ndefs[did]; j++) {
   bsput(kill, defs[did][j]);
   bsdel(gen, defs[did][j]);
  }
  bsput(gen, bb->nl[i]->nid);
  bsdel(kill, bb->nl[i]->nid);
 }
}

canonical_original_code:
static void genkill(struct Bb *bb, unsigned long **defs, unsigned long *ndefs, struct Bitset *gen, struct Bitset *kill)
{
 unsigned long i; unsigned long j; unsigned long did;
 struct Node *n;
 for (i = 0; i < bb->nnl; i++) {
  n = assignee(bb->nl[i]);
  if (!n)
   continue;
  did = n->expr.did;
  for (j = 0; j < ndefs[did]; j++) {
   bsput(kill, defs[did][j]);
   bsdel(gen, defs[did][j]);
  }
  bsput(gen, bb->nl[i]->nid);
  bsdel(kill, bb->nl[i]->nid);
 }
}

variable_types:
gen
struct Bitset *

variable_types:
kill
struct Bitset *

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


bsdump

decompiled_code:
int __fastcall bsdump(__int64 a1)
{
size_t v2[2]; // [rsp+8h] [rbp-10h] BYREF

v2[0] = 0LL;
while ( (unsigned int)bsiter(a1, v2) )
printf("%zd ", v2[0]++);
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1)
{
size_t v2[2]; // [rsp+8h] [rbp-10h] BYREF

v2[0] = 0LL;
while ( (unsigned int)bsiter(a1, v2) )
printf("%zd ", v2[0]++);
return putchar(10);
}

original_code:
void
bsdump(Bitset *bs)
{
 size_t i;
 for (i = 0; bsiter(bs, &i); i++)
  printf("%zd ", i);
 printf("\n");
}

canonical_original_code:
void bsdump(struct Bitset *bs)
{
 unsigned long i;
 for (i = 0; bsiter(bs, &i); i++)
  printf("%zd ", i);
 printf("\n");
}

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


reachingfree

decompiled_code:
void __fastcall reachingfree(void *ptr)
{
unsigned __int64 v1; // rbp
unsigned __int64 v2; // rbp

if ( *((_QWORD *)ptr + 4) )
{
v1 = 0LL;
do
{
bsfree(*(_QWORD *)(*(_QWORD *)ptr + 8 * v1));
bsfree(*(_QWORD *)(*((_QWORD *)ptr + 1) + 8 * v1++));
}
while ( *((_QWORD *)ptr + 4) > v1 );
}
if ( ndecls )
{
v2 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 2) + 8 * v2++));
while ( ndecls > v2 );
}
free(*(void **)ptr);
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
free(*((void **)ptr + 3));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
unsigned __int64 v1; // rbp
unsigned __int64 v2; // rbp

if ( *((_QWORD *)ptr + 4) )
{
v1 = 0LL;
do
{
bsfree(*(_QWORD *)(*(_QWORD *)ptr + 8 * v1));
bsfree(*(_QWORD *)(*((_QWORD *)ptr + 1) + 8 * v1++));
}
while ( *((_QWORD *)ptr + 4) > v1 );
}
if ( ndecls )
{
v2 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 2) + 8 * v2++));
while ( ndecls > v2 );
}
free(*(void **)ptr);
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
free(*((void **)ptr + 3));
free(ptr);
}

original_code:
void
reachingfree(Reaching *r)
{
 size_t i;
 for (i = 0; i < r->nbb; i++) {
  bsfree(r->in[i]);
  bsfree(r->out[i]);
 }
 for (i = 0; i < ndecls; i++)
  free(r->defs[i]);
 free(r->in);
 free(r->out);
 free(r->defs);
 free(r->ndefs);
 free(r);
}

canonical_original_code:
void reachingfree(struct Reaching *r)
{
 unsigned long i;
 for (i = 0; i < r->nbb; i++) {
  bsfree(r->in[i]);
  bsfree(r->out[i]);
 }
 for (i = 0; i < ndecls; i++)
  free(r->defs[i]);
 free(r->in);
 free(r->out);
 free(r->defs);
 free(r->ndefs);
 free(r);
}

variable_types: struct Reaching { struct Bitset { unsigned long nchunks; unsigned long *chunks; } **in; struct Bitset **out; unsigned long **defs; unsigned long *ndefs; unsigned long nbb; } *

user_defined_types: struct Reaching { struct Bitset **in; struct Bitset **out; unsigned long **defs; unsigned long *ndefs; unsigned long nbb; }


decompiled_code:
unsigned __int64 __fastcall host64(unsigned __int64 *a1)
{
return _byteswap_uint64(*a1);
}

canonical_decompiled_code:
unsigned __int64 __fastcall func1(unsigned __int64 *a1)
{
return _byteswap_uint64(*a1);
}

canonical_original_code:
long long host64(unsigned char buf[8])
{
 long long v = 0;
 v |= ((long long)buf[0] << 56LL);
 v |= ((long long)buf[1] << 48LL);
 v |= ((long long)buf[2] << 40LL);
 v |= ((long long)buf[3] << 32LL);
 v |= ((long long)buf[4] << 24LL);
 v |= ((long long)buf[5] << 16LL);
 v |= ((long long)buf[6] << 8LL);
 v |= ((long long)buf[7] << 0LL);
 return v;
}

variable_types:
buf
unsigned char [8]

variable_types:
v
long long

return_type: long long


decompiled_code:
__int64 __fastcall host32(unsigned int *a1)
{
return (int)_byteswap_ulong(*a1);
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int *a1)
{
return (int)_byteswap_ulong(*a1);
}

variable_types:
buf
unsigned char [4]

variable_types: v int


bprintf

decompiled_code:
size_t bprintf(char *a1, size_t a2, const char *a3, ...)
{
size_t result; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a3);
result = vsnprintf(a1, a2, a3, arg);
if ( a2 <= (int)result )
result = a2;
return result;
}

canonical_decompiled_code:
size_t func16(char *a1, size_t a2, const char *a3, ...)
{
size_t result; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a3);
result = vsnprintf(a1, a2, a3, arg);
if ( a2 <= (int)result )
result = a2;
return result;
}

original_code:
size_t
bprintf(char *buf, size_t sz, char *fmt, ...)
{
 va_list ap;
 size_t n;
 __builtin_va_start(ap,fmt);
 n = vsnprintf(buf, sz, fmt, ap);
 if (n >= sz)
  n = sz;
 __builtin_va_end(ap);
 return n;
}

canonical_original_code:
unsigned long bprintf(char *buf, unsigned long sz, char *fmt, ...)
{
 __builtin_va_list ap;
 unsigned long n;
 __builtin_va_start(ap,fmt);
 n = vsnprintf(buf, sz, fmt, ap);
 if (n >= sz)
  n = sz;
 __builtin_va_end(ap);
 return n;
}

variable_types:
buf
char *

variable_types:
sz
unsigned long

variable_types:
fmt
char *

variable_types:
n
unsigned long


bshas

decompiled_code:
__int64 __fastcall bshas(_QWORD *a1, unsigned __int64 a2)
{
__int64 result; // rax

result = 0LL;
if ( *a1 << 6 > a2 )
result = (*(_QWORD *)(a1[1] + 8 * (a2 >> 6)) >> (a2 & 0x3F)) & 1LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1, unsigned __int64 a2)
{
__int64 result; // rax

result = 0LL;
if ( *a1 << 6 > a2 )
result = (*(_QWORD *)(a1[1] + 8 * (a2 >> 6)) >> (a2 & 0x3F)) & 1LL;
return result;
}

original_code:
static inline int bshas(Bitset *bs, size_t elt)
{
 size_t eltidx, eltshift;
 if (elt >= bs->nchunks * 8 * sizeof(size_t))
  return 0;
 eltidx = elt / (8 * sizeof(size_t));
 eltshift = elt % (8 * sizeof(size_t));
 return (bs->chunks[eltidx] & (1ULL << eltshift)) != 0;
}

canonical_original_code:
static inline int bshas(struct Bitset *bs, unsigned long elt)
{
 unsigned long eltidx; unsigned long eltshift;
 if (elt >= bs->nchunks * 8 * sizeof(unsigned long))
  return 0;
 eltidx = elt / (8 * sizeof(unsigned long));
 eltshift = elt % (8 * sizeof(unsigned long));
 return (bs->chunks[eltidx] & (1ULL << eltshift)) != 0;
}

variable_types:
elt
unsigned long

variable_types:
eltidx
unsigned long

variable_types:
eltshift
unsigned long


checkpredret

decompiled_code:
__int64 __fastcall checkpredret(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax
__int64 v4; // rbx
__int64 v5; // rax
__int64 v6[4]; // [rsp+8h] [rbp-20h] BYREF

for ( v6[0] = 0LL; ; ++v6[0] )
{
result = bsiter(*(_QWORD *)(a2 + 40), v6);
if ( !(_DWORD)result )
break;
v4 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v6[0]);
v5 = *(_QWORD *)(v4 + 32);
if ( v5 )
{
v2 = exprop(*(_QWORD *)(*(_QWORD *)(v4 + 24) + 8 * v5 - 8));
if ( v2 != 47 && v2 != 59 )
return fatal(
*(_QWORD *)(*(_QWORD *)(v4 + 24) + 8LL * *(_QWORD *)(v4 + 32) - 8),
"Reaches end of function without return\n");
}
else
{
checkpredret(a1, *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v6[0]));
}
}
return result;
}

original_code:
static void
checkpredret(Cfg *cfg, Bb *bb)
{
 Bb *pred;
 Op op;
 size_t i;
 for (i = 0; bsiter(bb->pred, &i); i++) {
  pred = cfg->bb[i];
  if (pred->nnl == 0) {
   checkpredret(cfg, pred);
  } else {
   op = exprop(pred->nl[pred->nnl - 1]);
   if (op != Oret && op != Odead) {
    fatal(pred->nl[pred->nnl-1], "Reaches end of function without return\n");
   }
  }
 }
}

canonical_original_code:
static void checkpredret(struct Cfg *cfg, struct Bb *bb)
{
 struct Bb *pred;
 enum Op op;
 unsigned long i;
 for (i = 0; bsiter(bb->pred, &i); i++) {
  pred = cfg->bb[i];
  if (pred->nnl == 0) {
   checkpredret(cfg, pred);
  } else {
   op = exprop(pred->nl[pred->nnl - 1]);
   if (op != Oret && op != Odead) {
    fatal(pred->nl[pred->nnl-1], "Reaches end of function without return\n");
   }
  }
 }
}

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:
i
unsigned long

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; }