StripLength

original_code:
int StripLength (int starttri, int startv)
{
 int m1, m2;
 int j;
 mtriangle_t *last, *check;
 int k;
 used[starttri] = 2;
 last = &triangles[starttri];
 stripverts[0] = last->vertindex[(startv)%3];
 stripverts[1] = last->vertindex[(startv+1)%3];
 stripverts[2] = last->vertindex[(startv+2)%3];
 striptris[0] = starttri;
 stripcount = 1;
 m1 = last->vertindex[(startv+2)%3];
 m2 = last->vertindex[(startv+1)%3];
nexttri:
 for (j=starttri+1, check=&triangles[starttri+1] ; j<pheader->numtris ; j++, check++)
 {
  if (check->facesfront != last->facesfront)
   continue;
  for (k=0 ; k<3 ; k++)
  {
   if (check->vertindex[k] != m1)
    continue;
   if (check->vertindex[ (k+1)%3 ] != m2)
    continue;
   if (used[j])
    goto done;
   if (stripcount & 1)
    m2 = check->vertindex[ (k+2)%3 ];
   else
    m1 = check->vertindex[ (k+2)%3 ];
   stripverts[stripcount+2] = check->vertindex[ (k+2)%3 ];
   striptris[stripcount] = j;
   stripcount++;
   used[j] = 2;
   goto nexttri;
  }
 }
done:
 for (j=starttri+1 ; j<pheader->numtris ; j++)
  if (used[j] == 2)
   used[j] = 0;
 return stripcount;
}

canonical_original_code:
int StripLength(int starttri, int startv)
{
 int m1; int m2;
 int j;
 struct mtriangle_s *last; struct mtriangle_s *check;
 int k;
 used[starttri] = 2;
 last = &triangles[starttri];
 stripverts[0] = last->vertindex[(startv)%3];
 stripverts[1] = last->vertindex[(startv+1)%3];
 stripverts[2] = last->vertindex[(startv+2)%3];
 striptris[0] = starttri;
 stripcount = 1;
 m1 = last->vertindex[(startv+2)%3];
 m2 = last->vertindex[(startv+1)%3];
nexttri:
 for (j=starttri+1, check=&triangles[starttri+1] ; j<pheader->numtris ; j++, check++)
 {
  if (check->facesfront != last->facesfront)
   continue;
  for (k=0 ; k<3 ; k++)
  {
   if (check->vertindex[k] != m1)
    continue;
   if (check->vertindex[ (k+1)%3 ] != m2)
    continue;
   if (used[j])
    goto done;
   if (stripcount & 1)
    m2 = check->vertindex[ (k+2)%3 ];
   else
    m1 = check->vertindex[ (k+2)%3 ];
   stripverts[stripcount+2] = check->vertindex[ (k+2)%3 ];
   striptris[stripcount] = j;
   stripcount++;
   used[j] = 2;
   goto nexttri;
  }
 }
done:
 for (j=starttri+1 ; j<pheader->numtris ; j++)
  if (used[j] == 2)
   used[j] = 0;
 return stripcount;
}

variable_types: starttri int

variable_types: startv int

variable_types: j int

variable_types: struct mtriangle_s { int facesfront; int vertindex[3]; } *

variable_types: k int


FanLength

repo: jite/jquake

decompiled_code:
__int64 __fastcall FanLength(int a1, int a2)
{
__int64 v2; // rdx
int v3; // er10
int v4; // ebx
int v5; // er12
__int64 v6; // rcx
__int64 v7; // r9
__int64 v8; // r11
char v9; // r14
int v10; // esi
int v11; // edx
_DWORD *v12; // rax
int v13; // ebp
int v14; // esi

used[a1] = 2;
v2 = 4LL * a1;
v3 = triangles[v2 + 1 + a2 % 3];
stripverts[0] = v3;
stripverts[1] = triangles[v2 + 1 + (a2 + 1) % 3];
v4 = triangles[v2 + 1 + (a2 + 2) % 3];
stripverts[2] = v4;
striptris[0] = a1;
stripcount = 1;
v5 = a1 + 1;
v6 = a1 + 1;
v7 = pheader;
v8 = 1LL;
v9 = 0;
while ( 2 )
{
v14 = *(_DWORD *)(v7 + 64);
if ( v5 >= v14 )
{
if ( v9 )
stripcount = v8;
return (unsigned int)stripcount;
}
v12 = &triangles[4 * v5];
v11 = a1 + 1;
while ( 1 )
{
if ( *v12 != triangles[4 * a1] )
goto LABEL_8;
v13 = v12[1];
if ( v3 == v13 && v4 == v12[2] )
break;
if ( v3 == v12[2] && v4 == v12[3] )
{
v10 = 1;
goto LABEL_13;
}
if ( v3 == v12[3] && v4 == v13 )
{
v10 = 2;
goto LABEL_13;
}
LABEL_8:
++v11;
v12 += 4;
if ( v11 == v14 )
{
if ( v9 )
stripcount = v8;
goto LABEL_22;
}
}
v10 = 0;
LABEL_13:
if ( !used[v11] )
{
v4 = v12[(int)(v10 + 2 - 3 * ((unsigned __int64)(1431655766LL * (v10 + 2)) >> 32)) + 1];
stripverts[v8 + 2] = v4;
striptris[v8] = v11;
used[v11] = 2;
++v8;
v9 = 1;
continue;
}
break;
}
if ( v9 )
stripcount = v8;
do
{
LABEL_22:
if ( used[v6] == 2 )
used[v6] = 0;
++v6;
}
while ( *(_DWORD *)(v7 + 64) > (int)v6 );
return (unsigned int)stripcount;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, int a2)
{
__int64 v2; // rdx
int v3; // er10
int v4; // ebx
int v5; // er12
__int64 v6; // rcx
__int64 v7; // r9
__int64 v8; // r11
char v9; // r14
int v10; // esi
int v11; // edx
_DWORD *v12; // rax
int v13; // ebp
int v14; // esi

used[a1] = 2;
v2 = 4LL * a1;
v3 = triangles[v2 + 1 + a2 % 3];
stripverts[0] = v3;
stripverts[1] = triangles[v2 + 1 + (a2 + 1) % 3];
v4 = triangles[v2 + 1 + (a2 + 2) % 3];
stripverts[2] = v4;
striptris[0] = a1;
stripcount = 1;
v5 = a1 + 1;
v6 = a1 + 1;
v7 = pheader;
v8 = 1LL;
v9 = 0;
while ( 2 )
{
v14 = *(_DWORD *)(v7 + 64);
if ( v5 >= v14 )
{
if ( v9 )
stripcount = v8;
return (unsigned int)stripcount;
}
v12 = &triangles[4 * v5];
v11 = a1 + 1;
while ( 1 )
{
if ( *v12 != triangles[4 * a1] )
goto LABEL_8;
v13 = v12[1];
if ( v3 == v13 && v4 == v12[2] )
break;
if ( v3 == v12[2] && v4 == v12[3] )
{
v10 = 1;
goto LABEL_13;
}
if ( v3 == v12[3] && v4 == v13 )
{
v10 = 2;
goto LABEL_13;
}
LABEL_8:
++v11;
v12 += 4;
if ( v11 == v14 )
{
if ( v9 )
stripcount = v8;
goto LABEL_22;
}
}
v10 = 0;
LABEL_13:
if ( !used[v11] )
{
v4 = v12[(int)(v10 + 2 - 3 * ((unsigned __int64)(1431655766LL * (v10 + 2)) >> 32)) + 1];
stripverts[v8 + 2] = v4;
striptris[v8] = v11;
used[v11] = 2;
++v8;
v9 = 1;
continue;
}
break;
}
if ( v9 )
stripcount = v8;
do
{
LABEL_22:
if ( used[v6] == 2 )
used[v6] = 0;
++v6;
}
while ( *(_DWORD *)(v7 + 64) > (int)v6 );
return (unsigned int)stripcount;
}

original_code:
int FanLength (int starttri, int startv)
{
 int m1, m2;
 int j;
 mtriangle_t *last, *check;
 int k;
 used[starttri] = 2;
 last = &triangles[starttri];
 stripverts[0] = last->vertindex[(startv)%3];
 stripverts[1] = last->vertindex[(startv+1)%3];
 stripverts[2] = last->vertindex[(startv+2)%3];
 striptris[0] = starttri;
 stripcount = 1;
 m1 = last->vertindex[(startv+0)%3];
 m2 = last->vertindex[(startv+2)%3];
nexttri:
 for (j=starttri+1, check=&triangles[starttri+1] ; j<pheader->numtris ; j++, check++)
 {
  if (check->facesfront != last->facesfront)
   continue;
  for (k=0 ; k<3 ; k++)
  {
   if (check->vertindex[k] != m1)
    continue;
   if (check->vertindex[ (k+1)%3 ] != m2)
    continue;
   if (used[j])
    goto done;
   m2 = check->vertindex[ (k+2)%3 ];
   stripverts[stripcount+2] = m2;
   striptris[stripcount] = j;
   stripcount++;
   used[j] = 2;
   goto nexttri;
  }
 }
done:
 for (j=starttri+1 ; j<pheader->numtris ; j++)
  if (used[j] == 2)
   used[j] = 0;
 return stripcount;
}

canonical_original_code:
int FanLength(int starttri, int startv)
{
 int m1; int m2;
 int j;
 struct mtriangle_s *last; struct mtriangle_s *check;
 int k;
 used[starttri] = 2;
 last = &triangles[starttri];
 stripverts[0] = last->vertindex[(startv)%3];
 stripverts[1] = last->vertindex[(startv+1)%3];
 stripverts[2] = last->vertindex[(startv+2)%3];
 striptris[0] = starttri;
 stripcount = 1;
 m1 = last->vertindex[(startv+0)%3];
 m2 = last->vertindex[(startv+2)%3];
nexttri:
 for (j=starttri+1, check=&triangles[starttri+1] ; j<pheader->numtris ; j++, check++)
 {
  if (check->facesfront != last->facesfront)
   continue;
  for (k=0 ; k<3 ; k++)
  {
   if (check->vertindex[k] != m1)
    continue;
   if (check->vertindex[ (k+1)%3 ] != m2)
    continue;
   if (used[j])
    goto done;
   m2 = check->vertindex[ (k+2)%3 ];
   stripverts[stripcount+2] = m2;
   striptris[stripcount] = j;
   stripcount++;
   used[j] = 2;
   goto nexttri;
  }
 }
done:
 for (j=starttri+1 ; j<pheader->numtris ; j++)
  if (used[j] == 2)
   used[j] = 0;
 return stripcount;
}

return_type: int

user_defined_types: struct mtriangle_s { int facesfront; int vertindex[3]; }


BuildTris

original_code:
void BuildTris (void)
{
 int i, j, k;
 int startv;
 float s, t;
 int len, bestlen, besttype = 0;
 int bestverts[1024];
 int besttris[1024];
 int type;
 numorder = 0;
 numcommands = 0;
 memset (used, 0, sizeof(used));
 for (i=0 ; i<pheader->numtris ; i++)
 {
  if (used[i])
   continue;
  bestlen = 0;
  for (type = 0 ; type < 2 ; type++)
  {
   for (startv =0 ; startv < 3 ; startv++)
   {
    if (type == 1)
     len = StripLength (i, startv);
    else
     len = FanLength (i, startv);
    if (len > bestlen)
    {
     besttype = type;
     bestlen = len;
     for (j=0 ; j<bestlen+2 ; j++)
      bestverts[j] = stripverts[j];
     for (j=0 ; j<bestlen ; j++)
      besttris[j] = striptris[j];
    }
   }
  }
  for (j=0 ; j<bestlen ; j++)
   used[besttris[j]] = 1;
  if (besttype == 1)
   commands[numcommands++] = (bestlen+2);
  else
   commands[numcommands++] = -(bestlen+2);
  for (j=0 ; j<bestlen+2 ; j++)
  {
   k = bestverts[j];
   vertexorder[numorder++] = k;
   s = stverts[k].s;
   t = stverts[k].t;
   if (!triangles[besttris[0]].facesfront && stverts[k].onseam)
    s += pheader->skinwidth / 2;
   s = (s + 0.5) / pheader->skinwidth;
   t = (t + 0.5) / pheader->skinheight;
   *(float *)&commands[numcommands++] = s;
   *(float *)&commands[numcommands++] = t;
  }
 }
 commands[numcommands++] = 0;
 Com_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->numtris, numorder, numcommands);
 allverts += numorder;
 alltris += pheader->numtris;
}

canonical_original_code:
void BuildTris()
{
 int i; int j; int k;
 int startv;
 float s; float t;
 int len; int bestlen; int besttype = 0;
 int bestverts[1024];
 int besttris[1024];
 int type;
 numorder = 0;
 numcommands = 0;
 memset (used, 0, sizeof(used));
 for (i=0 ; i<pheader->numtris ; i++)
 {
  if (used[i])
   continue;
  bestlen = 0;
  for (type = 0 ; type < 2 ; type++)
  {
   for (startv =0 ; startv < 3 ; startv++)
   {
    if (type == 1)
     len = StripLength (i, startv);
    else
     len = FanLength (i, startv);
    if (len > bestlen)
    {
     besttype = type;
     bestlen = len;
     for (j=0 ; j<bestlen+2 ; j++)
      bestverts[j] = stripverts[j];
     for (j=0 ; j<bestlen ; j++)
      besttris[j] = striptris[j];
    }
   }
  }
  for (j=0 ; j<bestlen ; j++)
   used[besttris[j]] = 1;
  if (besttype == 1)
   commands[numcommands++] = (bestlen+2);
  else
   commands[numcommands++] = -(bestlen+2);
  for (j=0 ; j<bestlen+2 ; j++)
  {
   k = bestverts[j];
   vertexorder[numorder++] = k;
   s = stverts[k].s;
   t = stverts[k].t;
   if (!triangles[besttris[0]].facesfront && stverts[k].onseam)
    s += pheader->skinwidth / 2;
   s = (s + 0.5) / pheader->skinwidth;
   t = (t + 0.5) / pheader->skinheight;
   *(float *)&commands[numcommands++] = s;
   *(float *)&commands[numcommands++] = t;
  }
 }
 commands[numcommands++] = 0;
 Com_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->numtris, numorder, numcommands);
 allverts += numorder;
 alltris += pheader->numtris;
}

variable_types: i int

variable_types: s float

variable_types: t float

variable_types: len int

variable_types: bestlen int

variable_types: besttype int

variable_types:
bestverts
int [1024]

variable_types:
besttris
int [1024]

variable_types: type int

return_type: void


decompiled_code:
__int64 __fastcall GL_MakeAliasModelDisplayLists(__int64 a1, __int64 a2)
{
void *v2; // rax
__int64 v3; // rdx
__int64 result; // rax
__int64 v5; // rdi
__int64 i; // rax

aliasmodel = a1;
paliashdr = a2;
BuildTris();
*(_DWORD *)(paliashdr + 88) = numorder;
v2 = (void *)Hunk_Alloc((unsigned int)(4 * numcommands));
*(_DWORD *)(paliashdr + 96) = (_DWORD)v2 - paliashdr;
memcpy(v2, commands, 4 * numcommands);
v3 = Hunk_Alloc((unsigned int)(4 * *(_DWORD *)(paliashdr + 88) * *(_DWORD *)(paliashdr + 84)));
result = paliashdr;
*(_DWORD *)(paliashdr + 92) = v3 - paliashdr;
v5 = 0LL;
if ( *(int *)(result + 84) > 0 )
{
do
{
for ( i = 0LL; numorder > (int)i; ++i )
{
v3 += 4LL;
*(_DWORD *)(v3 - 4) = *(_DWORD *)(*((_QWORD *)&poseverts + v5) + 4LL * vertexorder[i]);
}
++v5;
result = paliashdr;
}
while ( *(_DWORD *)(paliashdr + 84) > (int)v5 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
void *v2; // rax
__int64 v3; // rdx
__int64 result; // rax
__int64 v5; // rdi
__int64 i; // rax

aliasmodel = a1;
paliashdr = a2;
func2();
*(_DWORD *)(paliashdr + 88) = numorder;
v2 = (void *)Hunk_Alloc((unsigned int)(4 * numcommands));
*(_DWORD *)(paliashdr + 96) = (_DWORD)v2 - paliashdr;
memcpy(v2, commands, 4 * numcommands);
v3 = Hunk_Alloc((unsigned int)(4 * *(_DWORD *)(paliashdr + 88) * *(_DWORD *)(paliashdr + 84)));
result = paliashdr;
*(_DWORD *)(paliashdr + 92) = v3 - paliashdr;
v5 = 0LL;
if ( *(int *)(result + 84) > 0 )
{
do
{
for ( i = 0LL; numorder > (int)i; ++i )
{
v3 += 4LL;
*(_DWORD *)(v3 - 4) = *(_DWORD *)(*((_QWORD *)&poseverts + v5) + 4LL * vertexorder[i]);
}
++v5;
result = paliashdr;
}
while ( *(_DWORD *)(paliashdr + 84) > (int)v5 );
}
return result;
}

original_code:
void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
{
 int i, j;
 int *cmds;
 trivertx_t *verts;
 aliasmodel = m;
 paliashdr = hdr;
 BuildTris ();
 paliashdr->poseverts = numorder;
 cmds = (int *) Hunk_Alloc (numcommands * 4);
 paliashdr->commands = (byte *)cmds - (byte *)paliashdr;
 memcpy (cmds, commands, numcommands * 4);
 verts = (trivertx_t *) Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts
  * sizeof(trivertx_t) );
 paliashdr->posedata = (byte *)verts - (byte *)paliashdr;
 for (i=0 ; i<paliashdr->numposes ; i++)
  for (j=0 ; j<numorder ; j++)
   *verts++ = poseverts[i][vertexorder[j]];
}

canonical_original_code:
void GL_MakeAliasModelDisplayLists(struct model_s *m, struct aliashdr_s *hdr)
{
 int i; int j;
 int *cmds;
 struct trivertx_t *verts;
 aliasmodel = m;
 paliashdr = hdr;
 BuildTris ();
 paliashdr->poseverts = numorder;
 cmds = (int *) Hunk_Alloc (numcommands * 4);
 paliashdr->commands = (unsigned char *)cmds - (unsigned char *)paliashdr;
 memcpy (cmds, commands, numcommands * 4);
 verts = (struct trivertx_t *) Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts
  * sizeof(trivertx_t) );
 paliashdr->posedata = (unsigned char *)verts - (unsigned char *)paliashdr;
 for (i=0 ; i<paliashdr->numposes ; i++)
  for (j=0 ; j<numorder ; j++)
   *verts++ = poseverts[i][vertexorder[j]];
}

variable_types: struct model_s { char name[64]; enum qbool { false=0, true=1 } needload; unsigned short crc; int simpletexture[5]; enum modhint_t { MOD_NORMAL=0, MOD_PLAYER=1, MOD_EYES=2, MOD_FLAME=3, MOD_THUNDERBOLT=4, MOD_BACKPACK=5, MOD_FLAG=6, MOD_SPIKE=7, MOD_TF_TRAIL=8, MOD_GRENADE=9, MOD_TESLA=10, MOD_SENTRYGUN=11, MOD_DETPACK=12, MOD_LASER=13, MOD_DEMON=14, MOD_SOLDIER=15, MOD_OGRE=16, MOD_ENFORCER=17, MOD_VOORSPIKE=18, MOD_LAVABALL=19, MOD_RAIL=20, MOD_RAIL2=21, MOD_BUILDINGGIBS=22, MOD_CLUSTER=23, MOD_SHAMBLER=24, MOD_TELEPORTDESTINATION=25, MOD_GIB=26, MOD_VMODEL=27 } modhint; enum modtype_t { mod_brush=0, mod_sprite=1, mod_spr32=2, mod_alias=3, mod_alias3=4 } type; int numframes; enum synctype_t { ST_SYNC=0, ST_RAND=1 } synctype; int flags; float mins[3]; float radius; int firstmodelsurface; int numsubmodels; struct dmodel_t { float mins[3]; float origin[3]; int headnode[4]; int visleafs; int firstface; } *submodels; int numplanes; struct mplane_s { float normal[3]; float dist; unsigned char type; unsigned char signbits; unsigned char pad[2]; } *planes; int numleafs; struct mleaf_s { int contents; int visframe; float minmaxs[6]; struct mnode_s { int contents; int visframe; float minmaxs[6]; struct mnode_s *parent; struct mplane_s *plane; struct mnode_s *children[2]; unsigned short firstsurface; unsigned short numsurfaces; } *parent; unsigned char *compressed_vis; struct efrag_s { struct mleaf_s *leaf; struct efrag_s *leafnext; struct entity_s { float origin[3]; float angles[3]; struct model_s *model; unsigned char *colormap; int skinnum; struct player_info_s { int userid; char userinfo[1024]; char name[16]; float entertime; int frags; int ping; unsigned char pl; int topcolor; int bottomcolor; int _topcolor; int _bottomcolor; int real_topcolor; int real_bottomcolor; char team[1024]; char _team[1024]; int fps_msec; int last_fps; int fps; int fps_frames; double fps_measure_time; enum qbool { false=0, true=1 } isnear; int spectator; unsigned char translations[-1]; struct skin_t { char name[16]; enum qbool { false=0, true=1 } failedload; enum qbool { false=0, true=1 } warned; int width; int bpp; int texnum; struct cache_user_s { void *data; } cache; } *skin; int stats[32]; enum qbool { false=0, true=1 } skin_refresh; enum qbool { false=0, true=1 } ignored; enum qbool { false=0, true=1 } validated; char f_server[16]; enum qbool { false=0, true=1 } dead; } *scoreboard; int renderfx; int effects; int oldframe; int frame; float framelerp; struct efrag_s *efrag; int visframe; int dlightframe; int dlightbits; float alpha; int trivial_accept; struct mnode_s *topnode; } *entity; struct efrag_s *entnext; } *efrags; struct msurface_s { int visframe; struct mplane_s *plane; int flags; int firstedge; int numedges; short texturemins[2]; short extents[2]; int light_s; struct glpoly_s { struct glpoly_s *next; struct glpoly_s *chain; struct glpoly_s *fb_chain; struct glpoly_s *luma_chain; struct glpoly_s *caustics_chain; struct glpoly_s *detail_chain; int numverts; float verts[4][9]; } *polys; struct msurface_s *texturechain; struct mtexinfo_s { float vecs[2][4]; struct texture_s { char name[16]; unsigned int width; int gl_texturenum; int fb_texturenum; struct msurface_s *texturechain[2]; struct msurface_s **texturechain_tail[2]; int anim_total; int anim_min; struct texture_s *anim_next; struct texture_s *alternate_anims; unsigned int offsets[4]; unsigned int flatcolor3ub; enum qbool { false=0, true=1 } loaded; int isLumaTexture; } *texture; int flags; } *texinfo; int dlightframe; int dlightbits; int lightmaptexturenum; unsigned char styles[4]; int cached_light[4]; enum qbool { false=0, true=1 } cached_dlight; unsigned char *samples; } **firstmarksurface; int nummarksurfaces; } *leafs; int numvertexes; struct mvertex_s { float position[3]; } *vertexes; int numedges; struct medge_s { unsigned short v[2]; unsigned int cachededgeoffset; } *edges; int numnodes; int firstnode; struct mnode_s *nodes; int numtexinfo; struct mtexinfo_s *texinfo; int numsurfaces; struct msurface_s *surfaces; int numsurfedges; int *surfedges; int nummarksurfaces; struct msurface_s **marksurfaces; int numtextures; struct texture_s **textures; unsigned char *visdata; unsigned char *lightdata; int bspversion; enum qbool { false=0, true=1 } isworldmodel; struct cache_user_s cache; } *

variable_types: struct aliashdr_s { int ident; int version; float scale[3]; float scale_origin[3]; float boundingradius; float eyeposition[3]; int numskins; int skinwidth; int skinheight; int numverts; int numtris; int numframes; enum synctype_t { ST_SYNC=0, ST_RAND=1 } synctype; int flags; float size; int numposes; int poseverts; int posedata; int commands; int gl_texturenum[32][4]; int fb_texturenum[32][4]; struct maliasframedesc_s { int firstpose; int numposes; float interval; float bboxmin[3]; float bboxmax[3]; float radius; int frame; char name[16]; } frames[1]; } *

variable_types:
cmds
int *

variable_types: struct trivertx_t { unsigned char v[3]; unsigned char lightnormalindex; } *

user_defined_types: struct model_s { char name[64]; enum qbool needload; unsigned short crc; int simpletexture[5]; enum modhint_t modhint; enum modtype_t type; int numframes; enum synctype_t synctype; int flags; float mins[3]; float radius; int firstmodelsurface; int numsubmodels; struct dmodel_t *submodels; int numplanes; struct mplane_s *planes; int numleafs; struct mleaf_s *leafs; int numvertexes; struct mvertex_s *vertexes; int numedges; struct medge_s *edges; int numnodes; int firstnode; struct mnode_s *nodes; int numtexinfo; struct mtexinfo_s *texinfo; int numsurfaces; struct msurface_s *surfaces; int numsurfedges; int *surfedges; int nummarksurfaces; struct msurface_s **marksurfaces; int numtextures; struct texture_s **textures; unsigned char *visdata; unsigned char *lightdata; int bspversion; enum qbool isworldmodel; struct cache_user_s cache; }

user_defined_types: struct aliashdr_s { int ident; int version; float scale[3]; float scale_origin[3]; float boundingradius; float eyeposition[3]; int numskins; int skinwidth; int skinheight; int numverts; int numtris; int numframes; enum synctype_t synctype; int flags; float size; int numposes; int poseverts; int posedata; int commands; int gl_texturenum[32][4]; int fb_texturenum[32][4]; struct maliasframedesc_s frames[1]; }

user_defined_types: struct mleaf_s { int contents; int visframe; float minmaxs[6]; struct mnode_s *parent; unsigned char *compressed_vis; struct efrag_s *efrags; struct msurface_s **firstmarksurface; int nummarksurfaces; }

user_defined_types: struct efrag_s { struct mleaf_s *leaf; struct efrag_s *leafnext; struct entity_s *entity; struct efrag_s *entnext; }

user_defined_types: struct msurface_s { int visframe; struct mplane_s *plane; int flags; int firstedge; int numedges; short texturemins[2]; short extents[2]; int light_s; struct glpoly_s *polys; struct msurface_s *texturechain; struct mtexinfo_s *texinfo; int dlightframe; int dlightbits; int lightmaptexturenum; unsigned char styles[4]; int cached_light[4]; enum qbool cached_dlight; unsigned char *samples; }

user_defined_types: struct entity_s { float origin[3]; float angles[3]; struct model_s *model; unsigned char *colormap; int skinnum; struct player_info_s *scoreboard; int renderfx; int effects; int oldframe; int frame; float framelerp; struct efrag_s *efrag; int visframe; int dlightframe; int dlightbits; float alpha; int trivial_accept; struct mnode_s *topnode; }

user_defined_types: struct mtexinfo_s { float vecs[2][4]; struct texture_s *texture; int flags; }

user_defined_types: struct player_info_s { int userid; char userinfo[1024]; char name[16]; float entertime; int frags; int ping; unsigned char pl; int topcolor; int bottomcolor; int _topcolor; int _bottomcolor; int real_topcolor; int real_bottomcolor; char team[1024]; char _team[1024]; int fps_msec; int last_fps; int fps; int fps_frames; double fps_measure_time; enum qbool isnear; int spectator; unsigned char translations[-1]; struct skin_t *skin; int stats[32]; enum qbool skin_refresh; enum qbool ignored; enum qbool validated; char f_server[16]; enum qbool dead; }

user_defined_types: struct texture_s { char name[16]; unsigned int width; int gl_texturenum; int fb_texturenum; struct msurface_s *texturechain[2]; struct msurface_s **texturechain_tail[2]; int anim_total; int anim_min; struct texture_s *anim_next; struct texture_s *alternate_anims; unsigned int offsets[4]; unsigned int flatcolor3ub; enum qbool loaded; int isLumaTexture; }

user_defined_types: struct skin_t { char name[16]; enum qbool failedload; enum qbool warned; int width; int bpp; int texnum; struct cache_user_s cache; }


GetFileLocalTime

decompiled_code:
__int64 __fastcall GetFileLocalTime(const char *a1, _DWORD *a2)
{
int v2; // edx
__int64 result; // rax
struct tm *v4; // rax
struct stat v5; // [rsp+0h] [rbp-98h] BYREF

v2 = stat(a1, &v5);
result = 0LL;
if ( !v2 )
{
v4 = localtime(&v5.st_mtim.tv_sec);
UnixtimeToWintime(a2, (unsigned int *)v4);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1, _DWORD *a2)
{
int v2; // edx
__int64 result; // rax
struct tm *v4; // rax
struct stat v5; // [rsp+0h] [rbp-98h] BYREF

v2 = stat(a1, &v5);
result = 0LL;
if ( !v2 )
{
v4 = localtime(&v5.st_mtim.tv_sec);
func0(a2, (unsigned int *)v4);
result = 1LL;
}
return result;
}

original_code:
int GetFileLocalTime(char *path, SYSTEMTIME *wintime)
{
    struct stat statbuf;
    struct tm * lintime;
    if (stat(path, &statbuf) != 0)
        return 0;
    lintime = localtime(&statbuf.st_mtim.tv_sec);
    UnixtimeToWintime(wintime, lintime);
    return 1;
}

canonical_original_code:
int GetFileLocalTime(char *path, struct SYSTEMTIME_s *wintime)
{
    struct stat statbuf;
    struct tm *lintime;
    if (stat(path, &statbuf) != 0)
        return 0;
    lintime = localtime(&statbuf.st_mtim.tv_sec);
    UnixtimeToWintime(wintime, lintime);
    return 1;
}

variable_types:
path
char *

variable_types: struct SYSTEMTIME_s { int wYear; int wMonth; int wDay; int wDayOfWeek; int wHour; int wMinute; int wSecond; int wMilliseconds; } *

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }

variable_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; } *

user_defined_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }


SYSTEMTIMEcmp

original_code:
int SYSTEMTIMEcmp(const SYSTEMTIME *t1, const SYSTEMTIME *t2)
{
    return intcmp( t1->wSecond, t2->wSecond )
    + intcmp( t1->wMinute, t2->wMinute ) * 2
    + intcmp( t1->wHour, t2->wHour ) * 4
    + intcmp( t1->wDay, t2->wDay ) * 8
    + intcmp( t1->wMonth, t2->wMonth ) * 16
    + intcmp( t1->wYear, t2->wYear ) * 32;
}

canonical_original_code:
int SYSTEMTIMEcmp(struct SYSTEMTIME_s *t1, struct SYSTEMTIME_s *t2)
{
    return intcmp( t1->wSecond, t2->wSecond )
    + intcmp( t1->wMinute, t2->wMinute ) * 2
    + intcmp( t1->wHour, t2->wHour ) * 4
    + intcmp( t1->wDay, t2->wDay ) * 8
    + intcmp( t1->wMonth, t2->wMonth ) * 16
    + intcmp( t1->wYear, t2->wYear ) * 32;
}

user_defined_types: struct SYSTEMTIME_s { int wYear; int wMonth; int wDay; int wDayOfWeek; int wHour; int wMinute; int wSecond; int wMilliseconds; }


intcmp

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

result = 1LL;
if ( a1 <= a2 )
result = (unsigned int)-(a1 < a2);
return result;
}

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

result = 1LL;
if ( a1 <= a2 )
result = (unsigned int)-(a1 < a2);
return result;
}

original_code:
int intcmp(int i1, int i2)
{
    if (i1 > i2)
    return 1;
    if (i1 < i2)
    return -1;
    return 0;
}


original_code:
static void XSD_Command_Init(xml_command_t *document)
{
    memset(document, 0, sizeof(xml_command_t));
}

canonical_original_code:
static void XSD_Command_Init(struct xml_command_s *document)
{
    memset(document, 0, sizeof(xml_command_t));
}

variable_types: struct xml_command_s { char *document_type; char *name; char *description; char *syntax; struct command_argument_s { char *name; char *description; struct command_argument_s *next; } *arguments; char *remarks; } *

user_defined_types: struct xml_command_s { char *document_type; char *name; char *description; char *syntax; struct command_argument_s *arguments; char *remarks; }


decompiled_code:
void __fastcall XSD_Command_Free(void *ptr)
{
void *v2; // rdi
void *v3; // rdi
void *v4; // rdi
void *v5; // rdi
_QWORD *i; // rbx
void *v7; // rdi

v2 = (void *)*((_QWORD *)ptr + 1);
if ( v2 )
{
free(v2);
*((_QWORD *)ptr + 1) = 0LL;
}
v3 = (void *)*((_QWORD *)ptr + 2);
if ( v3 )
{
free(v3);
*((_QWORD *)ptr + 2) = 0LL;
}
v4 = (void *)*((_QWORD *)ptr + 5);
if ( v4 )
{
free(v4);
*((_QWORD *)ptr + 5) = 0LL;
}
v5 = (void *)*((_QWORD *)ptr + 3);
if ( v5 )
{
free(v5);
*((_QWORD *)ptr + 3) = 0LL;
}
for ( i = (_QWORD *)*((_QWORD *)ptr + 4); i; *((_QWORD *)ptr + 4) = i )
{
v7 = i;
i = (_QWORD *)i[2];
free(v7);
}
if ( *(_QWORD *)ptr )
free(*(void **)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
void *v2; // rdi
void *v3; // rdi
void *v4; // rdi
void *v5; // rdi
_QWORD *i; // rbx
void *v7; // rdi

v2 = (void *)*((_QWORD *)ptr + 1);
if ( v2 )
{
free(v2);
*((_QWORD *)ptr + 1) = 0LL;
}
v3 = (void *)*((_QWORD *)ptr + 2);
if ( v3 )
{
free(v3);
*((_QWORD *)ptr + 2) = 0LL;
}
v4 = (void *)*((_QWORD *)ptr + 5);
if ( v4 )
{
free(v4);
*((_QWORD *)ptr + 5) = 0LL;
}
v5 = (void *)*((_QWORD *)ptr + 3);
if ( v5 )
{
free(v5);
*((_QWORD *)ptr + 3) = 0LL;
}
for ( i = (_QWORD *)*((_QWORD *)ptr + 4); i; *((_QWORD *)ptr + 4) = i )
{
v7 = i;
i = (_QWORD *)i[2];
free(v7);
}
if ( *(_QWORD *)ptr )
free(*(void **)ptr);
free(ptr);
}

original_code:
void XSD_Command_Free(xml_t *doc)
{
    xml_command_t *document = (xml_command_t *) doc;
    if (document->name)
        if(document->name) { free(document->name); document->name = ((void *)0); };
    if (document->description)
        if(document->description) { free(document->description); document->description = ((void *)0); };
    if (document->remarks)
        if(document->remarks) { free(document->remarks); document->remarks = ((void *)0); };
    if (document->syntax)
        if(document->syntax) { free(document->syntax); document->syntax = ((void *)0); };
    while (document->arguments)
    {
        command_argument_t *next = document->arguments->next;
        if(document->arguments) { free(document->arguments); document->arguments = ((void *)0); };
        document->arguments = next;
    }
    if (document->document_type)
        if(document->document_type) { free(document->document_type); document->document_type = ((void *)0); };
    if(document) { free(document); document = ((void *)0); };
}

canonical_original_code:
void XSD_Command_Free(struct xml_s *doc)
{
    struct xml_command_s *document = (xml_command_t *) doc;
    if (document->name)
        if(document->name) { free(document->name); document->name = ((void *)0); };
    if (document->description)
        if(document->description) { free(document->description); document->description = ((void *)0); };
    if (document->remarks)
        if(document->remarks) { free(document->remarks); document->remarks = ((void *)0); };
    if (document->syntax)
        if(document->syntax) { free(document->syntax); document->syntax = ((void *)0); };
    while (document->arguments)
    {
        struct command_argument_s *next = document->arguments->next;
        if(document->arguments) { free(document->arguments); document->arguments = ((void *)0); };
        document->arguments = next;
    }
    if (document->document_type)
        if(document->document_type) { free(document->document_type); document->document_type = ((void *)0); };
    if(document) { free(document); document = ((void *)0); };
}

variable_types:
doc
struct xml_s { char *document_type; } *

variable_types: struct command_argument_s { char *name; char *description; struct command_argument_s *next; } *


decompiled_code:
__int64 __fastcall EZ_window_Init(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, int a8, int a9, int a10)
{
unsigned int v11; // er14
__int64 v12; // rbp
__int64 v13; // r13
unsigned int v14; // er15
__int64 v15; // r13
__int64 v16; // rax

EZ_control_Init(a1, a2, a3, a4);
*(_DWORD *)a1 = 6;
*(_DWORD *)(a1 + 176) |= a10 | 0x64;
v11 = *(_DWORD *)(a1 + 164);
EZ_control_SetBackgroundImage(a1, "gfx/ui/ez_window");
EZ_control_SetBackgroundImageOpacity(a1, 1.0);
EZ_control_SetBackgroundImageEdgePercentage(a1, 20LL);
v12 = EZ_control_Create(a2, a1, "Window titlebar", 0LL, v11, v11, *(unsigned int *)(a1 + 56), 15LL, 3111LL);
*(_QWORD *)(a1 + 1128) = v12;
EZ_control_SetBackgroundImage(v12, "gfx/ui/ez_titlebar");
EZ_control_SetSize(v12, *(_DWORD *)(a1 + 56) - 2 * v11, 15LL);
EZ_control_SetAnchor(v12, 14LL);
EZ_control_SetDrawOrder(v12, (unsigned int)(*(_DWORD *)(a1 + 168) + 1), 1LL);
v13 = EZ_button_Create(a2, v12, "Close button", 0LL, 0LL, 0LL, 10LL, 10LL, 1LL);
*(_QWORD *)(a1 + 1136) = v13;
v14 = *(_DWORD *)(v12 + 60) - 4;
EZ_control_SetPosition(v13, 4294967294LL, 2LL);
EZ_control_SetSize(v13, v14, v14);
EZ_control_SetAnchor(v13, 12LL);
v15 = EZ_scrollpane_Create(a2, a1, "Window scrollpane", 0LL, v11, *(_DWORD *)(v12 + 60) + v11, 10LL, 10LL, 0LL);
*(_QWORD *)(a1 + 1112) = v15;
EZ_control_SetSize(v15, *(_DWORD *)(a1 + 56) - 2 * v11, *(_DWORD *)(a1 + 60) - (*(_DWORD *)(v12 + 60) + 2 * v11));
EZ_control_SetAnchor(v15, 30LL);
v16 = EZ_control_Create(a2, v15, "Window area", 0LL, 0LL, 0LL, 10LL, 10LL, 289LL);
*(_QWORD *)(a1 + 1120) = v16;
EZ_scrollpane_SetTarget(*(_QWORD *)(a1 + 1112), v16);
return EZ_control_SetDrawOrder(*(_QWORD *)(a1 + 1120), (unsigned int)(*(_DWORD *)(v15 + 168) + 1), 1LL);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, int a8, int a9, int a10)
{
unsigned int v11; // er14
__int64 v12; // rbp
__int64 v13; // r13
unsigned int v14; // er15
__int64 v15; // r13
__int64 v16; // rax

EZ_control_Init(a1, a2, a3, a4);
*(_DWORD *)a1 = 6;
*(_DWORD *)(a1 + 176) |= a10 | 0x64;
v11 = *(_DWORD *)(a1 + 164);
EZ_control_SetBackgroundImage(a1, "gfx/ui/ez_window");
EZ_control_SetBackgroundImageOpacity(a1, 1.0);
EZ_control_SetBackgroundImageEdgePercentage(a1, 20LL);
v12 = EZ_control_Create(a2, a1, "Window titlebar", 0LL, v11, v11, *(unsigned int *)(a1 + 56), 15LL, 3111LL);
*(_QWORD *)(a1 + 1128) = v12;
EZ_control_SetBackgroundImage(v12, "gfx/ui/ez_titlebar");
EZ_control_SetSize(v12, *(_DWORD *)(a1 + 56) - 2 * v11, 15LL);
EZ_control_SetAnchor(v12, 14LL);
EZ_control_SetDrawOrder(v12, (unsigned int)(*(_DWORD *)(a1 + 168) + 1), 1LL);
v13 = EZ_button_Create(a2, v12, "Close button", 0LL, 0LL, 0LL, 10LL, 10LL, 1LL);
*(_QWORD *)(a1 + 1136) = v13;
v14 = *(_DWORD *)(v12 + 60) - 4;
EZ_control_SetPosition(v13, 4294967294LL, 2LL);
EZ_control_SetSize(v13, v14, v14);
EZ_control_SetAnchor(v13, 12LL);
v15 = EZ_scrollpane_Create(a2, a1, "Window scrollpane", 0LL, v11, *(_DWORD *)(v12 + 60) + v11, 10LL, 10LL, 0LL);
*(_QWORD *)(a1 + 1112) = v15;
EZ_control_SetSize(v15, *(_DWORD *)(a1 + 56) - 2 * v11, *(_DWORD *)(a1 + 60) - (*(_DWORD *)(v12 + 60) + 2 * v11));
EZ_control_SetAnchor(v15, 30LL);
v16 = EZ_control_Create(a2, v15, "Window area", 0LL, 0LL, 0LL, 10LL, 10LL, 289LL);
*(_QWORD *)(a1 + 1120) = v16;
EZ_scrollpane_SetTarget(*(_QWORD *)(a1 + 1112), v16);
return EZ_control_SetDrawOrder(*(_QWORD *)(a1 + 1120), (unsigned int)(*(_DWORD *)(v15 + 168) + 1), 1LL);
}

original_code:
void EZ_window_Init(ez_window_t *window, ez_tree_t *tree, ez_control_t *parent,
         char *name, char *description,
         int x, int y, int width, int height,
         ez_control_flags_t flags)
{
 ez_control_t *window_ctrl = (ez_control_t *)window;
 ez_control_t *titlebar_ctrl = ((void *)0);
 ez_control_t *scrollpane_ctrl = ((void *)0);
 int rh_size = 0;
 EZ_control_Init(&window->super, tree, parent, name, description, x, y, width, height, flags);
 ((ez_control_t *)window)->CLASS_ID = EZ_WINDOW_ID;
 ((ez_control_t *)window)->ext_flags |= (flags | control_focusable | control_contained | control_resizeable);
 rh_size = window_ctrl->resize_handle_thickness;
 EZ_control_SetBackgroundImage(window_ctrl, "gfx/ui/ez_window");
 EZ_control_SetBackgroundImageOpacity(window_ctrl, 1.0);
 EZ_control_SetBackgroundImageEdgePercentage(window_ctrl, 20);
 {
  window->titlebar = EZ_control_Create(tree, window_ctrl, "Window titlebar", ((void *)0), rh_size, rh_size, window_ctrl->width, 15,
   (control_focusable | control_move_parent | control_movable | control_resizeable | control_enabled | control_anchor_viewport));
  titlebar_ctrl = (ez_control_t *)window->titlebar;
  EZ_control_SetBackgroundImage(titlebar_ctrl, "gfx/ui/ez_titlebar");
  EZ_control_SetSize(titlebar_ctrl, (window_ctrl->width - (2 * rh_size)), 15);
  EZ_control_SetAnchor(titlebar_ctrl, (anchor_left | anchor_top | anchor_right));
  EZ_control_SetDrawOrder(titlebar_ctrl, window_ctrl->draw_order + 1, true);
  {
   int cb_sidelength = 0;
   ez_control_t *close_ctrl = ((void *)0);
   window->close_button = EZ_button_Create(tree, titlebar_ctrl, "Close button", ((void *)0),
             0, 0, 10, 10, control_enabled);
   close_ctrl = (ez_control_t *)window->close_button;
   cb_sidelength = (titlebar_ctrl->height - (2 * 2));
   EZ_control_SetPosition(close_ctrl, -2, 2);
   EZ_control_SetSize(close_ctrl, cb_sidelength, cb_sidelength);
   EZ_control_SetAnchor(close_ctrl, (anchor_top | anchor_right));
  }
 }
 {
  window->scrollpane = EZ_scrollpane_Create(tree, window_ctrl, "Window scrollpane", ((void *)0), rh_size, (rh_size + titlebar_ctrl->height), 10, 10, 0);
  scrollpane_ctrl = (ez_control_t *)window->scrollpane;
  EZ_control_SetSize(scrollpane_ctrl,
   (window_ctrl->width - (2 * rh_size)),
   (window_ctrl->height - (titlebar_ctrl->height + (2 * rh_size))));
  EZ_control_SetAnchor(scrollpane_ctrl, (anchor_left | anchor_right | anchor_bottom | anchor_top));
  {
   window->window_area = EZ_control_Create(tree, scrollpane_ctrl, "Window area", ((void *)0), 0, 0, 10, 10, (control_scrollable | control_enabled | control_resizeable));
   EZ_scrollpane_SetTarget(window->scrollpane, window->window_area);
   EZ_control_SetDrawOrder(window->window_area, scrollpane_ctrl->draw_order + 1, true);
  }
 }
}

canonical_original_code:
void EZ_window_Init(struct ez_window_s *window, struct ez_tree_s *tree, struct ez_control_s *parent, char *name, char *description, int x, int y, int width, int height, enum ez_control_flags_e flags)
{
 struct ez_control_s *window_ctrl = (ez_control_t *)window;
 struct ez_control_s *titlebar_ctrl = ((void *)0);
 struct ez_control_s *scrollpane_ctrl = ((void *)0);
 int rh_size = 0;
 EZ_control_Init(&window->super, tree, parent, name, description, x, y, width, height, flags);
 ((struct ez_control_s *)window)->CLASS_ID = EZ_WINDOW_ID;
 ((struct ez_control_s *)window)->ext_flags |= (flags | control_focusable | control_contained | control_resizeable);
 rh_size = window_ctrl->resize_handle_thickness;
 EZ_control_SetBackgroundImage(window_ctrl, "gfx/ui/ez_window");
 EZ_control_SetBackgroundImageOpacity(window_ctrl, 1.0);
 EZ_control_SetBackgroundImageEdgePercentage(window_ctrl, 20);
 {
  window->titlebar = EZ_control_Create(tree, window_ctrl, "Window titlebar", ((void *)0), rh_size, rh_size, window_ctrl->width, 15,
   (control_focusable | control_move_parent | control_movable | control_resizeable | control_enabled | control_anchor_viewport));
  titlebar_ctrl = (struct ez_control_s *)window->titlebar;
  EZ_control_SetBackgroundImage(titlebar_ctrl, "gfx/ui/ez_titlebar");
  EZ_control_SetSize(titlebar_ctrl, (window_ctrl->width - (2 * rh_size)), 15);
  EZ_control_SetAnchor(titlebar_ctrl, (anchor_left | anchor_top | anchor_right));
  EZ_control_SetDrawOrder(titlebar_ctrl, window_ctrl->draw_order + 1, true);
  {
   int cb_sidelength = 0;
   struct ez_control_s *close_ctrl = ((void *)0);
   window->close_button = EZ_button_Create(tree, titlebar_ctrl, "Close button", ((void *)0),
             0, 0, 10, 10, control_enabled);
   close_ctrl = (struct ez_control_s *)window->close_button;
   cb_sidelength = (titlebar_ctrl->height - (2 * 2));
   EZ_control_SetPosition(close_ctrl, -2, 2);
   EZ_control_SetSize(close_ctrl, cb_sidelength, cb_sidelength);
   EZ_control_SetAnchor(close_ctrl, (anchor_top | anchor_right));
  }
 }
 {
  window->scrollpane = EZ_scrollpane_Create(tree, window_ctrl, "Window scrollpane", ((void *)0), rh_size, (rh_size + titlebar_ctrl->height), 10, 10, 0);
  scrollpane_ctrl = (struct ez_control_s *)window->scrollpane;
  EZ_control_SetSize(scrollpane_ctrl,
   (window_ctrl->width - (2 * rh_size)),
   (window_ctrl->height - (titlebar_ctrl->height + (2 * rh_size))));
  EZ_control_SetAnchor(scrollpane_ctrl, (anchor_left | anchor_right | anchor_bottom | anchor_top));
  {
   window->window_area = EZ_control_Create(tree, scrollpane_ctrl, "Window area", ((void *)0), 0, 0, 10, 10, (control_scrollable | control_enabled | control_resizeable));
   EZ_scrollpane_SetTarget(window->scrollpane, window->window_area);
   EZ_control_SetDrawOrder(window->window_area, scrollpane_ctrl->draw_order + 1, true);
  }
 }
}

variable_types: struct ez_window_s { struct ez_control_s { enum ez_control_id_e { EZ_CONTROL_ID=0, EZ_BUTTON_ID=1, EZ_LABEL_ID=2, EZ_SLIDER_ID=3, EZ_SCROLLBAR_ID=4, EZ_SCROLLPANE_ID=5, EZ_WINDOW_ID=6, EZ_LISTVIEW_ID=7, EZ_LISTVIEWITEM_ID=8 } CLASS_ID; char *name; char *description; int x; int y; int prev_x; int prev_y; int absolute_x; int absolute_y; int prev_absolute_x; int prev_absolute_y; int width; int height; int prev_width; int prev_height; int virtual_x; int virtual_y; int absolute_virtual_x; int absolute_virtual_y; int virtual_width; int virtual_height; int prev_virtual_width; int prev_virtual_height; int virtual_width_min; int virtual_height_min; int width_max; int width_min; int height_max; int height_min; int bound_top; int bound_left; int bound_right; int bound_bottom; int left_edge_gap; int right_edge_gap; int top_edge_gap; int bottom_edge_gap; enum ez_anchor_e { anchor_none=expr, anchor_left=expr, anchor_right=expr, anchor_top=expr, anchor_bottom=expr } anchor_flags; int resize_handle_thickness; int draw_order; int tab_order; enum ez_control_flags_e { control_enabled=expr, control_movable=expr, control_focusable=expr, control_resize_h=expr, control_resize_v=expr, control_resizeable=expr, control_contained=expr, control_visible=expr, control_scrollable=expr, control_ignore_mouse=expr, control_anchor_viewport=expr, control_move_parent=expr, control_listen_repeat_mouse=expr, control_bg_tile_center=expr, control_bg_tile_edges=expr } ext_flags; enum ez_control_iflags_e { control_focused=expr, control_moving=expr, control_resizing_left=expr, control_resizing_right=expr, control_resizing_top=expr, control_resizing_bottom=expr, control_clicked=expr, control_mouse_over=expr, control_update_anchorgap=expr, control_hidden_by_parent=expr } int_flags; unsigned char background_color[4]; struct mpic_t { int width; int texnum; float sl; } *background; float bg_edge_size_ratio; float bg_opacity; float opacity; float overall_opacity; float x_percent; float y_percent; void *payload; struct ez_control_events_s { int (*OnMouseEvent)(struct ez_control_s *self, struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool { false=0, true=1 } buttons[9]; int button_down; int button_up; } *mouse_state); int (*OnMouseClick)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUp)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUpOutside)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseDown)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseHover)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseEnter)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseLeave)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnKeyEvent)(struct ez_control_s *self, int key, int unichar, enum qbool { false=0, true=1 } down); int (*OnKeyDown)(struct ez_control_s *self, int key, int unichar); int (*OnKeyUp)(struct ez_control_s *self, int key, int unichar); int (*OnLayoutChildren)(struct ez_control_s *self, void *ext_event_info); int (*OnDraw)(struct ez_control_s *self, void *ext_event_info); int (*OnDestroy)(struct ez_control_s *self, enum qbool { false=0, true=1 } destroy_children); int (*OnMove)(struct ez_control_s *self, void *ext_event_info); int (*OnScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnParentScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnResize)(struct ez_control_s *self, void *ext_event_info); int (*OnParentResize)(struct ez_control_s *self, void *ext_event_info); int (*OnGotFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnLostFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnMinVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnFlagsChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnResizeHandleThicknessChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnEventHandlerChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnAnchorChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnVisibilityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnOpacityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnChildMoved)(struct ez_control_s *self, struct ez_control_s *child); int (*OnChildResize)(struct ez_control_s *self, struct ez_control_s *child); } events; struct ez_control_eventhandlers_s { struct ez_eventhandler_s { int function_type; union ez_eventhandlerfunction_u { int (*normal)(struct ez_control_s *self, void *payload, void *ext_info); int (*mouse)(struct ez_control_s *self, void *payload, struct mouse_state_s *mouse_state); int (*key)(struct ez_control_s *self, void *payload, int key, int unichar, enum qbool { false=0, true=1 } down); int (*key_sp)(struct ez_control_s *self, void *payload, int key, int unichar); int (*destroy)(struct ez_control_s *self, void *payload, enum qbool { false=0, true=1 } destroy_children); int (*child)(struct ez_control_s *self, void *payload, struct ez_control_s *child); } function; void *payload; struct ez_eventhandler_s *next; } *OnMouseEvent; struct ez_eventhandler_s *OnMouseClick; struct ez_eventhandler_s *OnMouseUp; struct ez_eventhandler_s *OnMouseUpOutside; struct ez_eventhandler_s *OnMouseDown; struct ez_eventhandler_s *OnMouseHover; struct ez_eventhandler_s *OnMouseEnter; struct ez_eventhandler_s *OnMouseLeave; struct ez_eventhandler_s *OnKeyEvent; struct ez_eventhandler_s *OnKeyDown; struct ez_eventhandler_s *OnKeyUp; struct ez_eventhandler_s *OnLayoutChildren; struct ez_eventhandler_s *OnDraw; struct ez_eventhandler_s *OnDestroy; struct ez_eventhandler_s *OnMove; struct ez_eventhandler_s *OnScroll; struct ez_eventhandler_s *OnParentScroll; struct ez_eventhandler_s *OnResize; struct ez_eventhandler_s *OnParentResize; struct ez_eventhandler_s *OnGotFocus; struct ez_eventhandler_s *OnLostFocus; struct ez_eventhandler_s *OnVirtualResize; struct ez_eventhandler_s *OnMinVirtualResize; struct ez_eventhandler_s *OnFlagsChanged; struct ez_eventhandler_s *OnResizeHandleThicknessChanged; struct ez_eventhandler_s *OnEventHandlerChanged; struct ez_eventhandler_s *OnAnchorChanged; struct ez_eventhandler_s *OnVisibilityChanged; struct ez_eventhandler_s *OnOpacityChanged; struct ez_eventhandler_s *OnChildMoved; struct ez_eventhandler_s *OnChildResize; } event_handlers; struct ez_control_eventcount_s { int OnMouseEvent; int OnMouseClick; int OnMouseUp; int OnMouseUpOutside; int OnMouseDown; int OnMouseHover; int OnMouseEnter; int OnMouseLeave; int OnKeyEvent; int OnKeyDown; int OnKeyUp; int OnLayoutChildren; int OnDraw; int OnDestroy; int OnMove; int OnScroll; int OnParentScroll; int OnResize; int OnParentResize; int OnGotFocus; int OnLostFocus; int OnVirtualResize; int OnMinVirtualResize; int OnFlagsChanged; int OnResizeHandleThicknessChanged; int OnEventHandlerChanged; int OnAnchorChanged; int OnVisibilityChanged; int OnOpacityChanged; int OnChildMoved; int OnChildResize; } inherit_levels; struct ez_control_eventcount_s override_counts; enum qbool { false=0, true=1 } initializing; struct ez_control_s *parent; struct ez_double_linked_list_s { int count; struct ez_dllist_node_s { struct ez_dllist_node_s *next; struct ez_dllist_node_s *previous; void *payload; } *head; struct ez_dllist_node_s *tail; } children; struct ez_tree_s { struct ez_control_s *root; enum qbool { false=0, true=1 } destroying; struct ez_dllist_node_s *focused_node; struct ez_double_linked_list_s drawlist; struct ez_double_linked_list_s tablist; struct mouse_state_s prev_mouse_state; double mouse_pressed_time[9]; } *control_tree; struct mouse_state_s prev_mouse_state; double mouse_repeat_delay; } super; struct ez_scrollpane_s { struct ez_control_s super; struct ez_scrollpane_events_s { int (*OnTargetChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnTargetResize)(struct ez_control_s *self, void *ext_event_info); int (*OnTargetScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnScrollbarThicknessChanged)(struct ez_control_s *self, void *ext_event_info); } events; struct ez_scrollpane_eventhandlers_s { struct ez_eventhandler_s *OnTargetChanged; struct ez_eventhandler_s *OnTargetResize; struct ez_eventhandler_s *OnTargetScroll; struct ez_eventhandler_s *OnScrollbarThicknessChanged; } event_handlers; struct ez_scrollpane_eventcount_s { int OnTargetChanged; int OnScrollbarThicknessChanged; } inherit_levels; struct ez_scrollpane_eventcount_s override_counts; struct ez_control_s *target; struct ez_control_s *prev_target; struct ez_scrollbar_s { struct ez_control_s super; struct ez_scrollbar_events_s { int (*OnTargetChanged)(struct ez_control_s *self, void *ext_event_info); } events; struct ez_scrollbar_eventhandlers_s { struct ez_eventhandler_s *OnTargetChanged; } event_handlers; struct ez_scrollbar_eventcount_s { int OnTargetChanged; } inherit_levels; struct ez_scrollbar_eventcount_s override_counts; struct ez_button_s { struct ez_control_s super; struct ez_button_events_s { int (*OnAction)(struct ez_control_s *self, void *ext_event_info); int (*OnTextAlignmentChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnToggled)(struct ez_control_s *self, void *ext_event_info); } events; struct ez_button_eventhandlers_s { struct ez_eventhandler_s *OnAction; struct ez_eventhandler_s *OnTextAlignmentChanged; struct ez_eventhandler_s *OnToggled; } event_handlers; struct ez_button_eventcount_s { int OnAction; int OnTextAlignmentChanged; int OnToggled; } inherit_levels; struct ez_button_eventcount_s override_counts; struct ez_label_s { struct ez_control_s super; struct ez_label_events_s { int (*OnTextChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnCaretMoved)(struct ez_control_s *self, void *ext_event_info); int (*OnTextScaleChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnTextFlagsChanged)(struct ez_control_s *self, void *ext_event_info); } events; struct ez_label_eventhandlers_s { struct ez_eventhandler_s *OnTextChanged; struct ez_eventhandler_s *OnCaretMoved; struct ez_eventhandler_s *OnTextScaleChanged; struct ez_eventhandler_s *OnTextFlagsChanged; } event_handlers; struct ez_label_eventcount_s { int OnTextChanged; int OnCaretMoved; int OnTextScaleChanged; int OnTextFlagsChanged; } inherit_levels; struct ez_label_eventcount_s override_counts; char *text; int text_length; enum ez_label_flags_e { label_largefont=expr, label_autosize=expr, label_autoellipsis=expr, label_wraptext=expr, label_selectable=expr, label_readonly=expr } ext_flags; enum ez_label_iflags_e { label_selecting=expr } int_flags; struct ez_label_textpos_s { int index; int row; int col; } wordwraps[512]; struct clrinfo_s { int c; int i; } color; float scale; int scaled_char_size; int select_start; int select_end; struct ez_label_textpos_s caret_pos; int num_rows; int num_cols; } *text_label; struct mpic_t *focused_image; struct mpic_t *normal_image; struct mpic_t *hover_image; struct mpic_t *pressed_image; struct mpic_t *toggled_hover_image; unsigned char color_focused[4]; unsigned char color_normal[4]; unsigned char color_hover[4]; unsigned char color_pressed[4]; unsigned char color_toggled_hover[4]; enum ez_button_iflags_e { button_toggled=expr } int_flags; enum ez_button_flags_e { button_use_images=expr, button_is_toggleable=expr } ext_flags; int padding_top; int padding_left; int padding_right; int padding_bottom; enum ez_textalign_e { top_left=0, top_center=1, top_right=2, middle_left=3, middle_center=4, middle_right=5, bottom_left=6, bottom_center=7, bottom_right=8 } text_alignment; struct clrinfo_s focused_text_color; struct clrinfo_s normal_text_color; struct clrinfo_s hover_text_color; struct clrinfo_s pressed_text_color; int override_count; int inheritance_level; } *back; struct ez_button_s *slider; struct ez_button_s *forward; enum ez_orientation_s { vertical=0, horizontal=1 } orientation; int scroll_area; int slider_minsize; int scroll_delta_x; int scroll_delta_y; struct ez_control_s *target; enum ez_scrollbar_flags_e { target_parent=expr } ext_flags; enum ez_scrollbar_iflags_e { sliding=expr, scrolling=expr } int_flags; } *v_scrollbar; struct ez_scrollbar_s *h_scrollbar; int scrollbar_thickness; enum ez_scrollpane_flags_e { always_v_scrollbar=expr, always_h_scrollbar=expr } ext_flags; enum ez_scrollpane_iflags_e { show_v_scrollbar=expr, show_h_scrollbar=expr, resizing_target=expr } int_flags; } *scrollpane; struct ez_control_s *window_area; struct ez_control_s *titlebar; struct ez_button_s *close_button; } *

variable_types:
tree
struct ez_tree_s *

variable_types:
parent
struct ez_control_s *

variable_types:
name
char *

variable_types:
description
char *

variable_types: x int

variable_types: y int

variable_types: width int

variable_types: height int

variable_types: struct ez_control_s { enum ez_control_id_e { EZ_CONTROL_ID=0, EZ_BUTTON_ID=1, EZ_LABEL_ID=2, EZ_SLIDER_ID=3, EZ_SCROLLBAR_ID=4, EZ_SCROLLPANE_ID=5, EZ_WINDOW_ID=6, EZ_LISTVIEW_ID=7, EZ_LISTVIEWITEM_ID=8 } CLASS_ID; char *name; char *description; int x; int y; int prev_x; int prev_y; int absolute_x; int absolute_y; int prev_absolute_x; int prev_absolute_y; int width; int height; int prev_width; int prev_height; int virtual_x; int virtual_y; int absolute_virtual_x; int absolute_virtual_y; int virtual_width; int virtual_height; int prev_virtual_width; int prev_virtual_height; int virtual_width_min; int virtual_height_min; int width_max; int width_min; int height_max; int height_min; int bound_top; int bound_left; int bound_right; int bound_bottom; int left_edge_gap; int right_edge_gap; int top_edge_gap; int bottom_edge_gap; enum ez_anchor_e { anchor_none=expr, anchor_left=expr, anchor_right=expr, anchor_top=expr, anchor_bottom=expr } anchor_flags; int resize_handle_thickness; int draw_order; int tab_order; enum ez_control_flags_e { control_enabled=expr, control_movable=expr, control_focusable=expr, control_resize_h=expr, control_resize_v=expr, control_resizeable=expr, control_contained=expr, control_visible=expr, control_scrollable=expr, control_ignore_mouse=expr, control_anchor_viewport=expr, control_move_parent=expr, control_listen_repeat_mouse=expr, control_bg_tile_center=expr, control_bg_tile_edges=expr } ext_flags; enum ez_control_iflags_e { control_focused=expr, control_moving=expr, control_resizing_left=expr, control_resizing_right=expr, control_resizing_top=expr, control_resizing_bottom=expr, control_clicked=expr, control_mouse_over=expr, control_update_anchorgap=expr, control_hidden_by_parent=expr } int_flags; unsigned char background_color[4]; struct mpic_t { int width; int texnum; float sl; } *background; float bg_edge_size_ratio; float bg_opacity; float opacity; float overall_opacity; float x_percent; float y_percent; void *payload; struct ez_control_events_s { int (*OnMouseEvent)(struct ez_control_s *self, struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool { false=0, true=1 } buttons[9]; int button_down; int button_up; } *mouse_state); int (*OnMouseClick)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUp)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUpOutside)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseDown)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseHover)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseEnter)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseLeave)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnKeyEvent)(struct ez_control_s *self, int key, int unichar, enum qbool { false=0, true=1 } down); int (*OnKeyDown)(struct ez_control_s *self, int key, int unichar); int (*OnKeyUp)(struct ez_control_s *self, int key, int unichar); int (*OnLayoutChildren)(struct ez_control_s *self, void *ext_event_info); int (*OnDraw)(struct ez_control_s *self, void *ext_event_info); int (*OnDestroy)(struct ez_control_s *self, enum qbool { false=0, true=1 } destroy_children); int (*OnMove)(struct ez_control_s *self, void *ext_event_info); int (*OnScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnParentScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnResize)(struct ez_control_s *self, void *ext_event_info); int (*OnParentResize)(struct ez_control_s *self, void *ext_event_info); int (*OnGotFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnLostFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnMinVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnFlagsChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnResizeHandleThicknessChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnEventHandlerChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnAnchorChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnVisibilityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnOpacityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnChildMoved)(struct ez_control_s *self, struct ez_control_s *child); int (*OnChildResize)(struct ez_control_s *self, struct ez_control_s *child); } events; struct ez_control_eventhandlers_s { struct ez_eventhandler_s { int function_type; union ez_eventhandlerfunction_u { int (*normal)(struct ez_control_s *self, void *payload, void *ext_info); int (*mouse)(struct ez_control_s *self, void *payload, struct mouse_state_s *mouse_state); int (*key)(struct ez_control_s *self, void *payload, int key, int unichar, enum qbool { false=0, true=1 } down); int (*key_sp)(struct ez_control_s *self, void *payload, int key, int unichar); int (*destroy)(struct ez_control_s *self, void *payload, enum qbool { false=0, true=1 } destroy_children); int (*child)(struct ez_control_s *self, void *payload, struct ez_control_s *child); } function; void *payload; struct ez_eventhandler_s *next; } *OnMouseEvent; struct ez_eventhandler_s *OnMouseClick; struct ez_eventhandler_s *OnMouseUp; struct ez_eventhandler_s *OnMouseUpOutside; struct ez_eventhandler_s *OnMouseDown; struct ez_eventhandler_s *OnMouseHover; struct ez_eventhandler_s *OnMouseEnter; struct ez_eventhandler_s *OnMouseLeave; struct ez_eventhandler_s *OnKeyEvent; struct ez_eventhandler_s *OnKeyDown; struct ez_eventhandler_s *OnKeyUp; struct ez_eventhandler_s *OnLayoutChildren; struct ez_eventhandler_s *OnDraw; struct ez_eventhandler_s *OnDestroy; struct ez_eventhandler_s *OnMove; struct ez_eventhandler_s *OnScroll; struct ez_eventhandler_s *OnParentScroll; struct ez_eventhandler_s *OnResize; struct ez_eventhandler_s *OnParentResize; struct ez_eventhandler_s *OnGotFocus; struct ez_eventhandler_s *OnLostFocus; struct ez_eventhandler_s *OnVirtualResize; struct ez_eventhandler_s *OnMinVirtualResize; struct ez_eventhandler_s *OnFlagsChanged; struct ez_eventhandler_s *OnResizeHandleThicknessChanged; struct ez_eventhandler_s *OnEventHandlerChanged; struct ez_eventhandler_s *OnAnchorChanged; struct ez_eventhandler_s *OnVisibilityChanged; struct ez_eventhandler_s *OnOpacityChanged; struct ez_eventhandler_s *OnChildMoved; struct ez_eventhandler_s *OnChildResize; } event_handlers; struct ez_control_eventcount_s { int OnMouseEvent; int OnMouseClick; int OnMouseUp; int OnMouseUpOutside; int OnMouseDown; int OnMouseHover; int OnMouseEnter; int OnMouseLeave; int OnKeyEvent; int OnKeyDown; int OnKeyUp; int OnLayoutChildren; int OnDraw; int OnDestroy; int OnMove; int OnScroll; int OnParentScroll; int OnResize; int OnParentResize; int OnGotFocus; int OnLostFocus; int OnVirtualResize; int OnMinVirtualResize; int OnFlagsChanged; int OnResizeHandleThicknessChanged; int OnEventHandlerChanged; int OnAnchorChanged; int OnVisibilityChanged; int OnOpacityChanged; int OnChildMoved; int OnChildResize; } inherit_levels; struct ez_control_eventcount_s override_counts; enum qbool { false=0, true=1 } initializing; struct ez_control_s *parent; struct ez_double_linked_list_s { int count; struct ez_dllist_node_s { struct ez_dllist_node_s *next; struct ez_dllist_node_s *previous; void *payload; } *head; struct ez_dllist_node_s *tail; } children; struct ez_tree_s { struct ez_control_s *root; enum qbool { false=0, true=1 } destroying; struct ez_dllist_node_s *focused_node; struct ez_double_linked_list_s drawlist; struct ez_double_linked_list_s tablist; struct mouse_state_s prev_mouse_state; double mouse_pressed_time[9]; } *control_tree; struct mouse_state_s prev_mouse_state; double mouse_repeat_delay; } *

user_defined_types: struct ez_window_s { struct ez_control_s super; struct ez_scrollpane_s *scrollpane; struct ez_control_s *window_area; struct ez_control_s *titlebar; struct ez_button_s *close_button; }

user_defined_types: struct ez_control_s { enum ez_control_id_e CLASS_ID; char *name; char *description; int x; int y; int prev_x; int prev_y; int absolute_x; int absolute_y; int prev_absolute_x; int prev_absolute_y; int width; int height; int prev_width; int prev_height; int virtual_x; int virtual_y; int absolute_virtual_x; int absolute_virtual_y; int virtual_width; int virtual_height; int prev_virtual_width; int prev_virtual_height; int virtual_width_min; int virtual_height_min; int width_max; int width_min; int height_max; int height_min; int bound_top; int bound_left; int bound_right; int bound_bottom; int left_edge_gap; int right_edge_gap; int top_edge_gap; int bottom_edge_gap; enum ez_anchor_e anchor_flags; int resize_handle_thickness; int draw_order; int tab_order; enum ez_control_flags_e ext_flags; enum ez_control_iflags_e int_flags; unsigned char background_color[4]; struct mpic_t *background; float bg_edge_size_ratio; float bg_opacity; float opacity; float overall_opacity; float x_percent; float y_percent; void *payload; struct ez_control_events_s events; struct ez_control_eventhandlers_s event_handlers; struct ez_control_eventcount_s inherit_levels; struct ez_control_eventcount_s override_counts; enum qbool initializing; struct ez_control_s *parent; struct ez_double_linked_list_s children; struct ez_tree_s *control_tree; struct mouse_state_s prev_mouse_state; double mouse_repeat_delay; }

user_defined_types: struct ez_control_events_s { int (*OnMouseEvent)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseClick)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUp)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUpOutside)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseDown)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseHover)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseEnter)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseLeave)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnKeyEvent)(struct ez_control_s *self, int key, int unichar, enum qbool down); int (*OnKeyDown)(struct ez_control_s *self, int key, int unichar); int (*OnKeyUp)(struct ez_control_s *self, int key, int unichar); int (*OnLayoutChildren)(struct ez_control_s *self, void *ext_event_info); int (*OnDraw)(struct ez_control_s *self, void *ext_event_info); int (*OnDestroy)(struct ez_control_s *self, enum qbool destroy_children); int (*OnMove)(struct ez_control_s *self, void *ext_event_info); int (*OnScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnParentScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnResize)(struct ez_control_s *self, void *ext_event_info); int (*OnParentResize)(struct ez_control_s *self, void *ext_event_info); int (*OnGotFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnLostFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnMinVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnFlagsChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnResizeHandleThicknessChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnEventHandlerChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnAnchorChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnVisibilityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnOpacityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnChildMoved)(struct ez_control_s *self, struct ez_control_s *child); int (*OnChildResize)(struct ez_control_s *self, struct ez_control_s *child); }

user_defined_types: struct ez_control_eventhandlers_s { struct ez_eventhandler_s *OnMouseEvent; struct ez_eventhandler_s *OnMouseClick; struct ez_eventhandler_s *OnMouseUp; struct ez_eventhandler_s *OnMouseUpOutside; struct ez_eventhandler_s *OnMouseDown; struct ez_eventhandler_s *OnMouseHover; struct ez_eventhandler_s *OnMouseEnter; struct ez_eventhandler_s *OnMouseLeave; struct ez_eventhandler_s *OnKeyEvent; struct ez_eventhandler_s *OnKeyDown; struct ez_eventhandler_s *OnKeyUp; struct ez_eventhandler_s *OnLayoutChildren; struct ez_eventhandler_s *OnDraw; struct ez_eventhandler_s *OnDestroy; struct ez_eventhandler_s *OnMove; struct ez_eventhandler_s *OnScroll; struct ez_eventhandler_s *OnParentScroll; struct ez_eventhandler_s *OnResize; struct ez_eventhandler_s *OnParentResize; struct ez_eventhandler_s *OnGotFocus; struct ez_eventhandler_s *OnLostFocus; struct ez_eventhandler_s *OnVirtualResize; struct ez_eventhandler_s *OnMinVirtualResize; struct ez_eventhandler_s *OnFlagsChanged; struct ez_eventhandler_s *OnResizeHandleThicknessChanged; struct ez_eventhandler_s *OnEventHandlerChanged; struct ez_eventhandler_s *OnAnchorChanged; struct ez_eventhandler_s *OnVisibilityChanged; struct ez_eventhandler_s *OnOpacityChanged; struct ez_eventhandler_s *OnChildMoved; struct ez_eventhandler_s *OnChildResize; }

user_defined_types: struct ez_double_linked_list_s { int count; struct ez_dllist_node_s *head; struct ez_dllist_node_s *tail; }

user_defined_types: struct ez_scrollpane_s { struct ez_control_s super; struct ez_scrollpane_events_s events; struct ez_scrollpane_eventhandlers_s event_handlers; struct ez_scrollpane_eventcount_s inherit_levels; struct ez_scrollpane_eventcount_s override_counts; struct ez_control_s *target; struct ez_control_s *prev_target; struct ez_scrollbar_s *v_scrollbar; struct ez_scrollbar_s *h_scrollbar; int scrollbar_thickness; enum ez_scrollpane_flags_e ext_flags; enum ez_scrollpane_iflags_e int_flags; }

user_defined_types: struct ez_tree_s { struct ez_control_s *root; enum qbool destroying; struct ez_dllist_node_s *focused_node; struct ez_double_linked_list_s drawlist; struct ez_double_linked_list_s tablist; struct mouse_state_s prev_mouse_state; double mouse_pressed_time[9]; }

user_defined_types: struct ez_eventhandler_s { int function_type; union ez_eventhandlerfunction_u function; void *payload; struct ez_eventhandler_s *next; }

user_defined_types: struct ez_scrollbar_s { struct ez_control_s super; struct ez_scrollbar_events_s events; struct ez_scrollbar_eventhandlers_s event_handlers; struct ez_scrollbar_eventcount_s inherit_levels; struct ez_scrollbar_eventcount_s override_counts; struct ez_button_s *back; struct ez_button_s *slider; struct ez_button_s *forward; enum ez_orientation_s orientation; int scroll_area; int slider_minsize; int scroll_delta_x; int scroll_delta_y; struct ez_control_s *target; enum ez_scrollbar_flags_e ext_flags; enum ez_scrollbar_iflags_e int_flags; }

user_defined_types: union ez_eventhandlerfunction_u { int (*normal)(struct ez_control_s *self, void *payload, void *ext_info); int (*mouse)(struct ez_control_s *self, void *payload, struct mouse_state_s *mouse_state); int (*key)(struct ez_control_s *self, void *payload, int key, int unichar, enum qbool down); int (*key_sp)(struct ez_control_s *self, void *payload, int key, int unichar); int (*destroy)(struct ez_control_s *self, void *payload, enum qbool destroy_children); int (*child)(struct ez_control_s *self, void *payload, struct ez_control_s *child); }

user_defined_types: struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool buttons[9]; int button_down; int button_up; }

user_defined_types: struct ez_button_s { struct ez_control_s super; struct ez_button_events_s events; struct ez_button_eventhandlers_s event_handlers; struct ez_button_eventcount_s inherit_levels; struct ez_button_eventcount_s override_counts; struct ez_label_s *text_label; struct mpic_t *focused_image; struct mpic_t *normal_image; struct mpic_t *hover_image; struct mpic_t *pressed_image; struct mpic_t *toggled_hover_image; unsigned char color_focused[4]; unsigned char color_normal[4]; unsigned char color_hover[4]; unsigned char color_pressed[4]; unsigned char color_toggled_hover[4]; enum ez_button_iflags_e int_flags; enum ez_button_flags_e ext_flags; int padding_top; int padding_left; int padding_right; int padding_bottom; enum ez_textalign_e text_alignment; struct clrinfo_s focused_text_color; struct clrinfo_s normal_text_color; struct clrinfo_s hover_text_color; struct clrinfo_s pressed_text_color; int override_count; int inheritance_level; }

user_defined_types: struct ez_label_s { struct ez_control_s super; struct ez_label_events_s events; struct ez_label_eventhandlers_s event_handlers; struct ez_label_eventcount_s inherit_levels; struct ez_label_eventcount_s override_counts; char *text; int text_length; enum ez_label_flags_e ext_flags; enum ez_label_iflags_e int_flags; struct ez_label_textpos_s wordwraps[512]; struct clrinfo_s color; float scale; int scaled_char_size; int select_start; int select_end; struct ez_label_textpos_s caret_pos; int num_rows; int num_cols; }


decompiled_code:
__int64 __fastcall EZ_window_Destroy(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx
int v3; // eax

v2 = *(_QWORD *)(a1 + 584);
if ( v2 )
{
v3 = *(_DWORD *)(a1 + 904);
if ( v3 == 1 )
{
do
{
EZ_eventhandler_Exec(v2, a1, a2);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v2 );
}
else
{
*(_DWORD *)(a1 + 904) = v3 - 1;
}
}
EZ_control_Destroy(a1, a2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx
int v3; // eax

v2 = *(_QWORD *)(a1 + 584);
if ( v2 )
{
v3 = *(_DWORD *)(a1 + 904);
if ( v3 == 1 )
{
do
{
EZ_eventhandler_Exec(v2, a1, a2);
v2 = *(_QWORD *)(v2 + 24);
}
while ( v2 );
}
else
{
*(_DWORD *)(a1 + 904) = v3 - 1;
}
}
EZ_control_Destroy(a1, a2);
return 0LL;
}

original_code:
int EZ_window_Destroy(ez_control_t *self, qbool destroy_children)
{
 { int *p = (int *)((void *)0), temp = 0; ez_control_t *c = (ez_control_t *)self; if (c->event_handlers.OnDestroy) { if (c->override_counts.OnDestroy == 1) { ez_eventhandler_t *e = c->event_handlers.OnDestroy; while (e) { EZ_eventhandler_Exec(e, (ez_control_t *)self, destroy_children); e = e->next; } } else c->override_counts.OnDestroy--; } if(p) (*p) = temp; };
 EZ_control_Destroy(self, destroy_children);
 return 0;
}

canonical_original_code:
int EZ_window_Destroy(struct ez_control_s *self, enum qbool destroy_children)
{
 { int *p = (int *)((void *)0); int temp = 0; struct ez_control_s *c = (ez_control_t *)self; if (c->event_handlers.OnDestroy) { if (c->override_counts.OnDestroy == 1) { struct ez_eventhandler_s *e = c->event_handlers.OnDestroy; while (e) { EZ_eventhandler_Exec(e, (struct ez_control_s *)self, destroy_children); e = e->next; } } else c->override_counts.OnDestroy--; } if(p) (*p) = temp; };
 EZ_control_Destroy(self, destroy_children);
 return 0;
}

variable_types:
p
int *

variable_types: temp int

variable_types: struct ez_eventhandler_s { int function_type; union ez_eventhandlerfunction_u { int (*normal)(struct ez_control_s { enum ez_control_id_e { EZ_CONTROL_ID=0, EZ_BUTTON_ID=1, EZ_LABEL_ID=2, EZ_SLIDER_ID=3, EZ_SCROLLBAR_ID=4, EZ_SCROLLPANE_ID=5, EZ_WINDOW_ID=6, EZ_LISTVIEW_ID=7, EZ_LISTVIEWITEM_ID=8 } CLASS_ID; char *name; char *description; int x; int y; int prev_x; int prev_y; int absolute_x; int absolute_y; int prev_absolute_x; int prev_absolute_y; int width; int height; int prev_width; int prev_height; int virtual_x; int virtual_y; int absolute_virtual_x; int absolute_virtual_y; int virtual_width; int virtual_height; int prev_virtual_width; int prev_virtual_height; int virtual_width_min; int virtual_height_min; int width_max; int width_min; int height_max; int height_min; int bound_top; int bound_left; int bound_right; int bound_bottom; int left_edge_gap; int right_edge_gap; int top_edge_gap; int bottom_edge_gap; enum ez_anchor_e { anchor_none=expr, anchor_left=expr, anchor_right=expr, anchor_top=expr, anchor_bottom=expr } anchor_flags; int resize_handle_thickness; int draw_order; int tab_order; enum ez_control_flags_e { control_enabled=expr, control_movable=expr, control_focusable=expr, control_resize_h=expr, control_resize_v=expr, control_resizeable=expr, control_contained=expr, control_visible=expr, control_scrollable=expr, control_ignore_mouse=expr, control_anchor_viewport=expr, control_move_parent=expr, control_listen_repeat_mouse=expr, control_bg_tile_center=expr, control_bg_tile_edges=expr } ext_flags; enum ez_control_iflags_e { control_focused=expr, control_moving=expr, control_resizing_left=expr, control_resizing_right=expr, control_resizing_top=expr, control_resizing_bottom=expr, control_clicked=expr, control_mouse_over=expr, control_update_anchorgap=expr, control_hidden_by_parent=expr } int_flags; unsigned char background_color[4]; struct mpic_t { int width; int texnum; float sl; } *background; float bg_edge_size_ratio; float bg_opacity; float opacity; float overall_opacity; float x_percent; float y_percent; void *payload; struct ez_control_events_s { int (*OnMouseEvent)(struct ez_control_s *self, struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool { false=0, true=1 } buttons[9]; int button_down; int button_up; } *mouse_state); int (*OnMouseClick)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUp)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUpOutside)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseDown)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseHover)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseEnter)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseLeave)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnKeyEvent)(struct ez_control_s *self, int key, int unichar, enum qbool { false=0, true=1 } down); int (*OnKeyDown)(struct ez_control_s *self, int key, int unichar); int (*OnKeyUp)(struct ez_control_s *self, int key, int unichar); int (*OnLayoutChildren)(struct ez_control_s *self, void *ext_event_info); int (*OnDraw)(struct ez_control_s *self, void *ext_event_info); int (*OnDestroy)(struct ez_control_s *self, enum qbool { false=0, true=1 } destroy_children); int (*OnMove)(struct ez_control_s *self, void *ext_event_info); int (*OnScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnParentScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnResize)(struct ez_control_s *self, void *ext_event_info); int (*OnParentResize)(struct ez_control_s *self, void *ext_event_info); int (*OnGotFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnLostFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnMinVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnFlagsChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnResizeHandleThicknessChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnEventHandlerChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnAnchorChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnVisibilityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnOpacityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnChildMoved)(struct ez_control_s *self, struct ez_control_s *child); int (*OnChildResize)(struct ez_control_s *self, struct ez_control_s *child); } events; struct ez_control_eventhandlers_s { struct ez_eventhandler_s *OnMouseEvent; struct ez_eventhandler_s *OnMouseClick; struct ez_eventhandler_s *OnMouseUp; struct ez_eventhandler_s *OnMouseUpOutside; struct ez_eventhandler_s *OnMouseDown; struct ez_eventhandler_s *OnMouseHover; struct ez_eventhandler_s *OnMouseEnter; struct ez_eventhandler_s *OnMouseLeave; struct ez_eventhandler_s *OnKeyEvent; struct ez_eventhandler_s *OnKeyDown; struct ez_eventhandler_s *OnKeyUp; struct ez_eventhandler_s *OnLayoutChildren; struct ez_eventhandler_s *OnDraw; struct ez_eventhandler_s *OnDestroy; struct ez_eventhandler_s *OnMove; struct ez_eventhandler_s *OnScroll; struct ez_eventhandler_s *OnParentScroll; struct ez_eventhandler_s *OnResize; struct ez_eventhandler_s *OnParentResize; struct ez_eventhandler_s *OnGotFocus; struct ez_eventhandler_s *OnLostFocus; struct ez_eventhandler_s *OnVirtualResize; struct ez_eventhandler_s *OnMinVirtualResize; struct ez_eventhandler_s *OnFlagsChanged; struct ez_eventhandler_s *OnResizeHandleThicknessChanged; struct ez_eventhandler_s *OnEventHandlerChanged; struct ez_eventhandler_s *OnAnchorChanged; struct ez_eventhandler_s *OnVisibilityChanged; struct ez_eventhandler_s *OnOpacityChanged; struct ez_eventhandler_s *OnChildMoved; struct ez_eventhandler_s *OnChildResize; } event_handlers; struct ez_control_eventcount_s { int OnMouseEvent; int OnMouseClick; int OnMouseUp; int OnMouseUpOutside; int OnMouseDown; int OnMouseHover; int OnMouseEnter; int OnMouseLeave; int OnKeyEvent; int OnKeyDown; int OnKeyUp; int OnLayoutChildren; int OnDraw; int OnDestroy; int OnMove; int OnScroll; int OnParentScroll; int OnResize; int OnParentResize; int OnGotFocus; int OnLostFocus; int OnVirtualResize; int OnMinVirtualResize; int OnFlagsChanged; int OnResizeHandleThicknessChanged; int OnEventHandlerChanged; int OnAnchorChanged; int OnVisibilityChanged; int OnOpacityChanged; int OnChildMoved; int OnChildResize; } inherit_levels; struct ez_control_eventcount_s override_counts; enum qbool { false=0, true=1 } initializing; struct ez_control_s *parent; struct ez_double_linked_list_s { int count; struct ez_dllist_node_s { struct ez_dllist_node_s *next; struct ez_dllist_node_s *previous; void *payload; } *head; struct ez_dllist_node_s *tail; } children; struct ez_tree_s { struct ez_control_s *root; enum qbool { false=0, true=1 } destroying; struct ez_dllist_node_s *focused_node; struct ez_double_linked_list_s drawlist; struct ez_double_linked_list_s tablist; struct mouse_state_s prev_mouse_state; double mouse_pressed_time[9]; } *control_tree; struct mouse_state_s prev_mouse_state; double mouse_repeat_delay; } *self, void *payload, void *ext_info); int (*mouse)(struct ez_control_s *self, void *payload, struct mouse_state_s *mouse_state); int (*key)(struct ez_control_s *self, void *payload, int key, int unichar, enum qbool { false=0, true=1 } down); int (*key_sp)(struct ez_control_s *self, void *payload, int key, int unichar); int (*destroy)(struct ez_control_s *self, void *payload, enum qbool { false=0, true=1 } destroy_children); int (*child)(struct ez_control_s *self, void *payload, struct ez_control_s *child); } function; void *payload; struct ez_eventhandler_s *next; } *


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

if ( *(_QWORD *)(a1 + 1120) )
result = EZ_control_SetMinVirtualSize();
return result;
}

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

if ( *(_QWORD *)(a1 + 1120) )
result = EZ_control_SetMinVirtualSize();
return result;
}

original_code:
void EZ_window_SetWindowAreaMinVirtualSize(ez_window_t *window, int min_virtual_width, int min_virtual_height)
{
 if (window->window_area)
 {
  EZ_control_SetMinVirtualSize(window->window_area, min_virtual_width, min_virtual_height);
 }
}

canonical_original_code:
void EZ_window_SetWindowAreaMinVirtualSize(struct ez_window_s *window, int min_virtual_width, int min_virtual_height)
{
 if (window->window_area)
 {
  EZ_control_SetMinVirtualSize(window->window_area, min_virtual_width, min_virtual_height);
 }
}

user_defined_types: enum ez_control_id_e { EZ_CONTROL_ID=0, EZ_BUTTON_ID=1, EZ_LABEL_ID=2, EZ_SLIDER_ID=3, EZ_SCROLLBAR_ID=4, EZ_SCROLLPANE_ID=5, EZ_WINDOW_ID=6, EZ_LISTVIEW_ID=7, EZ_LISTVIEWITEM_ID=8 }

user_defined_types: enum ez_anchor_e { anchor_none=expr, anchor_left=expr, anchor_right=expr, anchor_top=expr, anchor_bottom=expr }

user_defined_types: enum ez_control_flags_e { control_enabled=expr, control_movable=expr, control_focusable=expr, control_resize_h=expr, control_resize_v=expr, control_resizeable=expr, control_contained=expr, control_visible=expr, control_scrollable=expr, control_ignore_mouse=expr, control_anchor_viewport=expr, control_move_parent=expr, control_listen_repeat_mouse=expr, control_bg_tile_center=expr, control_bg_tile_edges=expr }

user_defined_types: enum ez_control_iflags_e { control_focused=expr, control_moving=expr, control_resizing_left=expr, control_resizing_right=expr, control_resizing_top=expr, control_resizing_bottom=expr, control_clicked=expr, control_mouse_over=expr, control_update_anchorgap=expr, control_hidden_by_parent=expr }

user_defined_types: struct ez_control_eventcount_s { int OnMouseEvent; int OnMouseClick; int OnMouseUp; int OnMouseUpOutside; int OnMouseDown; int OnMouseHover; int OnMouseEnter; int OnMouseLeave; int OnKeyEvent; int OnKeyDown; int OnKeyUp; int OnLayoutChildren; int OnDraw; int OnDestroy; int OnMove; int OnScroll; int OnParentScroll; int OnResize; int OnParentResize; int OnGotFocus; int OnLostFocus; int OnVirtualResize; int OnMinVirtualResize; int OnFlagsChanged; int OnResizeHandleThicknessChanged; int OnEventHandlerChanged; int OnAnchorChanged; int OnVisibilityChanged; int OnOpacityChanged; int OnChildMoved; int OnChildResize; }

user_defined_types: struct mpic_t { int width; int texnum; float sl; }

user_defined_types: struct ez_scrollpane_events_s { int (*OnTargetChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnTargetResize)(struct ez_control_s *self, void *ext_event_info); int (*OnTargetScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnScrollbarThicknessChanged)(struct ez_control_s *self, void *ext_event_info); }

user_defined_types: struct ez_scrollpane_eventhandlers_s { struct ez_eventhandler_s *OnTargetChanged; struct ez_eventhandler_s *OnTargetResize; struct ez_eventhandler_s *OnTargetScroll; struct ez_eventhandler_s *OnScrollbarThicknessChanged; }

user_defined_types: struct ez_scrollpane_eventcount_s { int OnTargetChanged; int OnScrollbarThicknessChanged; }

user_defined_types: enum ez_scrollpane_flags_e { always_v_scrollbar=expr, always_h_scrollbar=expr }

user_defined_types: enum ez_scrollpane_iflags_e { show_v_scrollbar=expr, show_h_scrollbar=expr, resizing_target=expr }

user_defined_types: struct ez_dllist_node_s { struct ez_dllist_node_s *next; struct ez_dllist_node_s *previous; void *payload; }

user_defined_types: struct ez_scrollbar_events_s { int (*OnTargetChanged)(struct ez_control_s *self, void *ext_event_info); }

user_defined_types: struct ez_scrollbar_eventhandlers_s { struct ez_eventhandler_s *OnTargetChanged; }

user_defined_types: struct ez_scrollbar_eventcount_s { int OnTargetChanged; }

user_defined_types: enum ez_orientation_s { vertical=0, horizontal=1 }

user_defined_types: enum ez_scrollbar_flags_e { target_parent=expr }

user_defined_types: enum ez_scrollbar_iflags_e { sliding=expr, scrolling=expr }

user_defined_types: struct ez_button_events_s { int (*OnAction)(struct ez_control_s *self, void *ext_event_info); int (*OnTextAlignmentChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnToggled)(struct ez_control_s *self, void *ext_event_info); }

user_defined_types: struct ez_button_eventhandlers_s { struct ez_eventhandler_s *OnAction; struct ez_eventhandler_s *OnTextAlignmentChanged; struct ez_eventhandler_s *OnToggled; }

user_defined_types: struct ez_button_eventcount_s { int OnAction; int OnTextAlignmentChanged; int OnToggled; }

user_defined_types: enum ez_button_iflags_e { button_toggled=expr }

user_defined_types: enum ez_button_flags_e { button_use_images=expr, button_is_toggleable=expr }

user_defined_types: enum ez_textalign_e { top_left=0, top_center=1, top_right=2, middle_left=3, middle_center=4, middle_right=5, bottom_left=6, bottom_center=7, bottom_right=8 }

user_defined_types: struct ez_label_events_s { int (*OnTextChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnCaretMoved)(struct ez_control_s *self, void *ext_event_info); int (*OnTextScaleChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnTextFlagsChanged)(struct ez_control_s *self, void *ext_event_info); }

user_defined_types: struct ez_label_eventhandlers_s { struct ez_eventhandler_s *OnTextChanged; struct ez_eventhandler_s *OnCaretMoved; struct ez_eventhandler_s *OnTextScaleChanged; struct ez_eventhandler_s *OnTextFlagsChanged; }

user_defined_types: struct ez_label_eventcount_s { int OnTextChanged; int OnCaretMoved; int OnTextScaleChanged; int OnTextFlagsChanged; }

user_defined_types: enum ez_label_flags_e { label_largefont=expr, label_autosize=expr, label_autoellipsis=expr, label_wraptext=expr, label_selectable=expr, label_readonly=expr }

user_defined_types: enum ez_label_iflags_e { label_selecting=expr }

user_defined_types: struct ez_label_textpos_s { int index; int row; int col; }


decompiled_code:
__int64 __fastcall EZ_window_AddChild(__int64 a1, __int64 a2)
{
if ( !*(_QWORD *)(*(_QWORD *)(a1 + 1112) + 1192LL) )
Sys_Error("EZ_window_AddChild(): Window scrollpane has a NULL target.\n");
EZ_control_AddChild(*(_QWORD *)(a1 + 1120), a2);
return EZ_control_SetDrawOrder(a2, (unsigned int)(*(_DWORD *)(*(_QWORD *)(a1 + 1120) + 168LL) + 1), 1LL);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
if ( !*(_QWORD *)(*(_QWORD *)(a1 + 1112) + 1192LL) )
Sys_Error("EZ_window_AddChild(): Window scrollpane has a NULL target.\n");
EZ_control_AddChild(*(_QWORD *)(a1 + 1120), a2);
return EZ_control_SetDrawOrder(a2, (unsigned int)(*(_DWORD *)(*(_QWORD *)(a1 + 1120) + 168LL) + 1), 1LL);
}

original_code:
void EZ_window_AddChild(ez_window_t *window, ez_control_t *child)
{
 if (!window->scrollpane->target)
 {
  Sys_Error("EZ_window_AddChild(): Window scrollpane has a NULL target.\n");
 }
 EZ_control_AddChild(window->window_area, child);
 EZ_control_SetDrawOrder(child, window->window_area->draw_order + 1, true);
}

canonical_original_code:
void EZ_window_AddChild(struct ez_window_s *window, struct ez_control_s *child)
{
 if (!window->scrollpane->target)
 {
  Sys_Error("EZ_window_AddChild(): Window scrollpane has a NULL target.\n");
 }
 EZ_control_AddChild(window->window_area, child);
 EZ_control_SetDrawOrder(child, window->window_area->draw_order + 1, true);
}

variable_types:
child
struct ez_control_s *

user_defined_types: struct ez_window_s { struct ez_control_s super; struct ez_scrollpane_s *scrollpane; struct ez_control_s *window_area; struct ez_control_s *titlebar; struct ez_button_s *close_button; }

user_defined_types: struct ez_control_s { enum ez_control_id_e CLASS_ID; char *name; char *description; int x; int y; int prev_x; int prev_y; int absolute_x; int absolute_y; int prev_absolute_x; int prev_absolute_y; int width; int height; int prev_width; int prev_height; int virtual_x; int virtual_y; int absolute_virtual_x; int absolute_virtual_y; int virtual_width; int virtual_height; int prev_virtual_width; int prev_virtual_height; int virtual_width_min; int virtual_height_min; int width_max; int width_min; int height_max; int height_min; int bound_top; int bound_left; int bound_right; int bound_bottom; int left_edge_gap; int right_edge_gap; int top_edge_gap; int bottom_edge_gap; enum ez_anchor_e anchor_flags; int resize_handle_thickness; int draw_order; int tab_order; enum ez_control_flags_e ext_flags; enum ez_control_iflags_e int_flags; unsigned char background_color[4]; struct mpic_t *background; float bg_edge_size_ratio; float bg_opacity; float opacity; float overall_opacity; float x_percent; float y_percent; void *payload; struct ez_control_events_s events; struct ez_control_eventhandlers_s event_handlers; struct ez_control_eventcount_s inherit_levels; struct ez_control_eventcount_s override_counts; enum qbool initializing; struct ez_control_s *parent; struct ez_double_linked_list_s children; struct ez_tree_s *control_tree; struct mouse_state_s prev_mouse_state; double mouse_repeat_delay; }

user_defined_types: enum ez_control_id_e { EZ_CONTROL_ID=0, EZ_BUTTON_ID=1, EZ_LABEL_ID=2, EZ_SLIDER_ID=3, EZ_SCROLLBAR_ID=4, EZ_SCROLLPANE_ID=5, EZ_WINDOW_ID=6, EZ_LISTVIEW_ID=7, EZ_LISTVIEWITEM_ID=8 }

user_defined_types: enum ez_anchor_e { anchor_none=expr, anchor_left=expr, anchor_right=expr, anchor_top=expr, anchor_bottom=expr }

user_defined_types: enum ez_control_flags_e { control_enabled=expr, control_movable=expr, control_focusable=expr, control_resize_h=expr, control_resize_v=expr, control_resizeable=expr, control_contained=expr, control_visible=expr, control_scrollable=expr, control_ignore_mouse=expr, control_anchor_viewport=expr, control_move_parent=expr, control_listen_repeat_mouse=expr, control_bg_tile_center=expr, control_bg_tile_edges=expr }

user_defined_types: enum ez_control_iflags_e { control_focused=expr, control_moving=expr, control_resizing_left=expr, control_resizing_right=expr, control_resizing_top=expr, control_resizing_bottom=expr, control_clicked=expr, control_mouse_over=expr, control_update_anchorgap=expr, control_hidden_by_parent=expr }

user_defined_types: struct ez_control_events_s { int (*OnMouseEvent)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseClick)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUp)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseUpOutside)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseDown)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseHover)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseEnter)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnMouseLeave)(struct ez_control_s *self, struct mouse_state_s *mouse_state); int (*OnKeyEvent)(struct ez_control_s *self, int key, int unichar, enum qbool down); int (*OnKeyDown)(struct ez_control_s *self, int key, int unichar); int (*OnKeyUp)(struct ez_control_s *self, int key, int unichar); int (*OnLayoutChildren)(struct ez_control_s *self, void *ext_event_info); int (*OnDraw)(struct ez_control_s *self, void *ext_event_info); int (*OnDestroy)(struct ez_control_s *self, enum qbool destroy_children); int (*OnMove)(struct ez_control_s *self, void *ext_event_info); int (*OnScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnParentScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnResize)(struct ez_control_s *self, void *ext_event_info); int (*OnParentResize)(struct ez_control_s *self, void *ext_event_info); int (*OnGotFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnLostFocus)(struct ez_control_s *self, void *ext_event_info); int (*OnVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnMinVirtualResize)(struct ez_control_s *self, void *ext_event_info); int (*OnFlagsChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnResizeHandleThicknessChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnEventHandlerChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnAnchorChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnVisibilityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnOpacityChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnChildMoved)(struct ez_control_s *self, struct ez_control_s *child); int (*OnChildResize)(struct ez_control_s *self, struct ez_control_s *child); }

user_defined_types: struct ez_control_eventhandlers_s { struct ez_eventhandler_s *OnMouseEvent; struct ez_eventhandler_s *OnMouseClick; struct ez_eventhandler_s *OnMouseUp; struct ez_eventhandler_s *OnMouseUpOutside; struct ez_eventhandler_s *OnMouseDown; struct ez_eventhandler_s *OnMouseHover; struct ez_eventhandler_s *OnMouseEnter; struct ez_eventhandler_s *OnMouseLeave; struct ez_eventhandler_s *OnKeyEvent; struct ez_eventhandler_s *OnKeyDown; struct ez_eventhandler_s *OnKeyUp; struct ez_eventhandler_s *OnLayoutChildren; struct ez_eventhandler_s *OnDraw; struct ez_eventhandler_s *OnDestroy; struct ez_eventhandler_s *OnMove; struct ez_eventhandler_s *OnScroll; struct ez_eventhandler_s *OnParentScroll; struct ez_eventhandler_s *OnResize; struct ez_eventhandler_s *OnParentResize; struct ez_eventhandler_s *OnGotFocus; struct ez_eventhandler_s *OnLostFocus; struct ez_eventhandler_s *OnVirtualResize; struct ez_eventhandler_s *OnMinVirtualResize; struct ez_eventhandler_s *OnFlagsChanged; struct ez_eventhandler_s *OnResizeHandleThicknessChanged; struct ez_eventhandler_s *OnEventHandlerChanged; struct ez_eventhandler_s *OnAnchorChanged; struct ez_eventhandler_s *OnVisibilityChanged; struct ez_eventhandler_s *OnOpacityChanged; struct ez_eventhandler_s *OnChildMoved; struct ez_eventhandler_s *OnChildResize; }

user_defined_types: struct ez_control_eventcount_s { int OnMouseEvent; int OnMouseClick; int OnMouseUp; int OnMouseUpOutside; int OnMouseDown; int OnMouseHover; int OnMouseEnter; int OnMouseLeave; int OnKeyEvent; int OnKeyDown; int OnKeyUp; int OnLayoutChildren; int OnDraw; int OnDestroy; int OnMove; int OnScroll; int OnParentScroll; int OnResize; int OnParentResize; int OnGotFocus; int OnLostFocus; int OnVirtualResize; int OnMinVirtualResize; int OnFlagsChanged; int OnResizeHandleThicknessChanged; int OnEventHandlerChanged; int OnAnchorChanged; int OnVisibilityChanged; int OnOpacityChanged; int OnChildMoved; int OnChildResize; }

user_defined_types: struct ez_double_linked_list_s { int count; struct ez_dllist_node_s *head; struct ez_dllist_node_s *tail; }

user_defined_types: struct ez_scrollpane_s { struct ez_control_s super; struct ez_scrollpane_events_s events; struct ez_scrollpane_eventhandlers_s event_handlers; struct ez_scrollpane_eventcount_s inherit_levels; struct ez_scrollpane_eventcount_s override_counts; struct ez_control_s *target; struct ez_control_s *prev_target; struct ez_scrollbar_s *v_scrollbar; struct ez_scrollbar_s *h_scrollbar; int scrollbar_thickness; enum ez_scrollpane_flags_e ext_flags; enum ez_scrollpane_iflags_e int_flags; }

user_defined_types: struct mpic_t { int width; int texnum; float sl; }

user_defined_types: struct ez_tree_s { struct ez_control_s *root; enum qbool destroying; struct ez_dllist_node_s *focused_node; struct ez_double_linked_list_s drawlist; struct ez_double_linked_list_s tablist; struct mouse_state_s prev_mouse_state; double mouse_pressed_time[9]; }

user_defined_types: struct ez_scrollpane_events_s { int (*OnTargetChanged)(struct ez_control_s *self, void *ext_event_info); int (*OnTargetResize)(struct ez_control_s *self, void *ext_event_info); int (*OnTargetScroll)(struct ez_control_s *self, void *ext_event_info); int (*OnScrollbarThicknessChanged)(struct ez_control_s *self, void *ext_event_info); }

user_defined_types: struct ez_scrollpane_eventhandlers_s { struct ez_eventhandler_s *OnTargetChanged; struct ez_eventhandler_s *OnTargetResize; struct ez_eventhandler_s *OnTargetScroll; struct ez_eventhandler_s *OnScrollbarThicknessChanged; }

user_defined_types: struct ez_scrollpane_eventcount_s { int OnTargetChanged; int OnScrollbarThicknessChanged; }

user_defined_types: enum ez_scrollpane_flags_e { always_v_scrollbar=expr, always_h_scrollbar=expr }

user_defined_types: enum ez_scrollpane_iflags_e { show_v_scrollbar=expr, show_h_scrollbar=expr, resizing_target=expr }

user_defined_types: struct ez_eventhandler_s { int function_type; union ez_eventhandlerfunction_u function; void *payload; struct ez_eventhandler_s *next; }

user_defined_types: struct ez_dllist_node_s { struct ez_dllist_node_s *next; struct ez_dllist_node_s *previous; void *payload; }

user_defined_types: struct ez_scrollbar_s { struct ez_control_s super; struct ez_scrollbar_events_s events; struct ez_scrollbar_eventhandlers_s event_handlers; struct ez_scrollbar_eventcount_s inherit_levels; struct ez_scrollbar_eventcount_s override_counts; struct ez_button_s *back; struct ez_button_s *slider; struct ez_button_s *forward; enum ez_orientation_s orientation; int scroll_area; int slider_minsize; int scroll_delta_x; int scroll_delta_y; struct ez_control_s *target; enum ez_scrollbar_flags_e ext_flags; enum ez_scrollbar_iflags_e int_flags; }

user_defined_types: union ez_eventhandlerfunction_u { int (*normal)(struct ez_control_s *self, void *payload, void *ext_info); int (*mouse)(struct ez_control_s *self, void *payload, struct mouse_state_s *mouse_state); int (*key)(struct ez_control_s *self, void *payload, int key, int unichar, enum qbool down); int (*key_sp)(struct ez_control_s *self, void *payload, int key, int unichar); int (*destroy)(struct ez_control_s *self, void *payload, enum qbool destroy_children); int (*child)(struct ez_control_s *self, void *payload, struct ez_control_s *child); }

user_defined_types: struct ez_scrollbar_events_s { int (*OnTargetChanged)(struct ez_control_s *self, void *ext_event_info); }

user_defined_types: struct ez_scrollbar_eventhandlers_s { struct ez_eventhandler_s *OnTargetChanged; }

user_defined_types: struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool buttons[9]; int button_down; int button_up; }

user_defined_types: struct ez_button_s { struct ez_control_s super; struct ez_button_events_s events; struct ez_button_eventhandlers_s event_handlers; struct ez_button_eventcount_s inherit_levels; struct ez_button_eventcount_s override_counts; struct ez_label_s *text_label; struct mpic_t *focused_image; struct mpic_t *normal_image; struct mpic_t *hover_image; struct mpic_t *pressed_image; struct mpic_t *toggled_hover_image; unsigned char color_focused[4]; unsigned char color_normal[4]; unsigned char color_hover[4]; unsigned char color_pressed[4]; unsigned char color_toggled_hover[4]; enum ez_button_iflags_e int_flags; enum ez_button_flags_e ext_flags; int padding_top; int padding_left; int padding_right; int padding_bottom; enum ez_textalign_e text_alignment; struct clrinfo_s focused_text_color; struct clrinfo_s normal_text_color; struct clrinfo_s hover_text_color; struct clrinfo_s pressed_text_color; int override_count; int inheritance_level; }

user_defined_types: struct ez_label_s { struct ez_control_s super; struct ez_label_events_s events; struct ez_label_eventhandlers_s event_handlers; struct ez_label_eventcount_s inherit_levels; struct ez_label_eventcount_s override_counts; char *text; int text_length; enum ez_label_flags_e ext_flags; enum ez_label_iflags_e int_flags; struct ez_label_textpos_s wordwraps[512]; struct clrinfo_s color; float scale; int scaled_char_size; int select_start; int select_end; struct ez_label_textpos_s caret_pos; int num_rows; int num_cols; }