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


repo: cincodenada/editor-on-fire

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

return_type: void

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
void *v1; // rdi
__int64 v2; // rbx
void *v3; // rdi
__int64 v4; // rbp
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
{
v1 = (void *)eof_undo_filename[v0];
if ( v1 )
{
free(v1);
eof_undo_filename[v0] = 0LL;
}
v2 = v0 + 1;
v3 = (void *)eof_undo_filename[v0 + 1];
if ( v3 )
{
free(v3);
eof_undo_filename[v2] = 0LL;
}
v4 = v0 + 2;
v5 = (void *)eof_undo_filename[v2 + 1];
if ( v5 )
{
free(v5);
eof_undo_filename[v4] = 0LL;
}
v6 = (void *)eof_undo_filename[v2 + 2];
if ( v6 )
{
free(v6);
eof_undo_filename[v2 + 2] = 0LL;
}
v7 = (void *)eof_undo_filename[v2 + 3];
if ( v7 )
{
free(v7);
eof_undo_filename[v2 + 3] = 0LL;
}
v8 = (void *)eof_undo_filename[v2 + 4];
if ( v8 )
{
free(v8);
eof_undo_filename[v2 + 4] = 0LL;
}
v9 = (void *)eof_undo_filename[v2 + 5];
if ( v9 )
{
free(v9);
eof_undo_filename[v2 + 5] = 0LL;
}
v10 = (void *)eof_undo_filename[v2 + 6];
if ( v10 )
{
free(v10);
eof_undo_filename[v2 + 6] = 0LL;
}
v11 = (void *)eof_undo_filename[v2 + 7];
if ( v11 )
{
free(v11);
eof_undo_filename[v2 + 7] = 0LL;
}
v12 = (void *)eof_undo_filename[v2 + 8];
if ( v12 )
{
free(v12);
eof_undo_filename[v2 + 8] = 0LL;
}
v0 = v2 + 9;
}
while ( v2 != 91 );
}
}

canonical_decompiled_code:
void func5()
{
__int64 v0; // rbp
void *v1; // rdi
__int64 v2; // rbx
void *v3; // rdi
__int64 v4; // rbp
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
{
v1 = (void *)eof_undo_filename[v0];
if ( v1 )
{
free(v1);
eof_undo_filename[v0] = 0LL;
}
v2 = v0 + 1;
v3 = (void *)eof_undo_filename[v0 + 1];
if ( v3 )
{
free(v3);
eof_undo_filename[v2] = 0LL;
}
v4 = v0 + 2;
v5 = (void *)eof_undo_filename[v2 + 1];
if ( v5 )
{
free(v5);
eof_undo_filename[v4] = 0LL;
}
v6 = (void *)eof_undo_filename[v2 + 2];
if ( v6 )
{
free(v6);
eof_undo_filename[v2 + 2] = 0LL;
}
v7 = (void *)eof_undo_filename[v2 + 3];
if ( v7 )
{
free(v7);
eof_undo_filename[v2 + 3] = 0LL;
}
v8 = (void *)eof_undo_filename[v2 + 4];
if ( v8 )
{
free(v8);
eof_undo_filename[v2 + 4] = 0LL;
}
v9 = (void *)eof_undo_filename[v2 + 5];
if ( v9 )
{
free(v9);
eof_undo_filename[v2 + 5] = 0LL;
}
v10 = (void *)eof_undo_filename[v2 + 6];
if ( v10 )
{
free(v10);
eof_undo_filename[v2 + 6] = 0LL;
}
v11 = (void *)eof_undo_filename[v2 + 7];
if ( v11 )
{
free(v11);
eof_undo_filename[v2 + 7] = 0LL;
}
v12 = (void *)eof_undo_filename[v2 + 8];
if ( v12 )
{
free(v12);
eof_undo_filename[v2 + 8] = 0LL;
}
v0 = v2 + 9;
}
while ( v2 != 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 func0()
{
return 0LL;
}

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

canonical_original_code:
int allegro_InitIdleSystem()
{
 return 0;
}

return_type: int


decompiled_code:
// attributes: thunk
__int64 allegro_Idle()
{
return rest();
}

canonical_decompiled_code:
__int64 func1()
{
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


InitIdleSystem

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

canonical_decompiled_code:
__int64 func2()
{
return func0();
}

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 func3()
{
;
}

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

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


decompiled_code:
void allegro_PrepVSyncIdle()
{
;
}

canonical_decompiled_code:
void func5()
{
;
}

original_code:
void allegro_PrepVSyncIdle (void)
{
}

canonical_original_code:
void allegro_PrepVSyncIdle()
{
}


decompiled_code:
void allegro_IdleUntilVSync()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code:
void allegro_IdleUntilVSync (void)
{
}

canonical_original_code:
void allegro_IdleUntilVSync()
{
}


decompiled_code:
void allegro_IdleUntilPollScroll()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code:
void allegro_IdleUntilPollScroll (void)
{
}

canonical_original_code:
void allegro_IdleUntilPollScroll()
{
}


decompiled_code:
void allegro_DoneVSync()
{
;
}

canonical_decompiled_code:
void func8()
{
;
}

original_code:
void allegro_DoneVSync (void)
{
}

canonical_original_code:
void allegro_DoneVSync()
{
}


decompiled_code:
void allegro_StopIdleSystem()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

original_code:
void allegro_StopIdleSystem (void)
{
}

canonical_original_code:
void allegro_StopIdleSystem()
{
}


Idle

decompiled_code:
// attributes: thunk
__int64 Idle()
{
return allegro_Idle();
}

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

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()
{
__int64 result; // rax
int v1; // edx
__int64 v2; // r8
__int64 v3; // r11
int v4; // eax
__int64 v5; // rcx
__int64 v6; // rsi
__int64 v7; // r9
int v8; // edi
__int64 v9; // rdx
__int64 v10; // rcx
__int64 v11; // r11

result = (unsigned int)once_0;
if ( !once_0 )
{
v1 = agup_themes_count;
once_0 = 1;
v2 = aphoton_theme;
v3 = awin95_theme;
agup_themes_list[agup_themes_count] = agtk_theme;
v4 = v1;
v5 = aase_theme;
v6 = v1 + 3;
agup_themes_list[v1 + 1] = v2;
v7 = abeos_theme;
v8 = v1 + 4;
agup_themes_list[v1 + 2] = v3;
v9 = ans_theme;
agup_themes_list[v6] = v5;
LODWORD(v6) = v4 + 7;
v10 = aalg_theme;
v11 = v4 + 5;
result = v4 + 6;
agup_themes_list[v8] = v7;
agup_themes_count = v6;
agup_themes_list[v11] = v9;
agup_themes_list[result] = v10;
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax
int v1; // edx
__int64 v2; // r8
__int64 v3; // r11
int v4; // eax
__int64 v5; // rcx
__int64 v6; // rsi
__int64 v7; // r9
int v8; // edi
__int64 v9; // rdx
__int64 v10; // rcx
__int64 v11; // r11

result = (unsigned int)once_0;
if ( !once_0 )
{
v1 = agup_themes_count;
once_0 = 1;
v2 = aphoton_theme;
v3 = awin95_theme;
agup_themes_list[agup_themes_count] = agtk_theme;
v4 = v1;
v5 = aase_theme;
v6 = v1 + 3;
agup_themes_list[v1 + 1] = v2;
v7 = abeos_theme;
v8 = v1 + 4;
agup_themes_list[v1 + 2] = v3;
v9 = ans_theme;
agup_themes_list[v6] = v5;
LODWORD(v6) = v4 + 7;
v10 = aalg_theme;
v11 = v4 + 5;
result = v4 + 6;
agup_themes_list[v8] = v7;
agup_themes_count = v6;
agup_themes_list[v11] = v9;
agup_themes_list[result] = v10;
}
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();
*(_DWORD *)(a2 + 8) -= 3;
*(_DWORD *)(a2 + 12) -= 3;
--agup_edit_recursive;
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();
*(_DWORD *)(a2 + 8) -= 3;
*(_DWORD *)(a2 + 12) -= 3;
--agup_edit_recursive;
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:
__int64 __fastcall agup_edit_adjust_position(__int64 a1)
{
__int64 result; // rax

result = (unsigned int)agup_edit_recursive;
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) -= 3;
*(_DWORD *)(a1 + 12) -= 3;
}
return result;
}

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

result = (unsigned int)agup_edit_recursive;
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) -= 3;
*(_DWORD *)(a1 + 12) -= 3;
}
return result;
}

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:
__int64 __fastcall agup_edit_restore_position(__int64 a1)
{
__int64 result; // rax

result = (unsigned int)agup_edit_recursive;
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) += 3;
*(_DWORD *)(a1 + 12) += 3;
}
return result;
}

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

result = (unsigned int)agup_edit_recursive;
if ( agup_edit_recursive )
{
*(_DWORD *)(a1 + 8) += 3;
*(_DWORD *)(a1 + 12) += 3;
}
return result;
}

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; // er14
unsigned int v5; // er12
unsigned int v6; // ebx
__int64 v7; // rbp
__int64 v8; // rax

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

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

if ( a1 != 3 )
return d_text_proc();
v3 = *(_DWORD *)(a2 + 12);
v4 = **(_DWORD **)(agup_theme + 16);
v5 = *(_DWORD *)(a2 + 8);
v6 = **(_DWORD **)(agup_theme + 8);
v7 = *(_QWORD *)(a2 + 48);
v8 = gui_get_screen();
gui_textout_ex(v8, v7, v5, v3, v6, v4, 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
__int64 v4; // rbp
unsigned int v5; // er14
unsigned int v6; // ebx
unsigned int v7; // er12
__int64 v8; // rax

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

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

if ( a1 != 3 )
return d_ctext_proc();
v3 = *(_DWORD *)(a2 + 12);
v4 = *(_QWORD *)(a2 + 48);
v5 = **(_DWORD **)(agup_theme + 16);
v6 = **(_DWORD **)(agup_theme + 8);
v7 = *(_DWORD *)(a2 + 8) + *(_DWORD *)(a2 + 16) / 2;
v8 = gui_get_screen();
gui_textout_ex(v8, v4, v7, v3, v6, v5, -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; // er12
int v4; // ebx
unsigned int v5; // er14
unsigned int v6; // er13
unsigned int v7; // ebx
__int64 v8; // rbp
__int64 v9; // rax

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

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

if ( a1 != 3 )
return d_rtext_proc();
v3 = *(_DWORD *)(a2 + 12);
v4 = *(_DWORD *)(a2 + 8) + *(_DWORD *)(a2 + 16);
v5 = **(_DWORD **)(agup_theme + 16);
v6 = **(_DWORD **)(agup_theme + 8);
v7 = v4 - gui_strlen(*(_QWORD *)(a2 + 48));
v8 = *(_QWORD *)(a2 + 48);
v9 = gui_get_screen();
gui_textout_ex(v9, v8, v7, v3, v6, v5, 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; // r9
int *v2; // 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))();
v1 = *(int **)(agup_theme + 16);
v2 = *(int **)(agup_theme + 24);
agup_fg_color = **(_DWORD **)(agup_theme + 8);
agup_bg_color = *v1;
result = (unsigned int)*v2;
agup_mg_color = *v2;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
int *v1; // r9
int *v2; // 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))();
v1 = *(int **)(agup_theme + 16);
v2 = *(int **)(agup_theme + 24);
agup_fg_color = **(_DWORD **)(agup_theme + 8);
agup_bg_color = *v1;
result = (unsigned int)*v2;
agup_mg_color = *v2;
}
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 48)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 48)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 56)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 56)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 64)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 64)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 72)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 72)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 80)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 80)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 88)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 88)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 96)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 96)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 104)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 104)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 112)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 112)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 120)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 120)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 128)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 128)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 136)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 136)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 144)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 144)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 152)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 152)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 160)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 160)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 168)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 168)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 176)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 176)) != 0LL )
result = v0();
else
result = 0LL;
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 (*v0)(void); // rax
__int64 result; // rax

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 184)) != 0LL )
result = v0();
else
result = 0LL;
return result;
}

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

if ( agup_theme && (v0 = *(__int64 (**)(void))(agup_theme + 184)) != 0LL )
result = v0();
else
result = 0LL;
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)
{
__int64 result; // rax

install_int_ex(gametime_ticker, 1193181LL / a1, 1193181LL % a1);
result = 1LL;
gametime_tick = 0;
gametime_installed = 1;
return result;
}

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

install_int_ex(gametime_ticker, 1193181LL / a1, 1193181LL % a1);
result = 1LL;
gametime_tick = 0;
gametime_installed = 1;
return result;
}

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()
{
int v0; // eax
__int64 v1; // rcx
int v2; // eax
__int64 v3; // rcx

if ( eof_song && eof_song_loaded )
{
if ( (unsigned int)eof_count_selected_notes(0LL, 1LL) )
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 0;
v2 = eof_vocals_selected;
*((_DWORD *)&eof_right_click_menu_note + 26) = 0;
if ( v2 )
{
LABEL_6:
if ( (unsigned int)exists("eof.vocals.clipboard") )
goto LABEL_7;
goto LABEL_11;
}
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 32;
v0 = eof_vocals_selected;
*((_DWORD *)&eof_right_click_menu_note + 26) = 32;
if ( v0 )
goto LABEL_6;
}
if ( (unsigned int)exists("eof.clipboard") )
{
LABEL_7:
v1 = eof_note_type;
*((_DWORD *)&eof_right_click_menu_normal + 16) = 0;
*((_DWORD *)&eof_right_click_menu_note + 36) = 0;
if ( *((_BYTE *)&eof_track_diff_populated_status + v1) )
{
LABEL_8:
*((_DWORD *)&eof_right_click_menu_normal + 66) = 0;
*((_DWORD *)&eof_right_click_menu_note + 86) = 0;
return;
}
LABEL_12:
*((_DWORD *)&eof_right_click_menu_normal + 66) = 32;
*((_DWORD *)&eof_right_click_menu_note + 76) = 32;
return;
}
LABEL_11:
v3 = eof_note_type;
*((_DWORD *)&eof_right_click_menu_normal + 16) = 32;
*((_DWORD *)&eof_right_click_menu_note + 36) = 32;
if ( *((_BYTE *)&eof_track_diff_populated_status + v3) )
goto LABEL_8;
goto LABEL_12;
}
}

canonical_decompiled_code:
void func2()
{
int v0; // eax
__int64 v1; // rcx
int v2; // eax
__int64 v3; // rcx

if ( eof_song && eof_song_loaded )
{
if ( (unsigned int)eof_count_selected_notes(0LL, 1LL) )
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 0;
v2 = eof_vocals_selected;
*((_DWORD *)&eof_right_click_menu_note + 26) = 0;
if ( v2 )
{
LABEL_6:
if ( (unsigned int)exists("eof.vocals.clipboard") )
goto LABEL_7;
goto LABEL_11;
}
}
else
{
*((_DWORD *)&eof_right_click_menu_normal + 6) = 32;
v0 = eof_vocals_selected;
*((_DWORD *)&eof_right_click_menu_note + 26) = 32;
if ( v0 )
goto LABEL_6;
}
if ( (unsigned int)exists("eof.clipboard") )
{
LABEL_7:
v1 = eof_note_type;
*((_DWORD *)&eof_right_click_menu_normal + 16) = 0;
*((_DWORD *)&eof_right_click_menu_note + 36) = 0;
if ( *((_BYTE *)&eof_track_diff_populated_status + v1) )
{
LABEL_8:
*((_DWORD *)&eof_right_click_menu_normal + 66) = 0;
*((_DWORD *)&eof_right_click_menu_note + 86) = 0;
return;
}
LABEL_12:
*((_DWORD *)&eof_right_click_menu_normal + 66) = 32;
*((_DWORD *)&eof_right_click_menu_note + 76) = 32;
return;
}
LABEL_11:
v3 = eof_note_type;
*((_DWORD *)&eof_right_click_menu_normal + 16) = 32;
*((_DWORD *)&eof_right_click_menu_note + 36) = 32;
if ( *((_BYTE *)&eof_track_diff_populated_status + v3) )
goto LABEL_8;
goto LABEL_12;
}
}

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


decompiled_code:
double __fastcall eof_MIDI_delta_to_realtime(unsigned __int64 *a1, unsigned __int64 a2, int a3)
{
double v3; // xmm1_8
double v4; // xmm2_8
unsigned __int64 *v5; // rax
double v6; // xmm0_8

v3 = *(double *)&LC0;
v4 = 0.0;
if ( a1 )
{
do
{
v5 = a1;
a1 = (unsigned __int64 *)a1[3];
}
while ( a1 && *a1 <= a2 );
v4 = *((double *)v5 + 1);
a2 -= *v5;
v3 = 60000.0 / *((double *)v5 + 2);
}
v6 = (double)(int)a2;
if ( (a2 & 0x8000000000000000LL) != 0LL )
v6 = (double)(int)((a2 >> 1) | a2 & 1) + (double)(int)((a2 >> 1) | a2 & 1);
return v6 / (double)a3 * v3 + v4;
}

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

if ( ptr )
{
v1 = 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

if ( ptr )
{
v1 = 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; // rbx
void **v2; // rbp
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; // rbx
void **v2; // rbp
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; }


original_code:
void eof_MIDI_add_track(EOF_SONG *sp, struct eof_MIDI_data_track *ptr)
{
 if(!sp || !ptr)
  return;
 if(sp->midi_data_head == ((void *)0))
 {
  sp->midi_data_head = ptr;
 }
 else if(sp->midi_data_tail != ((void *)0))
 {
  sp->midi_data_tail->next = ptr;
 }
 sp->midi_data_tail = ptr;
}

canonical_original_code:
void eof_MIDI_add_track(struct EOF_SONG *sp, struct eof_MIDI_data_track *ptr)
{
 if(!sp || !ptr)
  return;
 if(sp->midi_data_head == ((void *)0))
 {
  sp->midi_data_head = ptr;
 }
 else if(sp->midi_data_tail != ((void *)0))
 {
  sp->midi_data_tail->next = ptr;
 }
 sp->midi_data_tail = ptr;
}

variable_types: struct EOF_SONG { struct EOF_SONG_TAGS { char artist[256]; char title[256]; char frettist[256]; char album[256]; char year[32]; char loading_text[512]; char lyrics; char eighth_note_hopo; char eof_fret_hand_pos_1_pg; char eof_fret_hand_pos_1_pb; char tempo_map_locked; char double_bass_drum_disabled; char click_drag_disabled; char rs_chord_technique_export; char unshare_drum_phrasing; char highlight_unsnapped_notes; struct EOF_OGG_INFO { char filename[256]; long midi_offset; char modified; char description[-1]; } ogg[8]; short oggs; char ini_setting[64][512]; short ini_settings; unsigned long revision; unsigned long difficulty; } *tags; int resolution; 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; } *track[-1]; unsigned long tracks; struct EOF_LEGACY_TRACK { unsigned char numlanes; struct EOF_TRACK_ENTRY *parent; struct EOF_NOTE { char name[-1]; unsigned char type; unsigned char note; unsigned long midi_pos; unsigned long midi_length; unsigned long pos; long length; unsigned long flags; unsigned char tflags; } *note[32768]; unsigned long notes; 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 trill[1000]; unsigned long trills; struct EOF_PHRASE_SECTION tremolo[1000]; unsigned long tremolos; struct EOF_PHRASE_SECTION slider[1000]; unsigned long sliders; } *legacy_track[8]; unsigned long legacy_tracks; struct EOF_VOCAL_TRACK { unsigned char toneset; struct EOF_TRACK_ENTRY *parent; struct EOF_LYRIC { unsigned char type; unsigned char note; char text[-1]; unsigned long midi_pos; long midi_length; unsigned long pos; long length; unsigned long flags; unsigned char tflags; } *lyric[32768]; unsigned long lyrics; struct EOF_PHRASE_SECTION line[4096]; unsigned long lines; } *vocal_track[1]; unsigned long vocal_tracks; 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 { 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 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]; } *pro_guitar_track[4]; unsigned long pro_guitar_tracks; struct EOF_BEAT_MARKER { unsigned long ppqn; unsigned long midi_pos; unsigned long pos; unsigned long flags; char key; double fpos; unsigned long measurenum; int beat_within_measure; char contains_tempo_change; } *beat[32768]; unsigned long beats; struct EOF_TEXT_EVENT { char text[256]; unsigned long beat; unsigned long track; char is_temporary; unsigned char flags; unsigned long index; } *text_event[4096]; unsigned long text_events; 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; } *midi_data_head; unsigned long bookmark_pos[10]; struct EOF_CATALOG { struct EOF_CATALOG_ENTRY { unsigned long track; unsigned char type; unsigned long start_pos; unsigned long end_pos; char name[-1]; } entry[256]; unsigned long entries; } *catalog; char fpbeattimes; } *

variable_types:
ptr
struct eof_MIDI_data_track *

user_defined_types: struct EOF_SONG { struct EOF_SONG_TAGS *tags; int resolution; struct EOF_TRACK_ENTRY *track[-1]; unsigned long tracks; struct EOF_LEGACY_TRACK *legacy_track[8]; unsigned long legacy_tracks; struct EOF_VOCAL_TRACK *vocal_track[1]; unsigned long vocal_tracks; struct EOF_PRO_GUITAR_TRACK *pro_guitar_track[4]; unsigned long pro_guitar_tracks; struct EOF_BEAT_MARKER *beat[32768]; unsigned long beats; struct EOF_TEXT_EVENT *text_event[4096]; unsigned long text_events; struct eof_MIDI_data_track *midi_data_head; unsigned long bookmark_pos[10]; struct EOF_CATALOG *catalog; char fpbeattimes; }

user_defined_types: struct EOF_SONG_TAGS { char artist[256]; char title[256]; char frettist[256]; char album[256]; char year[32]; char loading_text[512]; char lyrics; char eighth_note_hopo; char eof_fret_hand_pos_1_pg; char eof_fret_hand_pos_1_pb; char tempo_map_locked; char double_bass_drum_disabled; char click_drag_disabled; char rs_chord_technique_export; char unshare_drum_phrasing; char highlight_unsnapped_notes; struct EOF_OGG_INFO ogg[8]; short oggs; char ini_setting[64][512]; short ini_settings; unsigned long revision; unsigned long difficulty; }

user_defined_types: struct EOF_CATALOG { struct EOF_CATALOG_ENTRY entry[256]; unsigned long entries; }

user_defined_types: struct EOF_LEGACY_TRACK { unsigned char numlanes; struct EOF_TRACK_ENTRY *parent; struct EOF_NOTE *note[32768]; unsigned long notes; 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 trill[1000]; unsigned long trills; struct EOF_PHRASE_SECTION tremolo[1000]; unsigned long tremolos; struct EOF_PHRASE_SECTION slider[1000]; unsigned long sliders; }

user_defined_types: struct EOF_VOCAL_TRACK { unsigned char toneset; struct EOF_TRACK_ENTRY *parent; struct EOF_LYRIC *lyric[32768]; unsigned long lyrics; struct EOF_PHRASE_SECTION line[4096]; unsigned long lines; }


decompiled_code:
__int64 __fastcall eof_track_overridden_by_stored_MIDI_track(__int64 a1, unsigned __int64 a2)
{
_QWORD *v2; // rbx

if ( !a1 )
return 0LL;
if ( *(_QWORD *)(a1 + 128) <= a2 )
return 0LL;
v2 = *(_QWORD **)(a1 + 295192);
if ( !v2 )
return 0LL;
while ( !*v2 || (unsigned int)ustricmp(*v2, *(_QWORD *)(a1 + 8 * (a2 + 2)) + 16LL) )
{
v2 = (_QWORD *)v2[3];
if ( !v2 )
return 0LL;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, unsigned __int64 a2)
{
_QWORD *v2; // rbx

if ( !a1 )
return 0LL;
if ( *(_QWORD *)(a1 + 128) <= a2 )
return 0LL;
v2 = *(_QWORD **)(a1 + 295192);
if ( !v2 )
return 0LL;
while ( !*v2 || (unsigned int)ustricmp(*v2, *(_QWORD *)(a1 + 8 * (a2 + 2)) + 16LL) )
{
v2 = (_QWORD *)v2[3];
if ( !v2 )
return 0LL;
}
return 1LL;
}

original_code:
int eof_track_overridden_by_stored_MIDI_track(EOF_SONG *sp, unsigned long tracknum)
{
 struct eof_MIDI_data_track *trackptr;
 if(!sp || (tracknum >= sp->tracks))
  return 0;
 for(trackptr = sp->midi_data_head; trackptr != ((void *)0); trackptr = trackptr->next)
 {
  if(trackptr->trackname && !ustricmp(trackptr->trackname, sp->track[tracknum]->name))
  {
   return 1;
  }
 }
 return 0;
}

canonical_original_code:
int eof_track_overridden_by_stored_MIDI_track(struct EOF_SONG *sp, unsigned long tracknum)
{
 struct eof_MIDI_data_track *trackptr;
 if(!sp || (tracknum >= sp->tracks))
  return 0;
 for(trackptr = sp->midi_data_head; trackptr != ((void *)0); trackptr = trackptr->next)
 {
  if(trackptr->trackname && !ustricmp(trackptr->trackname, sp->track[tracknum]->name))
  {
   return 1;
  }
 }
 return 0;
}

variable_types:
tracknum
unsigned long

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

user_defined_types: struct EOF_BEAT_MARKER { unsigned long ppqn; unsigned long midi_pos; unsigned long pos; unsigned long flags; char key; double fpos; unsigned long measurenum; int beat_within_measure; char contains_tempo_change; }

user_defined_types: struct EOF_TEXT_EVENT { char text[256]; unsigned long beat; unsigned long track; char is_temporary; unsigned char flags; unsigned long index; }

user_defined_types: struct EOF_OGG_INFO { char filename[256]; long midi_offset; char modified; char description[-1]; }

user_defined_types: struct EOF_CATALOG_ENTRY { unsigned long track; unsigned char type; unsigned long start_pos; unsigned long end_pos; char name[-1]; }

user_defined_types: struct EOF_NOTE { char name[-1]; unsigned char type; unsigned char note; unsigned long midi_pos; unsigned long midi_length; unsigned long pos; long length; unsigned long flags; unsigned char tflags; }

user_defined_types: struct EOF_LYRIC { unsigned char type; unsigned char note; char text[-1]; unsigned long midi_pos; long midi_length; unsigned long pos; long length; unsigned long flags; unsigned char tflags; }


decompiled_code:
__int64 __fastcall eof_events_overridden_by_stored_MIDI_track(__int64 a1)
{
_QWORD *v1; // rbx

if ( !a1 )
return 0LL;
v1 = *(_QWORD **)(a1 + 295192);
if ( !v1 )
return 0LL;
while ( !*v1 || (unsigned int)ustricmp(*v1, "EVENTS") )
{
v1 = (_QWORD *)v1[3];
if ( !v1 )
return 0LL;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
_QWORD *v1; // rbx

if ( !a1 )
return 0LL;
v1 = *(_QWORD **)(a1 + 295192);
if ( !v1 )
return 0LL;
while ( !*v1 || (unsigned int)ustricmp(*v1, "EVENTS") )
{
v1 = (_QWORD *)v1[3];
if ( !v1 )
return 0LL;
}
return 1LL;
}

original_code:
int eof_events_overridden_by_stored_MIDI_track(EOF_SONG *sp)
{
 struct eof_MIDI_data_track *trackptr;
 if(!sp)
  return 0;
 for(trackptr = sp->midi_data_head; trackptr != ((void *)0); trackptr = trackptr->next)
 {
  if(trackptr->trackname && !ustricmp(trackptr->trackname, "EVENTS"))
  {
   return 1;
  }
 }
 return 0;
}

canonical_original_code:
int eof_events_overridden_by_stored_MIDI_track(struct EOF_SONG *sp)
{
 struct eof_MIDI_data_track *trackptr;
 if(!sp)
  return 0;
 for(trackptr = sp->midi_data_head; trackptr != ((void *)0); trackptr = trackptr->next)
 {
  if(trackptr->trackname && !ustricmp(trackptr->trackname, "EVENTS"))
  {
   return 1;
  }
 }
 return 0;
}

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

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


decompiled_code:
__int64 __fastcall eof_music_seek(int a1)
{
eof_log("eof_music_seek() entered", 1LL);
alogg_seek_abs_msecs_ogg(eof_music_track, (unsigned int)(a1 + eof_av_delay));
eof_music_pos = a1 + eof_av_delay;
eof_music_actual_pos = a1 + eof_av_delay;
eof_mix_seek();
return eof_reset_lyric_preview_lines();
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
eof_log("eof_music_seek() entered", 1LL);
alogg_seek_abs_msecs_ogg(eof_music_track, (unsigned int)(a1 + eof_av_delay));
eof_music_pos = a1 + eof_av_delay;
eof_music_actual_pos = a1 + eof_av_delay;
eof_mix_seek();
return eof_reset_lyric_preview_lines();
}

original_code:
void eof_music_seek(unsigned long pos)
{
 eof_log("eof_music_seek() entered", 1);
 alogg_seek_abs_msecs_ogg(eof_music_track, pos + eof_av_delay);
 eof_music_pos = pos + eof_av_delay;
 eof_music_actual_pos = eof_music_pos;
 eof_mix_seek(eof_music_actual_pos);
 eof_reset_lyric_preview_lines();
}

variable_types:
pos
unsigned long


decompiled_code:
unsigned __int64 __fastcall eof_music_play(char a1)
{
unsigned __int64 result; // rax
int v2; // eax
int v3; // ebp
_BOOL4 v4; // er11
int v5; // eax
__int64 v6; // rsi
unsigned __int64 v7; // rbx
__int64 v8; // rbp
unsigned __int64 v9; // rax
int v10; // eax
int v11; // ebp

result = eof_log("eof_music_play() entered", 1LL);
if ( !eof_music_catalog_playback && !eof_silence_loaded )
{
v2 = 1 - eof_music_paused;
v3 = 1000;
eof_music_paused = 1 - eof_music_paused;
if ( !a1 )
{
if ( (eof_key_shifts & 2) != 0 )
{
v3 = 500;
if ( (eof_key_shifts & 1) != 0 )
{
eof_shift_used = 1;
v3 = 250;
}
}
else if ( key[4] )
{
key[4] = 0;
}
else
{
v3 = eof_playback_speed;
}
}
if ( v2 )
{
eof_log("\tStopping playback", 1LL);
eof_stop_midi();
alogg_stop_ogg(eof_music_track);
result = alogg_get_pos_msecs_ogg(eof_music_track);
eof_music_actual_pos = result;
if ( eof_play_selection )
{
result = eof_music_seek(eof_music_rewind_pos);
eof_music_pos = eof_music_rewind_pos;
}
else if ( !eof_smooth_pos )
{
eof_music_pos = result;
}
}
else
{
result = eof_music_pos - eof_av_delay;
if ( result < eof_music_length )
{
eof_log("\tStarting playback", 1LL);
if ( !a1 )
speed_0 = v3;
if ( key[19] && eof_count_selected_notes(0LL, 0LL) )
{
v6 = eof_selected_track;
v7 = 0LL;
eof_music_end_pos = 0;
eof_music_rewind_pos = eof_chart_length;
while ( eof_get_track_size(eof_song, v6) > v7 )
{
v6 = eof_selected_track;
if ( eof_selection[v7 + 40] )
{
v8 = eof_get_note_pos(eof_song, eof_selected_track, v7);
if ( v8 + eof_get_note_length(eof_song, eof_selected_track, v7) > (unsigned __int64)eof_music_end_pos )
{
v11 = eof_get_note_pos(eof_song, eof_selected_track, v7);
eof_music_end_pos = eof_get_note_length(eof_song, eof_selected_track, v7) + v11;
}
v6 = eof_selected_track;
if ( eof_selection[v7 + 40] )
{
v9 = eof_get_note_pos(eof_song, eof_selected_track, v7);
v6 = eof_selected_track;
if ( v9 < eof_music_rewind_pos )
{
v10 = eof_get_note_pos(eof_song, eof_selected_track, v7);
v6 = eof_selected_track;
eof_music_rewind_pos = v10;
}
}
}
++v7;
}
eof_music_seek(eof_music_rewind_pos);
eof_play_selection = 1;
}
else
{
eof_play_selection = 0;
}
eof_music_rewind_pos = eof_music_pos;
alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
eof_mix_find_claps();
do
{
eof_read_controller(eof_drums);
eof_read_controller(eof_guitar);
v4 = (eof_drums[7] | eof_guitar[25]) != 0LL;
if ( eof_guitar[34] | eof_drums[16] )
v4 = 1;
if ( eof_guitar[43] | eof_drums[25] )
v4 = 1;
}
while ( eof_guitar[52] | eof_drums[34] || eof_guitar[61] | eof_drums[43] || v4 );
if ( eof_playback_time_stretch )
v5 = alogg_play_ogg_ts(
eof_music_track,
eof_buffer_size,
255LL,
128LL,
(unsigned int)speed_0,
eof_drums[7] | eof_guitar[25]);
else
v5 = alogg_play_ex_ogg(
eof_music_track,
eof_buffer_size,
255LL,
128LL,
(unsigned int)(eof_audio_fine_tune + speed_0),
0LL);
if ( v5 )
{
result = allegro_message("Can't play song!");
eof_music_paused = 1;
}
else
{
eof_mix_start((unsigned int)speed_0);
eof_entering_note_note = 0LL;
eof_entering_note_lyric = 0LL;
eof_entering_note = 0;
eof_snote = 0;
alogg_poll_ogg(eof_music_track);
result = alogg_get_pos_msecs_ogg(eof_music_track);
eof_music_actual_pos = result;
}
}
else
{
eof_music_paused = 1;
}
}
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func1(char a1)
{
unsigned __int64 result; // rax
int v2; // eax
int v3; // ebp
_BOOL4 v4; // er11
int v5; // eax
__int64 v6; // rsi
unsigned __int64 v7; // rbx
__int64 v8; // rbp
unsigned __int64 v9; // rax
int v10; // eax
int v11; // ebp

result = eof_log("eof_music_play() entered", 1LL);
if ( !eof_music_catalog_playback && !eof_silence_loaded )
{
v2 = 1 - eof_music_paused;
v3 = 1000;
eof_music_paused = 1 - eof_music_paused;
if ( !a1 )
{
if ( (eof_key_shifts & 2) != 0 )
{
v3 = 500;
if ( (eof_key_shifts & 1) != 0 )
{
eof_shift_used = 1;
v3 = 250;
}
}
else if ( key[4] )
{
key[4] = 0;
}
else
{
v3 = eof_playback_speed;
}
}
if ( v2 )
{
eof_log("\tStopping playback", 1LL);
eof_stop_midi();
alogg_stop_ogg(eof_music_track);
result = alogg_get_pos_msecs_ogg(eof_music_track);
eof_music_actual_pos = result;
if ( eof_play_selection )
{
result = func0(eof_music_rewind_pos);
eof_music_pos = eof_music_rewind_pos;
}
else if ( !eof_smooth_pos )
{
eof_music_pos = result;
}
}
else
{
result = eof_music_pos - eof_av_delay;
if ( result < eof_music_length )
{
eof_log("\tStarting playback", 1LL);
if ( !a1 )
speed_0 = v3;
if ( key[19] && eof_count_selected_notes(0LL, 0LL) )
{
v6 = eof_selected_track;
v7 = 0LL;
eof_music_end_pos = 0;
eof_music_rewind_pos = eof_chart_length;
while ( eof_get_track_size(eof_song, v6) > v7 )
{
v6 = eof_selected_track;
if ( eof_selection[v7 + 40] )
{
v8 = eof_get_note_pos(eof_song, eof_selected_track, v7);
if ( v8 + eof_get_note_length(eof_song, eof_selected_track, v7) > (unsigned __int64)eof_music_end_pos )
{
v11 = eof_get_note_pos(eof_song, eof_selected_track, v7);
eof_music_end_pos = eof_get_note_length(eof_song, eof_selected_track, v7) + v11;
}
v6 = eof_selected_track;
if ( eof_selection[v7 + 40] )
{
v9 = eof_get_note_pos(eof_song, eof_selected_track, v7);
v6 = eof_selected_track;
if ( v9 < eof_music_rewind_pos )
{
v10 = eof_get_note_pos(eof_song, eof_selected_track, v7);
v6 = eof_selected_track;
eof_music_rewind_pos = v10;
}
}
}
++v7;
}
func0(eof_music_rewind_pos);
eof_play_selection = 1;
}
else
{
eof_play_selection = 0;
}
eof_music_rewind_pos = eof_music_pos;
alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
eof_mix_find_claps();
do
{
eof_read_controller(eof_drums);
eof_read_controller(eof_guitar);
v4 = (eof_drums[7] | eof_guitar[25]) != 0LL;
if ( eof_guitar[34] | eof_drums[16] )
v4 = 1;
if ( eof_guitar[43] | eof_drums[25] )
v4 = 1;
}
while ( eof_guitar[52] | eof_drums[34] || eof_guitar[61] | eof_drums[43] || v4 );
if ( eof_playback_time_stretch )
v5 = alogg_play_ogg_ts(
eof_music_track,
eof_buffer_size,
255LL,
128LL,
(unsigned int)speed_0,
eof_drums[7] | eof_guitar[25]);
else
v5 = alogg_play_ex_ogg(
eof_music_track,
eof_buffer_size,
255LL,
128LL,
(unsigned int)(eof_audio_fine_tune + speed_0),
0LL);
if ( v5 )
{
result = allegro_message("Can't play song!");
eof_music_paused = 1;
}
else
{
eof_mix_start((unsigned int)speed_0);
eof_entering_note_note = 0LL;
eof_entering_note_lyric = 0LL;
eof_entering_note = 0;
eof_snote = 0;
alogg_poll_ogg(eof_music_track);
result = alogg_get_pos_msecs_ogg(eof_music_track);
eof_music_actual_pos = result;
}
}
else
{
eof_music_paused = 1;
}
}
}
return result;
}

original_code:
void eof_music_play(char resumelastspeed)
{
 static int speed = 1000;
 unsigned long i;
 int ret, newspeed = 1000;
 eof_log("eof_music_play() entered", 1);
 if(eof_music_catalog_playback || eof_silence_loaded)
 {
  return;
 }
 eof_music_paused = 1 - eof_music_paused;
 if(!resumelastspeed)
 {
  newspeed = eof_playback_speed;
  if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
  {
   if((eof_key_shifts & __allegro_KB_SHIFT_FLAG))
   {
    eof_shift_used = 1;
    newspeed = 250;
   }
   else
   {
    newspeed = 500;
   }
  }
  else if(key[__allegro_KEY_D])
  {
   newspeed = 1000;
   key[__allegro_KEY_D]=0;
  }
 }
 if(eof_music_paused)
 {
  eof_log("\tStopping playback", 1);
  eof_stop_midi();
  alogg_stop_ogg(eof_music_track);
  eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
  if(eof_play_selection)
  {
   eof_music_seek(eof_music_rewind_pos);
   eof_music_pos = eof_music_rewind_pos;
  }
  else if(!eof_smooth_pos)
  {
   eof_music_pos = eof_music_actual_pos;
  }
 }
 else if(eof_music_pos - eof_av_delay < eof_music_length)
 {
  unsigned long x;
  int held;
  eof_log("\tStarting playback", 1);
  if(!resumelastspeed)
  {
   speed = newspeed;
  }
  if(key[__allegro_KEY_S] && (eof_count_selected_notes(((void *)0), 0) > 0))
  {
   eof_music_end_pos = 0;
   eof_music_rewind_pos = eof_chart_length;
   for(i = 0; i < eof_get_track_size(eof_song, eof_selected_track); i++)
   {
    if(eof_selection.multi[i] && (eof_get_note_pos(eof_song, eof_selected_track, i) + eof_get_note_length(eof_song, eof_selected_track, i) > eof_music_end_pos))
    {
     eof_music_end_pos = eof_get_note_pos(eof_song, eof_selected_track, i) + eof_get_note_length(eof_song, eof_selected_track, i);
    }
    if(eof_selection.multi[i] && (eof_get_note_pos(eof_song, eof_selected_track, i) < eof_music_rewind_pos))
    {
     eof_music_rewind_pos = eof_get_note_pos(eof_song, eof_selected_track, i);
    }
   }
   eof_music_seek(eof_music_rewind_pos);
   eof_play_selection = 1;
  }
  else
  {
   eof_play_selection = 0;
  }
  eof_music_rewind_pos = eof_music_pos;
   alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
  eof_mix_find_claps();
  do{
   held = 0;
   eof_read_controller(&eof_drums);
   eof_read_controller(&eof_guitar);
   for(x = 0; x < 5; x++)
   {
    if((eof_drums.button[x].held) || (eof_guitar.button[x+2].held))
     held = 1;
   }
  }while(held);
  if(eof_playback_time_stretch)
  {
   ret = alogg_play_ogg_ts(eof_music_track, eof_buffer_size, 255, 128, speed);
  }
  else
  {
   ret = alogg_play_ex_ogg(eof_music_track, eof_buffer_size, 255, 128, speed + eof_audio_fine_tune, 0);
  }
  if(ret == 0)
  {
   eof_mix_start(speed);
   eof_entering_note_note = ((void *)0);
   eof_entering_note_lyric = ((void *)0);
   eof_entering_note = 0;
   eof_snote = 0;
   (void) alogg_poll_ogg(eof_music_track);
   eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
  }
  else
  {
   allegro_message("Can't play song!");
   eof_music_paused = 1;
  }
 }
 else
 {
  eof_music_paused = 1;
 }
}

canonical_original_code:
void eof_music_play(char resumelastspeed)
{
 static int speed = 1000;
 unsigned long i;
 int ret; int newspeed = 1000;
 eof_log("eof_music_play() entered", 1);
 if(eof_music_catalog_playback || eof_silence_loaded)
 {
  return;
 }
 eof_music_paused = 1 - eof_music_paused;
 if(!resumelastspeed)
 {
  newspeed = eof_playback_speed;
  if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
  {
   if((eof_key_shifts & __allegro_KB_SHIFT_FLAG))
   {
    eof_shift_used = 1;
    newspeed = 250;
   }
   else
   {
    newspeed = 500;
   }
  }
  else if(key[__allegro_KEY_D])
  {
   newspeed = 1000;
   key[__allegro_KEY_D]=0;
  }
 }
 if(eof_music_paused)
 {
  eof_log("\tStopping playback", 1);
  eof_stop_midi();
  alogg_stop_ogg(eof_music_track);
  eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
  if(eof_play_selection)
  {
   eof_music_seek(eof_music_rewind_pos);
   eof_music_pos = eof_music_rewind_pos;
  }
  else if(!eof_smooth_pos)
  {
   eof_music_pos = eof_music_actual_pos;
  }
 }
 else if(eof_music_pos - eof_av_delay < eof_music_length)
 {
  unsigned long x;
  int held;
  eof_log("\tStarting playback", 1);
  if(!resumelastspeed)
  {
   speed = newspeed;
  }
  if(key[__allegro_KEY_S] && (eof_count_selected_notes(((void *)0), 0) > 0))
  {
   eof_music_end_pos = 0;
   eof_music_rewind_pos = eof_chart_length;
   for(i = 0; i < eof_get_track_size(eof_song, eof_selected_track); i++)
   {
    if(eof_selection.multi[i] && (eof_get_note_pos(eof_song, eof_selected_track, i) + eof_get_note_length(eof_song, eof_selected_track, i) > eof_music_end_pos))
    {
     eof_music_end_pos = eof_get_note_pos(eof_song, eof_selected_track, i) + eof_get_note_length(eof_song, eof_selected_track, i);
    }
    if(eof_selection.multi[i] && (eof_get_note_pos(eof_song, eof_selected_track, i) < eof_music_rewind_pos))
    {
     eof_music_rewind_pos = eof_get_note_pos(eof_song, eof_selected_track, i);
    }
   }
   eof_music_seek(eof_music_rewind_pos);
   eof_play_selection = 1;
  }
  else
  {
   eof_play_selection = 0;
  }
  eof_music_rewind_pos = eof_music_pos;
   alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
  eof_mix_find_claps();
  do{
   held = 0;
   eof_read_controller(&eof_drums);
   eof_read_controller(&eof_guitar);
   for(x = 0; x < 5; x++)
   {
    if((eof_drums.button[x].held) || (eof_guitar.button[x+2].held))
     held = 1;
   }
  }while(held);
  if(eof_playback_time_stretch)
  {
   ret = alogg_play_ogg_ts(eof_music_track, eof_buffer_size, 255, 128, speed);
  }
  else
  {
   ret = alogg_play_ex_ogg(eof_music_track, eof_buffer_size, 255, 128, speed + eof_audio_fine_tune, 0);
  }
  if(ret == 0)
  {
   eof_mix_start(speed);
   eof_entering_note_note = ((void *)0);
   eof_entering_note_lyric = ((void *)0);
   eof_entering_note = 0;
   eof_snote = 0;
   (void) alogg_poll_ogg(eof_music_track);
   eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
  }
  else
  {
   allegro_message("Can't play song!");
   eof_music_paused = 1;
  }
 }
 else
 {
  eof_music_paused = 1;
 }
}

variable_types: resumelastspeed char

variable_types: speed int

variable_types:
i
unsigned long

variable_types: ret int

variable_types: newspeed int

variable_types:
x
unsigned long

variable_types: held int


decompiled_code:
unsigned __int64 eof_catalog_play()
{
unsigned __int64 result; // rax
__int64 v1; // rsi
__int64 v2; // rsi

eof_log("eof_catalog_play() entered", 1LL);
result = eof_song;
v1 = *(_QWORD *)(eof_song + 295288LL);
if ( *(_QWORD *)(v1 + 0x4000) && !eof_silence_loaded )
{
if ( eof_music_paused )
{
v2 = *(_QWORD *)(v1 + (eof_selected_catalog_entry << 6) + 16);
if ( eof_music_catalog_playback )
{
eof_music_catalog_playback = 0;
eof_music_catalog_pos = eof_av_delay + v2;
eof_stop_midi();
alogg_stop_ogg(eof_music_track);
result = alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
}
else
{
alogg_seek_abs_msecs_ogg(eof_music_track, v2);
eof_music_catalog_playback = 1;
eof_music_catalog_pos = *(_DWORD *)(*(_QWORD *)(eof_song + 295288LL) + (eof_selected_catalog_entry << 6) + 16LL)
+ eof_av_delay;
if ( (unsigned int)alogg_play_ex_ogg(
eof_music_track,
eof_buffer_size,
255LL,
128LL,
(unsigned int)(eof_audio_fine_tune + 1000),
0LL) )
{
result = allegro_message("Can't play song!");
}
else
{
eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
eof_mix_find_claps();
result = eof_mix_start(1000LL);
}
}
}
else
{
result = eof_music_play(0);
}
}
return result;
}

canonical_decompiled_code:
unsigned __int64 func2()
{
unsigned __int64 result; // rax
__int64 v1; // rsi
__int64 v2; // rsi

eof_log("eof_catalog_play() entered", 1LL);
result = eof_song;
v1 = *(_QWORD *)(eof_song + 295288LL);
if ( *(_QWORD *)(v1 + 0x4000) && !eof_silence_loaded )
{
if ( eof_music_paused )
{
v2 = *(_QWORD *)(v1 + (eof_selected_catalog_entry << 6) + 16);
if ( eof_music_catalog_playback )
{
eof_music_catalog_playback = 0;
eof_music_catalog_pos = eof_av_delay + v2;
eof_stop_midi();
alogg_stop_ogg(eof_music_track);
result = alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
}
else
{
alogg_seek_abs_msecs_ogg(eof_music_track, v2);
eof_music_catalog_playback = 1;
eof_music_catalog_pos = *(_DWORD *)(*(_QWORD *)(eof_song + 295288LL) + (eof_selected_catalog_entry << 6) + 16LL)
+ eof_av_delay;
if ( (unsigned int)alogg_play_ex_ogg(
eof_music_track,
eof_buffer_size,
255LL,
128LL,
(unsigned int)(eof_audio_fine_tune + 1000),
0LL) )
{
result = allegro_message("Can't play song!");
}
else
{
eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
eof_mix_find_claps();
result = eof_mix_start(1000LL);
}
}
}
else
{
result = func1(0);
}
}
return result;
}

original_code:
void eof_catalog_play(void)
{
 eof_log("eof_catalog_play() entered", 1);
 if((eof_song->catalog->entries > 0) && !eof_silence_loaded)
 {
  if(!eof_music_paused)
  {
   eof_music_play(0);
  }
  else if(eof_music_catalog_playback)
  {
   eof_music_catalog_playback = 0;
   eof_music_catalog_pos = eof_song->catalog->entry[eof_selected_catalog_entry].start_pos + eof_av_delay;
   eof_stop_midi();
   alogg_stop_ogg(eof_music_track);
   alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
  }
  else
  {
   alogg_seek_abs_msecs_ogg(eof_music_track, eof_song->catalog->entry[eof_selected_catalog_entry].start_pos);
   eof_music_catalog_pos = eof_song->catalog->entry[eof_selected_catalog_entry].start_pos + eof_av_delay;
   eof_music_catalog_playback = 1;
   if(alogg_play_ex_ogg(eof_music_track, eof_buffer_size, 255, 128, 1000 + eof_audio_fine_tune, 0) == 0)
   {
    eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
    eof_mix_find_claps();
    eof_mix_start(1000);
   }
   else
   {
    allegro_message("Can't play song!");
   }
  }
 }
}

canonical_original_code:
void eof_catalog_play()
{
 eof_log("eof_catalog_play() entered", 1);
 if((eof_song->catalog->entries > 0) && !eof_silence_loaded)
 {
  if(!eof_music_paused)
  {
   eof_music_play(0);
  }
  else if(eof_music_catalog_playback)
  {
   eof_music_catalog_playback = 0;
   eof_music_catalog_pos = eof_song->catalog->entry[eof_selected_catalog_entry].start_pos + eof_av_delay;
   eof_stop_midi();
   alogg_stop_ogg(eof_music_track);
   alogg_seek_abs_msecs_ogg(eof_music_track, eof_music_pos);
  }
  else
  {
   alogg_seek_abs_msecs_ogg(eof_music_track, eof_song->catalog->entry[eof_selected_catalog_entry].start_pos);
   eof_music_catalog_pos = eof_song->catalog->entry[eof_selected_catalog_entry].start_pos + eof_av_delay;
   eof_music_catalog_playback = 1;
   if(alogg_play_ex_ogg(eof_music_track, eof_buffer_size, 255, 128, 1000 + eof_audio_fine_tune, 0) == 0)
   {
    eof_music_actual_pos = alogg_get_pos_msecs_ogg(eof_music_track);
    eof_mix_find_claps();
    eof_mix_start(1000);
   }
   else
   {
    allegro_message("Can't play song!");
   }
  }
 }
}


decompiled_code:
__int64 eof_music_rewind()
{
__int64 result; // rax
int v1; // eax

eof_log("eof_music_rewind() entered", 2LL);
result = eof_stop_midi();
if ( !eof_music_catalog_playback )
{
v1 = eof_key_shifts & 1;
if ( (eof_key_shifts & 1) != 0 )
{
eof_shift_used = 1;
if ( (eof_key_shifts & 2) == 0 )
v1 = 1000;
}
else
{
v1 = (eof_key_shifts & 2) == 0 ? 100 : 10;
}
if ( eof_music_pos - eof_av_delay >= v1 )
result = eof_set_seek_position((unsigned int)(eof_music_pos - v1));
else
result = eof_menu_song_seek_start();
}
return result;
}

canonical_decompiled_code:
__int64 func3()
{
__int64 result; // rax
int v1; // eax

eof_log("eof_music_rewind() entered", 2LL);
result = eof_stop_midi();
if ( !eof_music_catalog_playback )
{
v1 = eof_key_shifts & 1;
if ( (eof_key_shifts & 1) != 0 )
{
eof_shift_used = 1;
if ( (eof_key_shifts & 2) == 0 )
v1 = 1000;
}
else
{
v1 = (eof_key_shifts & 2) == 0 ? 100 : 10;
}
if ( eof_music_pos - eof_av_delay >= v1 )
result = eof_set_seek_position((unsigned int)(eof_music_pos - v1));
else
result = eof_menu_song_seek_start();
}
return result;
}

original_code:
void eof_music_rewind(void)
{
 int amount = 0;
 eof_log("eof_music_rewind() entered", 2);
 eof_stop_midi();
 if(!eof_music_catalog_playback)
 {
  if((eof_key_shifts & __allegro_KB_SHIFT_FLAG))
  {
   eof_shift_used = 1;
   if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
   {
    amount = 1;
   }
   else
   {
    amount = 1000;
   }
  }
  else if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
  {
   amount = 10;
  }
  else
  {
   amount = 100;
  }
  if(eof_music_pos - eof_av_delay < amount)
  {
   (void) eof_menu_song_seek_start();
  }
  else
  {
   eof_set_seek_position(eof_music_pos - amount);
  }
 }
}

canonical_original_code:
void eof_music_rewind()
{
 int amount = 0;
 eof_log("eof_music_rewind() entered", 2);
 eof_stop_midi();
 if(!eof_music_catalog_playback)
 {
  if((eof_key_shifts & __allegro_KB_SHIFT_FLAG))
  {
   eof_shift_used = 1;
   if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
   {
    amount = 1;
   }
   else
   {
    amount = 1000;
   }
  }
  else if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
  {
   amount = 10;
  }
  else
  {
   amount = 100;
  }
  if(eof_music_pos - eof_av_delay < amount)
  {
   (void) eof_menu_song_seek_start();
  }
  else
  {
   eof_set_seek_position(eof_music_pos - amount);
  }
 }
}

variable_types: amount int


decompiled_code:
__int64 eof_music_forward()
{
__int64 result; // rax
int v1; // eax
int v2; // eax
__int64 v3; // rdi

eof_log("eof_music_forward() entered", 2LL);
result = eof_stop_midi();
if ( !eof_music_catalog_playback )
{
v1 = eof_key_shifts & 1;
if ( (eof_key_shifts & 1) != 0 )
{
eof_shift_used = 1;
if ( (eof_key_shifts & 2) == 0 )
v1 = 1000;
}
else
{
v1 = (eof_key_shifts & 2) == 0 ? 100 : 10;
}
v2 = eof_music_pos + v1;
v3 = eof_chart_length;
if ( (unsigned __int64)v2 <= eof_chart_length )
v3 = (unsigned int)v2;
result = eof_set_seek_position(v3);
}
return result;
}

canonical_decompiled_code:
__int64 func4()
{
__int64 result; // rax
int v1; // eax
int v2; // eax
__int64 v3; // rdi

eof_log("eof_music_forward() entered", 2LL);
result = eof_stop_midi();
if ( !eof_music_catalog_playback )
{
v1 = eof_key_shifts & 1;
if ( (eof_key_shifts & 1) != 0 )
{
eof_shift_used = 1;
if ( (eof_key_shifts & 2) == 0 )
v1 = 1000;
}
else
{
v1 = (eof_key_shifts & 2) == 0 ? 100 : 10;
}
v2 = eof_music_pos + v1;
v3 = eof_chart_length;
if ( (unsigned __int64)v2 <= eof_chart_length )
v3 = (unsigned int)v2;
result = eof_set_seek_position(v3);
}
return result;
}

original_code:
void eof_music_forward(void)
{
 int amount = 0, target;
 eof_log("eof_music_forward() entered", 2);
 eof_stop_midi();
 if(!eof_music_catalog_playback)
 {
  if((eof_key_shifts & __allegro_KB_SHIFT_FLAG))
  {
   eof_shift_used = 1;
   if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
   {
    amount = 1;
   }
   else
   {
    amount = 1000;
   }
  }
  else if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
  {
   amount = 10;
  }
  else
  {
   amount = 100;
  }
  target = eof_music_pos + amount;
  if(target > eof_chart_length)
  {
   target = eof_chart_length;
  }
  eof_set_seek_position(target);
 }
}

canonical_original_code:
void eof_music_forward()
{
 int amount = 0; int target;
 eof_log("eof_music_forward() entered", 2);
 eof_stop_midi();
 if(!eof_music_catalog_playback)
 {
  if((eof_key_shifts & __allegro_KB_SHIFT_FLAG))
  {
   eof_shift_used = 1;
   if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
   {
    amount = 1;
   }
   else
   {
    amount = 1000;
   }
  }
  else if((eof_key_shifts & __allegro_KB_CTRL_FLAG))
  {
   amount = 10;
  }
  else
  {
   amount = 100;
  }
  target = eof_music_pos + amount;
  if(target > eof_chart_length)
  {
   target = eof_chart_length;
  }
  eof_set_seek_position(target);
 }
}

variable_types: target int