decompiled_code:
__int64 __fastcall ocd3d_draw_line(__int64 a1, unsigned int a2, float a3, float a4, float a5, float a6, float a7, float a8)
{
float v8; // xmm0_4
float v11; // [rsp+Ch] [rbp-2Ch]
float v12; // [rsp+10h] [rbp-28h]
float v13; // [rsp+14h] [rbp-24h]

v11 = ocd3d_project_x(a3, a5);
v12 = ocd3d_project_x(a6, a8);
v13 = ocd3d_project_y(a4, a5);
v8 = ocd3d_project_y(a7, a8);
return line(a1, (unsigned int)(int)v11, (unsigned int)(int)v13, (unsigned int)(int)v12, (unsigned int)(int)v8, a2);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, unsigned int a2, float a3, float a4, float a5, float a6, float a7, float a8)
{
float v8; // xmm0_4
float v11; // [rsp+Ch] [rbp-2Ch]
float v12; // [rsp+10h] [rbp-28h]
float v13; // [rsp+14h] [rbp-24h]

v11 = func3(a3, a5);
v12 = func3(a6, a8);
v13 = func4(a4, a5);
v8 = func4(a7, a8);
return line(a1, (unsigned int)(int)v11, (unsigned int)(int)v13, (unsigned int)(int)v12, (unsigned int)(int)v8, a2);
}

original_code:
void ocd3d_draw_line(BITMAP * bp, float x, float y, float z, float x2, float y2, float z2, int color)
{
 float obx, oby, oex, oey;
 obx = ocd3d_project_x(x, z);
 oex = ocd3d_project_x(x2, z2);
 oby = ocd3d_project_y(y, z);
 oey = ocd3d_project_y(y2, z2);
 line(bp, obx, oby, oex, oey, color);
}

canonical_original_code:
void ocd3d_draw_line(struct BITMAP *bp, float x, float y, float z, float x2, float y2, float z2, int color)
{
 float obx; float oby; float oex; float oey;
 obx = ocd3d_project_x(x, z);
 oex = ocd3d_project_x(x2, z2);
 oby = ocd3d_project_y(y, z);
 oey = ocd3d_project_y(y2, z2);
 line(bp, obx, oby, oex, oey, color);
}

variable_types: struct BITMAP { int w; int clip; int cl; struct GFX_VTABLE { int color_depth; int mask_color; void *unwrite_bank; void (*set_clip)(struct BITMAP *bmp); void (*acquire)(struct BITMAP *bmp); void (*release)(struct BITMAP *bmp); struct BITMAP *(*create_sub_bitmap)(struct BITMAP *parent, int x, int y, int width, int height); void (*created_sub_bitmap)(struct BITMAP *bmp, struct BITMAP *parent); int (*getpixel)(struct BITMAP *bmp, int x, int y); void (*putpixel)(struct BITMAP *bmp, int x, int y, int color); void (*vline)(struct BITMAP *bmp, int x, int y_1, int y2, int color); void (*hline)(struct BITMAP *bmp, int x1, int y, int x2, int color); void (*hfill)(struct BITMAP *bmp, int x1, int y, int x2, int color); void (*line)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*fastline)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*rectfill)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*triangle)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int x3, int y3, int color); void (*draw_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_256_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_sprite_v_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_sprite_h_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_sprite_vh_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_trans_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_trans_rgba_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_lit_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color); void (*draw_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE { int w; int color_depth; int size; char dat[]; } *sprite, int x, int y); void (*draw_trans_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y); void (*draw_trans_rgba_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y); void (*draw_lit_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color); void (*draw_character)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color, int bg); void (*draw_glyph)(struct BITMAP *bmp, struct FONT_GLYPH { short w; unsigned char dat[]; } *glyph, int x, int y, int color, int bg); void (*blit_from_memory)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_memory)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_from_system)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_system)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_self)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_self_forward)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_self_backward)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_between_formats)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*masked_blit)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*clear_to_color)(struct BITMAP *bitmap, int color); void (*pivot_scaled_sprite_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int cx, int cy, int angle, int scale, int v_flip); void (*do_stretch_blit)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int dest_width, int dest_height, int masked); void (*draw_gouraud_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4); void (*draw_sprite_end)(); void (*blit_end)(); void (*polygon)(struct BITMAP *bmp, int vertices, int *points, int color); void (*rect)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*circle)(struct BITMAP *bmp, int x, int y, int radius, int color); void (*circlefill)(struct BITMAP *bmp, int x, int y, int radius, int color); void (*ellipse)(struct BITMAP *bmp, int x, int y, int rx, int ry, int color); void (*ellipsefill)(struct BITMAP *bmp, int x, int y, int rx, int ry, int color); void (*arc)(struct BITMAP *bmp, int x, int y, int ang1, int ang2, int r, int color); void (*spline)(struct BITMAP *bmp, int points[8], int color); void (*floodfill)(struct BITMAP *bmp, int x, int y, int color); void (*polygon3d)(struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, struct V3D { int x; int u; int c; } *vtx[]); void (*polygon3d_f)(struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, struct V3D_f { float x; float u; int c; } *vtx[]); void (*triangle3d)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D *v1, struct V3D *v2, struct V3D *v3); void (*triangle3d_f)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D_f *v1, struct V3D_f *v2, struct V3D_f *v3); void (*quad3d)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D *v1, struct V3D *v2, struct V3D *v3, struct V3D *v4); void (*quad3d_f)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D_f *v1, struct V3D_f *v2, struct V3D_f *v3, struct V3D_f *v4); void (*draw_sprite_ex)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int mode, int flip); } *vtable; void *write_bank; void *read_bank; void *dat; unsigned long id; void *extra; int x_ofs; int y_ofs; int seg; unsigned char *line[]; } *

variable_types: color int

variable_types: obx float

variable_types: oby float

variable_types: oex float

variable_types: oey float

user_defined_types: struct BITMAP { int w; int clip; int cl; struct GFX_VTABLE *vtable; void *write_bank; void *read_bank; void *dat; unsigned long id; void *extra; int x_ofs; int y_ofs; int seg; unsigned char *line[]; }

user_defined_types: struct GFX_VTABLE { int color_depth; int mask_color; void *unwrite_bank; void (*set_clip)(struct BITMAP *bmp); void (*acquire)(struct BITMAP *bmp); void (*release)(struct BITMAP *bmp); struct BITMAP *(*create_sub_bitmap)(struct BITMAP *parent, int x, int y, int width, int height); void (*created_sub_bitmap)(struct BITMAP *bmp, struct BITMAP *parent); int (*getpixel)(struct BITMAP *bmp, int x, int y); void (*putpixel)(struct BITMAP *bmp, int x, int y, int color); void (*vline)(struct BITMAP *bmp, int x, int y_1, int y2, int color); void (*hline)(struct BITMAP *bmp, int x1, int y, int x2, int color); void (*hfill)(struct BITMAP *bmp, int x1, int y, int x2, int color); void (*line)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*fastline)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*rectfill)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*triangle)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int x3, int y3, int color); void (*draw_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_256_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_sprite_v_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_sprite_h_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_sprite_vh_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_trans_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_trans_rgba_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); void (*draw_lit_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color); void (*draw_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y); void (*draw_trans_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y); void (*draw_trans_rgba_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y); void (*draw_lit_rle_sprite)(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color); void (*draw_character)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color, int bg); void (*draw_glyph)(struct BITMAP *bmp, struct FONT_GLYPH *glyph, int x, int y, int color, int bg); void (*blit_from_memory)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_memory)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_from_system)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_system)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_self)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_self_forward)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_to_self_backward)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*blit_between_formats)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*masked_blit)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height); void (*clear_to_color)(struct BITMAP *bitmap, int color); void (*pivot_scaled_sprite_flip)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int cx, int cy, int angle, int scale, int v_flip); void (*do_stretch_blit)(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int dest_width, int dest_height, int masked); void (*draw_gouraud_sprite)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4); void (*draw_sprite_end)(); void (*blit_end)(); void (*polygon)(struct BITMAP *bmp, int vertices, int *points, int color); void (*rect)(struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color); void (*circle)(struct BITMAP *bmp, int x, int y, int radius, int color); void (*circlefill)(struct BITMAP *bmp, int x, int y, int radius, int color); void (*ellipse)(struct BITMAP *bmp, int x, int y, int rx, int ry, int color); void (*ellipsefill)(struct BITMAP *bmp, int x, int y, int rx, int ry, int color); void (*arc)(struct BITMAP *bmp, int x, int y, int ang1, int ang2, int r, int color); void (*spline)(struct BITMAP *bmp, int points[8], int color); void (*floodfill)(struct BITMAP *bmp, int x, int y, int color); void (*polygon3d)(struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, struct V3D *vtx[]); void (*polygon3d_f)(struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, struct V3D_f *vtx[]); void (*triangle3d)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D *v1, struct V3D *v2, struct V3D *v3); void (*triangle3d_f)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D_f *v1, struct V3D_f *v2, struct V3D_f *v3); void (*quad3d)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D *v1, struct V3D *v2, struct V3D *v3, struct V3D *v4); void (*quad3d_f)(struct BITMAP *bmp, int type, struct BITMAP *texture, struct V3D_f *v1, struct V3D_f *v2, struct V3D_f *v3, struct V3D_f *v4); void (*draw_sprite_ex)(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int mode, int flip); }


repo: cincodenada/editor-on-fire

decompiled_code:
__int64 __fastcall ocd3d_draw_bitmap(int *a1, int *a2, float a3, float a4, float a5)
{
float v5; // xmm2_4
__int64 result; // rax
float v7; // [rsp+14h] [rbp-24h]
float v9; // [rsp+18h] [rbp-20h]
float v10; // [rsp+1Ch] [rbp-1Ch]

if ( (float)((float)*a1 + a5) > 0.0 )
{
v7 = ocd3d_project_x(a3, a5);
v9 = ocd3d_project_x((float)*a2 + a3, a5);
v10 = ocd3d_project_y(a4, a5);
v5 = ocd3d_project_y((float)a2[1] + a4, a5) - v10;
result = stretch_sprite(
a1,
a2,
(unsigned int)(int)v7,
(unsigned int)(int)v10,
(unsigned int)(int)(float)(v9 - v7),
(unsigned int)(int)v5);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(int *a1, int *a2, float a3, float a4, float a5)
{
float v5; // xmm2_4
__int64 result; // rax
float v7; // [rsp+14h] [rbp-24h]
float v9; // [rsp+18h] [rbp-20h]
float v10; // [rsp+1Ch] [rbp-1Ch]

if ( (float)((float)*a1 + a5) > 0.0 )
{
v7 = func3(a3, a5);
v9 = func3((float)*a2 + a3, a5);
v10 = func4(a4, a5);
v5 = func4((float)a2[1] + a4, a5) - v10;
result = stretch_sprite(
a1,
a2,
(unsigned int)(int)v7,
(unsigned int)(int)v10,
(unsigned int)(int)(float)(v9 - v7),
(unsigned int)(int)v5);
}
return result;
}

original_code:
void ocd3d_draw_bitmap(BITMAP * dest, BITMAP * bp, float x, float y, float z)
{
 float obj_x[2], obj_y[2], obj_z[2];
 float screen_w, screen_h;
 obj_x[0] = ocd3d_project_x(x, z);
 obj_x[1] = ocd3d_project_x(x + bp->w, z);
 obj_y[0] = ocd3d_project_y(y, z);
 obj_y[1] = ocd3d_project_y(y + bp->h, z);
 obj_z[0] = z + dest->w;
 obj_z[1] = z + dest->h;
 if(obj_z[0] > 0)
 {
  screen_w = obj_x[1] - obj_x[0];
  screen_h = obj_y[1] - obj_y[0];
  stretch_sprite(dest, bp, obj_x[0], obj_y[0], screen_w, screen_h);
 }
}

canonical_original_code:
void ocd3d_draw_bitmap(struct BITMAP *dest, struct BITMAP *bp, float x, float y, float z)
{
 float obj_x[2]; float obj_y[2]; float obj_z[2];
 float screen_w; float screen_h;
 obj_x[0] = ocd3d_project_x(x, z);
 obj_x[1] = ocd3d_project_x(x + bp->w, z);
 obj_y[0] = ocd3d_project_y(y, z);
 obj_y[1] = ocd3d_project_y(y + bp->h, z);
 obj_z[0] = z + dest->w;
 obj_z[1] = z + dest->h;
 if(obj_z[0] > 0)
 {
  screen_w = obj_x[1] - obj_x[0];
  screen_h = obj_y[1] - obj_y[0];
  stretch_sprite(dest, bp, obj_x[0], obj_y[0], screen_w, screen_h);
 }
}

variable_types:
bp
struct BITMAP *

variable_types: x float

variable_types: y float

variable_types: z float

return_type: void

user_defined_types: struct RLE_SPRITE { int w; int color_depth; int size; char dat[]; }

user_defined_types: struct FONT_GLYPH { short w; unsigned char dat[]; }

user_defined_types: struct V3D_f { float x; float u; int c; }


decompiled_code:
__int64 __fastcall ncd_file_select_allegro_want_all(__int64 a1)
{
int v1; // edx
const char *v2; // rax
unsigned __int64 v3; // r8
__int64 v4; // rsi
const char *v5; // rax

v1 = *(_DWORD *)(a1 + 0x4000);
if ( v1 <= 0 )
return 0LL;
v2 = (const char *)a1;
v3 = a1 + ((unsigned __int64)(unsigned int)(v1 - 1) << 9) + 512;
v4 = v1 & 3;
if ( (v1 & 3) == 0 )
{
LABEL_11:
while ( strcmp(v2, "*") )
{
v5 = v2 + 512;
if ( !strcmp(v5, "*") || !strcmp(v5 + 512, "*") || !strcmp(v5 + 1024, "*") )
break;
v2 = v5 + 1536;
if ( v2 == (const char *)v3 )
return 0LL;
}
return 1LL;
}
if ( v4 != 1 )
{
if ( v4 != 2 )
{
if ( !strcmp((const char *)a1, "*") )
return 1LL;
v2 = (const char *)(a1 + 512);
}
if ( strcmp(v2, "*") )
{
v2 += 512;
goto LABEL_9;
}
return 1LL;
}
LABEL_9:
if ( !strcmp(v2, "*") )
return 1LL;
v2 += 512;
if ( v2 != (const char *)v3 )
goto LABEL_11;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
int v1; // edx
const char *v2; // rax
unsigned __int64 v3; // r8
__int64 v4; // rsi
const char *v5; // rax

v1 = *(_DWORD *)(a1 + 0x4000);
if ( v1 <= 0 )
return 0LL;
v2 = (const char *)a1;
v3 = a1 + ((unsigned __int64)(unsigned int)(v1 - 1) << 9) + 512;
v4 = v1 & 3;
if ( (v1 & 3) == 0 )
{
LABEL_11:
while ( strcmp(v2, "*") )
{
v5 = v2 + 512;
if ( !strcmp(v5, "*") || !strcmp(v5 + 512, "*") || !strcmp(v5 + 1024, "*") )
break;
v2 = v5 + 1536;
if ( v2 == (const char *)v3 )
return 0LL;
}
return 1LL;
}
if ( v4 != 1 )
{
if ( v4 != 2 )
{
if ( !strcmp((const char *)a1, "*") )
return 1LL;
v2 = (const char *)(a1 + 512);
}
if ( strcmp(v2, "*") )
{
v2 += 512;
goto LABEL_9;
}
return 1LL;
}
LABEL_9:
if ( !strcmp(v2, "*") )
return 1LL;
v2 += 512;
if ( v2 != (const char *)v3 )
goto LABEL_11;
return 0LL;
}

original_code:
static int ncd_file_select_allegro_want_all(NCDFS_FILTER_LIST * lp)
{
 int i;
 for(i = 0; i < lp->filters; i++)
 {
  if(!strcmp(lp->filter[i].extension, "*"))
  {
   return 1;
  }
 }
 return 0;
}

canonical_original_code:
static int ncd_file_select_allegro_want_all(struct NCDFS_FILTER_LIST *lp)
{
 int i;
 for(i = 0; i < lp->filters; i++)
 {
  if(!strcmp(lp->filter[i].extension, "*"))
  {
   return 1;
  }
 }
 return 0;
}

variable_types: struct NCDFS_FILTER_LIST { struct NCDFS_FILTER { char extension[256]; char description[256]; } filter[32]; int filters; int default_filter; } *

variable_types: i int

return_type: int

user_defined_types: struct NCDFS_FILTER_LIST { struct NCDFS_FILTER filter[32]; int filters; int default_filter; }


decompiled_code:
_DWORD *ncdfs_filter_list_create()
{
_DWORD *result; // rax

result = malloc(0x4008uLL);
if ( result )
result[4096] = 0;
return result;
}

canonical_decompiled_code:
_DWORD *func1()
{
_DWORD *result; // rax

result = malloc(0x4008uLL);
if ( result )
result[4096] = 0;
return result;
}

original_code:
NCDFS_FILTER_LIST * ncdfs_filter_list_create(void)
{
 NCDFS_FILTER_LIST * flist;
 flist = malloc(sizeof(NCDFS_FILTER_LIST));
 if(flist)
 {
  flist->filters = 0;
 }
 return flist;
}

canonical_original_code:
struct NCDFS_FILTER_LIST *ncdfs_filter_list_create()
{
 struct NCDFS_FILTER_LIST *flist;
 flist = malloc(sizeof(NCDFS_FILTER_LIST));
 if(flist)
 {
  flist->filters = 0;
 }
 return flist;
}

return_type: struct NCDFS_FILTER_LIST { struct NCDFS_FILTER { char extension[256]; char description[256]; } filter[32]; int filters; int default_filter; } *


original_code:
int ncdfs_filter_list_add(NCDFS_FILTER_LIST * lp, char * ext, char * desc, int df)
{
 ustrzcpy(lp->filter[lp->filters].extension, 0x7fffffff, ext);
 ustrzcpy(lp->filter[lp->filters].description, 0x7fffffff, desc);
 if(df)
 {
  lp->default_filter = lp->filters;
 }
 lp->filters++;
 return 1;
}

canonical_original_code:
int ncdfs_filter_list_add(struct NCDFS_FILTER_LIST *lp, char *ext, char *desc, int df)
{
 ustrzcpy(lp->filter[lp->filters].extension, 0x7fffffff, ext);
 ustrzcpy(lp->filter[lp->filters].description, 0x7fffffff, desc);
 if(df)
 {
  lp->default_filter = lp->filters;
 }
 lp->filters++;
 return 1;
}

variable_types:
ext
char *

variable_types:
desc
char *

variable_types: df int

user_defined_types: struct NCDFS_FILTER { char extension[256]; char description[256]; }


decompiled_code:
void *__fastcall ncd_file_select_allegro(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
int v4; // er15
int v5; // eax
bool v6; // zf
void *result; // rax
int v8; // ebp
int v9; // er12
__int64 v10; // rbx
int v11; // er11
int v12; // ebp
__int64 i; // r13
__int64 v15; // [rsp+10h] [rbp-448h]
__int64 v16; // [rsp+18h] [rbp-440h]
__int64 v17[2]; // [rsp+20h] [rbp-438h] BYREF
char v18[1008]; // [rsp+30h] [rbp-428h] BYREF

v16 = a3;
v17[0] = 0LL;
v17[1] = 0LL;
memset(v18, 0, sizeof(v18));
if ( a2 )
ustrzcpy(&ncdfs_internal_return_path, 0x7FFFFFFFLL, a2);
if ( !a4 )
goto LABEL_6;
v4 = ncd_file_select_allegro_want_all(a4);
if ( v4 )
{
a4 = 0LL;
LABEL_6:
v5 = file_select_ex(v16, &ncdfs_internal_return_path, a4, 1024LL, 320LL, 240LL);
goto LABEL_7;
}
ustrzcpy(v17, 0x7FFFFFFFLL, &unk_2402);
v8 = 0;
v15 = 0LL;
if ( *(int *)(a4 + 0x4000) > 0 )
{
do
{
v10 = v8;
v12 = ~v8;
for ( i = a4 + v15 - v10; ; *((_BYTE *)&v16 + v10 + 7) = *(_BYTE *)(i + v10 - 1) )
{
v9 = v10++;
if ( (int)ustrlen(v15 + a4) <= v12 + (int)v10 )
break;
}
v11 = *(_DWORD *)(a4 + 0x4000);
if ( v11 - 1 > v4 )
*((_BYTE *)v17 + v9++) = 59;
*((_BYTE *)v17 + v9) = 0;
v8 = v9 + 1;
++v4;
v15 += 512LL;
}
while ( v11 > v4 );
v5 = file_select_ex(v16, &ncdfs_internal_return_path, v17, 1024LL, 320LL, 240LL);
}
else
{
v5 = file_select_ex(v16, &ncdfs_internal_return_path, v17, 1024LL, 320LL, 240LL);
}
LABEL_7:
v6 = v5 == 0;
result = &ncdfs_internal_return_path;
if ( v6 )
result = 0LL;
return result;
}

canonical_decompiled_code:
void *__fastcall func3(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
int v4; // er15
int v5; // eax
bool v6; // zf
void *result; // rax
int v8; // ebp
int v9; // er12
__int64 v10; // rbx
int v11; // er11
int v12; // ebp
__int64 i; // r13
__int64 v15; // [rsp+10h] [rbp-448h]
__int64 v16; // [rsp+18h] [rbp-440h]
__int64 v17[2]; // [rsp+20h] [rbp-438h] BYREF
char v18[1008]; // [rsp+30h] [rbp-428h] BYREF

v16 = a3;
v17[0] = 0LL;
v17[1] = 0LL;
memset(v18, 0, sizeof(v18));
if ( a2 )
ustrzcpy(&ncdfs_internal_return_path, 0x7FFFFFFFLL, a2);
if ( !a4 )
goto LABEL_6;
v4 = func0(a4);
if ( v4 )
{
a4 = 0LL;
LABEL_6:
v5 = file_select_ex(v16, &ncdfs_internal_return_path, a4, 1024LL, 320LL, 240LL);
goto LABEL_7;
}
ustrzcpy(v17, 0x7FFFFFFFLL, &unk_2402);
v8 = 0;
v15 = 0LL;
if ( *(int *)(a4 + 0x4000) > 0 )
{
do
{
v10 = v8;
v12 = ~v8;
for ( i = a4 + v15 - v10; ; *((_BYTE *)&v16 + v10 + 7) = *(_BYTE *)(i + v10 - 1) )
{
v9 = v10++;
if ( (int)ustrlen(v15 + a4) <= v12 + (int)v10 )
break;
}
v11 = *(_DWORD *)(a4 + 0x4000);
if ( v11 - 1 > v4 )
*((_BYTE *)v17 + v9++) = 59;
*((_BYTE *)v17 + v9) = 0;
v8 = v9 + 1;
++v4;
v15 += 512LL;
}
while ( v11 > v4 );
v5 = file_select_ex(v16, &ncdfs_internal_return_path, v17, 1024LL, 320LL, 240LL);
}
else
{
v5 = file_select_ex(v16, &ncdfs_internal_return_path, v17, 1024LL, 320LL, 240LL);
}
LABEL_7:
v6 = v5 == 0;
result = &ncdfs_internal_return_path;
if ( v6 )
result = 0LL;
return result;
}

original_code:
char * ncd_file_select_allegro(int type, char * initial, const char * title, NCDFS_FILTER_LIST * lp)
{
 char realfilter[1024] = {0};
 int i, j, epos;
 char * filter;
 if(!initial)
 {
 }
 else
 {
  ustrzcpy(ncdfs_internal_return_path, 0x7fffffff, initial);
 }
 if(!lp)
 {
  filter = ((void *)0);
 }
 else
 {
  if(ncd_file_select_allegro_want_all(lp))
  {
   filter = ((void *)0);
  }
  else
  {
   ustrzcpy(realfilter, 0x7fffffff, "");
   epos = 0;
   for(i = 0; i < lp->filters; i++)
   {
    for(j = 0; j < ustrlen(lp->filter[i].extension); j++)
    {
     realfilter[epos] = lp->filter[i].extension[j];
     epos++;
    }
    if(i < lp->filters - 1)
    {
     realfilter[epos] = ';';
     epos++;
    }
    realfilter[epos] = '\0';
    epos++;
   }
   filter = realfilter;
  }
 }
 if(file_select_ex(title, ncdfs_internal_return_path, filter, 1024, 320, 240))
 {
  return ncdfs_internal_return_path;
 }
 return ((void *)0);
}

canonical_original_code:
char *ncd_file_select_allegro(int type, char *initial, char *title, struct NCDFS_FILTER_LIST *lp)
{
 char realfilter[1024] = {0};
 int i; int j; int epos;
 char *filter;
 if(!initial)
 {
 }
 else
 {
  ustrzcpy(ncdfs_internal_return_path, 0x7fffffff, initial);
 }
 if(!lp)
 {
  filter = ((void *)0);
 }
 else
 {
  if(ncd_file_select_allegro_want_all(lp))
  {
   filter = ((void *)0);
  }
  else
  {
   ustrzcpy(realfilter, 0x7fffffff, "");
   epos = 0;
   for(i = 0; i < lp->filters; i++)
   {
    for(j = 0; j < ustrlen(lp->filter[i].extension); j++)
    {
     realfilter[epos] = lp->filter[i].extension[j];
     epos++;
    }
    if(i < lp->filters - 1)
    {
     realfilter[epos] = ';';
     epos++;
    }
    realfilter[epos] = '\0';
    epos++;
   }
   filter = realfilter;
  }
 }
 if(file_select_ex(title, ncdfs_internal_return_path, filter, 1024, 320, 240))
 {
  return ncdfs_internal_return_path;
 }
 return ((void *)0);
}

variable_types: type int

variable_types:
initial
char *

variable_types:
title
char *

variable_types:
realfilter
char [1024]

variable_types: j int

variable_types: epos int

variable_types:
filter
char *

return_type: char *


decompiled_code:
void *__fastcall ncd_file_select(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
return ncd_file_select_allegro(a1, a2, a3, a4);
}

canonical_decompiled_code:
void *__fastcall func4(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
return func3(a1, a2, a3, a4);
}

original_code:
char * ncd_file_select(int type, char * initial, const char * title, NCDFS_FILTER_LIST * lp)
 {
  return ncd_file_select_allegro(type, initial, title, lp);
 }

canonical_original_code:
char *ncd_file_select(int type, char *initial, char *title, struct NCDFS_FILTER_LIST *lp)
 {
  return ncd_file_select_allegro(type, initial, title, lp);
 }


decompiled_code:
void *__fastcall ncd_folder_select_allegro(__int64 a1)
{
bool v1; // zf
void *result; // rax

v1 = (unsigned int)file_select_ex(a1, &ncdfs_internal_return_folder, &unk_2402, 1024LL, 320LL, 240LL) == 0;
result = &ncdfs_internal_return_folder;
if ( v1 )
result = 0LL;
return result;
}

canonical_decompiled_code:
void *__fastcall func5(__int64 a1)
{
bool v1; // zf
void *result; // rax

v1 = (unsigned int)file_select_ex(a1, &ncdfs_internal_return_folder, &unk_2402, 1024LL, 320LL, 240LL) == 0;
result = &ncdfs_internal_return_folder;
if ( v1 )
result = 0LL;
return result;
}

original_code:
char * ncd_folder_select_allegro(char * title)
{
 if(file_select_ex(title, ncdfs_internal_return_folder, "", 1024, 320, 240))
 {
  return ncdfs_internal_return_folder;
 }
 return ((void *)0);
}

canonical_original_code:
char *ncd_folder_select_allegro(char *title)
{
 if(file_select_ex(title, ncdfs_internal_return_folder, "", 1024, 320, 240))
 {
  return ncdfs_internal_return_folder;
 }
 return ((void *)0);
}


decompiled_code:
void *__fastcall ncd_folder_select(__int64 a1)
{
return ncd_folder_select_allegro(a1);
}

canonical_decompiled_code:
void *__fastcall func6(__int64 a1)
{
return func5(a1);
}

original_code:
char * ncd_folder_select(char * title)
 {
  return ncd_folder_select_allegro(title);
 }

canonical_original_code:
char *ncd_folder_select(char *title)
 {
  return ncd_folder_select_allegro(title);
 }


decompiled_code:
__int64 eof_undo_reset()
{
__int64 result; // rax

result = eof_log("eof_undo_reset() entered", 1LL);
eof_undo_current_index = 0;
eof_undo_count = 0;
eof_redo_count = 0;
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax

result = eof_log("eof_undo_reset() entered", 1LL);
eof_undo_current_index = 0;
eof_undo_count = 0;
eof_redo_count = 0;
return result;
}

original_code:
void eof_undo_reset(void)
{
  eof_log("eof_undo_reset() entered", 1);
 eof_undo_current_index = 0;
 eof_undo_count = 0;
 eof_redo_count = 0;
}

canonical_original_code:
void eof_undo_reset()
{
  eof_log("eof_undo_reset() entered", 1);
 eof_undo_current_index = 0;
 eof_undo_count = 0;
 eof_redo_count = 0;
}


decompiled_code:
__int64 eof_undo_apply()
{
unsigned int v0; // ebx
__int64 result; // rax
int v2; // eax
bool v3; // zf
__int64 v4[32]; // [rsp+0h] [rbp-508h] BYREF
char s[8]; // [rsp+100h] [rbp-408h] BYREF
__int64 v6; // [rsp+108h] [rbp-400h]
char v7[1008]; // [rsp+110h] [rbp-3F8h] BYREF

*(_QWORD *)s = 0LL;
v6 = 0LL;
memset(v7, 0, sizeof(v7));
v4[0] = 0LL;
v4[1] = 0LL;
v4[2] = 0LL;
v4[3] = 0LL;
v4[4] = 0LL;
v4[5] = 0LL;
v4[6] = 0LL;
v4[7] = 0LL;
v4[8] = 0LL;
v4[9] = 0LL;
v4[10] = 0LL;
v4[11] = 0LL;
v4[12] = 0LL;
v4[13] = 0LL;
v4[14] = 0LL;
v4[15] = 0LL;
v4[16] = 0LL;
v4[17] = 0LL;
v4[18] = 0LL;
v4[19] = 0LL;
v4[20] = 0LL;
v4[21] = 0LL;
v4[22] = 0LL;
v4[23] = 0LL;
v4[24] = 0LL;
v4[25] = 0LL;
v4[26] = 0LL;
v4[27] = 0LL;
v4[28] = 0LL;
v4[29] = 0LL;
v4[30] = 0LL;
v4[31] = 0LL;
v0 = 0;
eof_log("eof_undo_apply() entered", 1LL);
result = 0LL;
if ( eof_undo_count > 0 )
{
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 224LL) + 24LL) == *(_QWORD *)(eof_song + 224LL) + 262192LL )
LOBYTE(v0) = 1;
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 232LL) + 24LL) == *(_QWORD *)(eof_song + 232LL) + 262192LL )
BYTE1(v0) = 1;
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 240LL) + 24LL) == *(_QWORD *)(eof_song + 240LL) + 262192LL )
v0 = v0 & 0xFF00FFFF | 0x10000;
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 248LL) + 24LL) == *(_QWORD *)(eof_song + 248LL) + 262192LL )
v0 = v0 & 0xFFFFFF | 0x1000000;
strncpy((char *)v4, (const char *)(*eof_song + 256LL), 0xFFuLL);
snprintf(s, 0x3FFuLL, "eof%03u.redo", eof_log_id);
eof_save_song(eof_song, s);
eof_redo_type = 0;
v2 = eof_undo_current_index - 1;
if ( eof_undo_current_index - 1 < 0 )
v2 = 99;
eof_undo_current_index = v2;
eof_undo_load_state((__int64)*(&eof_undo_filename + v2));
if ( eof_undo_type[eof_undo_current_index] == 2 )
eof_menu_edit_deselect_all();
if ( eof_undo_type[eof_undo_current_index] == 5 )
{
snprintf(s, 0x3FFuLL, "eof%03u.redo.ogg", eof_log_id);
eof_copy_file(&eof_loaded_ogg_name, s);
snprintf(s, 0x3FFuLL, "%s.ogg", (const char *)*(&eof_undo_filename + eof_undo_current_index));
eof_copy_file(s, &eof_loaded_ogg_name);
eof_load_ogg(&eof_loaded_ogg_name, 0LL);
eof_delete_rocksmith_wav();
eof_fix_waveform_graph();
eof_fix_spectrogram();
eof_redo_type = 5;
}
if ( strcmp((const char *)v4, (const char *)(*eof_song + 256LL)) )
eof_delete_rocksmith_wav();
--eof_undo_count;
eof_redo_count = 1;
v3 = eof_change_count-- == 1;
eof_changes = !v3;
eof_undo_last_type = 0;
eof_init_after_load(1LL);
eof_detect_difficulties(eof_song, eof_selected_track);
eof_select_beat(eof_selected_beat);
eof_fix_catalog_selection();
eof_fix_window_title();
eof_scale_fretboard(0LL);
if ( (_BYTE)v0 )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 224LL));
if ( BYTE1(v0) )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 232LL));
if ( v0 << 8 >> 24 )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 240LL));
if ( HIBYTE(v0) )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 248LL));
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 func3()
{
unsigned int v0; // ebx
__int64 result; // rax
int v2; // eax
bool v3; // zf
__int64 v4[32]; // [rsp+0h] [rbp-508h] BYREF
char s[8]; // [rsp+100h] [rbp-408h] BYREF
__int64 v6; // [rsp+108h] [rbp-400h]
char v7[1008]; // [rsp+110h] [rbp-3F8h] BYREF

*(_QWORD *)s = 0LL;
v6 = 0LL;
memset(v7, 0, sizeof(v7));
v4[0] = 0LL;
v4[1] = 0LL;
v4[2] = 0LL;
v4[3] = 0LL;
v4[4] = 0LL;
v4[5] = 0LL;
v4[6] = 0LL;
v4[7] = 0LL;
v4[8] = 0LL;
v4[9] = 0LL;
v4[10] = 0LL;
v4[11] = 0LL;
v4[12] = 0LL;
v4[13] = 0LL;
v4[14] = 0LL;
v4[15] = 0LL;
v4[16] = 0LL;
v4[17] = 0LL;
v4[18] = 0LL;
v4[19] = 0LL;
v4[20] = 0LL;
v4[21] = 0LL;
v4[22] = 0LL;
v4[23] = 0LL;
v4[24] = 0LL;
v4[25] = 0LL;
v4[26] = 0LL;
v4[27] = 0LL;
v4[28] = 0LL;
v4[29] = 0LL;
v4[30] = 0LL;
v4[31] = 0LL;
v0 = 0;
eof_log("eof_undo_apply() entered", 1LL);
result = 0LL;
if ( eof_undo_count > 0 )
{
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 224LL) + 24LL) == *(_QWORD *)(eof_song + 224LL) + 262192LL )
LOBYTE(v0) = 1;
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 232LL) + 24LL) == *(_QWORD *)(eof_song + 232LL) + 262192LL )
BYTE1(v0) = 1;
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 240LL) + 24LL) == *(_QWORD *)(eof_song + 240LL) + 262192LL )
v0 = v0 & 0xFF00FFFF | 0x10000;
if ( *(_QWORD *)(*(_QWORD *)(eof_song + 248LL) + 24LL) == *(_QWORD *)(eof_song + 248LL) + 262192LL )
v0 = v0 & 0xFFFFFF | 0x1000000;
strncpy((char *)v4, (const char *)(*eof_song + 256LL), 0xFFuLL);
snprintf(s, 0x3FFuLL, "eof%03u.redo", eof_log_id);
eof_save_song(eof_song, s);
eof_redo_type = 0;
v2 = eof_undo_current_index - 1;
if ( eof_undo_current_index - 1 < 0 )
v2 = 99;
eof_undo_current_index = v2;
func0((__int64)*(&eof_undo_filename + v2));
if ( eof_undo_type[eof_undo_current_index] == 2 )
eof_menu_edit_deselect_all();
if ( eof_undo_type[eof_undo_current_index] == 5 )
{
snprintf(s, 0x3FFuLL, "eof%03u.redo.ogg", eof_log_id);
eof_copy_file(&eof_loaded_ogg_name, s);
snprintf(s, 0x3FFuLL, "%s.ogg", (const char *)*(&eof_undo_filename + eof_undo_current_index));
eof_copy_file(s, &eof_loaded_ogg_name);
eof_load_ogg(&eof_loaded_ogg_name, 0LL);
eof_delete_rocksmith_wav();
eof_fix_waveform_graph();
eof_fix_spectrogram();
eof_redo_type = 5;
}
if ( strcmp((const char *)v4, (const char *)(*eof_song + 256LL)) )
eof_delete_rocksmith_wav();
--eof_undo_count;
eof_redo_count = 1;
v3 = eof_change_count-- == 1;
eof_changes = !v3;
eof_undo_last_type = 0;
eof_init_after_load(1LL);
eof_detect_difficulties(eof_song, eof_selected_track);
eof_select_beat(eof_selected_beat);
eof_fix_catalog_selection();
eof_fix_window_title();
eof_scale_fretboard(0LL);
if ( (_BYTE)v0 )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 224LL));
if ( BYTE1(v0) )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 232LL));
if ( v0 << 8 >> 24 )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 240LL));
if ( HIBYTE(v0) )
eof_menu_pro_guitar_track_enable_tech_view(*(_QWORD *)(eof_song + 248LL));
result = 1LL;
}
return result;
}

original_code:
int eof_undo_apply(void)
{
 char fn[1024] = {0};
 char title[256] = {0};
 unsigned long ctr;
 EOF_PRO_GUITAR_TRACK *tp = ((void *)0);
 char tech_view_status[4] = {0};
  eof_log("eof_undo_apply() entered", 1);
 if(eof_undo_count > 0)
 {
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tp->note == tp->technote)
   {
    tech_view_status[ctr] = 1;
   }
  }
  strncpy(title, eof_song->tags->title, sizeof(title) - 1);
  (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo", eof_log_id);
  (void) eof_save_song(eof_song, fn);
  eof_redo_type = 0;
  eof_undo_current_index--;
  if(eof_undo_current_index < 0)
  {
   eof_undo_current_index = 100 - 1;
  }
  (void) eof_undo_load_state(eof_undo_filename[eof_undo_current_index]);
  if(eof_undo_type[eof_undo_current_index] == 2)
  {
   (void) eof_menu_edit_deselect_all();
  }
  if(eof_undo_type[eof_undo_current_index] == 5)
  {
   (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo.ogg", eof_log_id);
   (void) eof_copy_file(eof_loaded_ogg_name, fn);
   (void) snprintf(fn, sizeof(fn) - 1, "%s.ogg", eof_undo_filename[eof_undo_current_index]);
   (void) eof_copy_file(fn, eof_loaded_ogg_name);
   (void) eof_load_ogg(eof_loaded_ogg_name, 0);
   eof_delete_rocksmith_wav();
   eof_fix_waveform_graph();
   eof_fix_spectrogram();
   eof_redo_type = 5;
  }
  if(strcmp(title, eof_song->tags->title))
  {
   eof_delete_rocksmith_wav();
  }
  eof_undo_count--;
  eof_redo_count = 1;
  eof_change_count--;
  if(eof_change_count == 0)
  {
   eof_changes = 0;
  }
  else
  {
   eof_changes = 1;
  }
  eof_undo_last_type = 0;
  eof_init_after_load(1);
  (void) eof_detect_difficulties(eof_song, eof_selected_track);
  eof_select_beat(eof_selected_beat);
  eof_fix_catalog_selection();
  eof_fix_window_title();
  eof_scale_fretboard(0);
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tech_view_status[ctr])
   {
    eof_menu_pro_guitar_track_enable_tech_view(tp);
   }
  }
  return 1;
 }
 return 0;
}

canonical_original_code:
int eof_undo_apply()
{
 char fn[1024] = {0};
 char title[256] = {0};
 unsigned long ctr;
 struct EOF_PRO_GUITAR_TRACK *tp = ((void *)0);
 char tech_view_status[4] = {0};
  eof_log("eof_undo_apply() entered", 1);
 if(eof_undo_count > 0)
 {
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tp->note == tp->technote)
   {
    tech_view_status[ctr] = 1;
   }
  }
  strncpy(title, eof_song->tags->title, sizeof(title) - 1);
  (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo", eof_log_id);
  (void) eof_save_song(eof_song, fn);
  eof_redo_type = 0;
  eof_undo_current_index--;
  if(eof_undo_current_index < 0)
  {
   eof_undo_current_index = 100 - 1;
  }
  (void) eof_undo_load_state(eof_undo_filename[eof_undo_current_index]);
  if(eof_undo_type[eof_undo_current_index] == 2)
  {
   (void) eof_menu_edit_deselect_all();
  }
  if(eof_undo_type[eof_undo_current_index] == 5)
  {
   (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo.ogg", eof_log_id);
   (void) eof_copy_file(eof_loaded_ogg_name, fn);
   (void) snprintf(fn, sizeof(fn) - 1, "%s.ogg", eof_undo_filename[eof_undo_current_index]);
   (void) eof_copy_file(fn, eof_loaded_ogg_name);
   (void) eof_load_ogg(eof_loaded_ogg_name, 0);
   eof_delete_rocksmith_wav();
   eof_fix_waveform_graph();
   eof_fix_spectrogram();
   eof_redo_type = 5;
  }
  if(strcmp(title, eof_song->tags->title))
  {
   eof_delete_rocksmith_wav();
  }
  eof_undo_count--;
  eof_redo_count = 1;
  eof_change_count--;
  if(eof_change_count == 0)
  {
   eof_changes = 0;
  }
  else
  {
   eof_changes = 1;
  }
  eof_undo_last_type = 0;
  eof_init_after_load(1);
  (void) eof_detect_difficulties(eof_song, eof_selected_track);
  eof_select_beat(eof_selected_beat);
  eof_fix_catalog_selection();
  eof_fix_window_title();
  eof_scale_fretboard(0);
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tech_view_status[ctr])
   {
    eof_menu_pro_guitar_track_enable_tech_view(tp);
   }
  }
  return 1;
 }
 return 0;
}

variable_types:
fn
char [1024]

variable_types:
title
char [256]

variable_types:
ctr
unsigned long

variable_types: struct EOF_PRO_GUITAR_TRACK { unsigned char numfrets; unsigned char numstrings; unsigned char arrangement; unsigned char ignore_tuning; unsigned char capo; char tuning[6]; struct EOF_TRACK_ENTRY { char track_format; char track_behavior; char track_type; unsigned long tracknum; char name[-1]; char altname[-1]; unsigned char difficulty; unsigned char numdiffs; unsigned long flags; } *parent; struct EOF_PRO_GUITAR_NOTE { char name[-1]; unsigned char type; unsigned char note; unsigned char ghost; unsigned char frets[8]; unsigned char finger[8]; unsigned char legacymask; unsigned long midi_pos; long midi_length; unsigned long pos; long length; unsigned long flags; unsigned long eflags; unsigned char bendstrength; unsigned char slideend; unsigned char unpitchend; unsigned char tflags; } **note; unsigned long notes; struct EOF_PRO_GUITAR_NOTE *pgnote[32768]; unsigned long pgnotes; struct EOF_PRO_GUITAR_NOTE *technote[32768]; unsigned long technotes; struct EOF_PHRASE_SECTION { unsigned long midi_start_pos; unsigned long midi_end_pos; unsigned long start_pos; unsigned long end_pos; unsigned long flags; char name[-1]; unsigned char difficulty; } solo[1000]; unsigned long solos; struct EOF_PHRASE_SECTION star_power_path[1000]; unsigned long star_power_paths; struct EOF_PHRASE_SECTION arpeggio[1000]; unsigned long arpeggios; struct EOF_PHRASE_SECTION trill[1000]; unsigned long trills; struct EOF_PHRASE_SECTION tremolo[1000]; unsigned long tremolos; struct EOF_PHRASE_SECTION handposition[32768]; unsigned long handpositions; struct EOF_PHRASE_SECTION popupmessage[1000]; unsigned long popupmessages; struct EOF_PHRASE_SECTION tonechange[1000]; unsigned long tonechanges; char defaulttone[-1]; } *

user_defined_types: struct EOF_PRO_GUITAR_TRACK { unsigned char numfrets; unsigned char numstrings; unsigned char arrangement; unsigned char ignore_tuning; unsigned char capo; char tuning[6]; struct EOF_TRACK_ENTRY *parent; struct EOF_PRO_GUITAR_NOTE **note; unsigned long notes; struct EOF_PRO_GUITAR_NOTE *pgnote[32768]; unsigned long pgnotes; struct EOF_PRO_GUITAR_NOTE *technote[32768]; unsigned long technotes; struct EOF_PHRASE_SECTION solo[1000]; unsigned long solos; struct EOF_PHRASE_SECTION star_power_path[1000]; unsigned long star_power_paths; struct EOF_PHRASE_SECTION arpeggio[1000]; unsigned long arpeggios; struct EOF_PHRASE_SECTION trill[1000]; unsigned long trills; struct EOF_PHRASE_SECTION tremolo[1000]; unsigned long tremolos; struct EOF_PHRASE_SECTION handposition[32768]; unsigned long handpositions; struct EOF_PHRASE_SECTION popupmessage[1000]; unsigned long popupmessages; struct EOF_PHRASE_SECTION tonechange[1000]; unsigned long tonechanges; char defaulttone[-1]; }


original_code:
void eof_redo_apply(void)
{
 char fn[1024] = {0};
 char title[256] = {0};
 unsigned long ctr;
 EOF_PRO_GUITAR_TRACK *tp = ((void *)0);
 char tech_view_status[4] = {0};
  eof_log("eof_redo_apply() entered", 1);
 if(eof_redo_count > 0)
 {
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tp->note == tp->technote)
   {
    tech_view_status[ctr] = 1;
   }
  }
  strncpy(title, eof_song->tags->title, sizeof(title) - 1);
  (void) eof_save_song(eof_song, eof_undo_filename[eof_undo_current_index]);
  eof_undo_current_index++;
  if(eof_undo_current_index >= 100)
  {
   eof_undo_current_index = 0;
  }
  (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo", eof_log_id);
  (void) eof_undo_load_state(fn);
  if(eof_redo_type == 5)
  {
   (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo.ogg", eof_log_id);
   (void) eof_copy_file(fn, eof_loaded_ogg_name);
   (void) eof_load_ogg(eof_loaded_ogg_name, 0);
   eof_delete_rocksmith_wav();
   eof_fix_waveform_graph();
   eof_fix_spectrogram();
  }
  if(strcmp(title, eof_song->tags->title))
  {
   eof_delete_rocksmith_wav();
  }
  eof_undo_count++;
  if(eof_undo_count >= 100)
  {
   eof_undo_count = 100;
  }
  eof_redo_count = 0;
  eof_change_count++;
  if(eof_change_count == 0)
  {
   eof_changes = 0;
  }
  else
  {
   eof_changes = 1;
  }
  eof_init_after_load(1);
  (void) eof_detect_difficulties(eof_song, eof_selected_track);
  eof_select_beat(eof_selected_beat);
  eof_fix_catalog_selection();
  eof_fix_window_title();
  eof_scale_fretboard(0);
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tech_view_status[ctr])
   {
    eof_menu_pro_guitar_track_enable_tech_view(tp);
   }
  }
 }
}

canonical_original_code:
void eof_redo_apply()
{
 char fn[1024] = {0};
 char title[256] = {0};
 unsigned long ctr;
 struct EOF_PRO_GUITAR_TRACK *tp = ((void *)0);
 char tech_view_status[4] = {0};
  eof_log("eof_redo_apply() entered", 1);
 if(eof_redo_count > 0)
 {
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tp->note == tp->technote)
   {
    tech_view_status[ctr] = 1;
   }
  }
  strncpy(title, eof_song->tags->title, sizeof(title) - 1);
  (void) eof_save_song(eof_song, eof_undo_filename[eof_undo_current_index]);
  eof_undo_current_index++;
  if(eof_undo_current_index >= 100)
  {
   eof_undo_current_index = 0;
  }
  (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo", eof_log_id);
  (void) eof_undo_load_state(fn);
  if(eof_redo_type == 5)
  {
   (void) snprintf(fn, sizeof(fn) - 1, "eof%03u.redo.ogg", eof_log_id);
   (void) eof_copy_file(fn, eof_loaded_ogg_name);
   (void) eof_load_ogg(eof_loaded_ogg_name, 0);
   eof_delete_rocksmith_wav();
   eof_fix_waveform_graph();
   eof_fix_spectrogram();
  }
  if(strcmp(title, eof_song->tags->title))
  {
   eof_delete_rocksmith_wav();
  }
  eof_undo_count++;
  if(eof_undo_count >= 100)
  {
   eof_undo_count = 100;
  }
  eof_redo_count = 0;
  eof_change_count++;
  if(eof_change_count == 0)
  {
   eof_changes = 0;
  }
  else
  {
   eof_changes = 1;
  }
  eof_init_after_load(1);
  (void) eof_detect_difficulties(eof_song, eof_selected_track);
  eof_select_beat(eof_selected_beat);
  eof_fix_catalog_selection();
  eof_fix_window_title();
  eof_scale_fretboard(0);
  for(ctr = 0; ctr < 4; ctr++)
  {
   tp = eof_song->pro_guitar_track[ctr];
   if(tech_view_status[ctr])
   {
    eof_menu_pro_guitar_track_enable_tech_view(tp);
   }
  }
 }
}

user_defined_types: struct EOF_TRACK_ENTRY { char track_format; char track_behavior; char track_type; unsigned long tracknum; char name[-1]; char altname[-1]; unsigned char difficulty; unsigned char numdiffs; unsigned long flags; }

user_defined_types: struct EOF_PHRASE_SECTION { unsigned long midi_start_pos; unsigned long midi_end_pos; unsigned long start_pos; unsigned long end_pos; unsigned long flags; char name[-1]; unsigned char difficulty; }

user_defined_types: struct EOF_PRO_GUITAR_NOTE { char name[-1]; unsigned char type; unsigned char note; unsigned char ghost; unsigned char frets[8]; unsigned char finger[8]; unsigned char legacymask; unsigned long midi_pos; long midi_length; unsigned long pos; long length; unsigned long flags; unsigned long eflags; unsigned char bendstrength; unsigned char slideend; unsigned char unpitchend; unsigned char tflags; }


decompiled_code:
void eof_destroy_undo()
{
__int64 v0; // rbp
__int64 v1; // rbx
void *v2; // rdi
__int64 v3; // rbp
void *v4; // rdi
void *v5; // rdi
void *v6; // rdi
void *v7; // rdi
void *v8; // rdi
void *v9; // rdi
void *v10; // rdi
void *v11; // rdi
void *v12; // rdi

if ( eof_undo_states_initialized > 0 )
{
v0 = 0LL;
do
{
v12 = *(&eof_undo_filename + v0);
if ( v12 )
{
free(v12);
*(&eof_undo_filename + v0) = 0LL;
}
v1 = v0 + 1;
v2 = *(&eof_undo_filename + v0 + 1);
if ( v2 )
{
free(v2);
*(&eof_undo_filename + v1) = 0LL;
}
v3 = v0 + 2;
v4 = *(&eof_undo_filename + v1 + 1);
if ( v4 )
{
free(v4);
*(&eof_undo_filename + v3) = 0LL;
}
v5 = *(&eof_undo_filename + v1 + 2);
if ( v5 )
{
free(v5);
*(&eof_undo_filename + v1 + 2) = 0LL;
}
v6 = *(&eof_undo_filename + v1 + 3);
if ( v6 )
{
free(v6);
*(&eof_undo_filename + v1 + 3) = 0LL;
}
v7 = *(&eof_undo_filename + v1 + 4);
if ( v7 )
{
free(v7);
*(&eof_undo_filename + v1 + 4) = 0LL;
}
v8 = *(&eof_undo_filename + v1 + 5);
if ( v8 )
{
free(v8);
*(&eof_undo_filename + v1 + 5) = 0LL;
}
v9 = *(&eof_undo_filename + v1 + 6);
if ( v9 )
{
free(v9);
*(&eof_undo_filename + v1 + 6) = 0LL;
}
v10 = *(&eof_undo_filename + v1 + 7);
if ( v10 )
{
free(v10);
*(&eof_undo_filename + v1 + 7) = 0LL;
}
v11 = *(&eof_undo_filename + v1 + 8);
if ( v11 )
{
free(v11);
*(&eof_undo_filename + v1 + 8) = 0LL;
}
v0 = v1 + 9;
}
while ( v1 != 91 );
}
}

canonical_decompiled_code:
void func5()
{
__int64 v0; // rbp
__int64 v1; // rbx
void *v2; // rdi
__int64 v3; // rbp
void *v4; // rdi
void *v5; // rdi
void *v6; // rdi
void *v7; // rdi
void *v8; // rdi
void *v9; // rdi
void *v10; // rdi
void *v11; // rdi
void *v12; // rdi

if ( eof_undo_states_initialized > 0 )
{
v0 = 0LL;
do
{
v12 = *(&eof_undo_filename + v0);
if ( v12 )
{
free(v12);
*(&eof_undo_filename + v0) = 0LL;
}
v1 = v0 + 1;
v2 = *(&eof_undo_filename + v0 + 1);
if ( v2 )
{
free(v2);
*(&eof_undo_filename + v1) = 0LL;
}
v3 = v0 + 2;
v4 = *(&eof_undo_filename + v1 + 1);
if ( v4 )
{
free(v4);
*(&eof_undo_filename + v3) = 0LL;
}
v5 = *(&eof_undo_filename + v1 + 2);
if ( v5 )
{
free(v5);
*(&eof_undo_filename + v1 + 2) = 0LL;
}
v6 = *(&eof_undo_filename + v1 + 3);
if ( v6 )
{
free(v6);
*(&eof_undo_filename + v1 + 3) = 0LL;
}
v7 = *(&eof_undo_filename + v1 + 4);
if ( v7 )
{
free(v7);
*(&eof_undo_filename + v1 + 4) = 0LL;
}
v8 = *(&eof_undo_filename + v1 + 5);
if ( v8 )
{
free(v8);
*(&eof_undo_filename + v1 + 5) = 0LL;
}
v9 = *(&eof_undo_filename + v1 + 6);
if ( v9 )
{
free(v9);
*(&eof_undo_filename + v1 + 6) = 0LL;
}
v10 = *(&eof_undo_filename + v1 + 7);
if ( v10 )
{
free(v10);
*(&eof_undo_filename + v1 + 7) = 0LL;
}
v11 = *(&eof_undo_filename + v1 + 8);
if ( v11 )
{
free(v11);
*(&eof_undo_filename + v1 + 8) = 0LL;
}
v0 = v1 + 9;
}
while ( v1 != 91 );
}
}

original_code:
void eof_destroy_undo(void)
{
 unsigned long ctr;
 if(eof_undo_states_initialized > 0)
 {
  for(ctr = 0; ctr < 100; ctr++)
  {
   if(eof_undo_filename[ctr] != ((void *)0))
   {
    free(eof_undo_filename[ctr]);
    eof_undo_filename[ctr] = ((void *)0);
   }
  }
 }
}

canonical_original_code:
void eof_destroy_undo()
{
 unsigned long ctr;
 if(eof_undo_states_initialized > 0)
 {
  for(ctr = 0; ctr < 100; ctr++)
  {
   if(eof_undo_filename[ctr] != ((void *)0))
   {
    free(eof_undo_filename[ctr]);
    eof_undo_filename[ctr] = ((void *)0);
   }
  }
 }
}


decompiled_code:
__int64 allegro_InitIdleSystem()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
return 0LL;
}

original_code:
int allegro_InitIdleSystem (void)
{
 return 0;
}

canonical_original_code:
int allegro_InitIdleSystem()
{
 return 0;
}


decompiled_code:
void allegro_PrepVSyncIdle()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void allegro_PrepVSyncIdle (void)
{
}

canonical_original_code:
void allegro_PrepVSyncIdle()
{
}


decompiled_code:
__int64 allegro_Idle()
{
return rest();
}

canonical_decompiled_code:
__int64 func3()
{
return rest();
}

original_code:
void allegro_Idle (int msec)
{
 rest(msec);
}

canonical_original_code:
void allegro_Idle(int msec)
{
 rest(msec);
}

variable_types: msec int


decompiled_code:
void allegro_IdleUntilVSync()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
void allegro_IdleUntilVSync (void)
{
}

canonical_original_code:
void allegro_IdleUntilVSync()
{
}


decompiled_code:
void allegro_IdleUntilPollScroll()
{
;
}

canonical_decompiled_code:
void func5()
{
;
}

original_code:
void allegro_IdleUntilPollScroll (void)
{
}

canonical_original_code:
void allegro_IdleUntilPollScroll()
{
}


decompiled_code:
void allegro_DoneVSync()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code:
void allegro_DoneVSync (void)
{
}

canonical_original_code:
void allegro_DoneVSync()
{
}


decompiled_code:
void allegro_StopIdleSystem()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code:
void allegro_StopIdleSystem (void)
{
}

canonical_original_code:
void allegro_StopIdleSystem()
{
}


InitIdleSystem

decompiled_code:
// attributes: thunk
__int64 InitIdleSystem()
{
return allegro_InitIdleSystem();
}

canonical_decompiled_code:
__int64 func8()
{
return func1();
}

original_code:
int InitIdleSystem (void)
{
  return allegro_InitIdleSystem();
}

canonical_original_code:
int InitIdleSystem()
{
  return allegro_InitIdleSystem();
}


PrepVSyncIdle

decompiled_code:
void PrepVSyncIdle()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

original_code:
void PrepVSyncIdle (void)
{
  allegro_PrepVSyncIdle();
}

canonical_original_code:
void PrepVSyncIdle()
{
  allegro_PrepVSyncIdle();
}


Idle

decompiled_code:
__int64 Idle()
{
return allegro_Idle();
}

canonical_decompiled_code:
__int64 func10()
{
return func3();
}

original_code:
void Idle (int msec)
{
  allegro_Idle(msec);
}

canonical_original_code:
void Idle(int msec)
{
  allegro_Idle(msec);
}


IdleUntilVSync

decompiled_code:
void IdleUntilVSync()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

original_code:
void IdleUntilVSync (void)
{
  allegro_IdleUntilVSync();
}

canonical_original_code:
void IdleUntilVSync()
{
  allegro_IdleUntilVSync();
}


DoneVSync

decompiled_code:
void DoneVSync()
{
;
}

canonical_decompiled_code:
void func12()
{
;
}

original_code:
void DoneVSync (void)
{
  allegro_DoneVSync();
}

canonical_original_code:
void DoneVSync()
{
  allegro_DoneVSync();
}


IdleUntilPollScroll

decompiled_code:
void IdleUntilPollScroll()
{
;
}

canonical_decompiled_code:
void func13()
{
;
}

original_code:
void IdleUntilPollScroll (void)
{
  allegro_IdleUntilPollScroll();
}

canonical_original_code:
void IdleUntilPollScroll()
{
  allegro_IdleUntilPollScroll();
}


StopIdleSystem

decompiled_code:
void StopIdleSystem()
{
;
}

canonical_decompiled_code:
void func14()
{
;
}

original_code:
void StopIdleSystem (void)
{
  allegro_StopIdleSystem();
}

canonical_original_code:
void StopIdleSystem()
{
  allegro_StopIdleSystem();
}


decompiled_code:
__int64 agup_themes_list_init()
{
int v0; // eax
__int64 result; // rax

if ( !once_0 )
{
once_0 = 1;
v0 = agup_themes_count;
agup_themes_list[agup_themes_count] = agtk_theme;
agup_themes_list[v0 + 1] = aphoton_theme;
agup_themes_list[v0 + 2] = awin95_theme;
agup_themes_list[v0 + 3] = aase_theme;
agup_themes_list[v0 + 4] = abeos_theme;
agup_themes_list[v0 + 5] = ans_theme;
agup_themes_count = v0 + 7;
result = v0 + 6;
agup_themes_list[result] = aalg_theme;
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
int v0; // eax
__int64 result; // rax

if ( !once_0 )
{
once_0 = 1;
v0 = agup_themes_count;
agup_themes_list[agup_themes_count] = agtk_theme;
agup_themes_list[v0 + 1] = aphoton_theme;
agup_themes_list[v0 + 2] = awin95_theme;
agup_themes_list[v0 + 3] = aase_theme;
agup_themes_list[v0 + 4] = abeos_theme;
agup_themes_list[v0 + 5] = ans_theme;
agup_themes_count = v0 + 7;
result = v0 + 6;
agup_themes_list[result] = aalg_theme;
}
return result;
}

original_code:
static void
agup_themes_list_init (void)
{
    static int once = 0;
    if (once)
       return;
    once++;
    agup_themes_list[agup_themes_count++] = agtk_theme;
    agup_themes_list[agup_themes_count++] = aphoton_theme;
    agup_themes_list[agup_themes_count++] = awin95_theme;
    agup_themes_list[agup_themes_count++] = aase_theme;
    agup_themes_list[agup_themes_count++] = abeos_theme;
    agup_themes_list[agup_themes_count++] = ans_theme;
    agup_themes_list[agup_themes_count++] = aalg_theme;
}

canonical_original_code:
static void agup_themes_list_init()
{
    static int once = 0;
    if (once)
       return;
    once++;
    agup_themes_list[agup_themes_count++] = agtk_theme;
    agup_themes_list[agup_themes_count++] = aphoton_theme;
    agup_themes_list[agup_themes_count++] = awin95_theme;
    agup_themes_list[agup_themes_count++] = aase_theme;
    agup_themes_list[agup_themes_count++] = abeos_theme;
    agup_themes_list[agup_themes_count++] = ans_theme;
    agup_themes_list[agup_themes_count++] = aalg_theme;
}

variable_types: once int


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

*(_DWORD *)(a2 + 8) += 3;
*(_DWORD *)(a2 + 12) += 3;
++agup_edit_recursive;
result = d_edit_proc();
--agup_edit_recursive;
*(_DWORD *)(a2 + 8) -= 3;
*(_DWORD *)(a2 + 12) -= 3;
return result;
}

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

*(_DWORD *)(a2 + 8) += 3;
*(_DWORD *)(a2 + 12) += 3;
++agup_edit_recursive;
result = d_edit_proc();
--agup_edit_recursive;
*(_DWORD *)(a2 + 8) -= 3;
*(_DWORD *)(a2 + 12) -= 3;
return result;
}

original_code:
int d_agup_adjusted_edit_proc(int msg, DIALOG *d, int c)
{
    int ret;
    d->x += 3;
    d->y += 3;
    agup_edit_recursive++;
    ret = d_edit_proc(msg, d, c);
    agup_edit_recursive--;
    d->x -= 3;
    d->y -= 3;
    return ret;
}

canonical_original_code:
int d_agup_adjusted_edit_proc(int msg, struct DIALOG *d, int c)
{
    int ret;
    d->x += 3;
    d->y += 3;
    agup_edit_recursive++;
    ret = d_edit_proc(msg, d, c);
    agup_edit_recursive--;
    d->x -= 3;
    d->y -= 3;
    return ret;
}

variable_types: msg int

variable_types: struct DIALOG { int (*proc)(int msg, struct DIALOG *d, int c); int x; int fg; int key; int flags; int d1; void *dp; } *

variable_types: c int

variable_types: ret int


decompiled_code:
void __fastcall agup_edit_adjust_position(__int64 a1)
{
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) -= 3;
*(_DWORD *)(a1 + 12) -= 3;
}
}

canonical_decompiled_code:
void __fastcall func2(__int64 a1)
{
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) -= 3;
*(_DWORD *)(a1 + 12) -= 3;
}
}

original_code:
void agup_edit_adjust_position (DIALOG *d)
{
    if (agup_edit_recursive)
    {
        d->x -= 3;
        d->y -= 3;
    }
}

canonical_original_code:
void agup_edit_adjust_position(struct DIALOG *d)
{
    if (agup_edit_recursive)
    {
        d->x -= 3;
        d->y -= 3;
    }
}

user_defined_types: struct DIALOG { int (*proc)(int msg, struct DIALOG *d, int c); int x; int fg; int key; int flags; int d1; void *dp; }


decompiled_code:
void __fastcall agup_edit_restore_position(__int64 a1)
{
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) += 3;
*(_DWORD *)(a1 + 12) += 3;
}
}

canonical_decompiled_code:
void __fastcall func3(__int64 a1)
{
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) += 3;
*(_DWORD *)(a1 + 12) += 3;
}
}

original_code:
void agup_edit_restore_position (DIALOG *d)
{
    if (agup_edit_recursive)
    {
        d->x += 3;
        d->y += 3;
    }
}

canonical_original_code:
void agup_edit_restore_position(struct DIALOG *d)
{
    if (agup_edit_recursive)
    {
        d->x += 3;
        d->y += 3;
    }
}


decompiled_code:
__int64 __fastcall d_agup_common_text_proc(int a1, __int64 a2)
{
unsigned int v3; // er13
unsigned int v4; // er12
unsigned int v5; // ebp
unsigned int v6; // ebx
__int64 v7; // r14
__int64 v8; // rax

if ( a1 != 3 )
return d_text_proc();
v3 = **(_DWORD **)(agup_theme + 16);
v4 = **(_DWORD **)(agup_theme + 8);
v5 = *(_DWORD *)(a2 + 12);
v6 = *(_DWORD *)(a2 + 8);
v7 = *(_QWORD *)(a2 + 48);
v8 = gui_get_screen();
gui_textout_ex(v8, v7, v6, v5, v4, v3, 0LL);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(int a1, __int64 a2)
{
unsigned int v3; // er13
unsigned int v4; // er12
unsigned int v5; // ebp
unsigned int v6; // ebx
__int64 v7; // r14
__int64 v8; // rax

if ( a1 != 3 )
return d_text_proc();
v3 = **(_DWORD **)(agup_theme + 16);
v4 = **(_DWORD **)(agup_theme + 8);
v5 = *(_DWORD *)(a2 + 12);
v6 = *(_DWORD *)(a2 + 8);
v7 = *(_QWORD *)(a2 + 48);
v8 = gui_get_screen();
gui_textout_ex(v8, v7, v6, v5, v4, v3, 0LL);
return 0LL;
}

original_code:
int
d_agup_common_text_proc (int msg, DIALOG *d, int c)
{
    if (msg == 3)
    {
        gui_textout_ex (gui_get_screen(), d->dp, d->x, d->y,
            *(agup_theme->fg_color), *(agup_theme->bg_color), 0);
        return 0;
    }
    return d_text_proc (msg, d, c);
}

canonical_original_code:
int d_agup_common_text_proc(int msg, struct DIALOG *d, int c)
{
    if (msg == 3)
    {
        gui_textout_ex (gui_get_screen(), d->dp, d->x, d->y,
            *(agup_theme->fg_color), *(agup_theme->bg_color), 0);
        return 0;
    }
    return d_text_proc (msg, d, c);
}


decompiled_code:
__int64 __fastcall d_agup_common_ctext_proc(int a1, __int64 a2)
{
unsigned int v3; // er13
unsigned int v4; // er12
unsigned int v5; // ebp
unsigned int v6; // ebx
__int64 v7; // r14
__int64 v8; // rax

if ( a1 != 3 )
return d_ctext_proc();
v3 = **(_DWORD **)(agup_theme + 16);
v4 = **(_DWORD **)(agup_theme + 8);
v5 = *(_DWORD *)(a2 + 12);
v6 = *(_DWORD *)(a2 + 8) + *(_DWORD *)(a2 + 16) / 2;
v7 = *(_QWORD *)(a2 + 48);
v8 = gui_get_screen();
gui_textout_ex(v8, v7, v6, v5, v4, v3, -1LL);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(int a1, __int64 a2)
{
unsigned int v3; // er13
unsigned int v4; // er12
unsigned int v5; // ebp
unsigned int v6; // ebx
__int64 v7; // r14
__int64 v8; // rax

if ( a1 != 3 )
return d_ctext_proc();
v3 = **(_DWORD **)(agup_theme + 16);
v4 = **(_DWORD **)(agup_theme + 8);
v5 = *(_DWORD *)(a2 + 12);
v6 = *(_DWORD *)(a2 + 8) + *(_DWORD *)(a2 + 16) / 2;
v7 = *(_QWORD *)(a2 + 48);
v8 = gui_get_screen();
gui_textout_ex(v8, v7, v6, v5, v4, v3, -1LL);
return 0LL;
}

original_code:
int
d_agup_common_ctext_proc (int msg, DIALOG *d, int c)
{
    if (msg == 3)
    {
        gui_textout_ex (gui_get_screen(), d->dp, d->x + d->w / 2, d->y,
            *(agup_theme->fg_color), *(agup_theme->bg_color), -1);
        return 0;
    }
    return d_ctext_proc (msg, d, c);
}

canonical_original_code:
int d_agup_common_ctext_proc(int msg, struct DIALOG *d, int c)
{
    if (msg == 3)
    {
        gui_textout_ex (gui_get_screen(), d->dp, d->x + d->w / 2, d->y,
            *(agup_theme->fg_color), *(agup_theme->bg_color), -1);
        return 0;
    }
    return d_ctext_proc (msg, d, c);
}


decompiled_code:
__int64 __fastcall d_agup_common_rtext_proc(int a1, __int64 a2)
{
unsigned int v3; // er14
unsigned int v4; // er13
unsigned int v5; // er12
int v6; // ebp
unsigned int v7; // ebp
__int64 v8; // rbx
__int64 v9; // rax

if ( a1 != 3 )
return d_rtext_proc();
v3 = **(_DWORD **)(agup_theme + 16);
v4 = **(_DWORD **)(agup_theme + 8);
v5 = *(_DWORD *)(a2 + 12);
v6 = *(_DWORD *)(a2 + 8) + *(_DWORD *)(a2 + 16);
v7 = v6 - gui_strlen(*(_QWORD *)(a2 + 48));
v8 = *(_QWORD *)(a2 + 48);
v9 = gui_get_screen();
gui_textout_ex(v9, v8, v7, v5, v4, v3, 0LL);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, __int64 a2)
{
unsigned int v3; // er14
unsigned int v4; // er13
unsigned int v5; // er12
int v6; // ebp
unsigned int v7; // ebp
__int64 v8; // rbx
__int64 v9; // rax

if ( a1 != 3 )
return d_rtext_proc();
v3 = **(_DWORD **)(agup_theme + 16);
v4 = **(_DWORD **)(agup_theme + 8);
v5 = *(_DWORD *)(a2 + 12);
v6 = *(_DWORD *)(a2 + 8) + *(_DWORD *)(a2 + 16);
v7 = v6 - gui_strlen(*(_QWORD *)(a2 + 48));
v8 = *(_QWORD *)(a2 + 48);
v9 = gui_get_screen();
gui_textout_ex(v9, v8, v7, v5, v4, v3, 0LL);
return 0LL;
}

original_code:
int
d_agup_common_rtext_proc (int msg, DIALOG *d, int c)
{
    if (msg == 3)
    {
        gui_textout_ex (gui_get_screen(), d->dp, d->x + d->w - gui_strlen(d->dp),
            d->y, *(agup_theme->fg_color), *(agup_theme->bg_color), 0);
        return 0;
    }
    return d_rtext_proc (msg, d, c);
}

canonical_original_code:
int d_agup_common_rtext_proc(int msg, struct DIALOG *d, int c)
{
    if (msg == 3)
    {
        gui_textout_ex (gui_get_screen(), d->dp, d->x + d->w - gui_strlen(d->dp),
            d->y, *(agup_theme->fg_color), *(agup_theme->bg_color), 0);
        return 0;
    }
    return d_rtext_proc (msg, d, c);
}


decompiled_code:
__int64 __fastcall agup_init(__int64 a1)
{
int *v1; // r11
__int64 result; // rax

agup_theme = a1;
if ( a1 )
{
backup_gui_bg_color = gui_bg_color;
backup_gui_mg_color = gui_mg_color;
backup_gui_fg_color = gui_fg_color;
(*(void (**)(void))(a1 + 32))();
agup_fg_color = **(_DWORD **)(agup_theme + 8);
agup_bg_color = **(_DWORD **)(agup_theme + 16);
v1 = *(int **)(agup_theme + 24);
result = (unsigned int)*v1;
agup_mg_color = *v1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
int *v1; // r11
__int64 result; // rax

agup_theme = a1;
if ( a1 )
{
backup_gui_bg_color = gui_bg_color;
backup_gui_mg_color = gui_mg_color;
backup_gui_fg_color = gui_fg_color;
(*(void (**)(void))(a1 + 32))();
agup_fg_color = **(_DWORD **)(agup_theme + 8);
agup_bg_color = **(_DWORD **)(agup_theme + 16);
v1 = *(int **)(agup_theme + 24);
result = (unsigned int)*v1;
agup_mg_color = *v1;
}
return result;
}

original_code:
void agup_init(const AGUP_THEME *thm)
{
    if ((agup_theme = thm)) {
        backup_gui_bg_color = gui_bg_color;
        backup_gui_mg_color = gui_mg_color;
        backup_gui_fg_color = gui_fg_color;
        agup_theme->init();
        agup_fg_color = *(agup_theme->fg_color);
        agup_bg_color = *(agup_theme->bg_color);
        agup_mg_color = *(agup_theme->mg_color);
    }
}

canonical_original_code:
void agup_init(struct AGUP_THEME *thm)
{
    if ((agup_theme = thm)) {
        backup_gui_bg_color = gui_bg_color;
        backup_gui_mg_color = gui_mg_color;
        backup_gui_fg_color = gui_fg_color;
        agup_theme->init();
        agup_fg_color = *(agup_theme->fg_color);
        agup_bg_color = *(agup_theme->bg_color);
        agup_mg_color = *(agup_theme->mg_color);
    }
}

variable_types: struct AGUP_THEME { char *name; int *fg_color; int *bg_color; int *mg_color; void (*init)(); void (*shutdown)(); int (*box_proc)(int, struct DIALOG { int (*proc)(int msg, struct DIALOG *d, int c); int x; int fg; int key; int flags; int d1; void *dp; } *, int); int (*shadow_box_proc)(int, struct DIALOG *, int); int (*button_proc)(int, struct DIALOG *, int); int (*push_proc)(int, struct DIALOG *, int); int (*check_proc)(int, struct DIALOG *, int); int (*radio_proc)(int, struct DIALOG *, int); int (*icon_proc)(int, struct DIALOG *, int); int (*edit_proc)(int, struct DIALOG *, int); int (*list_proc)(int, struct DIALOG *, int); int (*text_list_proc)(int, struct DIALOG *, int); int (*textbox_proc)(int, struct DIALOG *, int); int (*slider_proc)(int, struct DIALOG *, int); int (*menu_proc)(int, struct DIALOG *, int); int (*window_proc)(int, struct DIALOG *, int); int (*clear_proc)(int, struct DIALOG *, int); int (*text_proc)(int, struct DIALOG *, int); int (*ctext_proc)(int, struct DIALOG *, int); int (*rtext_proc)(int, struct DIALOG *, int); } *

user_defined_types: struct AGUP_THEME { char *name; int *fg_color; int *bg_color; int *mg_color; void (*init)(); void (*shutdown)(); int (*box_proc)(int, struct DIALOG *, int); int (*shadow_box_proc)(int, struct DIALOG *, int); int (*button_proc)(int, struct DIALOG *, int); int (*push_proc)(int, struct DIALOG *, int); int (*check_proc)(int, struct DIALOG *, int); int (*radio_proc)(int, struct DIALOG *, int); int (*icon_proc)(int, struct DIALOG *, int); int (*edit_proc)(int, struct DIALOG *, int); int (*list_proc)(int, struct DIALOG *, int); int (*text_list_proc)(int, struct DIALOG *, int); int (*textbox_proc)(int, struct DIALOG *, int); int (*slider_proc)(int, struct DIALOG *, int); int (*menu_proc)(int, struct DIALOG *, int); int (*window_proc)(int, struct DIALOG *, int); int (*clear_proc)(int, struct DIALOG *, int); int (*text_proc)(int, struct DIALOG *, int); int (*ctext_proc)(int, struct DIALOG *, int); int (*rtext_proc)(int, struct DIALOG *, int); }


decompiled_code:
__int64 agup_shutdown()
{
__int64 result; // rax

result = agup_theme;
if ( agup_theme )
{
result = (*(__int64 (**)(void))(agup_theme + 40))();
agup_theme = 0LL;
gui_bg_color = backup_gui_bg_color;
gui_mg_color = backup_gui_mg_color;
gui_fg_color = backup_gui_fg_color;
}
return result;
}

canonical_decompiled_code:
__int64 func8()
{
__int64 result; // rax

result = agup_theme;
if ( agup_theme )
{
result = (*(__int64 (**)(void))(agup_theme + 40))();
agup_theme = 0LL;
gui_bg_color = backup_gui_bg_color;
gui_mg_color = backup_gui_mg_color;
gui_fg_color = backup_gui_fg_color;
}
return result;
}

original_code:
void agup_shutdown(void)
{
    if (agup_theme) {
        agup_theme->shutdown();
        agup_theme = ((void *)0);
        gui_bg_color = backup_gui_bg_color;
        gui_mg_color = backup_gui_mg_color;
        gui_fg_color = backup_gui_fg_color;
    }
}

canonical_original_code:
void agup_shutdown()
{
    if (agup_theme) {
        agup_theme->shutdown();
        agup_theme = ((void *)0);
        gui_bg_color = backup_gui_bg_color;
        gui_mg_color = backup_gui_mg_color;
        gui_fg_color = backup_gui_fg_color;
    }
}


decompiled_code:
__int64 __fastcall agup_theme_by_name(__int64 a1)
{
__int64 v1; // rbx

agup_themes_list_init();
if ( agup_themes_count <= 0 )
return 0LL;
v1 = 0LL;
while ( (unsigned int)ustrcmp(*(_QWORD *)agup_themes_list[v1], a1) )
{
if ( agup_themes_count <= (int)++v1 )
return 0LL;
}
return agup_themes_list[(int)v1];
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
__int64 v1; // rbx

func0();
if ( agup_themes_count <= 0 )
return 0LL;
v1 = 0LL;
while ( (unsigned int)ustrcmp(*(_QWORD *)agup_themes_list[v1], a1) )
{
if ( agup_themes_count <= (int)++v1 )
return 0LL;
}
return agup_themes_list[(int)v1];
}

original_code:
AGUP_THEME const *agup_theme_by_name (char const *name)
{
    int i;
    agup_themes_list_init ();
    for (i = 0; i < agup_themes_count; i++)
    {
        if (!ustrcmp (agup_themes_list[i]->name, name))
        {
            return agup_themes_list[i];
        }
    }
    return ((void *)0);
}

canonical_original_code:
struct AGUP_THEME *agup_theme_by_name(char *name)
{
    int i;
    agup_themes_list_init ();
    for (i = 0; i < agup_themes_count; i++)
    {
        if (!ustrcmp (agup_themes_list[i]->name, name))
        {
            return agup_themes_list[i];
        }
    }
    return ((void *)0);
}

variable_types:
name
char *

variable_types: i int

return_type: struct AGUP_THEME { char *name; int *fg_color; int *bg_color; int *mg_color; void (*init)(); void (*shutdown)(); int (*box_proc)(int, struct DIALOG { int (*proc)(int msg, struct DIALOG *d, int c); int x; int fg; int key; int flags; int d1; void *dp; } *, int); int (*shadow_box_proc)(int, struct DIALOG *, int); int (*button_proc)(int, struct DIALOG *, int); int (*push_proc)(int, struct DIALOG *, int); int (*check_proc)(int, struct DIALOG *, int); int (*radio_proc)(int, struct DIALOG *, int); int (*icon_proc)(int, struct DIALOG *, int); int (*edit_proc)(int, struct DIALOG *, int); int (*list_proc)(int, struct DIALOG *, int); int (*text_list_proc)(int, struct DIALOG *, int); int (*textbox_proc)(int, struct DIALOG *, int); int (*slider_proc)(int, struct DIALOG *, int); int (*menu_proc)(int, struct DIALOG *, int); int (*window_proc)(int, struct DIALOG *, int); int (*clear_proc)(int, struct DIALOG *, int); int (*text_proc)(int, struct DIALOG *, int); int (*ctext_proc)(int, struct DIALOG *, int); int (*rtext_proc)(int, struct DIALOG *, int); } *


decompiled_code:
__int64 d_agup_box_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 48);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func10()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 48);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_box_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->box_proc)) ? agup_theme->box_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_box_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->box_proc)) ? agup_theme->box_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_shadow_box_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 56);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func11()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 56);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_shadow_box_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->shadow_box_proc)) ? agup_theme->shadow_box_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_shadow_box_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->shadow_box_proc)) ? agup_theme->shadow_box_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_button_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 64);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func12()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 64);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_button_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->button_proc)) ? agup_theme->button_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_button_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->button_proc)) ? agup_theme->button_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_push_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 72);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func13()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 72);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_push_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->push_proc)) ? agup_theme->push_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_push_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->push_proc)) ? agup_theme->push_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_check_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 80);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func14()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 80);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_check_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->check_proc)) ? agup_theme->check_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_check_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->check_proc)) ? agup_theme->check_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_radio_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 88);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func15()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 88);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_radio_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->radio_proc)) ? agup_theme->radio_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_radio_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->radio_proc)) ? agup_theme->radio_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_icon_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 96);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func16()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 96);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_icon_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->icon_proc)) ? agup_theme->icon_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_icon_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->icon_proc)) ? agup_theme->icon_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_edit_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 104);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func17()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 104);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_edit_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->edit_proc)) ? agup_theme->edit_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_edit_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->edit_proc)) ? agup_theme->edit_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_list_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 112);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func18()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 112);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_list_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->list_proc)) ? agup_theme->list_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_list_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->list_proc)) ? agup_theme->list_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_text_list_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 120);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func19()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 120);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_text_list_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->text_list_proc)) ? agup_theme->text_list_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_text_list_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->text_list_proc)) ? agup_theme->text_list_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_textbox_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 128);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func20()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 128);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_textbox_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->textbox_proc)) ? agup_theme->textbox_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_textbox_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->textbox_proc)) ? agup_theme->textbox_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_slider_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 136);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func21()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 136);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_slider_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->slider_proc)) ? agup_theme->slider_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_slider_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->slider_proc)) ? agup_theme->slider_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_menu_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 144);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func22()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 144);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_menu_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->menu_proc)) ? agup_theme->menu_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_menu_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->menu_proc)) ? agup_theme->menu_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_window_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 152);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func23()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 152);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_window_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->window_proc)) ? agup_theme->window_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_window_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->window_proc)) ? agup_theme->window_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_clear_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 160);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func24()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 160);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_clear_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->clear_proc)) ? agup_theme->clear_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_clear_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->clear_proc)) ? agup_theme->clear_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_text_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 168);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func25()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 168);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_text_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->text_proc)) ? agup_theme->text_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_text_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->text_proc)) ? agup_theme->text_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_ctext_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 176);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func26()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 176);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_ctext_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->ctext_proc)) ? agup_theme->ctext_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_ctext_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->ctext_proc)) ? agup_theme->ctext_proc(msg, d, c) : 0; }


decompiled_code:
__int64 d_agup_rtext_proc()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 184);
if ( v1 )
result = v1();
}
return result;
}

canonical_decompiled_code:
__int64 func27()
{
__int64 result; // rax
__int64 (*v1)(void); // r8

result = 0LL;
if ( agup_theme )
{
v1 = *(__int64 (**)(void))(agup_theme + 184);
if ( v1 )
result = v1();
}
return result;
}

original_code: int d_agup_rtext_proc(int msg, DIALOG *d, int c) { return ((agup_theme) && (agup_theme->rtext_proc)) ? agup_theme->rtext_proc(msg, d, c) : 0; }

canonical_original_code: int d_agup_rtext_proc(int msg, struct DIALOG *d, int c) { return ((agup_theme) && (agup_theme->rtext_proc)) ? agup_theme->rtext_proc(msg, d, c) : 0; }


decompiled_code:
void gametime_ticker()
{
++tic_counter;
}

canonical_decompiled_code:
void func0()
{
++tic_counter;
}

original_code:
void gametime_ticker(void)
 {
  tic_counter++;
 }

canonical_original_code:
void gametime_ticker()
 {
  tic_counter++;
 }


decompiled_code:
__int64 __fastcall gametime_init(unsigned int a1)
{
install_int_ex(gametime_ticker, 1193181LL / a1, 1193181LL % a1);
gametime_tick = 0;
gametime_installed = 1;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1)
{
install_int_ex(gametime_ticker, 1193181LL / a1, 1193181LL % a1);
gametime_tick = 0;
gametime_installed = 1;
return 1LL;
}

original_code:
int gametime_init(unsigned int freq)
 {
  install_int_ex(gametime_ticker, (1193181L / (long)(freq)));
  gametime_tick = 0;
  gametime_installed = 1;
  return 1;
 }

variable_types:
freq
unsigned int


decompiled_code:
__int64 gametime_get_frames()
{
__int64 result; // rax

result = (unsigned int)gametime_installed;
if ( gametime_installed )
result = (unsigned int)tic_counter;
return result;
}

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

result = (unsigned int)gametime_installed;
if ( gametime_installed )
result = (unsigned int)tic_counter;
return result;
}

original_code:
volatile int gametime_get_frames(void)
 {
  if(gametime_installed)
  {
   return tic_counter;
  }
  return 0;
 }

canonical_original_code:
int gametime_get_frames()
 {
  if(gametime_installed)
  {
   return tic_counter;
  }
  return 0;
 }


decompiled_code:
__int64 gametime_reset()
{
__int64 result; // rax

result = gametime_get_frames();
gametime_tick = result;
return result;
}

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

result = func2();
gametime_tick = result;
return result;
}

original_code:
void gametime_reset(void)
 {
  gametime_tick = gametime_get_frames();
 }

canonical_original_code:
void gametime_reset()
 {
  gametime_tick = gametime_get_frames();
 }


decompiled_code:
__int64 eof_disable_full_screen_3d()
{
eof_full_screen_3d = 0;
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
eof_full_screen_3d = 0;
return 0LL;
}

original_code:
int eof_disable_full_screen_3d(void)
{
 eof_full_screen_3d = 0;
 return 0;
}

canonical_original_code:
int eof_disable_full_screen_3d()
{
 eof_full_screen_3d = 0;
 return 0;
}


decompiled_code:
__int64 eof_enable_full_screen_3d()
{
eof_full_screen_3d = 1;
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
eof_full_screen_3d = 1;
return 0LL;
}

original_code:
int eof_enable_full_screen_3d(void)
{
 eof_full_screen_3d = 1;
 return 0;
}

canonical_original_code:
int eof_enable_full_screen_3d()
{
 eof_full_screen_3d = 1;
 return 0;
}


decompiled_code:
void eof_prepare_context_menu()
{
if ( eof_song && eof_song_loaded )
{
if ( (unsigned int)eof_count_selected_notes(0LL, 1LL) )
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 0;
*((_DWORD *)&eof_right_click_menu_note + 26) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 32;
*((_DWORD *)&eof_right_click_menu_note + 26) = 32;
}
if ( eof_vocals_selected )
{
if ( (unsigned int)exists("eof.vocals.clipboard") )
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 0;
*((_DWORD *)&eof_right_click_menu_note + 36) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 32;
*((_DWORD *)&eof_right_click_menu_note + 36) = 32;
}
}
else if ( (unsigned int)exists("eof.clipboard") )
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 0;
*((_DWORD *)&eof_right_click_menu_note + 36) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 32;
*((_DWORD *)&eof_right_click_menu_note + 36) = 32;
}
if ( *((_BYTE *)&eof_track_diff_populated_status + eof_note_type) )
{
*((_DWORD *)&eof_right_click_menu_normal + 66) = 0;
*((_DWORD *)&eof_right_click_menu_note + 86) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 66) = 32;
*((_DWORD *)&eof_right_click_menu_note + 76) = 32;
}
}
}

canonical_decompiled_code:
void func2()
{
if ( eof_song && eof_song_loaded )
{
if ( (unsigned int)eof_count_selected_notes(0LL, 1LL) )
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 0;
*((_DWORD *)&eof_right_click_menu_note + 26) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 32;
*((_DWORD *)&eof_right_click_menu_note + 26) = 32;
}
if ( eof_vocals_selected )
{
if ( (unsigned int)exists("eof.vocals.clipboard") )
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 0;
*((_DWORD *)&eof_right_click_menu_note + 36) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 32;
*((_DWORD *)&eof_right_click_menu_note + 36) = 32;
}
}
else if ( (unsigned int)exists("eof.clipboard") )
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 0;
*((_DWORD *)&eof_right_click_menu_note + 36) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 16) = 32;
*((_DWORD *)&eof_right_click_menu_note + 36) = 32;
}
if ( *((_BYTE *)&eof_track_diff_populated_status + eof_note_type) )
{
*((_DWORD *)&eof_right_click_menu_normal + 66) = 0;
*((_DWORD *)&eof_right_click_menu_note + 86) = 0;
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 66) = 32;
*((_DWORD *)&eof_right_click_menu_note + 76) = 32;
}
}
}

original_code:
void eof_prepare_context_menu(void)
{
 int vselected = 0;
 if(eof_song && eof_song_loaded)
 {
  vselected = eof_count_selected_notes(((void *)0), 1);
  if(vselected)
  {
   eof_right_click_menu_normal[0].flags = 0;
   eof_right_click_menu_note[2].flags = 0;
  }
  else
  {
   eof_right_click_menu_normal[0].flags = 32;
   eof_right_click_menu_note[2].flags = 32;
  }
  if(eof_vocals_selected)
  {
   if(exists("eof.vocals.clipboard"))
   {
    eof_right_click_menu_normal[1].flags = 0;
    eof_right_click_menu_note[3].flags = 0;
   }
   else
   {
    eof_right_click_menu_normal[1].flags = 32;
    eof_right_click_menu_note[3].flags = 32;
   }
  }
  else
  {
   if(exists("eof.clipboard"))
   {
    eof_right_click_menu_normal[1].flags = 0;
    eof_right_click_menu_note[3].flags = 0;
   }
   else
   {
    eof_right_click_menu_normal[1].flags = 32;
    eof_right_click_menu_note[3].flags = 32;
   }
  }
  if(eof_track_diff_populated_status[eof_note_type])
  {
   eof_right_click_menu_normal[6].flags = 0;
   eof_right_click_menu_note[8].flags = 0;
  }
  else
  {
   eof_right_click_menu_normal[6].flags = 32;
   eof_right_click_menu_note[7].flags = 32;
  }
 }
}

canonical_original_code:
void eof_prepare_context_menu()
{
 int vselected = 0;
 if(eof_song && eof_song_loaded)
 {
  vselected = eof_count_selected_notes(((void *)0), 1);
  if(vselected)
  {
   eof_right_click_menu_normal[0].flags = 0;
   eof_right_click_menu_note[2].flags = 0;
  }
  else
  {
   eof_right_click_menu_normal[0].flags = 32;
   eof_right_click_menu_note[2].flags = 32;
  }
  if(eof_vocals_selected)
  {
   if(exists("eof.vocals.clipboard"))
   {
    eof_right_click_menu_normal[1].flags = 0;
    eof_right_click_menu_note[3].flags = 0;
   }
   else
   {
    eof_right_click_menu_normal[1].flags = 32;
    eof_right_click_menu_note[3].flags = 32;
   }
  }
  else
  {
   if(exists("eof.clipboard"))
   {
    eof_right_click_menu_normal[1].flags = 0;
    eof_right_click_menu_note[3].flags = 0;
   }
   else
   {
    eof_right_click_menu_normal[1].flags = 32;
    eof_right_click_menu_note[3].flags = 32;
   }
  }
  if(eof_track_diff_populated_status[eof_note_type])
  {
   eof_right_click_menu_normal[6].flags = 0;
   eof_right_click_menu_note[8].flags = 0;
  }
  else
  {
   eof_right_click_menu_normal[6].flags = 32;
   eof_right_click_menu_note[7].flags = 32;
  }
 }
}

variable_types: vselected int


original_code:
double eof_MIDI_delta_to_realtime(struct eof_MIDI_tempo_change *tempolist, unsigned long absdelta, unsigned timedivision)
{
 struct eof_MIDI_tempo_change *ptr = tempolist;
 double BPM = 120.0;
 unsigned long reldelta = absdelta;
 double time = 0.0;
 if(tempolist)
 {
  while(ptr->next != ((void *)0))
  {
   if(absdelta >= (ptr->next)->absdelta)
   {
    ptr = ptr->next;
   }
   else
   {
    break;
   }
  }
  BPM = ptr->BPM;
  time = ptr->realtime;
  reldelta = absdelta - ptr->absdelta;
 }
 return time + (double)reldelta / timedivision * ((double)60000.0 / BPM);
}

canonical_original_code:
double eof_MIDI_delta_to_realtime(struct eof_MIDI_tempo_change *tempolist, unsigned long absdelta, unsigned int timedivision)
{
 struct eof_MIDI_tempo_change *ptr = tempolist;
 double BPM = 120.0;
 unsigned long reldelta = absdelta;
 double time = 0.0;
 if(tempolist)
 {
  while(ptr->next != ((void *)0))
  {
   if(absdelta >= (ptr->next)->absdelta)
   {
    ptr = ptr->next;
   }
   else
   {
    break;
   }
  }
  BPM = ptr->BPM;
  time = ptr->realtime;
  reldelta = absdelta - ptr->absdelta;
 }
 return time + (double)reldelta / timedivision * ((double)60000.0 / BPM);
}

variable_types: struct eof_MIDI_tempo_change { unsigned long absdelta; double realtime; double BPM; struct eof_MIDI_tempo_change *next; } *

variable_types:
absdelta
unsigned long

variable_types:
timedivision
unsigned int

variable_types: BPM double

variable_types:
reldelta
unsigned long

variable_types: time double

return_type: double


decompiled_code:
void __fastcall eof_MIDI_empty_event_list(void *ptr)
{
_QWORD *v1; // rbx
_QWORD *v2; // rbp
void *v3; // rdi
void *v4; // rdi

v1 = ptr;
if ( ptr )
{
do
{
v2 = v1;
v1 = (_QWORD *)v1[5];
v3 = (void *)v2[1];
if ( v3 )
free(v3);
v4 = (void *)v2[4];
if ( v4 )
free(v4);
free(v2);
}
while ( v1 );
}
}

canonical_decompiled_code:
void __fastcall func1(void *ptr)
{
_QWORD *v1; // rbx
_QWORD *v2; // rbp
void *v3; // rdi
void *v4; // rdi

v1 = ptr;
if ( ptr )
{
do
{
v2 = v1;
v1 = (_QWORD *)v1[5];
v3 = (void *)v2[1];
if ( v3 )
free(v3);
v4 = (void *)v2[4];
if ( v4 )
free(v4);
free(v2);
}
while ( v1 );
}
}

original_code:
void eof_MIDI_empty_event_list(struct eof_MIDI_data_event *ptr)
{
 struct eof_MIDI_data_event *temp;
 while(ptr != ((void *)0))
 {
  temp = ptr->next;
  if(ptr->stringtime)
   free(ptr->stringtime);
  if(ptr->data)
   free(ptr->data);
  free(ptr);
  ptr = temp;
 }
}

variable_types: struct eof_MIDI_data_event { double realtime; char *stringtime; unsigned long deltatime; unsigned int size; void *data; struct eof_MIDI_data_event *next; } *


decompiled_code:
void __fastcall eof_MIDI_empty_track_list(void *ptr)
{
void **v1; // rbp
void **v2; // rbx
void *v3; // rdi

v1 = (void **)ptr;
eof_log("eof_MIDI_empty_track_list() entered", 1LL);
if ( ptr )
{
do
{
v2 = v1;
v1 = (void **)v1[3];
if ( *v2 )
free(*v2);
v3 = v2[1];
if ( v3 )
free(v3);
eof_MIDI_empty_event_list(v2[2]);
free(v2);
}
while ( v1 );
}
}

canonical_decompiled_code:
void __fastcall func2(void *ptr)
{
void **v1; // rbp
void **v2; // rbx
void *v3; // rdi

v1 = (void **)ptr;
eof_log("eof_MIDI_empty_track_list() entered", 1LL);
if ( ptr )
{
do
{
v2 = v1;
v1 = (void **)v1[3];
if ( *v2 )
free(*v2);
v3 = v2[1];
if ( v3 )
free(v3);
func1(v2[2]);
free(v2);
}
while ( v1 );
}
}

original_code:
void eof_MIDI_empty_track_list(struct eof_MIDI_data_track *ptr)
{
 struct eof_MIDI_data_track *temp;
 eof_log("eof_MIDI_empty_track_list() entered", 1);
 while(ptr != ((void *)0))
 {
  temp = ptr->next;
  if(ptr->trackname)
   free(ptr->trackname);
  if(ptr->description)
   free(ptr->description);
  eof_MIDI_empty_event_list(ptr->events);
  free(ptr);
  ptr = temp;
 }
}

variable_types: struct eof_MIDI_data_track { char *trackname; char *description; struct eof_MIDI_data_event { double realtime; char *stringtime; unsigned long deltatime; unsigned int size; void *data; struct eof_MIDI_data_event *next; } *events; struct eof_MIDI_data_track *next; unsigned long timedivision; } *

user_defined_types: struct eof_MIDI_data_track { char *trackname; char *description; struct eof_MIDI_data_event *events; struct eof_MIDI_data_track *next; unsigned long timedivision; }