decompiled_code:
void CDAudio_Update()
{
char v0[24]; // [rsp+0h] [rbp-18h] BYREF

if ( enabled )
{
if ( *(float *)&cdvolume == bgmvolume[8] )
{
if ( !playing )
return;
}
else if ( *(float *)&cdvolume == 0.0 )
{
Cvar_SetValue(bgmvolume, COERCE_DOUBLE((unsigned __int64)LC33));
cdvolume = LODWORD(bgmvolume[8]);
CDAudio_Resume();
if ( !playing )
return;
}
else
{
Cvar_SetValue(bgmvolume, 0.0);
cdvolume = LODWORD(bgmvolume[8]);
CDAudio_Pause();
if ( !playing )
return;
}
if ( time(0LL) > lastchk_0 )
{
v0[0] = 2;
lastchk_0 = time(0LL) + 2;
if ( ioctl(cdfile, 0x530BuLL, v0) == -1 )
{
Com_DPrintf("ioctl cdromsubchnl failed\n");
playing = 0;
}
else if ( (unsigned __int8)(v0[1] - 17) > 1u )
{
playing = 0;
if ( playLooping )
CDAudio_Play(playTrack, 1);
}
}
}
}

canonical_decompiled_code:
void func8()
{
char v0[24]; // [rsp+0h] [rbp-18h] BYREF

if ( enabled )
{
if ( *(float *)&cdvolume == bgmvolume[8] )
{
if ( !playing )
return;
}
else if ( *(float *)&cdvolume == 0.0 )
{
Cvar_SetValue(bgmvolume, COERCE_DOUBLE((unsigned __int64)LC33));
cdvolume = LODWORD(bgmvolume[8]);
func6();
if ( !playing )
return;
}
else
{
Cvar_SetValue(bgmvolume, 0.0);
cdvolume = LODWORD(bgmvolume[8]);
func4();
if ( !playing )
return;
}
if ( time(0LL) > lastchk_0 )
{
v0[0] = 2;
lastchk_0 = time(0LL) + 2;
if ( ioctl(cdfile, 0x530BuLL, v0) == -1 )
{
Com_DPrintf("ioctl cdromsubchnl failed\n");
playing = 0;
}
else if ( (unsigned __int8)(v0[1] - 17) > 1u )
{
playing = 0;
if ( playLooping )
func5(playTrack, 1);
}
}
}
}

original_code:
void CDAudio_Update(void)
{
 struct cdrom_subchnl subchnl;
 static time_t lastchk;
 if (!enabled)
  return;
 if (bgmvolume.value != cdvolume)
 {
  if (cdvolume)
  {
   Cvar_SetValue (&bgmvolume, 0.0);
   cdvolume = bgmvolume.value;
   CDAudio_Pause ();
  }
  else
  {
   Cvar_SetValue (&bgmvolume, 1.0);
   cdvolume = bgmvolume.value;
   CDAudio_Resume ();
  }
 }
 if (playing && lastchk < time(((void *)0))) {
  lastchk = time(((void *)0)) + 2;
  subchnl.cdsc_format = 0x02;
  if (ioctl(cdfile, 0x530b, &subchnl) == -1 ) {
   Com_DPrintf ("ioctl cdromsubchnl failed\n");
   playing = false;
   return;
  }
  if (subchnl.cdsc_audiostatus != 0x11 &&
   subchnl.cdsc_audiostatus != 0x12) {
   playing = false;
   if (playLooping)
    CDAudio_Play(playTrack, true);
  }
 }
}

canonical_original_code:
void CDAudio_Update()
{
 struct cdrom_subchnl subchnl;
 static long lastchk;
 if (!enabled)
  return;
 if (bgmvolume.value != cdvolume)
 {
  if (cdvolume)
  {
   Cvar_SetValue (&bgmvolume, 0.0);
   cdvolume = bgmvolume.value;
   CDAudio_Pause ();
  }
  else
  {
   Cvar_SetValue (&bgmvolume, 1.0);
   cdvolume = bgmvolume.value;
   CDAudio_Resume ();
  }
 }
 if (playing && lastchk < time(((void *)0))) {
  lastchk = time(((void *)0)) + 2;
  subchnl.cdsc_format = 0x02;
  if (ioctl(cdfile, 0x530b, &subchnl) == -1 ) {
   Com_DPrintf ("ioctl cdromsubchnl failed\n");
   playing = false;
   return;
  }
  if (subchnl.cdsc_audiostatus != 0x11 &&
   subchnl.cdsc_audiostatus != 0x12) {
   playing = false;
   if (playLooping)
    CDAudio_Play(playTrack, true);
  }
 }
}

variable_types: struct cdrom_subchnl { unsigned char cdsc_format; unsigned char cdsc_audiostatus; unsigned char cdsc_adr; unsigned char cdsc_ctrl; unsigned char cdsc_trk; unsigned char cdsc_ind; union cdrom_addr { struct cdrom_msf0 { unsigned char minute; unsigned char second; unsigned char frame; } msf; int lba; } cdsc_absaddr; union cdrom_addr cdsc_reladdr; }

variable_types: lastchk long

user_defined_types: struct cdrom_subchnl { unsigned char cdsc_format; unsigned char cdsc_audiostatus; unsigned char cdsc_adr; unsigned char cdsc_ctrl; unsigned char cdsc_trk; unsigned char cdsc_ind; union cdrom_addr cdsc_absaddr; union cdrom_addr cdsc_reladdr; }


repo: jite/jquake

decompiled_code:
__int64 CDAudio_Init()
{
signed int v0; // er12
unsigned int v1; // er12
__int64 i; // rax
__int64 v4; // rax
int *v5; // rax

if ( !(unsigned int)COM_CheckParm("-cdaudio") )
return (unsigned int)-1;
v0 = COM_CheckParm("-cddev");
if ( v0 && (int)(COM_Argc() - 1) > v0 )
{
v4 = COM_Argv((unsigned int)(v0 + 1));
strlcpy(cd_dev, v4, 64LL);
}
cdfile = open(cd_dev, 0);
v1 = cdfile;
if ( cdfile == -1 )
{
v5 = _errno_location();
Com_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, (unsigned int)*v5);
cdfile = -1;
}
else
{
for ( i = 0LL; i != 100; ++i )
remap[i] = i;
initialized = 1;
enabled = 1;
if ( (unsigned int)CDAudio_GetAudioDiskInfo() )
{
Com_Printf("CDAudio_Init: No CD in player.\n");
cdValid = 0;
}
v1 = 0;
Cmd_AddCommand("cd", CD_f);
Com_Printf("CD Audio Initialized\n");
}
return v1;
}

canonical_decompiled_code:
__int64 func9()
{
signed int v0; // er12
unsigned int v1; // er12
__int64 i; // rax
__int64 v4; // rax
int *v5; // rax

if ( !(unsigned int)COM_CheckParm("-cdaudio") )
return (unsigned int)-1;
v0 = COM_CheckParm("-cddev");
if ( v0 && (int)(COM_Argc() - 1) > v0 )
{
v4 = COM_Argv((unsigned int)(v0 + 1));
strlcpy(cd_dev, v4, 64LL);
}
cdfile = open(cd_dev, 0);
v1 = cdfile;
if ( cdfile == -1 )
{
v5 = _errno_location();
Com_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, (unsigned int)*v5);
cdfile = -1;
}
else
{
for ( i = 0LL; i != 100; ++i )
remap[i] = i;
initialized = 1;
enabled = 1;
if ( (unsigned int)func0() )
{
Com_Printf("CDAudio_Init: No CD in player.\n");
cdValid = 0;
}
v1 = 0;
Cmd_AddCommand("cd", CD_f);
Com_Printf("CD Audio Initialized\n");
}
return v1;
}

original_code:
int CDAudio_Init(void)
{
 int i;
 if (!COM_CheckParm("-cdaudio"))
  return -1;
 if ((i = COM_CheckParm("-cddev")) != 0 && i < COM_Argc() - 1)
  strlcpy (cd_dev, COM_Argv(i + 1), sizeof(cd_dev));
 if ((cdfile = open(cd_dev, 00)) == -1) {
  Com_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, (*__errno_location ()));
  cdfile = -1;
  return -1;
 }
 for (i = 0; i < 100; i++)
  remap[i] = i;
 initialized = true;
 enabled = true;
 if (CDAudio_GetAudioDiskInfo())
 {
  Com_Printf ("CDAudio_Init: No CD in player.\n");
  cdValid = false;
 }
 Cmd_AddCommand ("cd", CD_f);
 Com_Printf ("CD Audio Initialized\n");
 return 0;
}

canonical_original_code:
int CDAudio_Init()
{
 int i;
 if (!COM_CheckParm("-cdaudio"))
  return -1;
 if ((i = COM_CheckParm("-cddev")) != 0 && i < COM_Argc() - 1)
  strlcpy (cd_dev, COM_Argv(i + 1), sizeof(cd_dev));
 if ((cdfile = open(cd_dev, 00)) == -1) {
  Com_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, (*__errno_location ()));
  cdfile = -1;
  return -1;
 }
 for (i = 0; i < 100; i++)
  remap[i] = i;
 initialized = true;
 enabled = true;
 if (CDAudio_GetAudioDiskInfo())
 {
  Com_Printf ("CDAudio_Init: No CD in player.\n");
  cdValid = false;
 }
 Cmd_AddCommand ("cd", CD_f);
 Com_Printf ("CD Audio Initialized\n");
 return 0;
}

variable_types: i int

return_type: int


decompiled_code:
int CDAudio_Shutdown()
{
int result; // eax

result = initialized;
if ( initialized )
{
CDAudio_Stop();
result = close(cdfile);
cdfile = -1;
}
return result;
}

canonical_decompiled_code:
int func10()
{
int result; // eax

result = initialized;
if ( initialized )
{
func3();
result = close(cdfile);
cdfile = -1;
}
return result;
}

original_code:
void CDAudio_Shutdown(void)
{
 if (!initialized)
  return;
 CDAudio_Stop();
 close(cdfile);
 cdfile = -1;
}

canonical_original_code:
void CDAudio_Shutdown()
{
 if (!initialized)
  return;
 CDAudio_Stop();
 close(cdfile);
 cdfile = -1;
}

return_type: void


decompiled_code:
const char *M_CG_bm_type_r()
{
const char *v0; // r8

v0 = "Arena";
if ( (unsigned int)(bm_type_var - 1) <= 3 )
v0 = bm_type_desc[bm_type_var];
return v0;
}

canonical_decompiled_code:
const char *func0()
{
const char *v0; // r8

v0 = "Arena";
if ( (unsigned int)(bm_type_var - 1) <= 3 )
v0 = bm_type_desc[bm_type_var];
return v0;
}

original_code: static const char* M_CG_bm_type_r(void) { if (((bm_type_var) > 0) && ((bm_type_var) < bm_type_max)) { return bm_type_desc[bm_type_var]; } else { return bm_type_desc[0]; } }

canonical_original_code: static char *M_CG_bm_type_r() { if (((bm_type_var) > 0) && ((bm_type_var) < bm_type_max)) { return bm_type_desc[bm_type_var]; } else { return bm_type_desc[0]; } }

return_type: char *


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

result = (a1 == 0 ? 2 : 0) + bm_type_var - 1;
if ( (unsigned int)result > 4 )
result = 0LL;
bm_type_var = result;
return result;
}

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

result = (a1 == 0 ? 2 : 0) + bm_type_var - 1;
if ( (unsigned int)result > 4 )
result = 0LL;
bm_type_var = result;
return result;
}

original_code: static void M_CG_bm_type_t(qbool back) { (bm_type_var) += back ? -1 : 1; if ((bm_type_var) >= bm_type_max) { (bm_type_var) = 0; } else if ((bm_type_var) < 0) { (bm_type_var) = bm_type_max - 1; } }

canonical_original_code: static void M_CG_bm_type_t(enum qbool back) { (bm_type_var) += back ? -1 : 1; if ((bm_type_var) >= bm_type_max) { (bm_type_var) = 0; } else if ((bm_type_var) < 0) { (bm_type_var) = bm_type_max - 1; } }

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


decompiled_code:
const char *M_CG_bm_map_r()
{
const char *v0; // r8

v0 = "dm3";
if ( (unsigned int)(bm_map_var - 1) <= 0xB )
v0 = bm_map_desc[bm_map_var];
return v0;
}

canonical_decompiled_code:
const char *func2()
{
const char *v0; // r8

v0 = "dm3";
if ( (unsigned int)(bm_map_var - 1) <= 0xB )
v0 = bm_map_desc[bm_map_var];
return v0;
}

original_code: static const char* M_CG_bm_map_r(void) { if (((bm_map_var) > 0) && ((bm_map_var) < bm_map_max)) { return bm_map_desc[bm_map_var]; } else { return bm_map_desc[0]; } }

canonical_original_code: static char *M_CG_bm_map_r() { if (((bm_map_var) > 0) && ((bm_map_var) < bm_map_max)) { return bm_map_desc[bm_map_var]; } else { return bm_map_desc[0]; } }


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

result = (a1 == 0 ? 2 : 0) + bm_map_var - 1;
if ( (unsigned int)result > 0xC )
result = 0LL;
bm_map_var = result;
return result;
}

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

result = (a1 == 0 ? 2 : 0) + bm_map_var - 1;
if ( (unsigned int)result > 0xC )
result = 0LL;
bm_map_var = result;
return result;
}

original_code: static void M_CG_bm_map_t(qbool back) { (bm_map_var) += back ? -1 : 1; if ((bm_map_var) >= bm_map_max) { (bm_map_var) = 0; } else if ((bm_map_var) < 0) { (bm_map_var) = bm_map_max - 1; } }

canonical_original_code: static void M_CG_bm_map_t(enum qbool back) { (bm_map_var) += back ? -1 : 1; if ((bm_map_var) >= bm_map_max) { (bm_map_var) = 0; } else if ((bm_map_var) < 0) { (bm_map_var) = bm_map_max - 1; } }


decompiled_code:
const char *M_CG_game_skill_r()
{
const char *v0; // r8

v0 = "Easy";
if ( (unsigned int)(game_skill_var - 1) <= 2 )
v0 = game_skill_desc[game_skill_var];
return v0;
}

canonical_decompiled_code:
const char *func4()
{
const char *v0; // r8

v0 = "Easy";
if ( (unsigned int)(game_skill_var - 1) <= 2 )
v0 = game_skill_desc[game_skill_var];
return v0;
}

original_code: static const char* M_CG_game_skill_r(void) { if (((game_skill_var) > 0) && ((game_skill_var) < game_skill_max)) { return game_skill_desc[game_skill_var]; } else { return game_skill_desc[0]; } }

canonical_original_code: static char *M_CG_game_skill_r() { if (((game_skill_var) > 0) && ((game_skill_var) < game_skill_max)) { return game_skill_desc[game_skill_var]; } else { return game_skill_desc[0]; } }


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

result = (a1 == 0 ? 2 : 0) + game_skill_var - 1;
if ( (unsigned int)result > 3 )
result = 0LL;
game_skill_var = result;
return result;
}

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

result = (a1 == 0 ? 2 : 0) + game_skill_var - 1;
if ( (unsigned int)result > 3 )
result = 0LL;
game_skill_var = result;
return result;
}

original_code: static void M_CG_game_skill_t(qbool back) { (game_skill_var) += back ? -1 : 1; if ((game_skill_var) >= game_skill_max) { (game_skill_var) = 0; } else if ((game_skill_var) < 0) { (game_skill_var) = game_skill_max - 1; } }

canonical_original_code: static void M_CG_game_skill_t(enum qbool back) { (game_skill_var) += back ? -1 : 1; if ((game_skill_var) >= game_skill_max) { (game_skill_var) = 0; } else if ((game_skill_var) < 0) { (game_skill_var) = game_skill_max - 1; } }


decompiled_code:
const char *M_CG_cg_teamdamage_r()
{
const char *result; // rax

result = "on";
if ( cg_teamdamage_var != 1 )
result = "off";
return result;
}

canonical_decompiled_code:
const char *func6()
{
const char *result; // rax

result = "on";
if ( cg_teamdamage_var != 1 )
result = "off";
return result;
}

original_code: static const char* M_CG_cg_teamdamage_r(void) { if (((cg_teamdamage_var) > 0) && ((cg_teamdamage_var) < cg_teamdamage_max)) { return cg_teamdamage_desc[cg_teamdamage_var]; } else { return cg_teamdamage_desc[0]; } }

canonical_original_code: static char *M_CG_cg_teamdamage_r() { if (((cg_teamdamage_var) > 0) && ((cg_teamdamage_var) < cg_teamdamage_max)) { return cg_teamdamage_desc[cg_teamdamage_var]; } else { return cg_teamdamage_desc[0]; } }


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

result = (a1 == 0 ? 2 : 0) + cg_teamdamage_var - 1;
if ( (unsigned int)result > 1 )
result = 0LL;
cg_teamdamage_var = result;
return result;
}

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

result = (a1 == 0 ? 2 : 0) + cg_teamdamage_var - 1;
if ( (unsigned int)result > 1 )
result = 0LL;
cg_teamdamage_var = result;
return result;
}

original_code: static void M_CG_cg_teamdamage_t(qbool back) { (cg_teamdamage_var) += back ? -1 : 1; if ((cg_teamdamage_var) >= cg_teamdamage_max) { (cg_teamdamage_var) = 0; } else if ((cg_teamdamage_var) < 0) { (cg_teamdamage_var) = cg_teamdamage_max - 1; } }

canonical_original_code: static void M_CG_cg_teamdamage_t(enum qbool back) { (cg_teamdamage_var) += back ? -1 : 1; if ((cg_teamdamage_var) >= cg_teamdamage_max) { (cg_teamdamage_var) = 0; } else if ((cg_teamdamage_var) < 0) { (cg_teamdamage_var) = cg_teamdamage_max - 1; } }


decompiled_code:
const char *M_CG_game_map_group_r()
{
const char *v0; // r8

v0 = "Doomed Dimension";
if ( (unsigned int)(game_map_group_var - 1) <= 3 )
v0 = game_map_group_desc[game_map_group_var];
return v0;
}

canonical_decompiled_code:
const char *func8()
{
const char *v0; // r8

v0 = "Doomed Dimension";
if ( (unsigned int)(game_map_group_var - 1) <= 3 )
v0 = game_map_group_desc[game_map_group_var];
return v0;
}

original_code: static const char* M_CG_game_map_group_r(void) { if (((game_map_group_var) > 0) && ((game_map_group_var) < game_map_group_max)) { return game_map_group_desc[game_map_group_var]; } else { return game_map_group_desc[0]; } }

canonical_original_code: static char *M_CG_game_map_group_r() { if (((game_map_group_var) > 0) && ((game_map_group_var) < game_map_group_max)) { return game_map_group_desc[game_map_group_var]; } else { return game_map_group_desc[0]; } }


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

result = (a1 == 0 ? 2 : 0) + game_map_group_var - 1;
if ( (unsigned int)result > 4 )
result = 0LL;
game_map_group_var = result;
return result;
}

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

result = (a1 == 0 ? 2 : 0) + game_map_group_var - 1;
if ( (unsigned int)result > 4 )
result = 0LL;
game_map_group_var = result;
return result;
}

original_code: static void M_CG_game_map_group_t(qbool back) { (game_map_group_var) += back ? -1 : 1; if ((game_map_group_var) >= game_map_group_max) { (game_map_group_var) = 0; } else if ((game_map_group_var) < 0) { (game_map_group_var) = game_map_group_max - 1; } }

canonical_original_code: static void M_CG_game_map_group_t(enum qbool back) { (game_map_group_var) += back ? -1 : 1; if ((game_map_group_var) >= game_map_group_max) { (game_map_group_var) = 0; } else if ((game_map_group_var) < 0) { (game_map_group_var) = game_map_group_max - 1; } }


decompiled_code:
const char *M_CG_DM_game_mode_r()
{
const char *v0; // r8

v0 = "Free For All";
if ( (unsigned int)(DM_game_mode_var - 1) <= 2 )
v0 = DM_game_mode_desc[DM_game_mode_var];
return v0;
}

canonical_decompiled_code:
const char *func10()
{
const char *v0; // r8

v0 = "Free For All";
if ( (unsigned int)(DM_game_mode_var - 1) <= 2 )
v0 = DM_game_mode_desc[DM_game_mode_var];
return v0;
}

original_code: static const char* M_CG_DM_game_mode_r(void) { if (((DM_game_mode_var) > 0) && ((DM_game_mode_var) < DM_game_mode_max)) { return DM_game_mode_desc[DM_game_mode_var]; } else { return DM_game_mode_desc[0]; } }

canonical_original_code: static char *M_CG_DM_game_mode_r() { if (((DM_game_mode_var) > 0) && ((DM_game_mode_var) < DM_game_mode_max)) { return DM_game_mode_desc[DM_game_mode_var]; } else { return DM_game_mode_desc[0]; } }


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

result = (a1 == 0 ? 2 : 0) + DM_game_mode_var - 1;
if ( (unsigned int)result > 3 )
result = 0LL;
DM_game_mode_var = result;
return result;
}

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

result = (a1 == 0 ? 2 : 0) + DM_game_mode_var - 1;
if ( (unsigned int)result > 3 )
result = 0LL;
DM_game_mode_var = result;
return result;
}

original_code: static void M_CG_DM_game_mode_t(qbool back) { (DM_game_mode_var) += back ? -1 : 1; if ((DM_game_mode_var) >= DM_game_mode_max) { (DM_game_mode_var) = 0; } else if ((DM_game_mode_var) < 0) { (DM_game_mode_var) = DM_game_mode_max - 1; } }

canonical_original_code: static void M_CG_DM_game_mode_t(enum qbool back) { (DM_game_mode_var) += back ? -1 : 1; if ((DM_game_mode_var) >= DM_game_mode_max) { (DM_game_mode_var) = 0; } else if ((DM_game_mode_var) < 0) { (DM_game_mode_var) = DM_game_mode_max - 1; } }


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

v0 = "ffa";
if ( (unsigned int)bm_type_var <= 4 )
v0 = CSWTCH_58[bm_type_var];
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

v0 = "ffa";
if ( (unsigned int)bm_type_var <= 4 )
v0 = CSWTCH_58[bm_type_var];
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 *


decompiled_code:
// attributes: thunk
__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:
// attributes: thunk
__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 *

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:
// attributes: thunk
__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


decompiled_code:
// attributes: thunk
__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:
// attributes: thunk
__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:
// attributes: thunk
__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:
// attributes: thunk
__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:
// attributes: thunk
__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:
// attributes: thunk
__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)
{
bool v1; // zf
double v2; // xmm1_8
__int64 result; // rax
__m128i v4; // [rsp+0h] [rbp-58h] BYREF
__m128i v5; // [rsp+10h] [rbp-48h]
__m128i v6; // [rsp+20h] [rbp-38h]
__m128i v7; // [rsp+30h] [rbp-28h]
__m128i v8; // [rsp+40h] [rbp-18h]

v1 = a1[4].m128i_i32[2] == 2;
v4 = _mm_loadu_si128(a1);
v5 = _mm_loadu_si128(a1 + 1);
v6 = _mm_loadu_si128(a1 + 2);
v7 = _mm_loadu_si128(a1 + 3);
v8 = _mm_loadu_si128(a1 + 4);
if ( v1 )
{
Menu_MultiPlayer_Key(201LL, 0);
result = 1LL;
}
else
{
v2 = (double)(int)Browser_window[1];
*(double *)v4.m128i_i64 = *(double *)v4.m128i_i64 - (double)Browser_window[0];
*(double *)&v4.m128i_i64[1] = *(double *)&v4.m128i_i64[1] - v2;
*(double *)v5.m128i_i64 = *(double *)v5.m128i_i64 - (double)Browser_window[0];
*(double *)&v5.m128i_i64[1] = *(double *)&v5.m128i_i64[1] - v2;
result = CTab_Mouse_Event(&sb_tab, &v4);
}
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; // er12
unsigned int v1; // ebp
__int64 v2; // rdi

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

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

v0 = game_skill_var;
v1 = 1 - ((cg_teamdamage_var == 0) - 1);
Cbuf_AddText("disconnect; sv_progsname spprogs; gamedir qw; coop 1; deathmatch 0\n");
v2 = va("teamplay %d; skill %d;maxclients %d;map start", v1, v0, (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:
// attributes: thunk
__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
unsigned int v2; // edx
int v3; // er8
int v4; // ecx
int v5; // er8

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

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

M_Unscale_Menu();
v0 = vid[7];
v1 = 640;
v2 = vid[9];
v3 = 480;
if ( v0 <= 0x280 )
v1 = vid[7];
v4 = v1 - 8;
if ( v2 <= 0x1E0 )
v3 = vid[9];
Browser_window[2] = v4;
v5 = v3 - 8;
Browser_window[0] = (v0 - v4) >> 1;
Browser_window[3] = v5;
Browser_window[1] = (v2 - v5) >> 1;
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:
// attributes: thunk
__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:
// attributes: thunk
__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:
__int64 Amf_SetMode_f()
{
const char *v0; // rax
__int64 result; // rax
const char *v2; // rax
__int64 v3; // [rsp+0h] [rbp-28h] BYREF
__int16 v4; // [rsp+8h] [rbp-20h]

if ( (unsigned int)Cmd_Argc() == 2 )
{
v2 = (const char *)Cmd_Argv(1LL);
snprintf((char *)&v3, 0x20uLL, "%s", v2);
if ( v3 == 0x6C6961727477656ELL && v4 == 115 )
{
Cvar_SetValue(amf_buildingsparks, 3.0);
Cvar_SetValue(amf_weather_rain, 0.0);
Cvar_SetValue(amf_lightning_sparks, 3.0);
Cvar_SetValue(amf_part_spikes, 5.0);
Cvar_SetValue(amf_part_gunshot, 5.0);
Cvar_SetValue(amf_part_explosion, 5.0);
Cvar_SetValue(amf_part_traillen, 1.0);
Cvar_SetValue(amf_part_trailtime, 1.5);
Cvar_SetValue(amf_part_sparks, 1.0);
Cvar_SetValue(amf_nailtrail_plasma, 0.0);
Cvar_SetValue(amf_part_traillen, 1.0);
Cvar_SetValue(amf_part_gunshot_type, 1.0);
Cvar_SetValue(amf_part_spikes_type, 1.0);
Cvar_SetValue(amf_part_trailwidth, 3.0);
Cvar_SetValue(amf_part_traildetail, 1.0);
Cvar_SetValue(amf_part_trailtype, 2.0);
result = Cvar_SetValue(&gl_bounceparticles, 1.0);
}
else
{
result = 0x686177746C7576LL;
if ( v3 == 0x686177746C7576LL )
{
Cvar_SetValue(amf_showstats, 1.0);
Cvar_SetValue(amf_part_spikes, 1.0);
Cvar_SetValue(amf_part_gunshot, 0.5);
Cvar_SetValue(amf_part_explosion, 1.0);
Cvar_SetValue(amf_part_blobexplosion, 0.5);
result = Cvar_SetValue(&gl_bounceparticles, 0.0);
}
}
}
else
{
v0 = (const char *)Cmd_Argv(0LL);
result = Com_Printf("Usage: %s [modename]\n", v0);
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
const char *v0; // rax
__int64 result; // rax
const char *v2; // rax
__int64 v3; // [rsp+0h] [rbp-28h] BYREF
__int16 v4; // [rsp+8h] [rbp-20h]

if ( (unsigned int)Cmd_Argc() == 2 )
{
v2 = (const char *)Cmd_Argv(1LL);
snprintf((char *)&v3, 0x20uLL, "%s", v2);
if ( v3 == 0x6C6961727477656ELL && v4 == 115 )
{
Cvar_SetValue(amf_buildingsparks, 3.0);
Cvar_SetValue(amf_weather_rain, 0.0);
Cvar_SetValue(amf_lightning_sparks, 3.0);
Cvar_SetValue(amf_part_spikes, 5.0);
Cvar_SetValue(amf_part_gunshot, 5.0);
Cvar_SetValue(amf_part_explosion, 5.0);
Cvar_SetValue(amf_part_traillen, 1.0);
Cvar_SetValue(amf_part_trailtime, 1.5);
Cvar_SetValue(amf_part_sparks, 1.0);
Cvar_SetValue(amf_nailtrail_plasma, 0.0);
Cvar_SetValue(amf_part_traillen, 1.0);
Cvar_SetValue(amf_part_gunshot_type, 1.0);
Cvar_SetValue(amf_part_spikes_type, 1.0);
Cvar_SetValue(amf_part_trailwidth, 3.0);
Cvar_SetValue(amf_part_traildetail, 1.0);
Cvar_SetValue(amf_part_trailtype, 2.0);
result = Cvar_SetValue(&gl_bounceparticles, 1.0);
}
else
{
result = 0x686177746C7576LL;
if ( v3 == 0x686177746C7576LL )
{
Cvar_SetValue(amf_showstats, 1.0);
Cvar_SetValue(amf_part_spikes, 1.0);
Cvar_SetValue(amf_part_gunshot, 0.5);
Cvar_SetValue(amf_part_explosion, 1.0);
Cvar_SetValue(amf_part_blobexplosion, 0.5);
result = Cvar_SetValue(&gl_bounceparticles, 0.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:
const char **__fastcall TP_GetModels(char *a1)
{
const char **v1; // r12
char *v2; // rbx

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

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

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

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; // r12
const char *v2; // rax
char *v3; // rax
const char **v4; // rax
const char **v5; // rbp
const char *v6; // r12
const char *v7; // rax
char *v8; // rax
const char **v9; // rax
const char **v10; // rbp
const char *v11; // rax
__int64 v12; // rdi
const char *v13; // rax
const char *v14; // r12
const char *v15; // rax
const char *v16; // r12
const char *v17; // rax

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

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

v0 = (unsigned int)((_DWORD)&dword_4E98 + 1394300);
do
{
while ( !*(_BYTE *)(v0 + 1024) )
{
LABEL_9:
v0 += 19720LL;
if ( (_UNKNOWN *)v0 == (_UNKNOWN *)((char *)&dword_4E98 + 2025340) )
return;
}
v8 = (char *)Info_ValueForKey(v0, "pmodel");
v9 = func4(v8);
v10 = v9;
if ( v9 )
{
if ( *((_DWORD *)v9 + 6) || !func2((char *)*v9, "6967") )
{
v1 = v10[1];
v2 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has suspicious player model (%s)\n", v2, v1);
}
}
else if ( *(_BYTE *)Info_ValueForKey(v0, "pmodel") )
{
v14 = (const char *)Info_ValueForKey(v0, "pmodel");
v15 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has suspicious player model (Unknown Model: %s)\n", v15, v14);
}
else
{
v11 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has hidden pmodel\n", v11);
}
v3 = (char *)Info_ValueForKey(v0, "emodel");
v4 = func4(v3);
v5 = v4;
if ( v4 )
{
if ( *((_DWORD *)v4 + 6) || func2((char *)*v4, "6967") )
{
v6 = v5[1];
v7 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has ILLEGAL eyes model (%s)\n", v7, v6);
}
goto LABEL_9;
}
if ( *(_BYTE *)Info_ValueForKey(v0, "emodel") )
{
v16 = (const char *)Info_ValueForKey(v0, "emodel");
v17 = (const char *)Info_ValueForKey(v0, "name");
Com_Printf("Warning: %s has ILLEGAL eyes model (Unknown Model: %s)\n", v17, v16);
goto LABEL_9;
}
v12 = v0;
v0 += 19720LL;
v13 = (const char *)Info_ValueForKey(v12, "name");
Com_Printf("Warning: %s has hidden emodel\n", v13);
}
while ( (_UNKNOWN *)v0 != (_UNKNOWN *)((char *)&dword_4E98 + 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 *v3; // rcx
int *v4; // rsi
__int64 result; // rax
int v6; // edx
double v7; // xmm1_8
float v8; // xmm0_4
__int64 v9; // rax
double v10; // xmm1_8
double v11; // xmm0_8
double v12; // xmm0_8
float v13; // xmm3_4
__int64 v14; // rax
__int64 v15; // rcx
double v16; // [rsp+8h] [rbp-20h]

if ( a1 )
{
vxdmgcnt_7 = (__int64)&vxdamagecountarmour;
v3 = &vxdamagecountarmour_time;
v4 = &vxdamagecountarmour_oldhealth;
vxdmgcnt_t_6 = (__int64)&vxdamagecountarmour_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecountarmour_oldhealth;
x_4 = 24;
}
else
{
vxdmgcnt_7 = (__int64)&vxdamagecount;
v3 = &vxdamagecount_time;
v4 = &vxdamagecount_oldhealth;
vxdmgcnt_t_6 = (__int64)&vxdamagecount_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecount_oldhealth;
x_4 = 136;
}
result = *((unsigned int *)&dword_4E98 + a1 + 331416);
if ( (int)result < *v4 - 1 )
{
v6 = *v4 - result;
if ( (double)*v3 > *((double *)&dword_4E98 + 165751) )
*(_DWORD *)vxdmgcnt_7 += v6;
else
*(_DWORD *)vxdmgcnt_7 = v6;
v7 = *((double *)&dword_4E98 + 165751);
v8 = *(float *)&amf_stat_loss[4];
if ( a2 )
{
v16 = *((double *)&dword_4E98 + 165751);
v9 = HUD_FindVar(a2, "duration", v8);
v3 = (int *)vxdmgcnt_t_6;
v4 = (int *)vxdmgcnt_o_5;
v8 = *(float *)(v9 + 32);
v7 = v16;
}
*v3 = (int)((float)(v8 + v8) + v7);
result = *((unsigned int *)&dword_4E98 + a1 + 331416);
}
*v4 = result;
v10 = *((double *)&dword_4E98 + 165751);
v11 = (double)*v3;
if ( v11 > v10 )
{
v12 = v11 - v10;
v13 = *(float *)&LC6;
if ( v12 <= 1.0 )
v13 = v12;
glTexEnvf(8960LL, 8704LL, 8448.0);
glDisable(3008LL);
glEnable(3042LL);
glColor4f(1.0, 1.0, 1.0, v13);
if ( a2 )
{
v14 = scale_3;
if ( scale_3 )
{
v15 = align_0;
}
else
{
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);
v15 = align_0;
v14 = scale_3;
}
SCR_HUD_DrawNum(
a2,
abs32(*(_DWORD *)vxdmgcnt_7),
1LL,
(unsigned int)(int)*(float *)(style_2 + 32),
*(unsigned int *)(digits_1 + 64),
*(_QWORD *)(v15 + 8),
*(float *)(v14 + 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, 1.0);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1, __int64 a2)
{
int *v3; // rcx
int *v4; // rsi
__int64 result; // rax
int v6; // edx
double v7; // xmm1_8
float v8; // xmm0_4
__int64 v9; // rax
double v10; // xmm1_8
double v11; // xmm0_8
double v12; // xmm0_8
float v13; // xmm3_4
__int64 v14; // rax
__int64 v15; // rcx
double v16; // [rsp+8h] [rbp-20h]

if ( a1 )
{
vxdmgcnt_7 = (__int64)&vxdamagecountarmour;
v3 = &vxdamagecountarmour_time;
v4 = &vxdamagecountarmour_oldhealth;
vxdmgcnt_t_6 = (__int64)&vxdamagecountarmour_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecountarmour_oldhealth;
x_4 = 24;
}
else
{
vxdmgcnt_7 = (__int64)&vxdamagecount;
v3 = &vxdamagecount_time;
v4 = &vxdamagecount_oldhealth;
vxdmgcnt_t_6 = (__int64)&vxdamagecount_time;
vxdmgcnt_o_5 = (__int64)&vxdamagecount_oldhealth;
x_4 = 136;
}
result = *((unsigned int *)&dword_4E98 + a1 + 331416);
if ( (int)result < *v4 - 1 )
{
v6 = *v4 - result;
if ( (double)*v3 > *((double *)&dword_4E98 + 165751) )
*(_DWORD *)vxdmgcnt_7 += v6;
else
*(_DWORD *)vxdmgcnt_7 = v6;
v7 = *((double *)&dword_4E98 + 165751);
v8 = *(float *)&amf_stat_loss[4];
if ( a2 )
{
v16 = *((double *)&dword_4E98 + 165751);
v9 = HUD_FindVar(a2, "duration", v8);
v3 = (int *)vxdmgcnt_t_6;
v4 = (int *)vxdmgcnt_o_5;
v8 = *(float *)(v9 + 32);
v7 = v16;
}
*v3 = (int)((float)(v8 + v8) + v7);
result = *((unsigned int *)&dword_4E98 + a1 + 331416);
}
*v4 = result;
v10 = *((double *)&dword_4E98 + 165751);
v11 = (double)*v3;
if ( v11 > v10 )
{
v12 = v11 - v10;
v13 = *(float *)&LC6;
if ( v12 <= 1.0 )
v13 = v12;
glTexEnvf(8960LL, 8704LL, 8448.0);
glDisable(3008LL);
glEnable(3042LL);
glColor4f(1.0, 1.0, 1.0, v13);
if ( a2 )
{
v14 = scale_3;
if ( scale_3 )
{
v15 = align_0;
}
else
{
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);
v15 = align_0;
v14 = scale_3;
}
SCR_HUD_DrawNum(
a2,
abs32(*(_DWORD *)vxdmgcnt_7),
1LL,
(unsigned int)(int)*(float *)(style_2 + 32),
*(unsigned int *)(digits_1 + 64),
*(_QWORD *)(v15 + 8),
*(float *)(v14 + 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, 1.0);
}
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 *i; // rdx

buf_8 = 0;
v1 = *a1;
for ( i = &buf_8; *a1; v1 = *a1 )
{
++a1;
*i++ = v1 & 0x7F;
}
*i = 0;
return &buf_8;
}

canonical_decompiled_code:
char *__fastcall func3(char *a1)
{
char v1; // al
char *i; // rdx

buf_8 = 0;
v1 = *a1;
for ( i = &buf_8; *a1; v1 = *a1 )
{
++a1;
*i++ = v1 & 0x7F;
}
*i = 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 *


decompiled_code:
__int64 __fastcall Draw_AlphaWindow(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4, unsigned __int8 a5, float a6)
{
unsigned int v6; // er15
unsigned int v9; // er12
__int64 v11; // rsi
unsigned int v12; // er13

v6 = a3 - a1;
v9 = a2;
Draw_Fill(a1, a2, a3 - (unsigned int)a1 + 1, 1LL, 2LL);
v11 = a4;
v12 = a4 - v9;
Draw_Fill((unsigned int)a1, v11, v6, 1LL, 1LL);
Draw_Fill((unsigned int)a1, v9, 1LL, v12, 2LL);
Draw_Fill(a3, v9, 1LL, v12 + 1, 1LL);
return Draw_AlphaFill((unsigned int)a1, v9, v6, v12, 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 v6; // er15
unsigned int v9; // er12
__int64 v11; // rsi
unsigned int v12; // er13

v6 = a3 - a1;
v9 = a2;
Draw_Fill(a1, a2, a3 - (unsigned int)a1 + 1, 1LL, 2LL);
v11 = a4;
v12 = a4 - v9;
Draw_Fill((unsigned int)a1, v11, v6, 1LL, 1LL);
Draw_Fill((unsigned int)a1, v9, 1LL, v12, 2LL);
Draw_Fill(a3, v9, 1LL, v12 + 1, 1LL);
return Draw_AlphaFill((unsigned int)a1, v9, v6, v12, 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