decompiled_code:
__int64 M_CG_BotMatch_Start()
{
const char *v0; // rsi
__int64 v1; // rdi

switch ( bm_type_var )
{
case 0:
v0 = "arena";
break;
case 1:
v0 = "clarena";
break;
case 2:
v0 = "duel";
break;
case 3:
v0 = "ffa";
break;
case 4:
v0 = "team";
break;
default:
v0 = "ffa";
break;
}
v1 = va("disconnect;sv_progsname qwprogs;gamedir fbca;exec configs/%s.cfg;map %s\n", v0, bm_map_desc[bm_map_var]);
Cbuf_AddText(v1);
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func14()
{
const char *v0; // rsi
__int64 v1; // rdi

switch ( bm_type_var )
{
case 0:
v0 = "arena";
break;
case 1:
v0 = "clarena";
break;
case 2:
v0 = "duel";
break;
case 3:
v0 = "ffa";
break;
case 4:
v0 = "team";
break;
default:
v0 = "ffa";
break;
}
v1 = va("disconnect;sv_progsname qwprogs;gamedir fbca;exec configs/%s.cfg;map %s\n", v0, bm_map_desc[bm_map_var]);
Cbuf_AddText(v1);
return M_LeaveMenus();
}

original_code:
static void M_CG_BotMatch_Start(void) {
  const char *cfg;
  const char *map = bm_map_desc[bm_map_var];
  switch (bm_type_var) {
   case bmt_arena: cfg = "arena"; break;
   case bmt_clarena: cfg = "clarena"; break;
   case bmt_duel: cfg = "duel"; break;
   case bmt_ffa: cfg = "ffa"; break;
   case bmt_team: cfg = "team"; break;
   default: cfg = "ffa"; break;
  }
  Cbuf_AddText(va("disconnect;sv_progsname qwprogs;gamedir fbca;exec configs/%s.cfg;map %s\n",cfg,map));
  M_LeaveMenus();
 }

canonical_original_code:
static void M_CG_BotMatch_Start() {
  char *cfg;
  char *map = bm_map_desc[bm_map_var];
  switch (bm_type_var) {
   case bmt_arena: cfg = "arena"; break;
   case bmt_clarena: cfg = "clarena"; break;
   case bmt_duel: cfg = "duel"; break;
   case bmt_ffa: cfg = "ffa"; break;
   case bmt_team: cfg = "team"; break;
   default: cfg = "ffa"; break;
  }
  Cbuf_AddText(va("disconnect;sv_progsname qwprogs;gamedir fbca;exec configs/%s.cfg;map %s\n",cfg,map));
  M_LeaveMenus();
 }

variable_types:
cfg
char *

variable_types:
map
char *


repo: jite/jquake

decompiled_code:
__int64 Servers_Mouse_Event()
{
return SB_Servers_Mouse_Event();
}

canonical_decompiled_code:
__int64 func15()
{
return SB_Servers_Mouse_Event();
}

original_code:
static qbool Servers_Mouse_Event(const mouse_state_t *ms)
{
 return SB_Servers_Mouse_Event(ms);
}

canonical_original_code:
static enum qbool Servers_Mouse_Event(struct mouse_state_s *ms)
{
 return SB_Servers_Mouse_Event(ms);
}

variable_types: struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool { false=0, true=1 } buttons[9]; int button_down; int button_up; } *

return_type: enum qbool { false=0, true=1 }

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


decompiled_code:
__int64 Servers_Key()
{
return SB_Servers_Key();
}

canonical_decompiled_code:
__int64 func17()
{
return SB_Servers_Key();
}

original_code:
static int Servers_Key(int key, unsigned short unichar, CTab_t *tab, CTabPage_t *page)
{
 return SB_Servers_Key(key);
}

canonical_original_code:
static int Servers_Key(int key, unsigned short unichar, struct CTab_s *tab, struct CTabPage_s *page)
{
 return SB_Servers_Key(key);
}

variable_types: key int

variable_types:
unichar
unsigned short

variable_types: struct CTab_s { struct CTabPage_s { char name[-1]; int id; struct CTabPage_Handlers_s { void (*draw)(int x, int y, int w, int h, struct CTab_s *, struct CTabPage_s *); int (*key)(int key, unsigned short unichar, struct CTab_s *, struct CTabPage_s *); void (*onshow)(); enum qbool { false=0, true=1 } (*mousemove)(struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool { false=0, true=1 } buttons[9]; int button_down; int button_up; } *ms); } handlers; } pages[16]; int nPages; int activePage; int lastViewedPage; int hoveredPage; int width; int height; struct { int x; } navi_boxes[16]; void *tag; } *

variable_types:
page
struct CTabPage_s *

return_type: int

user_defined_types: struct CTab_s { struct CTabPage_s pages[16]; int nPages; int activePage; int lastViewedPage; int hoveredPage; int width; int height; struct { int x; } navi_boxes[16]; void *tag; }

user_defined_types: struct CTabPage_s { char name[-1]; int id; struct CTabPage_Handlers_s handlers; }

user_defined_types: struct CTabPage_Handlers_s { void (*draw)(int x, int y, int w, int h, struct CTab_s *, struct CTabPage_s *); int (*key)(int key, unsigned short unichar, struct CTab_s *, struct CTabPage_s *); void (*onshow)(); enum qbool (*mousemove)(struct mouse_state_s *ms); }


decompiled_code:
__int64 Servers_Draw()
{
return SB_Servers_Draw();
}

canonical_decompiled_code:
__int64 func18()
{
return SB_Servers_Draw();
}

original_code:
static void Servers_Draw (int x, int y, int w, int h, CTab_t *tab, CTabPage_t *page)
{
 SB_Servers_Draw(x,y,w,h);
}

canonical_original_code:
static void Servers_Draw(int x, int y, int w, int h, struct CTab_s *tab, struct CTabPage_s *page)
{
 SB_Servers_Draw(x,y,w,h);
}

variable_types: x int

variable_types: y int

variable_types: w int

variable_types: h int

return_type: void


decompiled_code:
__int64 Sources_Mouse_Event()
{
return SB_Sources_Mouse_Event();
}

canonical_decompiled_code:
__int64 func19()
{
return SB_Sources_Mouse_Event();
}

original_code:
static qbool Sources_Mouse_Event(const mouse_state_t *ms)
{
 return SB_Sources_Mouse_Event(ms);
}

canonical_original_code:
static enum qbool Sources_Mouse_Event(struct mouse_state_s *ms)
{
 return SB_Sources_Mouse_Event(ms);
}


decompiled_code:
__int64 Sources_Key()
{
return SB_Sources_Key();
}

canonical_decompiled_code:
__int64 func20()
{
return SB_Sources_Key();
}

original_code:
static int Sources_Key(int key, unsigned short unichar, CTab_t *tab, CTabPage_t *page)
{
 return SB_Sources_Key(key);
}

canonical_original_code:
static int Sources_Key(int key, unsigned short unichar, struct CTab_s *tab, struct CTabPage_s *page)
{
 return SB_Sources_Key(key);
}


decompiled_code:
__int64 Sources_Draw()
{
return SB_Sources_Draw();
}

canonical_decompiled_code:
__int64 func21()
{
return SB_Sources_Draw();
}

original_code:
static void Sources_Draw (int x, int y, int w, int h, CTab_t *tab, CTabPage_t *page)
{
 SB_Sources_Draw(x,y,w,h);
}

canonical_original_code:
static void Sources_Draw(int x, int y, int w, int h, struct CTab_s *tab, struct CTabPage_s *page)
{
 SB_Sources_Draw(x,y,w,h);
}


decompiled_code:
__int64 Players_Mouse_Event()
{
return SB_Players_Mouse_Event();
}

canonical_decompiled_code:
__int64 func22()
{
return SB_Players_Mouse_Event();
}

original_code:
static qbool Players_Mouse_Event(const mouse_state_t *ms)
{
 return SB_Players_Mouse_Event(ms);
}

canonical_original_code:
static enum qbool Players_Mouse_Event(struct mouse_state_s *ms)
{
 return SB_Players_Mouse_Event(ms);
}


decompiled_code:
__int64 Players_Key()
{
return SB_Players_Key();
}

canonical_decompiled_code:
__int64 func23()
{
return SB_Players_Key();
}

original_code:
static int Players_Key(int key, unsigned short unichar, CTab_t *tab, CTabPage_t *page)
{
 return SB_Players_Key(key);
}

canonical_original_code:
static int Players_Key(int key, unsigned short unichar, struct CTab_s *tab, struct CTabPage_s *page)
{
 return SB_Players_Key(key);
}


decompiled_code:
__int64 Players_Draw()
{
return SB_Players_Draw();
}

canonical_decompiled_code:
__int64 func24()
{
return SB_Players_Draw();
}

original_code:
static void Players_Draw(int x, int y, int w, int h, CTab_t *tab, CTabPage_t *page)
{
 SB_Players_Draw(x, y, w, h);
}

canonical_original_code:
static void Players_Draw(int x, int y, int w, int h, struct CTab_s *tab, struct CTabPage_s *page)
{
 SB_Players_Draw(x, y, w, h);
}


decompiled_code:
__int64 __fastcall Options_Mouse_Event(__int64 a1)
{
return Settings_Mouse_Event(&sbsettings, a1);
}

canonical_decompiled_code:
__int64 __fastcall func25(__int64 a1)
{
return Settings_Mouse_Event(&sbsettings, a1);
}

original_code:
static qbool Options_Mouse_Event(const mouse_state_t *ms)
{
 return Settings_Mouse_Event(&sbsettings, ms);
}

canonical_original_code:
static enum qbool Options_Mouse_Event(struct mouse_state_s *ms)
{
 return Settings_Mouse_Event(&sbsettings, ms);
}


decompiled_code:
__int64 __fastcall CreateGame_Mouse_Event(__int64 a1)
{
return Settings_Mouse_Event(&create_game_options, a1);
}

canonical_decompiled_code:
__int64 __fastcall func26(__int64 a1)
{
return Settings_Mouse_Event(&create_game_options, a1);
}

original_code:
static qbool CreateGame_Mouse_Event(const mouse_state_t *ms)
{
 return Settings_Mouse_Event(&create_game_options, ms);
}

canonical_original_code:
static enum qbool CreateGame_Mouse_Event(struct mouse_state_s *ms)
{
 return Settings_Mouse_Event(&create_game_options, ms);
}


decompiled_code:
__int64 __fastcall Options_Key(unsigned int a1, unsigned __int16 a2)
{
return Settings_Key(&sbsettings, a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func27(unsigned int a1, unsigned __int16 a2)
{
return Settings_Key(&sbsettings, a1, a2);
}

original_code:
static int Options_Key(int key, unsigned short unichar, CTab_t *tab, CTabPage_t *page)
{
 return Settings_Key(&sbsettings, key, unichar);
}

canonical_original_code:
static int Options_Key(int key, unsigned short unichar, struct CTab_s *tab, struct CTabPage_s *page)
{
 return Settings_Key(&sbsettings, key, unichar);
}


decompiled_code:
__int64 __fastcall CreateGame_Key(unsigned int a1, unsigned __int16 a2)
{
return Settings_Key(&create_game_options, a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func28(unsigned int a1, unsigned __int16 a2)
{
return Settings_Key(&create_game_options, a1, a2);
}

original_code:
static int CreateGame_Key(int key, unsigned short unichar, CTab_t *tab, CTabPage_t *page)
{
 return Settings_Key(&create_game_options, key, unichar);
}

canonical_original_code:
static int CreateGame_Key(int key, unsigned short unichar, struct CTab_s *tab, struct CTabPage_s *page)
{
 return Settings_Key(&create_game_options, key, unichar);
}


decompiled_code:
__int64 __fastcall Options_Draw(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
return Settings_Draw(a1, a2, a3, a4, &sbsettings);
}

canonical_decompiled_code:
__int64 __fastcall func29(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
return Settings_Draw(a1, a2, a3, a4, &sbsettings);
}

original_code:
static void Options_Draw(int x, int y, int w, int h, CTab_t *tab, CTabPage_t *page)
{
 Settings_Draw(x, y, w, h, &sbsettings);
}

canonical_original_code:
static void Options_Draw(int x, int y, int w, int h, struct CTab_s *tab, struct CTabPage_s *page)
{
 Settings_Draw(x, y, w, h, &sbsettings);
}


decompiled_code:
__int64 __fastcall CreateGame_Draw(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
return Settings_Draw(a1, a2, a3, a4, &create_game_options);
}

canonical_decompiled_code:
__int64 __fastcall func30(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
return Settings_Draw(a1, a2, a3, a4, &create_game_options);
}

original_code:
static void CreateGame_Draw(int x, int y, int w, int h, CTab_t *tab, CTabPage_t *page)
{
 Settings_Draw(x,y,w,h,&create_game_options);
}

canonical_original_code:
static void CreateGame_Draw(int x, int y, int w, int h, struct CTab_s *tab, struct CTabPage_s *page)
{
 Settings_Draw(x,y,w,h,&create_game_options);
}


decompiled_code:
__int64 __fastcall Menu_MultiPlayer_Key(__int64 a1, unsigned __int16 a2)
{
__int64 result; // rax

result = SB_Specials_Key(a1, a2);
if ( !(_DWORD)result )
result = CTab_Key(&sb_tab, (unsigned int)a1, a2);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func32(__int64 a1, unsigned __int16 a2)
{
__int64 result; // rax

result = SB_Specials_Key(a1, a2);
if ( !(_DWORD)result )
result = CTab_Key(&sb_tab, (unsigned int)a1, a2);
return result;
}

original_code:
void Menu_MultiPlayer_Key(int key, unsigned short unichar)
{
 if (SB_Specials_Key(key, unichar)) return;
 CTab_Key(&sb_tab, key, unichar);
}


decompiled_code:
__int64 __fastcall Menu_MultiPlayer_Mouse_Event(const __m128i *a1)
{
double v1; // xmm1_8
__int64 result; // rax
__m128i v3; // [rsp+0h] [rbp-58h] BYREF
__m128i v4; // [rsp+10h] [rbp-48h]
__m128i v5; // [rsp+20h] [rbp-38h]
__m128i v6; // [rsp+30h] [rbp-28h]
__m128i v7; // [rsp+40h] [rbp-18h]

v3 = _mm_loadu_si128(a1);
v4 = _mm_loadu_si128(a1 + 1);
v5 = _mm_loadu_si128(a1 + 2);
v6 = _mm_loadu_si128(a1 + 3);
v7 = _mm_loadu_si128(a1 + 4);
if ( a1[4].m128i_i32[2] == 2 )
{
Menu_MultiPlayer_Key(201LL, 0);
result = 1LL;
}
else
{
*(double *)v3.m128i_i64 = *(double *)v3.m128i_i64 - (double)Browser_window[0];
v1 = (double)(int)Browser_window[1];
*(double *)&v3.m128i_i64[1] = *(double *)&v3.m128i_i64[1] - v1;
*(double *)v4.m128i_i64 = *(double *)v4.m128i_i64 - (double)Browser_window[0];
*(double *)&v4.m128i_i64[1] = *(double *)&v4.m128i_i64[1] - v1;
result = CTab_Mouse_Event(&sb_tab, &v3);
}
return result;
}

original_code:
qbool Menu_MultiPlayer_Mouse_Event(const mouse_state_t *ms)
{
 mouse_state_t nms = *ms;
    if (ms->button_up == 2) {
        Menu_MultiPlayer_Key(K_MOUSE2, 0);
        return true;
    }
 nms.x -= Browser_window.x;
 nms.y -= Browser_window.y;
 nms.x_old -= Browser_window.x;
 nms.y_old -= Browser_window.y;
 return CTab_Mouse_Event(&sb_tab, &nms);
}

canonical_original_code:
enum qbool Menu_MultiPlayer_Mouse_Event(struct mouse_state_s *ms)
{
 struct mouse_state_s nms = *ms;
    if (ms->button_up == 2) {
        Menu_MultiPlayer_Key(K_MOUSE2, 0);
        return true;
    }
 nms.x -= Browser_window.x;
 nms.y -= Browser_window.y;
 nms.x_old -= Browser_window.x;
 nms.y_old -= Browser_window.y;
 return CTab_Mouse_Event(&sb_tab, &nms);
}

variable_types: struct mouse_state_s { double x; double y; double x_old; double y_old; enum qbool { false=0, true=1 } buttons[9]; int button_down; int button_up; }


decompiled_code:
__int64 Menu_CG_DM_StartGame()
{
__int64 v0; // rdx
__int64 v1; // rsi
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax

Cbuf_AddText("disconnect; gamedir qw; coop 0; sv_progsname qwprogs;\n");
if ( DM_game_mode_var == 2 )
{
v0 = 2LL;
v1 = 1LL;
}
else
{
v0 = 0LL;
v1 = (unsigned int)(DM_game_mode_var == 3) + 3;
}
v2 = va("deathmatch %d;teamplay %d\n", v1, v0);
Cbuf_AddText(v2);
v3 = va("maxclients %d;maxspectators %d\n", (unsigned int)dm_maxplayers, (unsigned int)dm_maxspectators);
Cbuf_AddText(v3);
v4 = va("timelimit %d;fraglimit %d\n", (unsigned int)dm_timelimit, (unsigned int)dm_fraglimit);
Cbuf_AddText(v4);
Cbuf_AddText("map dm4\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func12()
{
__int64 v0; // rdx
__int64 v1; // rsi
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax

Cbuf_AddText("disconnect; gamedir qw; coop 0; sv_progsname qwprogs;\n");
if ( DM_game_mode_var == 2 )
{
v0 = 2LL;
v1 = 1LL;
}
else
{
v0 = 0LL;
v1 = (unsigned int)(DM_game_mode_var == 3) + 3;
}
v2 = va("deathmatch %d;teamplay %d\n", v1, v0);
Cbuf_AddText(v2);
v3 = va("maxclients %d;maxspectators %d\n", (unsigned int)dm_maxplayers, (unsigned int)dm_maxspectators);
Cbuf_AddText(v3);
v4 = va("timelimit %d;fraglimit %d\n", (unsigned int)dm_timelimit, (unsigned int)dm_fraglimit);
Cbuf_AddText(v4);
Cbuf_AddText("map dm4\n");
return M_LeaveMenus();
}

original_code:
void Menu_CG_DM_StartGame(void)
{
 int dm;
 int tp;
 Cbuf_AddText("disconnect; gamedir qw; coop 0; sv_progsname qwprogs;\n");
 switch (DM_game_mode_var) {
  case DMGM_ffa: tp = 0; dm = 3; break;
  case DMGM_duel: tp = 0; dm = 3; break;
  case DMGM_tp: tp = 2; dm = 1; break;
  case DMGM_arena: tp = 0; dm = 4; break;
  default: tp = 0; dm = 3; break;
 }
 Cbuf_AddText(va("deathmatch %d;teamplay %d\n",dm,tp));
 Cbuf_AddText(va("maxclients %d;maxspectators %d\n",dm_maxplayers,dm_maxspectators));
 Cbuf_AddText(va("timelimit %d;fraglimit %d\n",dm_timelimit,dm_fraglimit));
 Cbuf_AddText("map dm4\n");
 M_LeaveMenus();
}

canonical_original_code:
void Menu_CG_DM_StartGame()
{
 int dm;
 int tp;
 Cbuf_AddText("disconnect; gamedir qw; coop 0; sv_progsname qwprogs;\n");
 switch (DM_game_mode_var) {
  case DMGM_ffa: tp = 0; dm = 3; break;
  case DMGM_duel: tp = 0; dm = 3; break;
  case DMGM_tp: tp = 2; dm = 1; break;
  case DMGM_arena: tp = 0; dm = 4; break;
  default: tp = 0; dm = 3; break;
 }
 Cbuf_AddText(va("deathmatch %d;teamplay %d\n",dm,tp));
 Cbuf_AddText(va("maxclients %d;maxspectators %d\n",dm_maxplayers,dm_maxspectators));
 Cbuf_AddText(va("timelimit %d;fraglimit %d\n",dm_timelimit,dm_fraglimit));
 Cbuf_AddText("map dm4\n");
 M_LeaveMenus();
}

variable_types: dm int

variable_types: tp int


decompiled_code:
__int64 Menu_CG_Coop_StartGame()
{
unsigned int v0; // ebx
unsigned int v1; // ebp
__int64 v2; // rdi

v0 = 1 - ((cg_teamdamage_var == 0) - 1);
v1 = game_skill_var;
Cbuf_AddText("disconnect; sv_progsname spprogs; gamedir qw; coop 1; deathmatch 0\n");
v2 = va("teamplay %d; skill %d;maxclients %d;map start", v0, v1, (unsigned int)coopmaxplayers);
Cbuf_AddText(v2);
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func13()
{
unsigned int v0; // ebx
unsigned int v1; // ebp
__int64 v2; // rdi

v0 = 1 - ((cg_teamdamage_var == 0) - 1);
v1 = game_skill_var;
Cbuf_AddText("disconnect; sv_progsname spprogs; gamedir qw; coop 1; deathmatch 0\n");
v2 = va("teamplay %d; skill %d;maxclients %d;map start", v0, v1, (unsigned int)coopmaxplayers);
Cbuf_AddText(v2);
return M_LeaveMenus();
}

original_code:
void Menu_CG_Coop_StartGame(void)
{
 int tp = (cg_teamdamage_var == TD_OFF) ? 1 : 2;
 int skill = game_skill_var;
 Cbuf_AddText("disconnect; sv_progsname spprogs; gamedir qw; coop 1; deathmatch 0\n");
 Cbuf_AddText(va("teamplay %d; skill %d;maxclients %d;map start",
     tp,skill,coopmaxplayers));
 M_LeaveMenus();
}

canonical_original_code:
void Menu_CG_Coop_StartGame()
{
 int tp = (cg_teamdamage_var == TD_OFF) ? 1 : 2;
 int skill = game_skill_var;
 Cbuf_AddText("disconnect; sv_progsname spprogs; gamedir qw; coop 1; deathmatch 0\n");
 Cbuf_AddText(va("teamplay %d; skill %d;maxclients %d;map start",
     tp,skill,coopmaxplayers));
 M_LeaveMenus();
}

variable_types: skill int


decompiled_code:
__int64 Servers_OnShow()
{
return SB_Servers_OnShow();
}

canonical_decompiled_code:
__int64 func16()
{
return SB_Servers_OnShow();
}

original_code:
static void Servers_OnShow(void)
{
 SB_Servers_OnShow();
}

canonical_original_code:
static void Servers_OnShow()
{
 SB_Servers_OnShow();
}


decompiled_code:
__int64 Menu_MultiPlayer_Draw()
{
unsigned int v0; // esi
int v1; // ecx
int v2; // ecx
unsigned int v3; // edx
int v4; // er8
int v5; // er8

M_Unscale_Menu();
v0 = vid[7];
v1 = 640;
if ( v0 <= 0x280 )
v1 = vid[7];
v2 = v1 - 8;
v3 = vid[9];
v4 = 480;
if ( v3 <= 0x1E0 )
v4 = vid[9];
v5 = v4 - 8;
Browser_window[0] = (v0 - v2) >> 1;
Browser_window[1] = (v3 - v5) >> 1;
Browser_window[2] = v2;
Browser_window[3] = v5;
CTab_Draw(&sb_tab);
return SB_Specials_Draw();
}

canonical_decompiled_code:
__int64 func31()
{
unsigned int v0; // esi
int v1; // ecx
int v2; // ecx
unsigned int v3; // edx
int v4; // er8
int v5; // er8

M_Unscale_Menu();
v0 = vid[7];
v1 = 640;
if ( v0 <= 0x280 )
v1 = vid[7];
v2 = v1 - 8;
v3 = vid[9];
v4 = 480;
if ( v3 <= 0x1E0 )
v4 = vid[9];
v5 = v4 - 8;
Browser_window[0] = (v0 - v2) >> 1;
Browser_window[1] = (v3 - v5) >> 1;
Browser_window[2] = v2;
Browser_window[3] = v5;
CTab_Draw(&sb_tab);
return SB_Specials_Draw();
}

original_code:
void Menu_MultiPlayer_Draw (void)
{
 int x, y, w, h;
 M_Unscale_Menu();
 w = ((640) < (vid.width) ? (640) : (vid.width)) - 4*2;
 h = ((480) < (vid.height) ? (480) : (vid.height)) - 4*2;
 x = (vid.width - w) / 2;
 y = (vid.height - h) / 2;
 Browser_window.x = x;
 Browser_window.y = y;
 Browser_window.w = w;
 Browser_window.h = h;
 CTab_Draw(&sb_tab, x, y, w, h);
 SB_Specials_Draw();
}

canonical_original_code:
void Menu_MultiPlayer_Draw()
{
 int x; int y; int w; int h;
 M_Unscale_Menu();
 w = ((640) < (vid.width) ? (640) : (vid.width)) - 4*2;
 h = ((480) < (vid.height) ? (480) : (vid.height)) - 4*2;
 x = (vid.width - w) / 2;
 y = (vid.height - h) / 2;
 Browser_window.x = x;
 Browser_window.y = y;
 Browser_window.w = w;
 Browser_window.h = h;
 CTab_Draw(&sb_tab, x, y, w, h);
 SB_Specials_Draw();
}


decompiled_code:
__int64 Menu_MultiPlayer_Init()
{
Settings_Init(&sbsettings, &sbsettings_arr, 27LL);
Settings_Init(&create_game_options, &create_game_options_arr, 17LL);
CTab_Init(&sb_tab);
CTab_AddPage(&sb_tab, "Servers", 0LL, sb_servers_handlers);
CTab_AddPage(&sb_tab, "Sources", 1LL, sb_sources_handlers);
CTab_AddPage(&sb_tab, "Players", 2LL, sb_players_handlers);
CTab_AddPage(&sb_tab, "Options", 3LL, sb_options_handlers);
CTab_AddPage(&sb_tab, "Create", 4LL, sb_creategame_handlers);
return CTab_SetCurrentId(&sb_tab, 0LL);
}

canonical_decompiled_code:
__int64 func34()
{
Settings_Init(&sbsettings, &sbsettings_arr, 27LL);
Settings_Init(&create_game_options, &create_game_options_arr, 17LL);
CTab_Init(&sb_tab);
CTab_AddPage(&sb_tab, "Servers", 0LL, sb_servers_handlers);
CTab_AddPage(&sb_tab, "Sources", 1LL, sb_sources_handlers);
CTab_AddPage(&sb_tab, "Players", 2LL, sb_players_handlers);
CTab_AddPage(&sb_tab, "Options", 3LL, sb_options_handlers);
CTab_AddPage(&sb_tab, "Create", 4LL, sb_creategame_handlers);
return CTab_SetCurrentId(&sb_tab, 0LL);
}

original_code:
void Menu_MultiPlayer_Init()
{
 Settings_Init(&sbsettings, sbsettings_arr, sizeof(sbsettings_arr) / sizeof(setting));
 Settings_Init(&create_game_options, create_game_options_arr, sizeof(create_game_options_arr) / sizeof(setting));
 CTab_Init(&sb_tab);
 CTab_AddPage(&sb_tab, "Servers", SBPG_SERVERS, &sb_servers_handlers);
 CTab_AddPage(&sb_tab, "Sources", SBPG_SOURCES, &sb_sources_handlers);
 CTab_AddPage(&sb_tab, "Players", SBPG_PLAYERS, &sb_players_handlers);
 CTab_AddPage(&sb_tab, "Options", SBPG_OPTIONS, &sb_options_handlers);
 CTab_AddPage(&sb_tab, "Create", SBPG_CREATEGAME, &sb_creategame_handlers);
 CTab_SetCurrentId(&sb_tab, SBPG_SERVERS);
}


decompiled_code:
__int64 Menu_MultiPlayer_SwitchToServersTab()
{
M_EnterMenu(4LL);
return CTab_SetCurrentId(&sb_tab, 0LL);
}

canonical_decompiled_code:
__int64 func35()
{
M_EnterMenu(4LL);
return CTab_SetCurrentId(&sb_tab, 0LL);
}

original_code:
void Menu_MultiPlayer_SwitchToServersTab(void)
{
 M_EnterMenu(m_multiplayer);
 CTab_SetCurrentId(&sb_tab, SBPG_SERVERS);
}

canonical_original_code:
void Menu_MultiPlayer_SwitchToServersTab()
{
 M_EnterMenu(m_multiplayer);
 CTab_SetCurrentId(&sb_tab, SBPG_SERVERS);
}


decompiled_code:
__int64 MIng_Options()
{
return Cbuf_AddText("menu_options\n");
}

canonical_decompiled_code:
__int64 func3()
{
return Cbuf_AddText("menu_options\n");
}

original_code: static void MIng_Options(void) { Cbuf_AddText("menu_options" "\n"); if (false) M_LeaveMenus(); }

canonical_original_code: static void MIng_Options() { Cbuf_AddText("menu_options" "\n"); if (false) M_LeaveMenus(); }


decompiled_code:
__int64 MIng_ServerBrowser()
{
return Cbuf_AddText("menu_slist\n");
}

canonical_decompiled_code:
__int64 func4()
{
return Cbuf_AddText("menu_slist\n");
}

original_code: static void MIng_ServerBrowser(void) { Cbuf_AddText("menu_slist" "\n"); if (false) M_LeaveMenus(); }

canonical_original_code: static void MIng_ServerBrowser() { Cbuf_AddText("menu_slist" "\n"); if (false) M_LeaveMenus(); }


decompiled_code:
__int64 MIng_Disconnect()
{
Cbuf_AddText("disconnect\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func5()
{
Cbuf_AddText("disconnect\n");
return M_LeaveMenus();
}

original_code: static void MIng_Disconnect(void) { Cbuf_AddText("disconnect" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MIng_Disconnect() { Cbuf_AddText("disconnect" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MIng_Observe()
{
Cbuf_AddText("observe\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func6()
{
Cbuf_AddText("observe\n");
return M_LeaveMenus();
}

original_code: static void MIng_Observe(void) { Cbuf_AddText("observe" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MIng_Observe() { Cbuf_AddText("observe" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MIng_Join()
{
Cbuf_AddText("join\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func7()
{
Cbuf_AddText("join\n");
return M_LeaveMenus();
}

original_code: static void MIng_Join(void) { Cbuf_AddText("join" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MIng_Join() { Cbuf_AddText("join" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MIng_Break()
{
Cbuf_AddText("break\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func8()
{
Cbuf_AddText("break\n");
return M_LeaveMenus();
}

original_code: static void MIng_Break(void) { Cbuf_AddText("break" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MIng_Break() { Cbuf_AddText("break" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MIng_Ready()
{
Cbuf_AddText("ready\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func9()
{
Cbuf_AddText("ready\n");
return M_LeaveMenus();
}

original_code: static void MIng_Ready(void) { Cbuf_AddText("ready" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MIng_Ready() { Cbuf_AddText("ready" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MDemoCtrl_DemoBrowser()
{
return Cbuf_AddText("menu_demos\n");
}

canonical_decompiled_code:
__int64 func10()
{
return Cbuf_AddText("menu_demos\n");
}

original_code: static void MDemoCtrl_DemoBrowser(void) { Cbuf_AddText("menu_demos" "\n"); if (false) M_LeaveMenus(); }

canonical_original_code: static void MDemoCtrl_DemoBrowser() { Cbuf_AddText("menu_demos" "\n"); if (false) M_LeaveMenus(); }


decompiled_code:
__int64 MDemoCtrl_DemoControls()
{
Cbuf_AddText("demo_controls\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func11()
{
Cbuf_AddText("demo_controls\n");
return M_LeaveMenus();
}

original_code: static void MDemoCtrl_DemoControls(void) { Cbuf_AddText("demo_controls" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MDemoCtrl_DemoControls() { Cbuf_AddText("demo_controls" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MQTV_Autotrack()
{
Cbuf_AddText("autotrack\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func12()
{
Cbuf_AddText("autotrack\n");
return M_LeaveMenus();
}

original_code: static void MQTV_Autotrack(void) { Cbuf_AddText("autotrack" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MQTV_Autotrack() { Cbuf_AddText("autotrack" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MQTV_Reconnect()
{
Cbuf_AddText("qtvreconnect\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func13()
{
Cbuf_AddText("qtvreconnect\n");
return M_LeaveMenus();
}

original_code: static void MQTV_Reconnect(void) { Cbuf_AddText("qtvreconnect" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MQTV_Reconnect() { Cbuf_AddText("qtvreconnect" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MQTV_Observers()
{
Cbuf_AddText("qtvusers\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func14()
{
Cbuf_AddText("qtvusers\n");
return M_LeaveMenus();
}

original_code: static void MQTV_Observers(void) { Cbuf_AddText("qtvusers" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MQTV_Observers() { Cbuf_AddText("qtvusers" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 MQTV_Lastscores()
{
Cbuf_AddText("lastscores\n");
return M_LeaveMenus();
}

canonical_decompiled_code:
__int64 func15()
{
Cbuf_AddText("lastscores\n");
return M_LeaveMenus();
}

original_code: static void MQTV_Lastscores(void) { Cbuf_AddText("lastscores" "\n"); if (true) M_LeaveMenus(); }

canonical_original_code: static void MQTV_Lastscores() { Cbuf_AddText("lastscores" "\n"); if (true) M_LeaveMenus(); }


decompiled_code:
__int64 M_Ingame_Draw()
{
void *v0; // rax

M_Unscale_Menu();
v0 = M_Ingame_Current();
return Settings_Draw(0LL, 48LL, vid[7], vid[9] - 48, v0);
}

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

M_Unscale_Menu();
v0 = func0();
return Settings_Draw(0LL, 48LL, vid[7], vid[9] - 48, v0);
}

original_code:
void M_Ingame_Draw(void) {
 M_Unscale_Menu();
 Settings_Draw(0, (6*8), vid.width, vid.height - (6*8), M_Ingame_Current());
}

canonical_original_code:
void M_Ingame_Draw() {
 M_Unscale_Menu();
 Settings_Draw(0, (6*8), vid.width, vid.height - (6*8), M_Ingame_Current());
}


original_code:
qbool Menu_Ingame_Mouse_Event(const mouse_state_t *ms) {
 mouse_state_t m = *ms;
 m.y -= (6*8);
 return Settings_Mouse_Event(M_Ingame_Current(), &m);
}

canonical_original_code:
enum qbool Menu_Ingame_Mouse_Event(struct mouse_state_s *ms) {
 struct mouse_state_s m = *ms;
 m.y -= (6*8);
 return Settings_Mouse_Event(M_Ingame_Current(), &m);
}


decompiled_code:
__int64 MIng_MainMenu()
{
return M_Menu_Main_f();
}

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

original_code: void MIng_MainMenu(void) { M_Menu_Main_f(); }

canonical_original_code: void MIng_MainMenu() { M_Menu_Main_f(); }


decompiled_code:
__int64 MIng_Back()
{
return M_LeaveMenus();
}

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

original_code: void MIng_Back(void) { M_LeaveMenus(); }

canonical_original_code: void MIng_Back() { M_LeaveMenus(); }


decompiled_code:
__int64 __fastcall M_Ingame_Key(unsigned int a1)
{
void *v1; // rax
__int64 result; // rax

v1 = M_Ingame_Current();
result = Settings_Key(v1, a1, 0LL);
if ( !(_DWORD)result && (a1 == 27 || a1 == 201) )
result = M_LeaveMenus();
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(unsigned int a1)
{
void *v1; // rax
__int64 result; // rax

v1 = func0();
result = Settings_Key(v1, a1, 0LL);
if ( !(_DWORD)result && (a1 == 27 || a1 == 201) )
result = M_LeaveMenus();
return result;
}

original_code:
void M_Ingame_Key(int key) {
 if (Settings_Key(M_Ingame_Current(), key, 0)) return;
 switch (key) {
 case K_MOUSE2:
 case K_ESCAPE: M_LeaveMenus(); break;
 }
}


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

Settings_Init(single_menu, &single_menu_entries, 5LL);
single_menu[11] = 1;
Settings_Init(ingame_menu, &ingame_menu_entries, 12LL);
ingame_menu[11] = 1;
Settings_Init(democtrl_menu, &democtrl_menu_entries, 11LL);
democtrl_menu[11] = 1;
result = Settings_Init(qtv_menu, &qtv_menu_entries, 12LL);
qtv_menu[11] = 1;
return result;
}

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

Settings_Init(single_menu, &single_menu_entries, 5LL);
single_menu[11] = 1;
Settings_Init(ingame_menu, &ingame_menu_entries, 12LL);
ingame_menu[11] = 1;
Settings_Init(democtrl_menu, &democtrl_menu_entries, 11LL);
democtrl_menu[11] = 1;
result = Settings_Init(qtv_menu, &qtv_menu_entries, 12LL);
qtv_menu[11] = 1;
return result;
}

original_code:
void Menu_Ingame_Init(void)
{
 Settings_Init(&single_menu, single_menu_entries, sizeof(single_menu_entries) / sizeof(setting));
 { single_menu.mini = true; };
 Settings_Init(&ingame_menu, ingame_menu_entries, sizeof(ingame_menu_entries) / sizeof(setting));
 { ingame_menu.mini = true; };
 Settings_Init(&democtrl_menu, democtrl_menu_entries, sizeof(democtrl_menu_entries) / sizeof(setting));
 { democtrl_menu.mini = true; };
 Settings_Init(&qtv_menu, qtv_menu_entries, sizeof(qtv_menu_entries) / sizeof(setting));
 { qtv_menu.mini = true; };
}

canonical_original_code:
void Menu_Ingame_Init()
{
 Settings_Init(&single_menu, single_menu_entries, sizeof(single_menu_entries) / sizeof(setting));
 { single_menu.mini = true; };
 Settings_Init(&ingame_menu, ingame_menu_entries, sizeof(ingame_menu_entries) / sizeof(setting));
 { ingame_menu.mini = true; };
 Settings_Init(&democtrl_menu, democtrl_menu_entries, sizeof(democtrl_menu_entries) / sizeof(setting));
 { democtrl_menu.mini = true; };
 Settings_Init(&qtv_menu, qtv_menu_entries, sizeof(qtv_menu_entries) / sizeof(setting));
 { qtv_menu.mini = true; };
}


decompiled_code:
char Amf_SetMode_f()
{
const char *v0; // rax
char result; // al
const char *v2; // rax
bool v3; // cf
bool v4; // zf
const char *v5; // rdi
__int64 v6; // rcx
char *v7; // rsi
char v8; // al
bool v9; // cf
bool v10; // zf
char *v11; // rsi
const char *v12; // rdi
__int64 v13; // rcx
char v14[40]; // [rsp+0h] [rbp-28h] BYREF

if ( (unsigned int)Cmd_Argc() == 2 )
{
v2 = (const char *)Cmd_Argv(1LL);
snprintf(v14, 0x20uLL, "%s", v2);
v5 = "newtrails";
v6 = 10LL;
v7 = v14;
do
{
if ( !v6 )
break;
v3 = (unsigned __int8)*v7 < (unsigned int)*v5;
v4 = *v7++ == *v5++;
--v6;
}
while ( v4 );
v8 = (!v3 && !v4) - v3;
v9 = 0;
v10 = v8 == 0;
if ( v8 )
{
v11 = v14;
v12 = "vultwah";
v13 = 8LL;
do
{
if ( !v13 )
break;
v9 = (unsigned __int8)*v11 < (unsigned int)*v12;
v10 = *v11++ == *v12++;
--v13;
}
while ( v10 );
result = (!v9 && !v10) - v9;
if ( !result )
{
Cvar_SetValue(amf_showstats, v11, 1.0);
Cvar_SetValue(amf_part_spikes, v11, 1.0);
Cvar_SetValue(amf_part_gunshot, v11, 0.5);
Cvar_SetValue(amf_part_explosion, v11, 1.0);
Cvar_SetValue(amf_part_blobexplosion, v11, 0.5);
result = Cvar_SetValue(&gl_bounceparticles, v11, 0.0);
}
}
else
{
Cvar_SetValue(amf_buildingsparks, v7, 3.0);
Cvar_SetValue(amf_weather_rain, v7, 0.0);
Cvar_SetValue(amf_lightning_sparks, v7, 3.0);
Cvar_SetValue(amf_part_spikes, v7, 5.0);
Cvar_SetValue(amf_part_gunshot, v7, 5.0);
Cvar_SetValue(amf_part_explosion, v7, 5.0);
Cvar_SetValue(amf_part_traillen, v7, 1.0);
Cvar_SetValue(amf_part_trailtime, v7, 1.5);
Cvar_SetValue(amf_part_sparks, v7, 1.0);
Cvar_SetValue(amf_nailtrail_plasma, v7, 0.0);
Cvar_SetValue(amf_part_traillen, v7, 1.0);
Cvar_SetValue(amf_part_gunshot_type, v7, 1.0);
Cvar_SetValue(amf_part_spikes_type, v7, 1.0);
Cvar_SetValue(amf_part_trailwidth, v7, 3.0);
Cvar_SetValue(amf_part_traildetail, v7, 1.0);
Cvar_SetValue(amf_part_trailtype, v7, 2.0);
result = Cvar_SetValue(&gl_bounceparticles, v7, 1.0);
}
}
else
{
v0 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("Usage: %s [modename]\n", v0);
}
return result;
}

canonical_decompiled_code:
char func0()
{
const char *v0; // rax
char result; // al
const char *v2; // rax
bool v3; // cf
bool v4; // zf
const char *v5; // rdi
__int64 v6; // rcx
char *v7; // rsi
char v8; // al
bool v9; // cf
bool v10; // zf
char *v11; // rsi
const char *v12; // rdi
__int64 v13; // rcx
char v14[40]; // [rsp+0h] [rbp-28h] BYREF

if ( (unsigned int)Cmd_Argc() == 2 )
{
v2 = (const char *)Cmd_Argv(1LL);
snprintf(v14, 0x20uLL, "%s", v2);
v5 = "newtrails";
v6 = 10LL;
v7 = v14;
do
{
if ( !v6 )
break;
v3 = (unsigned __int8)*v7 < (unsigned int)*v5;
v4 = *v7++ == *v5++;
--v6;
}
while ( v4 );
v8 = (!v3 && !v4) - v3;
v9 = 0;
v10 = v8 == 0;
if ( v8 )
{
v11 = v14;
v12 = "vultwah";
v13 = 8LL;
do
{
if ( !v13 )
break;
v9 = (unsigned __int8)*v11 < (unsigned int)*v12;
v10 = *v11++ == *v12++;
--v13;
}
while ( v10 );
result = (!v9 && !v10) - v9;
if ( !result )
{
Cvar_SetValue(amf_showstats, v11, 1.0);
Cvar_SetValue(amf_part_spikes, v11, 1.0);
Cvar_SetValue(amf_part_gunshot, v11, 0.5);
Cvar_SetValue(amf_part_explosion, v11, 1.0);
Cvar_SetValue(amf_part_blobexplosion, v11, 0.5);
result = Cvar_SetValue(&gl_bounceparticles, v11, 0.0);
}
}
else
{
Cvar_SetValue(amf_buildingsparks, v7, 3.0);
Cvar_SetValue(amf_weather_rain, v7, 0.0);
Cvar_SetValue(amf_lightning_sparks, v7, 3.0);
Cvar_SetValue(amf_part_spikes, v7, 5.0);
Cvar_SetValue(amf_part_gunshot, v7, 5.0);
Cvar_SetValue(amf_part_explosion, v7, 5.0);
Cvar_SetValue(amf_part_traillen, v7, 1.0);
Cvar_SetValue(amf_part_trailtime, v7, 1.5);
Cvar_SetValue(amf_part_sparks, v7, 1.0);
Cvar_SetValue(amf_nailtrail_plasma, v7, 0.0);
Cvar_SetValue(amf_part_traillen, v7, 1.0);
Cvar_SetValue(amf_part_gunshot_type, v7, 1.0);
Cvar_SetValue(amf_part_spikes_type, v7, 1.0);
Cvar_SetValue(amf_part_trailwidth, v7, 3.0);
Cvar_SetValue(amf_part_traildetail, v7, 1.0);
Cvar_SetValue(amf_part_trailtype, v7, 2.0);
result = Cvar_SetValue(&gl_bounceparticles, v7, 1.0);
}
}
else
{
v0 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("Usage: %s [modename]\n", v0);
}
return result;
}

original_code:
void Amf_SetMode_f(void)
{
 char mode[32];
 if (Cmd_Argc() != 2)
 {
  Com_Printf("Usage: %s [modename]\n", Cmd_Argv(0));
  return;
 }
 snprintf(mode, sizeof (mode), "%s", Cmd_Argv(1));
 if (!strcmp(mode, "newtrails"))
 {
   Cvar_SetValue (&amf_buildingsparks, 3);
   Cvar_SetValue (&amf_weather_rain, 0);
   Cvar_SetValue (&amf_lightning_sparks, 3);
   Cvar_SetValue (&amf_part_spikes, 5);
   Cvar_SetValue (&amf_part_gunshot, 5);
   Cvar_SetValue (&amf_part_explosion, 5);
   Cvar_SetValue (&amf_part_traillen, 1);
   Cvar_SetValue (&amf_part_trailtime, 1.5);
   Cvar_SetValue (&amf_part_sparks, 1);
   Cvar_SetValue (&amf_nailtrail_plasma, 0);
   Cvar_SetValue (&amf_part_traillen, 1);
   Cvar_SetValue (&amf_part_gunshot_type, 1);
   Cvar_SetValue (&amf_part_spikes_type, 1);
   Cvar_SetValue (&amf_part_trailwidth, 3);
   Cvar_SetValue (&amf_part_traildetail, 1);
   Cvar_SetValue (&amf_part_trailtype, 2);
   Cvar_SetValue (&gl_bounceparticles, 1);
 }
 else if (!strcmp(mode, "vultwah"))
 {
  Cvar_SetValue (&amf_showstats, 1);
  Cvar_SetValue (&amf_part_spikes, 1);
  Cvar_SetValue (&amf_part_gunshot, 0.5);
  Cvar_SetValue (&amf_part_explosion, 1);
  Cvar_SetValue (&amf_part_blobexplosion, 0.5);
  Cvar_SetValue (&gl_bounceparticles, 0);
 }
}

canonical_original_code:
void Amf_SetMode_f()
{
 char mode[32];
 if (Cmd_Argc() != 2)
 {
  Com_Printf("Usage: %s [modename]\n", Cmd_Argv(0));
  return;
 }
 snprintf(mode, sizeof (mode), "%s", Cmd_Argv(1));
 if (!strcmp(mode, "newtrails"))
 {
   Cvar_SetValue (&amf_buildingsparks, 3);
   Cvar_SetValue (&amf_weather_rain, 0);
   Cvar_SetValue (&amf_lightning_sparks, 3);
   Cvar_SetValue (&amf_part_spikes, 5);
   Cvar_SetValue (&amf_part_gunshot, 5);
   Cvar_SetValue (&amf_part_explosion, 5);
   Cvar_SetValue (&amf_part_traillen, 1);
   Cvar_SetValue (&amf_part_trailtime, 1.5);
   Cvar_SetValue (&amf_part_sparks, 1);
   Cvar_SetValue (&amf_nailtrail_plasma, 0);
   Cvar_SetValue (&amf_part_traillen, 1);
   Cvar_SetValue (&amf_part_gunshot_type, 1);
   Cvar_SetValue (&amf_part_spikes_type, 1);
   Cvar_SetValue (&amf_part_trailwidth, 3);
   Cvar_SetValue (&amf_part_traildetail, 1);
   Cvar_SetValue (&amf_part_trailtype, 2);
   Cvar_SetValue (&gl_bounceparticles, 1);
 }
 else if (!strcmp(mode, "vultwah"))
 {
  Cvar_SetValue (&amf_showstats, 1);
  Cvar_SetValue (&amf_part_spikes, 1);
  Cvar_SetValue (&amf_part_gunshot, 0.5);
  Cvar_SetValue (&amf_part_explosion, 1);
  Cvar_SetValue (&amf_part_blobexplosion, 0.5);
  Cvar_SetValue (&gl_bounceparticles, 0);
 }
}

variable_types:
mode
char [32]


decompiled_code:
int __fastcall QW_strncmp(char *s1, char *s2)
{
size_t v2; // rax

v2 = strlen(s2);
return strncmp(s1, s2, v2);
}

canonical_decompiled_code:
int __fastcall func2(char *s1, char *s2)
{
size_t v2; // rax

v2 = strlen(s2);
return strncmp(s1, s2, v2);
}

original_code:
int QW_strncmp (char *s1, char *s2)
{
 return strncmp(s1, s2, strlen(s2));
}

canonical_original_code:
int QW_strncmp(char *s1, char *s2)
{
 return strncmp(s1, s2, strlen(s2));
}


decompiled_code:
char **__fastcall TP_GetModels(char *a1)
{
char *v1; // rbp
char **v2; // rbx

v1 = TP_ConvertToWhiteText(a1);
v2 = tp_checkmodels;
while ( !strstr(v1, *v2) )
{
v2 += 4;
if ( v2 == &tp_checkmodels[76] )
return 0LL;
}
return v2;
}

canonical_decompiled_code:
char **__fastcall func4(char *a1)
{
char *v1; // rbp
char **v2; // rbx

v1 = func3(a1);
v2 = tp_checkmodels;
while ( !strstr(v1, *v2) )
{
v2 += 4;
if ( v2 == &tp_checkmodels[76] )
return 0LL;
}
return v2;
}

original_code:
checkmodel_t *TP_GetModels (char *s)
{
 unsigned int i;
 char *f = TP_ConvertToWhiteText(s);
 checkmodel_t *model = tp_checkmodels;
 for (i = 0, model = tp_checkmodels; i < (sizeof(tp_checkmodels) / sizeof(tp_checkmodels[0])); i++, model++) {
  if (strstr(f, model->number)) {
   return model;
  }
 }
 return ((void *)0);
}

canonical_original_code:
struct checkmodel_t *TP_GetModels(char *s)
{
 unsigned int i;
 char *f = TP_ConvertToWhiteText(s);
 struct checkmodel_t *model = tp_checkmodels;
 for (i = 0, model = tp_checkmodels; i < (sizeof(tp_checkmodels) / sizeof(tp_checkmodels[0])); i++, model++) {
  if (strstr(f, model->number)) {
   return model;
  }
 }
 return ((void *)0);
}

variable_types:
s
char *

variable_types:
i
unsigned int

variable_types:
f
char *

variable_types: struct checkmodel_t { char *number; char *name; char *description; enum qbool { false=0, true=1 } notify; } *

user_defined_types: struct checkmodel_t { char *number; char *name; char *description; enum qbool notify; }


decompiled_code:
void CheckModels_f()
{
__int64 v0; // rbx
const char *v1; // rax
const char *v2; // rbp
const char *v3; // rax
const char *v4; // rax
const char *v5; // rbp
const char *v6; // rax
const char *v7; // rbp
const char *v8; // rax
char *v9; // rax
char **v10; // rax
char **v11; // rbp
const char *v12; // rbp
const char *v13; // rax
char *v14; // rax
char **v15; // rax
char **v16; // rbp

v0 = (unsigned int)((_DWORD)&dword_4E68 + 1394300);
do
{
if ( *(_BYTE *)(v0 + 1024) )
{
v9 = (char *)Info_ValueForKey(v0, "pmodel");
v10 = TP_GetModels(v9);
v11 = v10;
if ( v10 )
{
if ( *((_DWORD *)v10 + 6) || !QW_strncmp(*v10, "6967") )
{
v12 = v11[1];
v13 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has suspicious player model (%s)\n", v13, v12);
}
}
else if ( *(_BYTE *)Info_ValueForKey(v0, "pmodel") )
{
v2 = (const char *)Info_ValueForKey(v0, "pmodel");
v3 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has suspicious player model (Unknown Model: %s)\n", v3, v2);
}
else
{
v1 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has hidden pmodel\n", v1);
}
v14 = (char *)Info_ValueForKey(v0, "emodel");
v15 = TP_GetModels(v14);
v16 = v15;
if ( v15 )
{
if ( *((_DWORD *)v15 + 6) || QW_strncmp(*v15, "6967") )
{
v7 = v16[1];
v8 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has ILLEGAL eyes model (%s)\n", v8, v7);
}
}
else if ( *(_BYTE *)Info_ValueForKey(v0, "emodel") )
{
v5 = (const char *)Info_ValueForKey(v0, "emodel");
v6 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has ILLEGAL eyes model (Unknown Model: %s)\n", v6, v5);
}
else
{
v4 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has hidden emodel\n", v4);
}
}
v0 += 19720LL;
}
while ( v0 != (_DWORD)&dword_4E68 + 2025340 );
}

canonical_decompiled_code:
void func5()
{
__int64 v0; // rbx
const char *v1; // rax
const char *v2; // rbp
const char *v3; // rax
const char *v4; // rax
const char *v5; // rbp
const char *v6; // rax
const char *v7; // rbp
const char *v8; // rax
char *v9; // rax
char **v10; // rax
char **v11; // rbp
const char *v12; // rbp
const char *v13; // rax
char *v14; // rax
char **v15; // rax
char **v16; // rbp

v0 = (unsigned int)((_DWORD)&dword_4E68 + 1394300);
do
{
if ( *(_BYTE *)(v0 + 1024) )
{
v9 = (char *)Info_ValueForKey(v0, "pmodel");
v10 = func4(v9);
v11 = v10;
if ( v10 )
{
if ( *((_DWORD *)v10 + 6) || !func2(*v10, "6967") )
{
v12 = v11[1];
v13 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has suspicious player model (%s)\n", v13, v12);
}
}
else if ( *(_BYTE *)Info_ValueForKey(v0, "pmodel") )
{
v2 = (const char *)Info_ValueForKey(v0, "pmodel");
v3 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has suspicious player model (Unknown Model: %s)\n", v3, v2);
}
else
{
v1 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has hidden pmodel\n", v1);
}
v14 = (char *)Info_ValueForKey(v0, "emodel");
v15 = func4(v14);
v16 = v15;
if ( v15 )
{
if ( *((_DWORD *)v15 + 6) || func2(*v15, "6967") )
{
v7 = v16[1];
v8 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has ILLEGAL eyes model (%s)\n", v8, v7);
}
}
else if ( *(_BYTE *)Info_ValueForKey(v0, "emodel") )
{
v5 = (const char *)Info_ValueForKey(v0, "emodel");
v6 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has ILLEGAL eyes model (Unknown Model: %s)\n", v6, v5);
}
else
{
v4 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has hidden emodel\n", v4);
}
}
v0 += 19720LL;
}
while ( v0 != (_DWORD)&dword_4E68 + 2025340 );
}

original_code:
void CheckModels_f(void)
{
 int i;
 checkmodel_t *mod;
 for (i = 0; i < 32; i++)
 {
  if (!cl.players[i].name[0])
   continue;
  mod = TP_GetModels(Info_ValueForKey(cl.players[i].userinfo, "pmodel"));
  if (mod == ((void *)0))
  {
   if (!Info_ValueForKey(cl.players[i].userinfo, "pmodel")[0])
    Com_Printf("Warning: %s has hidden pmodel\n", Info_ValueForKey(cl.players[i].userinfo, "name"));
   else
    Com_Printf("Warning: %s has suspicious player model (Unknown Model: %s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), Info_ValueForKey(cl.players[i].userinfo, "pmodel"));
  }
  else if (mod->notify || !QW_strncmp(mod->number, "6967"))
  {
   Com_Printf("Warning: %s has suspicious player model (%s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), mod->name);
  }
  mod = TP_GetModels(Info_ValueForKey(cl.players[i].userinfo, "emodel"));
  if (mod == ((void *)0))
  {
   if (!Info_ValueForKey(cl.players[i].userinfo, "emodel")[0])
    Com_Printf("Warning: %s has hidden emodel\n", Info_ValueForKey(cl.players[i].userinfo, "name"));
   else
    Com_Printf("Warning: %s has ILLEGAL eyes model (Unknown Model: %s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), Info_ValueForKey(cl.players[i].userinfo, "emodel"));
  }
  else if (mod->notify || QW_strncmp(mod->number, "6967"))
  {
   Com_Printf("Warning: %s has ILLEGAL eyes model (%s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), mod->name);
  }
 }
}

canonical_original_code:
void CheckModels_f()
{
 int i;
 struct checkmodel_t *mod;
 for (i = 0; i < 32; i++)
 {
  if (!cl.players[i].name[0])
   continue;
  mod = TP_GetModels(Info_ValueForKey(cl.players[i].userinfo, "pmodel"));
  if (mod == ((void *)0))
  {
   if (!Info_ValueForKey(cl.players[i].userinfo, "pmodel")[0])
    Com_Printf("Warning: %s has hidden pmodel\n", Info_ValueForKey(cl.players[i].userinfo, "name"));
   else
    Com_Printf("Warning: %s has suspicious player model (Unknown Model: %s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), Info_ValueForKey(cl.players[i].userinfo, "pmodel"));
  }
  else if (mod->notify || !QW_strncmp(mod->number, "6967"))
  {
   Com_Printf("Warning: %s has suspicious player model (%s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), mod->name);
  }
  mod = TP_GetModels(Info_ValueForKey(cl.players[i].userinfo, "emodel"));
  if (mod == ((void *)0))
  {
   if (!Info_ValueForKey(cl.players[i].userinfo, "emodel")[0])
    Com_Printf("Warning: %s has hidden emodel\n", Info_ValueForKey(cl.players[i].userinfo, "name"));
   else
    Com_Printf("Warning: %s has ILLEGAL eyes model (Unknown Model: %s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), Info_ValueForKey(cl.players[i].userinfo, "emodel"));
  }
  else if (mod->notify || QW_strncmp(mod->number, "6967"))
  {
   Com_Printf("Warning: %s has ILLEGAL eyes model (%s)\n", Info_ValueForKey(cl.players[i].userinfo, "name"), mod->name);
  }
 }
}

variable_types: i int


decompiled_code:
__int64 __fastcall Draw_AMFStatLoss(int a1, __int64 a2)
{
int v2; // edx
int v3; // eax
double v4; // r12
float v5; // xmm0_4
__int64 result; // rax
double v7; // xmm0_8
double v8; // xmm1_8
double v9; // xmm0_8
unsigned int v10; // ebx
__m128i v11; // xmm5

if ( a1 )
{
vxdmgcnt_7 = (__int64)&vxdamagecountarmour;
vxdmgcnt_t_6 = (__int64)&vxdamagecountarmour_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecountarmour_oldhealth;
x_4 = 24;
}
else
{
vxdmgcnt_7 = (__int64)&vxdamagecount;
vxdmgcnt_t_6 = (__int64)&vxdamagecount_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecount_oldhealth;
x_4 = 136;
}
v2 = *((_DWORD *)&dword_4E68 + a1 + 331416);
v3 = *(_DWORD *)vxdmgcnt_o_5;
if ( v2 < *(_DWORD *)vxdmgcnt_o_5 - 1 )
{
if ( (double)*(int *)vxdmgcnt_t_6 <= *((double *)&dword_4E68 + 165751) )
*(_DWORD *)vxdmgcnt_7 = v3 - v2;
else
*(_DWORD *)vxdmgcnt_7 += v3 - v2;
v4 = *((double *)&dword_4E68 + 165751);
v5 = *(float *)&amf_stat_loss[4];
if ( a2 )
v5 = *(float *)(HUD_FindVar(a2, "duration", v5) + 32);
*(_DWORD *)vxdmgcnt_t_6 = (int)((float)(v5 + v5) + v4);
}
*(_DWORD *)vxdmgcnt_o_5 = *((_DWORD *)&dword_4E68 + a1 + 331416);
result = vxdmgcnt_t_6;
v7 = (double)*(int *)vxdmgcnt_t_6;
v8 = *((double *)&dword_4E68 + 165751);
if ( v7 > v8 )
{
v9 = v7 - v8;
v10 = LC6;
if ( v9 <= 1.0 )
{
v11 = 0LL;
*(float *)v11.m128i_i32 = v9;
v10 = _mm_cvtsi128_si32(v11);
}
glTexEnvf(8960LL, 8704LL, 8448.0);
glDisable(3008LL);
glEnable(3042LL);
glColor4f(1.0, 1.0, 1.0, *(double *)_mm_cvtsi32_si128(v10).m128i_i64);
if ( a2 )
{
if ( !scale_3 )
{
scale_3 = HUD_FindVar(a2, "scale", 1.0);
style_2 = HUD_FindVar(a2, "style", 1.0);
digits_1 = HUD_FindVar(a2, "digits", 1.0);
align_0 = HUD_FindVar(a2, "align", 1.0);
}
SCR_HUD_DrawNum(
a2,
abs32(*(_DWORD *)vxdmgcnt_7),
1LL,
(unsigned int)(int)*(float *)(style_2 + 32),
*(unsigned int *)(digits_1 + 64),
*(_QWORD *)(align_0 + 8),
*(float *)(scale_3 + 32));
}
else
{
Sbar_DrawNum((unsigned int)x_4, 4294967272LL, abs32(*(_DWORD *)vxdmgcnt_7), 3LL, *(_DWORD *)vxdmgcnt_7 > 0);
}
glEnable(3008LL);
glDisable(3042LL);
glTexEnvf(8960LL, 8704LL, 7681.0);
result = glColor4f(1.0, 1.0, 1.0, COERCE_DOUBLE((unsigned __int64)LC6));
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1, __int64 a2)
{
int v2; // edx
int v3; // eax
double v4; // r12
float v5; // xmm0_4
__int64 result; // rax
double v7; // xmm0_8
double v8; // xmm1_8
double v9; // xmm0_8
unsigned int v10; // ebx
__m128i v11; // xmm5

if ( a1 )
{
vxdmgcnt_7 = (__int64)&vxdamagecountarmour;
vxdmgcnt_t_6 = (__int64)&vxdamagecountarmour_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecountarmour_oldhealth;
x_4 = 24;
}
else
{
vxdmgcnt_7 = (__int64)&vxdamagecount;
vxdmgcnt_t_6 = (__int64)&vxdamagecount_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecount_oldhealth;
x_4 = 136;
}
v2 = *((_DWORD *)&dword_4E68 + a1 + 331416);
v3 = *(_DWORD *)vxdmgcnt_o_5;
if ( v2 < *(_DWORD *)vxdmgcnt_o_5 - 1 )
{
if ( (double)*(int *)vxdmgcnt_t_6 <= *((double *)&dword_4E68 + 165751) )
*(_DWORD *)vxdmgcnt_7 = v3 - v2;
else
*(_DWORD *)vxdmgcnt_7 += v3 - v2;
v4 = *((double *)&dword_4E68 + 165751);
v5 = *(float *)&amf_stat_loss[4];
if ( a2 )
v5 = *(float *)(HUD_FindVar(a2, "duration", v5) + 32);
*(_DWORD *)vxdmgcnt_t_6 = (int)((float)(v5 + v5) + v4);
}
*(_DWORD *)vxdmgcnt_o_5 = *((_DWORD *)&dword_4E68 + a1 + 331416);
result = vxdmgcnt_t_6;
v7 = (double)*(int *)vxdmgcnt_t_6;
v8 = *((double *)&dword_4E68 + 165751);
if ( v7 > v8 )
{
v9 = v7 - v8;
v10 = LC6;
if ( v9 <= 1.0 )
{
v11 = 0LL;
*(float *)v11.m128i_i32 = v9;
v10 = _mm_cvtsi128_si32(v11);
}
glTexEnvf(8960LL, 8704LL, 8448.0);
glDisable(3008LL);
glEnable(3042LL);
glColor4f(1.0, 1.0, 1.0, *(double *)_mm_cvtsi32_si128(v10).m128i_i64);
if ( a2 )
{
if ( !scale_3 )
{
scale_3 = HUD_FindVar(a2, "scale", 1.0);
style_2 = HUD_FindVar(a2, "style", 1.0);
digits_1 = HUD_FindVar(a2, "digits", 1.0);
align_0 = HUD_FindVar(a2, "align", 1.0);
}
SCR_HUD_DrawNum(
a2,
abs32(*(_DWORD *)vxdmgcnt_7),
1LL,
(unsigned int)(int)*(float *)(style_2 + 32),
*(unsigned int *)(digits_1 + 64),
*(_QWORD *)(align_0 + 8),
*(float *)(scale_3 + 32));
}
else
{
Sbar_DrawNum((unsigned int)x_4, 4294967272LL, abs32(*(_DWORD *)vxdmgcnt_7), 3LL, *(_DWORD *)vxdmgcnt_7 > 0);
}
glEnable(3008LL);
glDisable(3042LL);
glTexEnvf(8960LL, 8704LL, 7681.0);
result = glColor4f(1.0, 1.0, 1.0, COERCE_DOUBLE((unsigned __int64)LC6));
}
return result;
}

original_code:
void Draw_AMFStatLoss (int stat, hud_t* hud) {
    static int * vxdmgcnt, * vxdmgcnt_t, * vxdmgcnt_o;
 static int x;
    float alpha;
 if (stat == 0) {
        vxdmgcnt = &vxdamagecount;
        vxdmgcnt_t = &vxdamagecount_time;
        vxdmgcnt_o = &vxdamagecount_oldhealth;
  x = 136;
    } else {
        vxdmgcnt = &vxdamagecountarmour;
        vxdmgcnt_t = &vxdamagecountarmour_time;
        vxdmgcnt_o = &vxdamagecountarmour_oldhealth;
  x = 24;
    }
 if (cl.stats[stat] < (*vxdmgcnt_o - 1))
    {
       if (*vxdmgcnt_t > cl.time)
          *vxdmgcnt = *vxdmgcnt + (*vxdmgcnt_o - cl.stats[stat]);
       else
          *vxdmgcnt = *vxdmgcnt_o - cl.stats[stat];
       *vxdmgcnt_t = cl.time + 2 * (hud ? HUD_FindVar(hud, "duration")->value : amf_stat_loss.value);
    }
    *vxdmgcnt_o = cl.stats[stat];
    if (*vxdmgcnt_t > cl.time)
    {
       alpha = ((1) < ((*vxdmgcnt_t - cl.time)) ? (1) : ((*vxdmgcnt_t - cl.time)));
       glTexEnvf(0x2300, 0x2200, 0x2100);
       glDisable(0x0BC0);
       glEnable (0x0BE2);
       glColor4f(1, 1, 1, alpha);
  if (hud) {
   static cvar_t *scale = ((void *)0), *style, *digits, *align;
   if (scale == ((void *)0))
   {
    scale = HUD_FindVar(hud, "scale");
    style = HUD_FindVar(hud, "style");
    digits = HUD_FindVar(hud, "digits");
    align = HUD_FindVar(hud, "align");
   }
   SCR_HUD_DrawNum (hud, abs(*vxdmgcnt), 1,
                scale->value, style->value, digits->integer, align->string);
  } else {
        Sbar_DrawNum (x, -24, abs(*vxdmgcnt), 3, (*vxdmgcnt) > 0);
  }
       glEnable(0x0BC0);
       glDisable (0x0BE2);
       glTexEnvf(0x2300, 0x2200, 0x1E01);
       glColor4f(1, 1, 1, 1);
    }
}

canonical_original_code:
void Draw_AMFStatLoss(int stat, struct hud_s *hud) {
    static int *vxdmgcnt; static int *vxdmgcnt_t; static int *vxdmgcnt_o;
 static int x;
    float alpha;
 if (stat == 0) {
        vxdmgcnt = &vxdamagecount;
        vxdmgcnt_t = &vxdamagecount_time;
        vxdmgcnt_o = &vxdamagecount_oldhealth;
  x = 136;
    } else {
        vxdmgcnt = &vxdamagecountarmour;
        vxdmgcnt_t = &vxdamagecountarmour_time;
        vxdmgcnt_o = &vxdamagecountarmour_oldhealth;
  x = 24;
    }
 if (cl.stats[stat] < (*vxdmgcnt_o - 1))
    {
       if (*vxdmgcnt_t > cl.time)
          *vxdmgcnt = *vxdmgcnt + (*vxdmgcnt_o - cl.stats[stat]);
       else
          *vxdmgcnt = *vxdmgcnt_o - cl.stats[stat];
       *vxdmgcnt_t = cl.time + 2 * (hud ? HUD_FindVar(hud, "duration")->value : amf_stat_loss.value);
    }
    *vxdmgcnt_o = cl.stats[stat];
    if (*vxdmgcnt_t > cl.time)
    {
       alpha = ((1) < ((*vxdmgcnt_t - cl.time)) ? (1) : ((*vxdmgcnt_t - cl.time)));
       glTexEnvf(0x2300, 0x2200, 0x2100);
       glDisable(0x0BC0);
       glEnable (0x0BE2);
       glColor4f(1, 1, 1, alpha);
  if (hud) {
   static struct cvar_s *scale = ((void *)0); static struct cvar_s *style; static struct cvar_s *digits; static struct cvar_s *align;
   if (scale == ((void *)0))
   {
    scale = HUD_FindVar(hud, "scale");
    style = HUD_FindVar(hud, "style");
    digits = HUD_FindVar(hud, "digits");
    align = HUD_FindVar(hud, "align");
   }
   SCR_HUD_DrawNum (hud, abs(*vxdmgcnt), 1,
                scale->value, style->value, digits->integer, align->string);
  } else {
        Sbar_DrawNum (x, -24, abs(*vxdmgcnt), 3, (*vxdmgcnt) > 0);
  }
       glEnable(0x0BC0);
       glDisable (0x0BE2);
       glTexEnvf(0x2300, 0x2200, 0x1E01);
       glColor4f(1, 1, 1, 1);
    }
}

variable_types: stat int

variable_types: struct hud_s { char *name; char *description; void (*draw_func)(struct hud_s *); struct cvar_s { char *name; char *string; int flags; void (*OnChange)(struct cvar_s *var, char *value, enum qbool { false=0, true=1 } *cancel); float value; float maxrulesetvalue; float minrulesetvalue; char *defaultvalue; char *latchedString; int integer; unsigned char color[4]; enum qbool { false=0, true=1 } modified; enum qbool { false=0, true=1 } teamplay; struct cvar_group_s { char name[65]; int count; struct cvar_s *head; struct cvar_group_s *next; } *group; struct cvar_s *next_in_group; struct cvar_s *hash_next; struct cvar_s *next; } *order; struct cvar_s *show; struct cvar_s *frame; struct cvar_s *frame_color; unsigned char frame_color_cache[4]; struct cvar_s *opacity; struct cvar_s *place; struct hud_s *place_hud; enum qbool { false=0, true=1 } place_outside; int place_num; struct cvar_s *align_x; struct cvar_s *align_y; int align_x_num; int align_y_num; struct cvar_s *pos_x; struct cvar_s *pos_y; struct cvar_s **params; int num_params; enum cactive_t { ca_disconnected=0, ca_demostart=1, ca_connected=2, ca_onserver=3, ca_active=4 } min_state; unsigned int flags; int lx; int al; int last_try_sequence; int last_draw_sequence; struct hud_s *next; } *

variable_types:
vxdmgcnt
int *

variable_types: alpha float

user_defined_types: struct hud_s { char *name; char *description; void (*draw_func)(struct hud_s *); struct cvar_s *order; struct cvar_s *show; struct cvar_s *frame; struct cvar_s *frame_color; unsigned char frame_color_cache[4]; struct cvar_s *opacity; struct cvar_s *place; struct hud_s *place_hud; enum qbool place_outside; int place_num; struct cvar_s *align_x; struct cvar_s *align_y; int align_x_num; int align_y_num; struct cvar_s *pos_x; struct cvar_s *pos_y; struct cvar_s **params; int num_params; enum cactive_t min_state; unsigned int flags; int lx; int al; int last_try_sequence; int last_draw_sequence; struct hud_s *next; }

user_defined_types: struct cvar_s { char *name; char *string; int flags; void (*OnChange)(struct cvar_s *var, char *value, enum qbool *cancel); float value; float maxrulesetvalue; float minrulesetvalue; char *defaultvalue; char *latchedString; int integer; unsigned char color[4]; enum qbool modified; enum qbool teamplay; struct cvar_group_s *group; struct cvar_s *next_in_group; struct cvar_s *hash_next; struct cvar_s *next; }


decompiled_code:
void SCR_DrawAMFstats()
{
int v0; // edi
unsigned int v1; // ebx
int v2; // eax
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
char v7[104]; // [rsp-68h] [rbp-68h] BYREF

if ( *(float *)&amf_showstats[4] != 0.0 )
{
snprintf(v7, 0x50uLL, "Particle Count: %3d ", (unsigned int)ParticleCount);
v0 = vid[7] - 8 * strlen(v7);
v1 = (int)((double)vid[9] * 0.1);
Draw_AlphaWindow((unsigned int)(v0 - 16), v1 - 8, vid[7] - 8, v1 + 56, 1u, 0.33000001);
Draw_String((unsigned int)(v0 - 8), v1, v7);
snprintf(v7, 0x50uLL, "Highest: %3d ", (unsigned int)ParticleCountHigh);
v2 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v2), v1 + 8, v7);
snprintf(v7, 0x50uLL, "Corona Count: %3d ", (unsigned int)CoronaCount);
v3 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v3), v1 + 16, v7);
snprintf(v7, 0x50uLL, "Highest: %3d ", (unsigned int)CoronaCountHigh);
v4 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v4), v1 + 24, v7);
snprintf(v7, 0x50uLL, "Motion Trails: %3d ", (unsigned int)MotionBlurCount);
v5 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v5), v1 + 32, v7);
snprintf(v7, 0x50uLL, "Highest: %3d ", (unsigned int)MotionBlurCountHigh);
v6 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v6), v1 + 40, v7);
}
}

canonical_decompiled_code:
void func8()
{
int v0; // edi
unsigned int v1; // ebx
int v2; // eax
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
char v7[104]; // [rsp-68h] [rbp-68h] BYREF

if ( *(float *)&amf_showstats[4] != 0.0 )
{
snprintf(v7, 0x50uLL, "Particle Count: %3d ", (unsigned int)ParticleCount);
v0 = vid[7] - 8 * strlen(v7);
v1 = (int)((double)vid[9] * 0.1);
func6((unsigned int)(v0 - 16), v1 - 8, vid[7] - 8, v1 + 56, 1u, 0.33000001);
Draw_String((unsigned int)(v0 - 8), v1, v7);
snprintf(v7, 0x50uLL, "Highest: %3d ", (unsigned int)ParticleCountHigh);
v2 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v2), v1 + 8, v7);
snprintf(v7, 0x50uLL, "Corona Count: %3d ", (unsigned int)CoronaCount);
v3 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v3), v1 + 16, v7);
snprintf(v7, 0x50uLL, "Highest: %3d ", (unsigned int)CoronaCountHigh);
v4 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v4), v1 + 24, v7);
snprintf(v7, 0x50uLL, "Motion Trails: %3d ", (unsigned int)MotionBlurCount);
v5 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v5), v1 + 32, v7);
snprintf(v7, 0x50uLL, "Highest: %3d ", (unsigned int)MotionBlurCountHigh);
v6 = strlen(v7);
Draw_String((unsigned int)(vid[7] - 8 - 8 * v6), v1 + 40, v7);
}
}

original_code:
void SCR_DrawAMFstats (void)
{
 int x, y, numlines;
 char st[80];
 if (!amf_showstats.value)
  return;
 numlines = 6;
 numlines += 2;
 snprintf(st, sizeof (st), "Particle Count: %3d ", ParticleCount);
 x = vid.width - strlen(st)*8 -8;
 y = vid.height*0.1;
 Draw_AlphaWindow(x-8, y-8, x+strlen(st)*8, y+numlines*8-8, 1, 0.33);
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Highest: %3d ", ParticleCountHigh);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Corona Count: %3d ", CoronaCount);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Highest: %3d ", CoronaCountHigh);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Motion Trails: %3d ", MotionBlurCount);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Highest: %3d ", MotionBlurCountHigh);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
}

canonical_original_code:
void SCR_DrawAMFstats()
{
 int x; int y; int numlines;
 char st[80];
 if (!amf_showstats.value)
  return;
 numlines = 6;
 numlines += 2;
 snprintf(st, sizeof (st), "Particle Count: %3d ", ParticleCount);
 x = vid.width - strlen(st)*8 -8;
 y = vid.height*0.1;
 Draw_AlphaWindow(x-8, y-8, x+strlen(st)*8, y+numlines*8-8, 1, 0.33);
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Highest: %3d ", ParticleCountHigh);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Corona Count: %3d ", CoronaCount);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Highest: %3d ", CoronaCountHigh);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Motion Trails: %3d ", MotionBlurCount);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
 snprintf(st, sizeof (st), "Highest: %3d ", MotionBlurCountHigh);
 x = vid.width - strlen(st) * 8 - 8;
 y = y + 8;
 Draw_String(x, y, st);
}

variable_types: x int

variable_types: y int

variable_types: numlines int

variable_types:
st
char [80]


decompiled_code:
void Amf_Reset_DamageStats()
{
vxdamagecount = 0;
vxdamagecount_time = 0;
vxdamagecount_oldhealth = 0;
vxdamagecountarmour = 0;
vxdamagecountarmour_time = 0;
vxdamagecountarmour_oldhealth = 0;
}

canonical_decompiled_code:
void func1()
{
vxdamagecount = 0;
vxdamagecount_time = 0;
vxdamagecount_oldhealth = 0;
vxdamagecountarmour = 0;
vxdamagecountarmour_time = 0;
vxdamagecountarmour_oldhealth = 0;
}

original_code:
void Amf_Reset_DamageStats (void) {
 vxdamagecount = 0;
 vxdamagecount_time = 0;
 vxdamagecount_oldhealth = 0;
 vxdamagecountarmour = 0;
 vxdamagecountarmour_time = 0;
 vxdamagecountarmour_oldhealth = 0;
}


decompiled_code:
char *__fastcall TP_ConvertToWhiteText(char *a1)
{
char v1; // al
char *v2; // rdx

buf_8 = 0;
v1 = *a1;
if ( *a1 )
{
v2 = &buf_8;
do
{
*v2++ = v1 & 0x7F;
v1 = *++a1;
}
while ( *a1 );
}
else
{
v2 = &buf_8;
}
*v2 = 0;
return &buf_8;
}

original_code:
char *TP_ConvertToWhiteText(char *s)
{
 static char buf[4096];
 char *out, *p;
 buf[0] = 0;
 out = buf;
 for (p = s; *p; p++)
 {
  *out++ = *p - (*p & 128);
 }
 *out = 0;
 return buf;
}

canonical_original_code:
char *TP_ConvertToWhiteText(char *s)
{
 static char buf[4096];
 char *out; char *p;
 buf[0] = 0;
 out = buf;
 for (p = s; *p; p++)
 {
  *out++ = *p - (*p & 128);
 }
 *out = 0;
 return buf;
}

variable_types:
buf
char [4096]

variable_types:
out
char *

variable_types:
p
char *

return_type: char *


decompiled_code:
__int64 __fastcall Draw_AlphaWindow(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4, unsigned __int8 a5, float a6)
{
unsigned int v9; // er14
unsigned int v10; // ebx

v9 = a3 - a1;
Draw_Fill(a1, a2, a3 - (unsigned int)a1 + 1, 1LL, 2LL);
Draw_Fill((unsigned int)a1, a4, v9, 1LL, 1LL);
v10 = a4 - a2;
Draw_Fill((unsigned int)a1, (unsigned int)a2, 1LL, v10, 2LL);
Draw_Fill(a3, (unsigned int)a2, 1LL, v10 + 1, 1LL);
return Draw_AlphaFill((unsigned int)a1, (unsigned int)a2, v9, v10, a5, a6);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4, unsigned __int8 a5, float a6)
{
unsigned int v9; // er14
unsigned int v10; // ebx

v9 = a3 - a1;
Draw_Fill(a1, a2, a3 - (unsigned int)a1 + 1, 1LL, 2LL);
Draw_Fill((unsigned int)a1, a4, v9, 1LL, 1LL);
v10 = a4 - a2;
Draw_Fill((unsigned int)a1, (unsigned int)a2, 1LL, v10, 2LL);
Draw_Fill(a3, (unsigned int)a2, 1LL, v10 + 1, 1LL);
return Draw_AlphaFill((unsigned int)a1, (unsigned int)a2, v9, v10, a5, a6);
}

original_code:
void Draw_AlphaWindow (int x1, int y1, int x2, int y2, int col, float alpha)
{
 int dist;
 dist = x2-x1;
 Draw_Fill (x1, y1, dist+1, 1, 2);
 Draw_Fill (x1, y2, dist, 1, 1);
 dist = y2-y1;
 Draw_Fill (x1, y1, 1, dist, 2);
 Draw_Fill (x2, y1, 1, dist+1, 1);
 Draw_AlphaFill (x1, y1, x2-x1, y2-y1, col, alpha);
}

canonical_original_code:
void Draw_AlphaWindow(int x1, int y1, int x2, int y2, int col, float alpha)
{
 int dist;
 dist = x2-x1;
 Draw_Fill (x1, y1, dist+1, 1, 2);
 Draw_Fill (x1, y2, dist, 1, 1);
 dist = y2-y1;
 Draw_Fill (x1, y1, 1, dist, 2);
 Draw_Fill (x2, y1, 1, dist+1, 1);
 Draw_AlphaFill (x1, y1, x2-x1, y2-y1, col, alpha);
}

variable_types: col int

variable_types: dist int


InitVXStuff

decompiled_code:
__int64 InitVXStuff()
{
coronatexture = GL_LoadTextureImage("textures/flash", 0LL, 0LL, 0LL, 39LL);
gunflashtexture = GL_LoadTextureImage("textures/gunflash", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture1 = GL_LoadTextureImage("textures/explosionflash1", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture2 = GL_LoadTextureImage("textures/explosionflash2", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture3 = GL_LoadTextureImage("textures/explosionflash3", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture4 = GL_LoadTextureImage("textures/explosionflash4", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture5 = GL_LoadTextureImage("textures/explosionflash5", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture6 = GL_LoadTextureImage("textures/explosionflash6", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture7 = GL_LoadTextureImage("textures/explosionflash7", 0LL, 0LL, 0LL, 39LL);
InitCoronas();
Init_VLights();
Cvar_SetCurrentGroup("Status Bar and Scoreboard");
Cvar_Register(amf_stat_loss);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Spectator Tracking");
Cvar_Register(amf_camera_chase);
Cvar_Register(amf_camera_chase_dist);
Cvar_Register(amf_camera_chase_height);
Cvar_Register(amf_camera_death);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Screen Settings");
Cvar_Register(amf_showstats);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("FPS and EyeCandy Settings");
Cvar_Register(amf_hiderockets);
Cvar_Register(amf_hidenails);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Lighting");
Cvar_Register(amf_coronas);
Cvar_Register(amf_coronas_tele);
Cvar_Register(amf_lighting_vertex);
Cvar_Register(amf_lighting_colour);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Particle Effects");
Cvar_Register(amf_part_blood);
Cvar_Register(amf_part_blood_color);
Cvar_Register(amf_part_blood_type);
Cvar_Register(amf_part_muzzleflash);
Cvar_Register(amf_part_fire);
Cvar_Register(&amf_part_firecolor);
Cvar_Register(amf_part_deatheffect);
Cvar_Register(amf_part_gunshot);
Cvar_Register(amf_part_gunshot_type);
Cvar_Register(amf_part_spikes);
Cvar_Register(amf_part_spikes_type);
Cvar_Register(amf_part_explosion);
Cvar_Register(amf_part_blobexplosion);
Cvar_Register(amf_part_sparks);
Cvar_Register(amf_part_2dshockwaves);
Cvar_Register(amf_part_shockwaves);
Cvar_Register(amf_part_gibtrails);
Cvar_Register(amf_part_fasttrails);
Cvar_Register(amf_part_traillen);
Cvar_Register(amf_part_trailtime);
Cvar_Register(amf_part_traildetail);
Cvar_Register(amf_part_trailwidth);
Cvar_Register(amf_part_trailtype);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Turbulency and Sky Settings");
Cvar_Register(tei_lavafire);
Cvar_Register(tei_slime);
Cvar_Register(amf_weather_rain);
Cvar_Register(amf_weather_rain_fast);
Cvar_Register(amf_waterripple);
Cvar_Register(amf_underwater_trails);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("OpenGL Rendering");
Cvar_Register(amf_nailtrail);
Cvar_Register(amf_nailtrail_plasma);
Cvar_Register(amf_nailtrail_water);
Cvar_Register(amf_extratrails);
Cvar_Register(amf_detpacklights);
Cvar_Register(amf_buildingsparks);
Cvar_Register(amf_lightning);
Cvar_Register(amf_lightning_color);
Cvar_Register(amf_lightning_size);
Cvar_Register(amf_lightning_sparks);
Cvar_Register(amf_lightning_sparks_size);
Cvar_Register(amf_motiontrails);
Cvar_Register(amf_motiontrails_wtf);
Cvar_Register(amf_inferno_trail);
Cvar_Register(amf_inferno_speed);
Cvar_Register(amf_cutf_tesla_effect);
Cvar_ResetCurrentGroup();
Cmd_AddCommand("gl_checkmodels", CheckModels_f);
Cmd_AddCommand("gl_inferno", &InfernoFire_f);
return Cmd_AddCommand("gl_setmode", Amf_SetMode_f);
}

canonical_decompiled_code:
__int64 func9()
{
coronatexture = GL_LoadTextureImage("textures/flash", 0LL, 0LL, 0LL, 39LL);
gunflashtexture = GL_LoadTextureImage("textures/gunflash", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture1 = GL_LoadTextureImage("textures/explosionflash1", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture2 = GL_LoadTextureImage("textures/explosionflash2", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture3 = GL_LoadTextureImage("textures/explosionflash3", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture4 = GL_LoadTextureImage("textures/explosionflash4", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture5 = GL_LoadTextureImage("textures/explosionflash5", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture6 = GL_LoadTextureImage("textures/explosionflash6", 0LL, 0LL, 0LL, 39LL);
explosionflashtexture7 = GL_LoadTextureImage("textures/explosionflash7", 0LL, 0LL, 0LL, 39LL);
InitCoronas();
Init_VLights();
Cvar_SetCurrentGroup("Status Bar and Scoreboard");
Cvar_Register(amf_stat_loss);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Spectator Tracking");
Cvar_Register(amf_camera_chase);
Cvar_Register(amf_camera_chase_dist);
Cvar_Register(amf_camera_chase_height);
Cvar_Register(amf_camera_death);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Screen Settings");
Cvar_Register(amf_showstats);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("FPS and EyeCandy Settings");
Cvar_Register(amf_hiderockets);
Cvar_Register(amf_hidenails);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Lighting");
Cvar_Register(amf_coronas);
Cvar_Register(amf_coronas_tele);
Cvar_Register(amf_lighting_vertex);
Cvar_Register(amf_lighting_colour);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Particle Effects");
Cvar_Register(amf_part_blood);
Cvar_Register(amf_part_blood_color);
Cvar_Register(amf_part_blood_type);
Cvar_Register(amf_part_muzzleflash);
Cvar_Register(amf_part_fire);
Cvar_Register(&amf_part_firecolor);
Cvar_Register(amf_part_deatheffect);
Cvar_Register(amf_part_gunshot);
Cvar_Register(amf_part_gunshot_type);
Cvar_Register(amf_part_spikes);
Cvar_Register(amf_part_spikes_type);
Cvar_Register(amf_part_explosion);
Cvar_Register(amf_part_blobexplosion);
Cvar_Register(amf_part_sparks);
Cvar_Register(amf_part_2dshockwaves);
Cvar_Register(amf_part_shockwaves);
Cvar_Register(amf_part_gibtrails);
Cvar_Register(amf_part_fasttrails);
Cvar_Register(amf_part_traillen);
Cvar_Register(amf_part_trailtime);
Cvar_Register(amf_part_traildetail);
Cvar_Register(amf_part_trailwidth);
Cvar_Register(amf_part_trailtype);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("Turbulency and Sky Settings");
Cvar_Register(tei_lavafire);
Cvar_Register(tei_slime);
Cvar_Register(amf_weather_rain);
Cvar_Register(amf_weather_rain_fast);
Cvar_Register(amf_waterripple);
Cvar_Register(amf_underwater_trails);
Cvar_ResetCurrentGroup();
Cvar_SetCurrentGroup("OpenGL Rendering");
Cvar_Register(amf_nailtrail);
Cvar_Register(amf_nailtrail_plasma);
Cvar_Register(amf_nailtrail_water);
Cvar_Register(amf_extratrails);
Cvar_Register(amf_detpacklights);
Cvar_Register(amf_buildingsparks);
Cvar_Register(amf_lightning);
Cvar_Register(amf_lightning_color);
Cvar_Register(amf_lightning_size);
Cvar_Register(amf_lightning_sparks);
Cvar_Register(amf_lightning_sparks_size);
Cvar_Register(amf_motiontrails);
Cvar_Register(amf_motiontrails_wtf);
Cvar_Register(amf_inferno_trail);
Cvar_Register(amf_inferno_speed);
Cvar_Register(amf_cutf_tesla_effect);
Cvar_ResetCurrentGroup();
Cmd_AddCommand("gl_checkmodels", CheckModels_f);
Cmd_AddCommand("gl_inferno", &InfernoFire_f);
return Cmd_AddCommand("gl_setmode", Amf_SetMode_f);
}

original_code:
void InitVXStuff(void)
{
 int flags = (1<<0) | (1<<1) | (1<<2) | (1<<5);
 coronatexture = GL_LoadTextureImage ("textures/flash", ((void *)0), 0, 0, flags);
 gunflashtexture = GL_LoadTextureImage ("textures/gunflash", ((void *)0), 0, 0, flags);
 explosionflashtexture1 = GL_LoadTextureImage ("textures/explosionflash1", ((void *)0), 0, 0, flags);
 explosionflashtexture2 = GL_LoadTextureImage ("textures/explosionflash2", ((void *)0), 0, 0, flags);
 explosionflashtexture3 = GL_LoadTextureImage ("textures/explosionflash3", ((void *)0), 0, 0, flags);
 explosionflashtexture4 = GL_LoadTextureImage ("textures/explosionflash4", ((void *)0), 0, 0, flags);
 explosionflashtexture5 = GL_LoadTextureImage ("textures/explosionflash5", ((void *)0), 0, 0, flags);
 explosionflashtexture6 = GL_LoadTextureImage ("textures/explosionflash6", ((void *)0), 0, 0, flags);
 explosionflashtexture7 = GL_LoadTextureImage ("textures/explosionflash7", ((void *)0), 0, 0, flags);
 InitCoronas();
 Init_VLights();
 Cvar_SetCurrentGroup("Status Bar and Scoreboard");
 Cvar_Register (&amf_stat_loss);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Spectator Tracking");
 Cvar_Register (&amf_camera_chase);
 Cvar_Register (&amf_camera_chase_dist);
 Cvar_Register (&amf_camera_chase_height);
 Cvar_Register (&amf_camera_death);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Screen Settings");
 Cvar_Register (&amf_showstats);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("FPS and EyeCandy Settings");
 Cvar_Register (&amf_hiderockets);
 Cvar_Register (&amf_hidenails);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Lighting");
 Cvar_Register (&amf_coronas);
 Cvar_Register (&amf_coronas_tele);
 Cvar_Register (&amf_lighting_vertex);
 Cvar_Register (&amf_lighting_colour);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Particle Effects");
 Cvar_Register (&amf_part_blood);
 Cvar_Register (&amf_part_blood_color);
 Cvar_Register (&amf_part_blood_type);
 Cvar_Register (&amf_part_muzzleflash);
 Cvar_Register (&amf_part_fire);
 Cvar_Register (&amf_part_firecolor);
 Cvar_Register (&amf_part_deatheffect);
 Cvar_Register (&amf_part_gunshot);
 Cvar_Register (&amf_part_gunshot_type);
 Cvar_Register (&amf_part_spikes);
 Cvar_Register (&amf_part_spikes_type);
 Cvar_Register (&amf_part_explosion);
 Cvar_Register (&amf_part_blobexplosion);
 Cvar_Register (&amf_part_sparks);
 Cvar_Register (&amf_part_2dshockwaves);
 Cvar_Register (&amf_part_shockwaves);
 Cvar_Register (&amf_part_gibtrails);
 Cvar_Register (&amf_part_fasttrails);
 Cvar_Register (&amf_part_traillen);
 Cvar_Register (&amf_part_trailtime);
 Cvar_Register (&amf_part_traildetail);
 Cvar_Register (&amf_part_trailwidth);
 Cvar_Register (&amf_part_trailtype);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Turbulency and Sky Settings");
 Cvar_Register (&tei_lavafire);
 Cvar_Register (&tei_slime);
 Cvar_Register (&amf_weather_rain);
 Cvar_Register (&amf_weather_rain_fast);
 Cvar_Register (&amf_waterripple);
 Cvar_Register (&amf_underwater_trails);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("OpenGL Rendering");
 Cvar_Register (&amf_nailtrail);
 Cvar_Register (&amf_nailtrail_plasma);
 Cvar_Register (&amf_nailtrail_water);
 Cvar_Register (&amf_extratrails);
 Cvar_Register (&amf_detpacklights);
 Cvar_Register (&amf_buildingsparks);
 Cvar_Register (&amf_lightning);
 Cvar_Register (&amf_lightning_color);
 Cvar_Register (&amf_lightning_size);
 Cvar_Register (&amf_lightning_sparks);
 Cvar_Register (&amf_lightning_sparks_size);
 Cvar_Register (&amf_motiontrails);
 Cvar_Register (&amf_motiontrails_wtf);
 Cvar_Register (&amf_inferno_trail);
 Cvar_Register (&amf_inferno_speed);
 Cvar_Register (&amf_cutf_tesla_effect);
 Cvar_ResetCurrentGroup();
 Cmd_AddCommand ("gl_checkmodels", CheckModels_f);
 Cmd_AddCommand ("gl_inferno", InfernoFire_f);
 Cmd_AddCommand ("gl_setmode", Amf_SetMode_f);
}

canonical_original_code:
void InitVXStuff()
{
 int flags = (1<<0) | (1<<1) | (1<<2) | (1<<5);
 coronatexture = GL_LoadTextureImage ("textures/flash", ((void *)0), 0, 0, flags);
 gunflashtexture = GL_LoadTextureImage ("textures/gunflash", ((void *)0), 0, 0, flags);
 explosionflashtexture1 = GL_LoadTextureImage ("textures/explosionflash1", ((void *)0), 0, 0, flags);
 explosionflashtexture2 = GL_LoadTextureImage ("textures/explosionflash2", ((void *)0), 0, 0, flags);
 explosionflashtexture3 = GL_LoadTextureImage ("textures/explosionflash3", ((void *)0), 0, 0, flags);
 explosionflashtexture4 = GL_LoadTextureImage ("textures/explosionflash4", ((void *)0), 0, 0, flags);
 explosionflashtexture5 = GL_LoadTextureImage ("textures/explosionflash5", ((void *)0), 0, 0, flags);
 explosionflashtexture6 = GL_LoadTextureImage ("textures/explosionflash6", ((void *)0), 0, 0, flags);
 explosionflashtexture7 = GL_LoadTextureImage ("textures/explosionflash7", ((void *)0), 0, 0, flags);
 InitCoronas();
 Init_VLights();
 Cvar_SetCurrentGroup("Status Bar and Scoreboard");
 Cvar_Register (&amf_stat_loss);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Spectator Tracking");
 Cvar_Register (&amf_camera_chase);
 Cvar_Register (&amf_camera_chase_dist);
 Cvar_Register (&amf_camera_chase_height);
 Cvar_Register (&amf_camera_death);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Screen Settings");
 Cvar_Register (&amf_showstats);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("FPS and EyeCandy Settings");
 Cvar_Register (&amf_hiderockets);
 Cvar_Register (&amf_hidenails);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Lighting");
 Cvar_Register (&amf_coronas);
 Cvar_Register (&amf_coronas_tele);
 Cvar_Register (&amf_lighting_vertex);
 Cvar_Register (&amf_lighting_colour);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Particle Effects");
 Cvar_Register (&amf_part_blood);
 Cvar_Register (&amf_part_blood_color);
 Cvar_Register (&amf_part_blood_type);
 Cvar_Register (&amf_part_muzzleflash);
 Cvar_Register (&amf_part_fire);
 Cvar_Register (&amf_part_firecolor);
 Cvar_Register (&amf_part_deatheffect);
 Cvar_Register (&amf_part_gunshot);
 Cvar_Register (&amf_part_gunshot_type);
 Cvar_Register (&amf_part_spikes);
 Cvar_Register (&amf_part_spikes_type);
 Cvar_Register (&amf_part_explosion);
 Cvar_Register (&amf_part_blobexplosion);
 Cvar_Register (&amf_part_sparks);
 Cvar_Register (&amf_part_2dshockwaves);
 Cvar_Register (&amf_part_shockwaves);
 Cvar_Register (&amf_part_gibtrails);
 Cvar_Register (&amf_part_fasttrails);
 Cvar_Register (&amf_part_traillen);
 Cvar_Register (&amf_part_trailtime);
 Cvar_Register (&amf_part_traildetail);
 Cvar_Register (&amf_part_trailwidth);
 Cvar_Register (&amf_part_trailtype);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("Turbulency and Sky Settings");
 Cvar_Register (&tei_lavafire);
 Cvar_Register (&tei_slime);
 Cvar_Register (&amf_weather_rain);
 Cvar_Register (&amf_weather_rain_fast);
 Cvar_Register (&amf_waterripple);
 Cvar_Register (&amf_underwater_trails);
 Cvar_ResetCurrentGroup();
 Cvar_SetCurrentGroup("OpenGL Rendering");
 Cvar_Register (&amf_nailtrail);
 Cvar_Register (&amf_nailtrail_plasma);
 Cvar_Register (&amf_nailtrail_water);
 Cvar_Register (&amf_extratrails);
 Cvar_Register (&amf_detpacklights);
 Cvar_Register (&amf_buildingsparks);
 Cvar_Register (&amf_lightning);
 Cvar_Register (&amf_lightning_color);
 Cvar_Register (&amf_lightning_size);
 Cvar_Register (&amf_lightning_sparks);
 Cvar_Register (&amf_lightning_sparks_size);
 Cvar_Register (&amf_motiontrails);
 Cvar_Register (&amf_motiontrails_wtf);
 Cvar_Register (&amf_inferno_trail);
 Cvar_Register (&amf_inferno_speed);
 Cvar_Register (&amf_cutf_tesla_effect);
 Cvar_ResetCurrentGroup();
 Cmd_AddCommand ("gl_checkmodels", CheckModels_f);
 Cmd_AddCommand ("gl_inferno", InfernoFire_f);
 Cmd_AddCommand ("gl_setmode", Amf_SetMode_f);
}

variable_types: flags int


decompiled_code:
__int64 __fastcall Movie_Start(double a1)
{
__int64 result; // rax
time_t timer; // [rsp+8h] [rbp-10h] BYREF

timer = time(0LL);
localtime_r(&timer, &movie_start_date);
movie_is_capturing = 1;
movie_len = *(_QWORD *)&a1;
movie_start_time = cls[1];
movie_frame_count = 0;
if ( !strcmp(*((const char **)&scr_sshot_format + 1), "tga")
|| !strcmp(*((const char **)&scr_sshot_format + 1), "jpeg")
|| !strcmp(*((const char **)&scr_sshot_format + 1), "jpg")
|| !strcmp(*((const char **)&scr_sshot_format + 1), "png") )
{
result = strlcpy(&image_ext, *((_QWORD *)&scr_sshot_format + 1), 4LL);
}
else
{
result = strlcpy(&image_ext, "tga", 4LL);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(double a1)
{
__int64 result; // rax
time_t timer; // [rsp+8h] [rbp-10h] BYREF

timer = time(0LL);
localtime_r(&timer, &movie_start_date);
movie_is_capturing = 1;
movie_len = *(_QWORD *)&a1;
movie_start_time = cls[1];
movie_frame_count = 0;
if ( !strcmp(*((const char **)&scr_sshot_format + 1), "tga")
|| !strcmp(*((const char **)&scr_sshot_format + 1), "jpeg")
|| !strcmp(*((const char **)&scr_sshot_format + 1), "jpg")
|| !strcmp(*((const char **)&scr_sshot_format + 1), "png") )
{
result = strlcpy(&image_ext, *((_QWORD *)&scr_sshot_format + 1), 4LL);
}
else
{
result = strlcpy(&image_ext, "tga", 4LL);
}
return result;
}

original_code:
static void Movie_Start(double _time)
{
 extern cvar_t scr_sshot_format;
 time_t t;
 t = time(((void *)0));
 localtime_r(&t, &movie_start_date);
 movie_is_capturing = true;
 movie_len = _time;
 movie_start_time = cls.realtime;
 movie_frame_count = 0;
 {
  if (!strcmp(scr_sshot_format.string, "tga")
   || !strcmp(scr_sshot_format.string, "jpeg")
   || !strcmp(scr_sshot_format.string, "jpg")
   || !strcmp(scr_sshot_format.string, "png"))
  {
   strlcpy(image_ext, scr_sshot_format.string, sizeof(image_ext));
  }
  else
  {
   strlcpy (image_ext, "tga", sizeof (image_ext));
  }
 }
}

canonical_original_code:
static void Movie_Start(double _time)
{
 extern struct cvar_s scr_sshot_format;
 long t;
 t = time(((void *)0));
 localtime_r(&t, &movie_start_date);
 movie_is_capturing = true;
 movie_len = _time;
 movie_start_time = cls.realtime;
 movie_frame_count = 0;
 {
  if (!strcmp(scr_sshot_format.string, "tga")
   || !strcmp(scr_sshot_format.string, "jpeg")
   || !strcmp(scr_sshot_format.string, "jpg")
   || !strcmp(scr_sshot_format.string, "png"))
  {
   strlcpy(image_ext, scr_sshot_format.string, sizeof(image_ext));
  }
  else
  {
   strlcpy (image_ext, "tga", sizeof (image_ext));
  }
 }
}

variable_types: struct cvar_s { char *name; char *string; int flags; void (*OnChange)(struct cvar_s *var, char *value, enum qbool { false=0, true=1 } *cancel); float value; float maxrulesetvalue; float minrulesetvalue; char *defaultvalue; char *latchedString; int integer; unsigned char color[4]; enum qbool { false=0, true=1 } modified; enum qbool { false=0, true=1 } teamplay; struct cvar_group_s { char name[65]; int count; struct cvar_s *head; struct cvar_group_s *next; } *group; struct cvar_s *next_in_group; struct cvar_s *hash_next; struct cvar_s *next; }

variable_types: t long


decompiled_code:
_BOOL8 Movie_IsCapturing()
{
_BOOL8 result; // rax

result = 0LL;
if ( HIDWORD(cls[1213]) )
{
if ( !LODWORD(cls[1346]) )
result = movie_is_capturing != 0;
}
return result;
}

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

result = 0LL;
if ( HIDWORD(cls[1213]) )
{
if ( !LODWORD(cls[1346]) )
result = movie_is_capturing != 0;
}
return result;
}

original_code:
qbool Movie_IsCapturing(void) {
 return cls.demoplayback && !cls.timedemo && movie_is_capturing;
}

canonical_original_code:
enum qbool Movie_IsCapturing() {
 return cls.demoplayback && !cls.timedemo && movie_is_capturing;
}


decompiled_code:
__int64 __fastcall OnChange_movie_dir(__int64 a1, const char *a2, _DWORD *a3)
{
__int64 result; // rax
__int64 v5; // rax

if ( Movie_IsCapturing() )
{
result = Com_Printf("Cannot change demo_capture_dir whilst capturing. Use 'demo_capture stop' to cease capturing first.\n");
*a3 = 1;
}
else if ( strlen(a2) > 0x1F )
{
result = Com_Printf("demo_capture_dir can only contain a maximum of 31 characters\n");
*a3 = 1;
}
else
{
Util_Process_Filename(a2);
result = Util_Is_Valid_Filename(a2);
if ( !(_DWORD)result )
{
v5 = Util_Invalid_Filename_Msg("demo_capture_dir");
result = Com_Printf(v5);
*a3 = 1;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, const char *a2, _DWORD *a3)
{
__int64 result; // rax
__int64 v5; // rax

if ( func1() )
{
result = Com_Printf("Cannot change demo_capture_dir whilst capturing. Use 'demo_capture stop' to cease capturing first.\n");
*a3 = 1;
}
else if ( strlen(a2) > 0x1F )
{
result = Com_Printf("demo_capture_dir can only contain a maximum of 31 characters\n");
*a3 = 1;
}
else
{
Util_Process_Filename(a2);
result = Util_Is_Valid_Filename(a2);
if ( !(_DWORD)result )
{
v5 = Util_Invalid_Filename_Msg("demo_capture_dir");
result = Com_Printf(v5);
*a3 = 1;
}
}
return result;
}

original_code:
static void OnChange_movie_dir(cvar_t *var, char *string, qbool *cancel) {
 if (Movie_IsCapturing()) {
  Com_Printf("Cannot change demo_capture_dir whilst capturing.  Use 'demo_capture stop' to cease capturing first.\n");
  *cancel = true;
  return;
 } else if (strlen(string) > 31) {
  Com_Printf("demo_capture_dir can only contain a maximum of 31 characters\n");
  *cancel = true;
  return;
 }
 Util_Process_Filename(string);
 if (!(Util_Is_Valid_Filename(string))) {
  Com_Printf(Util_Invalid_Filename_Msg("demo_capture_dir"));
  *cancel = true;
  return;
 }
}

canonical_original_code:
static void OnChange_movie_dir(struct cvar_s *var, char *string, enum qbool *cancel) {
 if (Movie_IsCapturing()) {
  Com_Printf("Cannot change demo_capture_dir whilst capturing.  Use 'demo_capture stop' to cease capturing first.\n");
  *cancel = true;
  return;
 } else if (strlen(string) > 31) {
  Com_Printf("demo_capture_dir can only contain a maximum of 31 characters\n");
  *cancel = true;
  return;
 }
 Util_Process_Filename(string);
 if (!(Util_Is_Valid_Filename(string))) {
  Com_Printf(Util_Invalid_Filename_Msg("demo_capture_dir"));
  *cancel = true;
  return;
 }
}

variable_types: struct cvar_s { char *name; char *string; int flags; void (*OnChange)(struct cvar_s *var, char *value, enum qbool { false=0, true=1 } *cancel); float value; float maxrulesetvalue; float minrulesetvalue; char *defaultvalue; char *latchedString; int integer; unsigned char color[4]; enum qbool { false=0, true=1 } modified; enum qbool { false=0, true=1 } teamplay; struct cvar_group_s { char name[65]; int count; struct cvar_s *head; struct cvar_group_s *next; } *group; struct cvar_s *next_in_group; struct cvar_s *hash_next; struct cvar_s *next; } *

variable_types:
string
char *

variable_types:
cancel
enum qbool { false=0, true=1 } *


decompiled_code:
__int64 Movie_Stop()
{
float v0; // xmm0_4

movie_is_capturing = 0;
v0 = cls[1] - *(double *)&movie_start_time;
return Com_Printf("Captured %d frames (%.2fs).\n", (unsigned int)movie_frame_count, v0);
}

canonical_decompiled_code:
__int64 func3()
{
float v0; // xmm0_4

movie_is_capturing = 0;
v0 = cls[1] - *(double *)&movie_start_time;
return Com_Printf("Captured %d frames (%.2fs).\n", (unsigned int)movie_frame_count, v0);
}

original_code:
void Movie_Stop (void) {
 movie_is_capturing = false;
 Com_Printf("Captured %d frames (%.2fs).\n", movie_frame_count, (float) (cls.realtime - movie_start_time));
}

canonical_original_code:
void Movie_Stop() {
 movie_is_capturing = false;
 Com_Printf("Captured %d frames (%.2fs).\n", movie_frame_count, (float) (cls.realtime - movie_start_time));
}


decompiled_code:
__int64 Movie_Demo_Capture_f()
{
const char *v0; // rax
const char *v1; // rbx
int v2; // eax
const char *v3; // rsi
const char *v4; // rax
__int64 result; // rax
const char *v6; // rsi
const char *v7; // rax
const char *v8; // rax
__int64 v9; // rax
float v10; // xmm0_4
const char *v11; // rax

v0 = (const char *)Cmd_Argv(0LL);
v1 = (const char *)va("Usage: %s <start time | stop>\n", v0);
v2 = Cmd_Argc();
if ( (unsigned int)(v2 - 2) > 1 )
return Com_Printf(v1);
if ( v2 == 2 )
{
v6 = (const char *)Cmd_Argv(1LL);
if ( !strncasecmp("stop", v6, 4uLL) )
{
if ( Movie_IsCapturing() )
return Movie_Stop();
v7 = (const char *)Cmd_Argv(0LL);
return Com_Printf("%s : Not capturing\n", v7);
}
return Com_Printf(v1);
}
v3 = (const char *)Cmd_Argv(1LL);
if ( strncasecmp("start", v3, 5uLL) )
return Com_Printf(v1);
if ( Movie_IsCapturing() )
{
v8 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("%s : Already capturing\n", v8);
}
else if ( HIDWORD(cls[1213]) && !LODWORD(cls[1346]) )
{
v9 = Cmd_Argv(2LL);
v10 = Q_atof(v9);
if ( v10 <= 0.0 )
{
v11 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("%s : Time argument must be positive\n", v11);
}
else
{
result = Movie_Start(v10);
}
}
else
{
v4 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("%s : Must be playing a demo to capture\n", v4);
}
return result;
}

canonical_decompiled_code:
__int64 func4()
{
const char *v0; // rax
const char *v1; // rbx
int v2; // eax
const char *v3; // rsi
const char *v4; // rax
__int64 result; // rax
const char *v6; // rsi
const char *v7; // rax
const char *v8; // rax
__int64 v9; // rax
float v10; // xmm0_4
const char *v11; // rax

v0 = (const char *)Cmd_Argv(0LL);
v1 = (const char *)va("Usage: %s <start time | stop>\n", v0);
v2 = Cmd_Argc();
if ( (unsigned int)(v2 - 2) > 1 )
return Com_Printf(v1);
if ( v2 == 2 )
{
v6 = (const char *)Cmd_Argv(1LL);
if ( !strncasecmp("stop", v6, 4uLL) )
{
if ( func1() )
return func3();
v7 = (const char *)Cmd_Argv(0LL);
return Com_Printf("%s : Not capturing\n", v7);
}
return Com_Printf(v1);
}
v3 = (const char *)Cmd_Argv(1LL);
if ( strncasecmp("start", v3, 5uLL) )
return Com_Printf(v1);
if ( func1() )
{
v8 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("%s : Already capturing\n", v8);
}
else if ( HIDWORD(cls[1213]) && !LODWORD(cls[1346]) )
{
v9 = Cmd_Argv(2LL);
v10 = Q_atof(v9);
if ( v10 <= 0.0 )
{
v11 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("%s : Time argument must be positive\n", v11);
}
else
{
result = func0(v10);
}
}
else
{
v4 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("%s : Must be playing a demo to capture\n", v4);
}
return result;
}

original_code:
void Movie_Demo_Capture_f(void) {
 int argc;
 double time;
 char *error;
 error = va("Usage: %s <start time | stop>\n", Cmd_Argv(0));
 if ((argc = Cmd_Argc()) != 2 && argc != 3) {
  Com_Printf(error);
  return;
 }
 if (argc == 2) {
  if (strncasecmp("stop", Cmd_Argv(1), 4))
   Com_Printf(error);
  else if (Movie_IsCapturing())
   Movie_Stop();
  else
   Com_Printf("%s : Not capturing\n", Cmd_Argv(0));
  return;
 }
 if (strncasecmp("start", Cmd_Argv(1), 5)) {
  Com_Printf(error);
  return;
 } else if (Movie_IsCapturing()) {
  Com_Printf("%s : Already capturing\n", Cmd_Argv(0));
  return;
 }
 if (!cls.demoplayback || cls.timedemo) {
  Com_Printf("%s : Must be playing a demo to capture\n", Cmd_Argv(0));
  return;
 }
 if ((time = Q_atof(Cmd_Argv(2))) <= 0) {
  Com_Printf("%s : Time argument must be positive\n", Cmd_Argv(0));
  return;
 }
 Movie_Start(time);
}

canonical_original_code:
void Movie_Demo_Capture_f() {
 int argc;
 double time;
 char *error;
 error = va("Usage: %s <start time | stop>\n", Cmd_Argv(0));
 if ((argc = Cmd_Argc()) != 2 && argc != 3) {
  Com_Printf(error);
  return;
 }
 if (argc == 2) {
  if (strncasecmp("stop", Cmd_Argv(1), 4))
   Com_Printf(error);
  else if (Movie_IsCapturing())
   Movie_Stop();
  else
   Com_Printf("%s : Not capturing\n", Cmd_Argv(0));
  return;
 }
 if (strncasecmp("start", Cmd_Argv(1), 5)) {
  Com_Printf(error);
  return;
 } else if (Movie_IsCapturing()) {
  Com_Printf("%s : Already capturing\n", Cmd_Argv(0));
  return;
 }
 if (!cls.demoplayback || cls.timedemo) {
  Com_Printf("%s : Must be playing a demo to capture\n", Cmd_Argv(0));
  return;
 }
 if ((time = Q_atof(Cmd_Argv(2))) <= 0) {
  Com_Printf("%s : Time argument must be positive\n", Cmd_Argv(0));
  return;
 }
 Movie_Start(time);
}

variable_types: argc int

variable_types: time double

variable_types:
error
char *


decompiled_code:
__int64 Movie_Init()
{
Cvar_SetCurrentGroup("Demo Handling");
Cvar_Register(movie_fps);
Cvar_Register(movie_dir);
Cvar_Register(movie_steadycam);
Cvar_ResetCurrentGroup();
return Cmd_AddCommand("demo_capture", Movie_Demo_Capture_f);
}

canonical_decompiled_code:
__int64 func5()
{
Cvar_SetCurrentGroup("Demo Handling");
Cvar_Register(movie_fps);
Cvar_Register(movie_dir);
Cvar_Register(movie_steadycam);
Cvar_ResetCurrentGroup();
return Cmd_AddCommand("demo_capture", Movie_Demo_Capture_f);
}

original_code:
void Movie_Init(void) {
 Cvar_SetCurrentGroup("Demo Handling");
 Cvar_Register(&movie_fps);
 Cvar_Register(&movie_dir);
 Cvar_Register(&movie_steadycam);
 Cvar_ResetCurrentGroup();
 Cmd_AddCommand("demo_capture", Movie_Demo_Capture_f);
}

canonical_original_code:
void Movie_Init() {
 Cvar_SetCurrentGroup("Demo Handling");
 Cvar_Register(&movie_fps);
 Cvar_Register(&movie_dir);
 Cvar_Register(&movie_steadycam);
 Cvar_ResetCurrentGroup();
 Cmd_AddCommand("demo_capture", Movie_Demo_Capture_f);
}


decompiled_code:
double Movie_StartFrame()
{
float v0; // xmm0_4
int v1; // ebx
float v2; // xmm1_4
double v3; // xmm0_8
double result; // xmm0_8

v0 = cl_multiview[8];
v1 = 1;
if ( v0 != 0.0 )
v1 = (int)v0;
if ( Cmd_FindAlias("f_captureframe") )
Cbuf_AddTextEx(&cbuf_main, "f_captureframe\n");
v2 = *(float *)&movie_fps[4];
v3 = *(double *)&LC18;
if ( v2 > 0.0 )
v3 = 1.0 / v2;
result = v3 / (double)v1;
if ( result < 0.001 )
return *(double *)&LC20;
if ( result > 1.0 )
result = *(double *)&LC19;
return result;
}

canonical_decompiled_code:
double func6()
{
float v0; // xmm0_4
int v1; // ebx
float v2; // xmm1_4
double v3; // xmm0_8
double result; // xmm0_8

v0 = cl_multiview[8];
v1 = 1;
if ( v0 != 0.0 )
v1 = (int)v0;
if ( Cmd_FindAlias("f_captureframe") )
Cbuf_AddTextEx(&cbuf_main, "f_captureframe\n");
v2 = *(float *)&movie_fps[4];
v3 = *(double *)&LC18;
if ( v2 > 0.0 )
v3 = 1.0 / v2;
result = v3 / (double)v1;
if ( result < 0.001 )
return *(double *)&LC20;
if ( result > 1.0 )
result = *(double *)&LC19;
return result;
}

original_code:
double Movie_StartFrame(void)
{
 double time;
 int views = 1;
 if (cl_multiview.value)
 {
  views = cl_multiview.value;
 }
 if (Cmd_FindAlias("f_captureframe"))
 {
  Cbuf_AddTextEx (&cbuf_main, "f_captureframe\n");
 }
 time = (movie_fps.value > 0) ? (1.0 / movie_fps.value) : (1 / 30.0);
 return ((1.0 / 1000) >= (1.0) ? (1.0 / 1000) : (time / views) < (1.0 / 1000) ? (1.0 / 1000) : (time / views) > (1.0) ? (1.0) : (time / views));
}

canonical_original_code:
double Movie_StartFrame()
{
 double time;
 int views = 1;
 if (cl_multiview.value)
 {
  views = cl_multiview.value;
 }
 if (Cmd_FindAlias("f_captureframe"))
 {
  Cbuf_AddTextEx (&cbuf_main, "f_captureframe\n");
 }
 time = (movie_fps.value > 0) ? (1.0 / movie_fps.value) : (1 / 30.0);
 return ((1.0 / 1000) >= (1.0) ? (1.0 / 1000) : (time / views) < (1.0 / 1000) ? (1.0 / 1000) : (time / views) > (1.0) ? (1.0) : (time / views));
}

variable_types: views int

return_type: double


decompiled_code:
int Movie_FinishFrame()
{
int result; // eax
char s[136]; // [rsp+0h] [rbp-88h] BYREF

result = Movie_IsCapturing();
if ( result )
{
result = snprintf(
s,
0x80uLL,
"%s/capture_%02d-%02d-%04d_%02d-%02d-%02d/shot-%06d.%s",
movie_dir[1],
(unsigned int)movie_start_date.tm_mday,
(unsigned int)movie_start_date.tm_mon,
(unsigned int)movie_start_date.tm_year,
(unsigned int)movie_start_date.tm_hour,
(unsigned int)movie_start_date.tm_min,
(unsigned int)movie_start_date.tm_sec,
(unsigned int)movie_frame_count,
image_ext);
con_suppress = 1;
if ( cl_multiview[8] == 0.0 || !LODWORD(cls[1717]) || CURRVIEW == 1 )
result = SCR_Movieshot(s);
con_suppress = 0;
if ( cl_multiview[8] == 0.0 || !LODWORD(cls[1717]) )
{
++movie_frame_count;
}
else if ( CURRVIEW == 1 )
{
++movie_frame_count;
}
if ( cls[1] >= *(double *)&movie_start_time + *(double *)&movie_len )
result = Movie_Stop();
}
return result;
}

canonical_decompiled_code:
int func7()
{
int result; // eax
char s[136]; // [rsp+0h] [rbp-88h] BYREF

result = func1();
if ( result )
{
result = snprintf(
s,
0x80uLL,
"%s/capture_%02d-%02d-%04d_%02d-%02d-%02d/shot-%06d.%s",
movie_dir[1],
(unsigned int)movie_start_date.tm_mday,
(unsigned int)movie_start_date.tm_mon,
(unsigned int)movie_start_date.tm_year,
(unsigned int)movie_start_date.tm_hour,
(unsigned int)movie_start_date.tm_min,
(unsigned int)movie_start_date.tm_sec,
(unsigned int)movie_frame_count,
image_ext);
con_suppress = 1;
if ( cl_multiview[8] == 0.0 || !LODWORD(cls[1717]) || CURRVIEW == 1 )
result = SCR_Movieshot(s);
con_suppress = 0;
if ( cl_multiview[8] == 0.0 || !LODWORD(cls[1717]) )
{
++movie_frame_count;
}
else if ( CURRVIEW == 1 )
{
++movie_frame_count;
}
if ( cls[1] >= *(double *)&movie_start_time + *(double *)&movie_len )
result = func3();
}
return result;
}

original_code:
void Movie_FinishFrame(void)
{
 char fname[128];
 if (!Movie_IsCapturing())
  return;
 snprintf(fname, sizeof(fname), "%s/capture_%02d-%02d-%04d_%02d-%02d-%02d/shot-%06d.%s",
  movie_dir.string, movie_start_date.tm_mday, movie_start_date.tm_mon, movie_start_date.tm_year,
  movie_start_date.tm_hour, movie_start_date.tm_min, movie_start_date.tm_sec, movie_frame_count, image_ext);
 con_suppress = true;
 if (cl_multiview.value && cls.mvdplayback)
 {
  if (CURRVIEW == 1)
  {
   SCR_Movieshot(fname);
  }
 }
 else
 {
  SCR_Movieshot(fname);
 }
 {
  con_suppress = false;
 }
 if (cl_multiview.value && cls.mvdplayback)
 {
  if (CURRVIEW == 1)
  {
   movie_frame_count++;
  }
 }
 else
 {
  movie_frame_count++;
 }
 if (cls.realtime >= movie_start_time + movie_len)
  Movie_Stop();
}

canonical_original_code:
void Movie_FinishFrame()
{
 char fname[128];
 if (!Movie_IsCapturing())
  return;
 snprintf(fname, sizeof(fname), "%s/capture_%02d-%02d-%04d_%02d-%02d-%02d/shot-%06d.%s",
  movie_dir.string, movie_start_date.tm_mday, movie_start_date.tm_mon, movie_start_date.tm_year,
  movie_start_date.tm_hour, movie_start_date.tm_min, movie_start_date.tm_sec, movie_frame_count, image_ext);
 con_suppress = true;
 if (cl_multiview.value && cls.mvdplayback)
 {
  if (CURRVIEW == 1)
  {
   SCR_Movieshot(fname);
  }
 }
 else
 {
  SCR_Movieshot(fname);
 }
 {
  con_suppress = false;
 }
 if (cl_multiview.value && cls.mvdplayback)
 {
  if (CURRVIEW == 1)
  {
   movie_frame_count++;
  }
 }
 else
 {
  movie_frame_count++;
 }
 if (cls.realtime >= movie_start_time + movie_len)
  Movie_Stop();
}

variable_types:
fname
char [128]