decompiled_code:
__int64 __fastcall Movie_Start(double a1)
{
const char *v1; // r8
__int64 result; // rax
time_t timer; // [rsp+18h] [rbp-10h] BYREF

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

canonical_decompiled_code:
__int64 __fastcall func0(double a1)
{
const char *v1; // r8
__int64 result; // rax
time_t timer; // [rsp+18h] [rbp-10h] BYREF

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

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

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

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

variable_types: t long


repo: jite/jquake

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

result = cls[2427];
if ( (_DWORD)result )
{
result = 0LL;
if ( !cls[2692] )
result = movie_is_capturing != 0;
}
return result;
}

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

result = cls[2427];
if ( (_DWORD)result )
{
result = 0LL;
if ( !cls[2692] )
result = movie_is_capturing != 0;
}
return result;
}

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

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

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


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

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

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

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

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

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

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

variable_types:
string
char *

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

return_type: void

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:
__int64 Movie_Stop()
{
double v0; // xmm0_8

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

canonical_decompiled_code:
__int64 func3()
{
double v0; // xmm0_8

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

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

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


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

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

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

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

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

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

variable_types: argc int

variable_types: time double

variable_types:
error
char *


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

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

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

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


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

result = Cmd_FindAlias("f_captureframe");
if ( result )
result = Cbuf_AddTextEx(&cbuf_main, "f_captureframe\n");
return result;
}

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

result = Cmd_FindAlias("f_captureframe");
if ( result )
result = Cbuf_AddTextEx(&cbuf_main, "f_captureframe\n");
return result;
}

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

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

variable_types: views int

return_type: double


decompiled_code:
__int64 Movie_FinishFrame()
{
__int64 result; // rax
float v1; // xmm1_4
char s[136]; // [rsp+0h] [rbp-88h] BYREF

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

canonical_decompiled_code:
__int64 func7()
{
__int64 result; // rax
float v1; // xmm1_4
char s[136]; // [rsp+0h] [rbp-88h] BYREF

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

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

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

variable_types:
fname
char [128]


original_code:
motionblur_t *CL_AllocBlur (void)
{
 int i;
 float time;
 int index;
 for (i=0 ; i<128 ; i++)
  if (!cl_blurs[i].model)
   return &cl_blurs[i];
 time = cl.time;
 index = 0;
 for (i=0 ; i<128 ; i++)
  if (cl_blurs[i].start < time)
  {
   time = cl_blurs[i].start;
   index = i;
  }
 return &cl_blurs[index];
}

canonical_original_code:
struct motionblur_t *CL_AllocBlur()
{
 int i;
 float time;
 int index;
 for (i=0 ; i<128 ; i++)
  if (!cl_blurs[i].model)
   return &cl_blurs[i];
 time = cl.time;
 index = 0;
 for (i=0 ; i<128 ; i++)
  if (cl_blurs[i].start < time)
  {
   time = cl_blurs[i].start;
   index = i;
  }
 return &cl_blurs[index];
}

variable_types: i int

variable_types: time float

variable_types: index int

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

user_defined_types: struct motionblur_t { float origin[3]; float angles[3]; float alpha; float fade; struct model_s *model; int frame; int oldframe; struct player_info_s *scoreboard; float start; int skinnum; }

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

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

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

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

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

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

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

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

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


original_code:
void CL_CreateBlurs (vec3_t start, vec3_t end, entity_t *ent)
{
 vec3_t vec;
 float len, maxlen;
 motionblur_t *blur;
 if ((cl.paused || (!cl_demospeed.value && cls.demoplayback)))
  return;
 if (((start)[0] == (end)[0] && (start)[1] == (end)[1] && (start)[2] == (end)[2]))
 {
  blur = CL_AllocBlur();
  if (!blur)
   return;
  ((blur->origin)[0] = (start)[0], (blur->origin)[1] = (start)[1], (blur->origin)[2] = (start)[2]);
  ((blur->angles)[0] = (ent->angles)[0], (blur->angles)[1] = (ent->angles)[1], (blur->angles)[2] = (ent->angles)[2]);
  blur->model = ent->model;
  blur->frame = ent->frame;
  blur->oldframe = ent->oldframe;
  blur->scoreboard = ent->scoreboard;
  blur->start = cl.time;
  blur->alpha = 1;
  blur->fade = 4.5;
  blur->skinnum = ent->skinnum;
  return;
 }
 ((vec)[0] = (end)[0] - (start)[0], (vec)[1] = (end)[1] - (start)[1], (vec)[2] = (end)[2] - (start)[2]);
 len = VectorNormalize(vec);
 maxlen = len;
 while (len > 0)
 {
  blur = CL_AllocBlur();
  if (!blur)
   return;
  ((blur->origin)[0] = (start)[0], (blur->origin)[1] = (start)[1], (blur->origin)[2] = (start)[2]);
  ((blur->angles)[0] = (ent->angles)[0], (blur->angles)[1] = (ent->angles)[1], (blur->angles)[2] = (ent->angles)[2]);
  blur->model = ent->model;
  blur->frame = ent->frame;
  blur->oldframe = ent->oldframe;
  blur->scoreboard = ent->scoreboard;
  blur->start = cl.time;
  blur->alpha = len/maxlen;
  blur->fade = 6;
  blur->skinnum = ent->skinnum;
  len=-2;
  ((start)[0] = (start)[0] + (vec)[0], (start)[1] = (start)[1] + (vec)[1], (start)[2] = (start)[2] + (vec)[2]);
 }
}

canonical_original_code:
void CL_CreateBlurs(float start[3], float end[3], struct entity_s *ent)
{
 float vec[3];
 float len; float maxlen;
 struct motionblur_t *blur;
 if ((cl.paused || (!cl_demospeed.value && cls.demoplayback)))
  return;
 if (((start)[0] == (end)[0] && (start)[1] == (end)[1] && (start)[2] == (end)[2]))
 {
  blur = CL_AllocBlur();
  if (!blur)
   return;
  ((blur->origin)[0] = (start)[0], (blur->origin)[1] = (start)[1], (blur->origin)[2] = (start)[2]);
  ((blur->angles)[0] = (ent->angles)[0], (blur->angles)[1] = (ent->angles)[1], (blur->angles)[2] = (ent->angles)[2]);
  blur->model = ent->model;
  blur->frame = ent->frame;
  blur->oldframe = ent->oldframe;
  blur->scoreboard = ent->scoreboard;
  blur->start = cl.time;
  blur->alpha = 1;
  blur->fade = 4.5;
  blur->skinnum = ent->skinnum;
  return;
 }
 ((vec)[0] = (end)[0] - (start)[0], (vec)[1] = (end)[1] - (start)[1], (vec)[2] = (end)[2] - (start)[2]);
 len = VectorNormalize(vec);
 maxlen = len;
 while (len > 0)
 {
  blur = CL_AllocBlur();
  if (!blur)
   return;
  ((blur->origin)[0] = (start)[0], (blur->origin)[1] = (start)[1], (blur->origin)[2] = (start)[2]);
  ((blur->angles)[0] = (ent->angles)[0], (blur->angles)[1] = (ent->angles)[1], (blur->angles)[2] = (ent->angles)[2]);
  blur->model = ent->model;
  blur->frame = ent->frame;
  blur->oldframe = ent->oldframe;
  blur->scoreboard = ent->scoreboard;
  blur->start = cl.time;
  blur->alpha = len/maxlen;
  blur->fade = 6;
  blur->skinnum = ent->skinnum;
  len=-2;
  ((start)[0] = (start)[0] + (vec)[0], (start)[1] = (start)[1] + (vec)[1], (start)[2] = (start)[2] + (vec)[2]);
 }
}

variable_types:
start
float [3]

variable_types:
end
float [3]

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

variable_types:
vec
float [3]

variable_types: len float

variable_types: maxlen float

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


TrailStats

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

result = a1;
if ( MotionBlurCount > MotionBlurCountHigh )
MotionBlurCountHigh = MotionBlurCount;
MotionBlurCount += a1;
return result;
}

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

result = a1;
if ( MotionBlurCount > MotionBlurCountHigh )
MotionBlurCountHigh = MotionBlurCount;
MotionBlurCount += a1;
return result;
}

original_code:
void TrailStats (int change)
{
 if (MotionBlurCount > MotionBlurCountHigh)
  MotionBlurCountHigh = MotionBlurCount;
 MotionBlurCount+=change;
}

canonical_original_code:
void TrailStats(int change)
{
 if (MotionBlurCount > MotionBlurCountHigh)
  MotionBlurCountHigh = MotionBlurCount;
 MotionBlurCount+=change;
}

variable_types: change int


decompiled_code:
__int64 CL_UpdateBlurs()
{
__int64 *v0; // rbx
__int64 result; // rax
__int64 v2; // rax
int v3; // edx
int v4; // xmm0_4
int v5; // xmm0_4
float v6; // xmm0_4
float v7; // xmm0_4
__int64 v8; // rax
int v9; // xmm0_4
int v10; // xmm0_4
__int64 vars0[19]; // [rsp+0h] [rbp+0h] BYREF

v0 = cl_blurs;
memset(vars0, 0, 0x78uLL);
result = TrailStats(-MotionBlurCount);
MotionBlurCount = 0;
do
{
if ( v0[4] && *((float *)v0 + 6) > 0.0 )
{
TrailStats(1u);
v2 = v0[4];
v3 = LODWORD(unk_2818[165765]);
LODWORD(vars0[0]) = *(_DWORD *)v0;
v4 = *((_DWORD *)v0 + 1);
vars0[3] = v2;
LODWORD(v2) = *((_DWORD *)v0 + 10);
HIDWORD(vars0[0]) = v4;
v5 = *((_DWORD *)v0 + 2);
HIDWORD(vars0[8]) = v2;
LODWORD(v2) = *((_DWORD *)v0 + 11);
LODWORD(vars0[1]) = v5;
v6 = *((float *)v0 + 6);
LODWORD(vars0[8]) = v2;
*((float *)&vars0[12] + 1) = v6;
if ( !v3 && (cl_demospeed[8] != 0.0 || !cls[2427]) )
{
v7 = v6 - *((float *)v0 + 7) * *(double *)&cls[10];
*((float *)v0 + 6) = v7;
}
v8 = v0[6];
HIDWORD(vars0[1]) = *((_DWORD *)v0 + 3);
v9 = *((_DWORD *)v0 + 4);
vars0[6] = v8;
LODWORD(v8) = *((_DWORD *)v0 + 15);
LODWORD(vars0[2]) = v9;
v10 = *((_DWORD *)v0 + 5);
LODWORD(vars0[5]) = v8;
HIDWORD(vars0[2]) = v10;
result = CL_AddEntity(vars0);
}
v0 += 8;
}
while ( v0 != &cl_blurs[1024] );
return result;
}

original_code:
void CL_UpdateBlurs (void)
{
 int i;
 motionblur_t *blur;
 entity_t ent;
 memset (&ent, 0, sizeof(entity_t));
 TrailStats (-MotionBlurCount);
 MotionBlurCount = 0;
 for (i=0, blur=cl_blurs ; i< 128 ; i++, blur++)
 {
  if (!blur->model || blur->alpha <= 0)
   continue;
  if (blur->alpha <= 0)
  {
   blur->model = ((void *)0);
   continue;
  }
  TrailStats (1);
  ((ent.origin)[0] = (blur->origin)[0], (ent.origin)[1] = (blur->origin)[1], (ent.origin)[2] = (blur->origin)[2]);
  ent.model = blur->model;
  ent.frame = blur->frame;
  ent.alpha = blur->alpha;
  ent.oldframe = blur->oldframe;
  if (!(cl.paused || (!cl_demospeed.value && cls.demoplayback)))
   blur->alpha -= cls.frametime*blur->fade;
  ent.scoreboard = blur->scoreboard;
  ((ent.angles)[0] = (blur->angles)[0], (ent.angles)[1] = (blur->angles)[1], (ent.angles)[2] = (blur->angles)[2]);
  ent.skinnum = blur->skinnum;
  CL_AddEntity (&ent);
 }
}

canonical_original_code:
void CL_UpdateBlurs()
{
 int i;
 struct motionblur_t *blur;
 struct entity_s ent;
 memset (&ent, 0, sizeof(entity_t));
 TrailStats (-MotionBlurCount);
 MotionBlurCount = 0;
 for (i=0, blur=cl_blurs ; i< 128 ; i++, blur++)
 {
  if (!blur->model || blur->alpha <= 0)
   continue;
  if (blur->alpha <= 0)
  {
   blur->model = ((void *)0);
   continue;
  }
  TrailStats (1);
  ((ent.origin)[0] = (blur->origin)[0], (ent.origin)[1] = (blur->origin)[1], (ent.origin)[2] = (blur->origin)[2]);
  ent.model = blur->model;
  ent.frame = blur->frame;
  ent.alpha = blur->alpha;
  ent.oldframe = blur->oldframe;
  if (!(cl.paused || (!cl_demospeed.value && cls.demoplayback)))
   blur->alpha -= cls.frametime*blur->fade;
  ent.scoreboard = blur->scoreboard;
  ((ent.angles)[0] = (blur->angles)[0], (ent.angles)[1] = (blur->angles)[1], (ent.angles)[2] = (blur->angles)[2]);
  ent.skinnum = blur->skinnum;
  CL_AddEntity (&ent);
 }
}

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


decompiled_code:
__int64 *CL_ClearBlurs()
{
__int64 *result; // rax

MotionBlurCount = 0;
result = cl_blurs;
do
{
result[4] = 0LL;
result += 8;
*((_DWORD *)result - 13) = 0;
*((_DWORD *)result - 12) = 0;
*((_DWORD *)result - 11) = 0;
*((_DWORD *)result - 9) = 0;
*((_DWORD *)result - 6) = 0;
*((_DWORD *)result - 5) = 0;
*((_DWORD *)result - 16) = 0;
*((_DWORD *)result - 15) = 0;
*((_DWORD *)result - 14) = 0;
*(result - 2) = 0LL;
*((_DWORD *)result - 1) = 0;
*((_DWORD *)result - 2) = 0;
}
while ( result != &cl_blurs[1024] );
return result;
}

canonical_decompiled_code:
__int64 *func4()
{
__int64 *result; // rax

MotionBlurCount = 0;
result = cl_blurs;
do
{
result[4] = 0LL;
result += 8;
*((_DWORD *)result - 13) = 0;
*((_DWORD *)result - 12) = 0;
*((_DWORD *)result - 11) = 0;
*((_DWORD *)result - 9) = 0;
*((_DWORD *)result - 6) = 0;
*((_DWORD *)result - 5) = 0;
*((_DWORD *)result - 16) = 0;
*((_DWORD *)result - 15) = 0;
*((_DWORD *)result - 14) = 0;
*(result - 2) = 0LL;
*((_DWORD *)result - 1) = 0;
*((_DWORD *)result - 2) = 0;
}
while ( result != &cl_blurs[1024] );
return result;
}

original_code:
void CL_ClearBlurs (void)
{
 int i, j;
 motionblur_t *blur;
 MotionBlurCount = 0;
 for (i=0, blur=cl_blurs ; i< 128 ; i++, blur++)
 {
  blur->model = ((void *)0);
  for (j=0;j<3;j++)
   blur->angles[j] = 0;
  blur->fade = 0;
  blur->frame = 0;
  blur->oldframe = 0;
  for (j=0;j<3;j++)
   blur->origin[j] = 0;
  blur->scoreboard = 0;
  blur->skinnum = 0;
  blur->start = 0;
 }
}

canonical_original_code:
void CL_ClearBlurs()
{
 int i; int j;
 struct motionblur_t *blur;
 MotionBlurCount = 0;
 for (i=0, blur=cl_blurs ; i< 128 ; i++, blur++)
 {
  blur->model = ((void *)0);
  for (j=0;j<3;j++)
   blur->angles[j] = 0;
  blur->fade = 0;
  blur->frame = 0;
  blur->oldframe = 0;
  for (j=0;j<3;j++)
   blur->origin[j] = 0;
  blur->scoreboard = 0;
  blur->skinnum = 0;
  blur->start = 0;
 }
}

variable_types: j int

user_defined_types: enum modhint_t { MOD_NORMAL=0, MOD_PLAYER=1, MOD_EYES=2, MOD_FLAME=3, MOD_THUNDERBOLT=4, MOD_BACKPACK=5, MOD_FLAG=6, MOD_SPIKE=7, MOD_TF_TRAIL=8, MOD_GRENADE=9, MOD_TESLA=10, MOD_SENTRYGUN=11, MOD_DETPACK=12, MOD_LASER=13, MOD_DEMON=14, MOD_SOLDIER=15, MOD_OGRE=16, MOD_ENFORCER=17, MOD_VOORSPIKE=18, MOD_LAVABALL=19, MOD_RAIL=20, MOD_RAIL2=21, MOD_BUILDINGGIBS=22, MOD_CLUSTER=23, MOD_SHAMBLER=24, MOD_TELEPORTDESTINATION=25, MOD_GIB=26, MOD_VMODEL=27 }

user_defined_types: enum modtype_t { mod_brush=0, mod_sprite=1, mod_spr32=2, mod_alias=3, mod_alias3=4 }

user_defined_types: enum synctype_t { ST_SYNC=0, ST_RAND=1 }

user_defined_types: struct dmodel_t { float mins[3]; float origin[3]; int headnode[4]; int visleafs; int firstface; }

user_defined_types: struct mplane_s { float normal[3]; float dist; unsigned char type; unsigned char signbits; unsigned char pad[2]; }

user_defined_types: struct medge_s { unsigned short v[2]; unsigned int cachededgeoffset; }

user_defined_types: struct mnode_s { int contents; int visframe; float minmaxs[6]; struct mnode_s *parent; struct mplane_s *plane; struct mnode_s *children[2]; unsigned short firstsurface; unsigned short numsurfaces; }

user_defined_types: struct glpoly_s { struct glpoly_s *next; struct glpoly_s *chain; struct glpoly_s *fb_chain; struct glpoly_s *luma_chain; struct glpoly_s *caustics_chain; struct glpoly_s *detail_chain; int numverts; float verts[4][9]; }


decompiled_code:
__int64 __fastcall Mod_ReadFlagsFromMD1(char *s1)
{
_DWORD *v1; // rax
unsigned int v2; // er8
char v4[72]; // [rsp+0h] [rbp-48h] BYREF

COM_StripExtension(s1, v4);
COM_DefaultExtension(v4, ".md3");
if ( !strcmp(s1, v4) )
{
COM_StripExtension(s1, v4);
COM_DefaultExtension(v4, ".md1");
}
else
{
COM_StripExtension(s1, v4);
COM_DefaultExtension(v4, ".mdl");
}
v1 = (_DWORD *)FS_LoadTempFile(v4, 0LL);
v2 = 0;
if ( v1 && *v1 == 1330660425 && v1[1] == 6 )
v2 = v1[19];
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *s1)
{
_DWORD *v1; // rax
unsigned int v2; // er8
char v4[72]; // [rsp+0h] [rbp-48h] BYREF

COM_StripExtension(s1, v4);
COM_DefaultExtension(v4, ".md3");
if ( !strcmp(s1, v4) )
{
COM_StripExtension(s1, v4);
COM_DefaultExtension(v4, ".md1");
}
else
{
COM_StripExtension(s1, v4);
COM_DefaultExtension(v4, ".mdl");
}
v1 = (_DWORD *)FS_LoadTempFile(v4, 0LL);
v2 = 0;
if ( v1 && *v1 == 1330660425 && v1[1] == 6 )
v2 = v1[19];
return v2;
}

original_code:
int Mod_ReadFlagsFromMD1(char *name, int md3version)
{
 mdl_t *pinmodel;
 char fname[64];
 COM_StripExtension(name, fname);
 COM_DefaultExtension(fname, ".md3");
 if (!strcmp(name, fname))
 {
  COM_StripExtension(name, fname);
  COM_DefaultExtension(fname, ".md1");
 }
 else
 {
  COM_StripExtension(name, fname);
  COM_DefaultExtension(fname, ".mdl");
 }
 pinmodel = (mdl_t *)FS_LoadTempFile(fname, ((void *)0));
 if (!pinmodel)
  return 0;
 if (pinmodel->ident != (('O'<<24)+('P'<<16)+('D'<<8)+'I'))
  return 0;
 if (pinmodel->version != 6)
  return 0;
 return pinmodel->flags;
}

canonical_original_code:
int Mod_ReadFlagsFromMD1(char *name, int md3version)
{
 struct mdl_t *pinmodel;
 char fname[64];
 COM_StripExtension(name, fname);
 COM_DefaultExtension(fname, ".md3");
 if (!strcmp(name, fname))
 {
  COM_StripExtension(name, fname);
  COM_DefaultExtension(fname, ".md1");
 }
 else
 {
  COM_StripExtension(name, fname);
  COM_DefaultExtension(fname, ".mdl");
 }
 pinmodel = (struct mdl_t *)FS_LoadTempFile(fname, ((void *)0));
 if (!pinmodel)
  return 0;
 if (pinmodel->ident != (('O'<<24)+('P'<<16)+('D'<<8)+'I'))
  return 0;
 if (pinmodel->version != 6)
  return 0;
 return pinmodel->flags;
}

variable_types:
name
char *

variable_types: struct mdl_t { int ident; int version; float scale[3]; float scale_origin[3]; float boundingradius; float eyeposition[3]; int numskins; int skinwidth; int skinheight; int numverts; int numtris; int numframes; enum synctype_t { ST_SYNC=0, ST_RAND=1 } synctype; int flags; float size; } *

variable_types:
fname
char [64]

return_type: int

user_defined_types: struct mdl_t { int ident; int version; float scale[3]; float scale_origin[3]; float boundingradius; float eyeposition[3]; int numskins; int skinwidth; int skinheight; int numverts; int numtris; int numframes; enum synctype_t synctype; int flags; float size; }


original_code:
void Mod_LoadAlias3Model (model_t *mod, void *buffer, int filesize)
{
 char specifiedskinname[128];
 char skinfileskinname[128];
 char tenebraeskinname[128];
 extern char loadname[];
 int start, end, total;
 int numsurfs;
 int numskins;
 int surfn;
 md3model_t *pheader;
 md3Header_t *mem;
 surfinf_t *sinf;
 md3Surface_t *surf;
 md3Shader_t *sshad;
 md3Frame_t *mFrame;
 int fr, i, j;
 md3St_t *st;
 start = Hunk_LowMark ();
 mod->type = mod_alias3;
 numsurfs = (((md3Header_t *)buffer)->numSurfaces);
 numskins = 1;
 pheader = (md3model_t *) Hunk_Alloc(sizeof(md3model_t) +(numsurfs*numskins)*sizeof(surfinf_t));
 pheader->surfinf = sizeof(md3model_t);
 mem = (md3Header_t *) Hunk_Alloc(filesize);
 pheader->md3model = (char *)mem - (char *)pheader;
 memcpy(mem, buffer, filesize);
 mem->ident=(mem->ident);
 mem->version=(mem->version);
 mem->flags=(mem->flags);
 mem->numFrames=(mem->numFrames);
 mem->numTags=(mem->numTags);
 mem->numSurfaces=(mem->numSurfaces);
 mem->numSkins=(mem->numSkins);
 mem->ofsFrames=(mem->ofsFrames);
 mem->ofsTags=(mem->ofsTags);
 mem->ofsSurfaces=(mem->ofsSurfaces);
 mem->ofsEnd=(mem->ofsEnd);
 pheader->numframes = mem->numFrames;
 pheader->numtags = mem->numTags;
 pheader->ofstags = pheader->md3model + mem->ofsTags;
 for (fr = 0; fr < mem->numFrames; fr++)
 {
  mFrame = ((md3Frame_t *)((char *)mem + mem->ofsFrames)) + fr;
  for (j = 0; j < 3; j++)
  {
   mFrame->bounds[0][j]=(mFrame->bounds[0][j]);
   mFrame->bounds[1][j]=(mFrame->bounds[1][j]);
   mFrame->localOrigin[j]=(mFrame->localOrigin[j]);
  }
  mFrame->radius=(mFrame->radius);
 }
 sinf = (surfinf_t*)((char *)pheader + pheader->surfinf);
 {
  surf = (md3Surface_t *)((char *)mem + mem->ofsSurfaces);
  for (surfn = 0; surfn < numsurfs; surfn++)
  {
   md3Triangle_t *tris;
   md3XyzNormal_t *vert;
   surf->ident=(surf->ident);
   surf->flags=(surf->flags);
   surf->numFrames=(surf->numFrames);
   surf->numShaders=(surf->numShaders);
   surf->numVerts=(surf->numVerts);
   surf->numTriangles=(surf->numTriangles);
   surf->ofsTriangles=(surf->ofsTriangles);
   surf->ofsShaders=(surf->ofsShaders);
   surf->ofsSt=(surf->ofsSt);
   surf->ofsXyzNormals=(surf->ofsXyzNormals);
   surf->ofsEnd=(surf->ofsEnd);
   st = (md3St_t *)((char *)surf + surf->ofsSt);
   for (i = 0; i < surf->numVerts; i++)
   {
    st[i].s=(st[i].s);
    st[i].t=(st[i].t);
   }
   tris = (md3Triangle_t *)((char *)surf + surf->ofsTriangles);
   for (j=0 ; j<surf->numTriangles ; j++)
   {
    tris[j].indexes[0]=(tris[j].indexes[0]);
    tris[j].indexes[1]=(tris[j].indexes[1]);
    tris[j].indexes[2]=(tris[j].indexes[2]);
   }
   vert = (md3XyzNormal_t *)((char *)surf + surf->ofsXyzNormals);
   for (j=0 ; j < surf->numVerts * surf->numFrames ; j++)
   {
    vert[j].xyz[0] = (vert[j].xyz[0]);
    vert[j].xyz[1] = (vert[j].xyz[1]);
    vert[j].xyz[2] = (vert[j].xyz[2]);
    vert[j].normal = (vert[j].normal);
   }
   sshad = (md3Shader_t *)((char *)surf + surf->ofsShaders);
   sshad->shaderIndex=(sshad->shaderIndex);
   *specifiedskinname = *skinfileskinname = *tenebraeskinname = '\0';
   strlcpy (specifiedskinname, sshad->name, sizeof (specifiedskinname));
   if (*sshad->name)
   {
    strlcpy (tenebraeskinname, mod->name, sizeof (tenebraeskinname));
    strcpy (COM_SkipPathWritable(tenebraeskinname), sshad->name);
   }
   else
   {
    char *sfile, *sfilestart, *nl;
    int len;
    strlcpy (sinf->name, mod->name, sizeof (sinf->name));
    COM_StripExtension(sinf->name, sinf->name);
    strlcat (sinf->name, "_default.skin", sizeof (sinf->name));
    sfile = sfilestart = (char *) FS_LoadHunkFile(sinf->name, ((void *)0));
    strlcpy (sinf->name, mod->name, sizeof (sinf->name));
    COM_StripExtension(sinf->name, sinf->name);
    strlcat (sinf->name, "_skin.tga", sizeof (sinf->name));
    len = strlen(surf->name);
    if (sfilestart)
    {
     while(*sfile)
     {
      nl = strchr(sfile, '\n');
      if (!nl)
       nl = sfile + strlen(sfile);
      if (sfile[len] == ',' && !strncasecmp(surf->name, sfile, len))
      {
       strlcpy(skinfileskinname, sfile+len+1, nl - (sfile + len) -2);
       break;
      }
      sfile = nl+1;
     }
    }
   }
   if (*skinfileskinname && (sinf->texnum=GL_LoadTextureImage(skinfileskinname, skinfileskinname, 0, 0, 0)))
    strlcpy (sinf->name, skinfileskinname, sizeof (sinf->name));
   else if (*specifiedskinname && (sinf->texnum=GL_LoadTextureImage(specifiedskinname, specifiedskinname, 0, 0, 0)))
    strlcpy (sinf->name, specifiedskinname, sizeof (sinf->name));
   else if (*tenebraeskinname)
   {
    sinf->texnum=GL_LoadTextureImage(tenebraeskinname, tenebraeskinname, 0, 0, 0);
    strlcpy (sinf->name, tenebraeskinname, sizeof (sinf->name));
   }
   else if (*skinfileskinname)
   {
    sinf->texnum=GL_LoadTextureImage(skinfileskinname, skinfileskinname, 0, 0, 0);
    strlcpy (sinf->name, skinfileskinname, sizeof (sinf->name));
   }
   else
   {
    sinf->texnum=GL_LoadTextureImage("dummy", "dummy", 0, 0, 0);
    strlcpy (sinf->name, "dummy", sizeof (sinf->name));
   }
   surf = (md3Surface_t *)((char *)surf + surf->ofsEnd);
   sinf++;
  }
 }
 end = Hunk_LowMark ();
 total = end - start;
 Cache_Alloc (&mod->cache, total, loadname);
 if (!mod->cache.data)
  return;
 memcpy (mod->cache.data, pheader, total);
 memset(mod->simpletexture, 0, sizeof(mod->simpletexture));
 mod->simpletexture[0] = Mod_LoadSimpleTexture(mod, 0);
 Hunk_FreeToLowMark (start);
 mod->flags = Mod_ReadFlagsFromMD1(mod->name, mem->flags);
}

canonical_original_code:
void Mod_LoadAlias3Model(struct model_s *mod, void *buffer, int filesize)
{
 char specifiedskinname[128];
 char skinfileskinname[128];
 char tenebraeskinname[128];
 extern char loadname[];
 int start; int end; int total;
 int numsurfs;
 int numskins;
 int surfn;
 struct md3model_t *pheader;
 struct md3Header_t *mem;
 struct surfinf_t *sinf;
 struct md3Surface_t *surf;
 struct md3Shader_t *sshad;
 struct md3Frame_s *mFrame;
 int fr; int i; int j;
 struct md3St_t *st;
 start = Hunk_LowMark ();
 mod->type = mod_alias3;
 numsurfs = (((struct md3Header_t *)buffer)->numSurfaces);
 numskins = 1;
 pheader = (struct md3model_t *) Hunk_Alloc(sizeof(md3model_t) +(numsurfs*numskins)*sizeof(surfinf_t));
 pheader->surfinf = sizeof(md3model_t);
 mem = (struct md3Header_t *) Hunk_Alloc(filesize);
 pheader->md3model = (char *)mem - (char *)pheader;
 memcpy(mem, buffer, filesize);
 mem->ident=(mem->ident);
 mem->version=(mem->version);
 mem->flags=(mem->flags);
 mem->numFrames=(mem->numFrames);
 mem->numTags=(mem->numTags);
 mem->numSurfaces=(mem->numSurfaces);
 mem->numSkins=(mem->numSkins);
 mem->ofsFrames=(mem->ofsFrames);
 mem->ofsTags=(mem->ofsTags);
 mem->ofsSurfaces=(mem->ofsSurfaces);
 mem->ofsEnd=(mem->ofsEnd);
 pheader->numframes = mem->numFrames;
 pheader->numtags = mem->numTags;
 pheader->ofstags = pheader->md3model + mem->ofsTags;
 for (fr = 0; fr < mem->numFrames; fr++)
 {
  mFrame = ((struct md3Frame_s *)((char *)mem + mem->ofsFrames)) + fr;
  for (j = 0; j < 3; j++)
  {
   mFrame->bounds[0][j]=(mFrame->bounds[0][j]);
   mFrame->bounds[1][j]=(mFrame->bounds[1][j]);
   mFrame->localOrigin[j]=(mFrame->localOrigin[j]);
  }
  mFrame->radius=(mFrame->radius);
 }
 sinf = (struct surfinf_t *)((char *)pheader + pheader->surfinf);
 {
  surf = (struct md3Surface_t *)((char *)mem + mem->ofsSurfaces);
  for (surfn = 0; surfn < numsurfs; surfn++)
  {
   struct md3Triangle_t *tris;
   struct md3XyzNormal_t *vert;
   surf->ident=(surf->ident);
   surf->flags=(surf->flags);
   surf->numFrames=(surf->numFrames);
   surf->numShaders=(surf->numShaders);
   surf->numVerts=(surf->numVerts);
   surf->numTriangles=(surf->numTriangles);
   surf->ofsTriangles=(surf->ofsTriangles);
   surf->ofsShaders=(surf->ofsShaders);
   surf->ofsSt=(surf->ofsSt);
   surf->ofsXyzNormals=(surf->ofsXyzNormals);
   surf->ofsEnd=(surf->ofsEnd);
   st = (struct md3St_t *)((char *)surf + surf->ofsSt);
   for (i = 0; i < surf->numVerts; i++)
   {
    st[i].s=(st[i].s);
    st[i].t=(st[i].t);
   }
   tris = (struct md3Triangle_t *)((char *)surf + surf->ofsTriangles);
   for (j=0 ; j<surf->numTriangles ; j++)
   {
    tris[j].indexes[0]=(tris[j].indexes[0]);
    tris[j].indexes[1]=(tris[j].indexes[1]);
    tris[j].indexes[2]=(tris[j].indexes[2]);
   }
   vert = (struct md3XyzNormal_t *)((char *)surf + surf->ofsXyzNormals);
   for (j=0 ; j < surf->numVerts * surf->numFrames ; j++)
   {
    vert[j].xyz[0] = (vert[j].xyz[0]);
    vert[j].xyz[1] = (vert[j].xyz[1]);
    vert[j].xyz[2] = (vert[j].xyz[2]);
    vert[j].normal = (vert[j].normal);
   }
   sshad = (struct md3Shader_t *)((char *)surf + surf->ofsShaders);
   sshad->shaderIndex=(sshad->shaderIndex);
   *specifiedskinname = *skinfileskinname = *tenebraeskinname = '\0';
   strlcpy (specifiedskinname, sshad->name, sizeof (specifiedskinname));
   if (*sshad->name)
   {
    strlcpy (tenebraeskinname, mod->name, sizeof (tenebraeskinname));
    strcpy (COM_SkipPathWritable(tenebraeskinname), sshad->name);
   }
   else
   {
    char *sfile; char *sfilestart; char *nl;
    int len;
    strlcpy (sinf->name, mod->name, sizeof (sinf->name));
    COM_StripExtension(sinf->name, sinf->name);
    strlcat (sinf->name, "_default.skin", sizeof (sinf->name));
    sfile = sfilestart = (char *) FS_LoadHunkFile(sinf->name, ((void *)0));
    strlcpy (sinf->name, mod->name, sizeof (sinf->name));
    COM_StripExtension(sinf->name, sinf->name);
    strlcat (sinf->name, "_skin.tga", sizeof (sinf->name));
    len = strlen(surf->name);
    if (sfilestart)
    {
     while(*sfile)
     {
      nl = strchr(sfile, '\n');
      if (!nl)
       nl = sfile + strlen(sfile);
      if (sfile[len] == ',' && !strncasecmp(surf->name, sfile, len))
      {
       strlcpy(skinfileskinname, sfile+len+1, nl - (sfile + len) -2);
       break;
      }
      sfile = nl+1;
     }
    }
   }
   if (*skinfileskinname && (sinf->texnum=GL_LoadTextureImage(skinfileskinname, skinfileskinname, 0, 0, 0)))
    strlcpy (sinf->name, skinfileskinname, sizeof (sinf->name));
   else if (*specifiedskinname && (sinf->texnum=GL_LoadTextureImage(specifiedskinname, specifiedskinname, 0, 0, 0)))
    strlcpy (sinf->name, specifiedskinname, sizeof (sinf->name));
   else if (*tenebraeskinname)
   {
    sinf->texnum=GL_LoadTextureImage(tenebraeskinname, tenebraeskinname, 0, 0, 0);
    strlcpy (sinf->name, tenebraeskinname, sizeof (sinf->name));
   }
   else if (*skinfileskinname)
   {
    sinf->texnum=GL_LoadTextureImage(skinfileskinname, skinfileskinname, 0, 0, 0);
    strlcpy (sinf->name, skinfileskinname, sizeof (sinf->name));
   }
   else
   {
    sinf->texnum=GL_LoadTextureImage("dummy", "dummy", 0, 0, 0);
    strlcpy (sinf->name, "dummy", sizeof (sinf->name));
   }
   surf = (struct md3Surface_t *)((char *)surf + surf->ofsEnd);
   sinf++;
  }
 }
 end = Hunk_LowMark ();
 total = end - start;
 Cache_Alloc (&mod->cache, total, loadname);
 if (!mod->cache.data)
  return;
 memcpy (mod->cache.data, pheader, total);
 memset(mod->simpletexture, 0, sizeof(mod->simpletexture));
 mod->simpletexture[0] = Mod_LoadSimpleTexture(mod, 0);
 Hunk_FreeToLowMark (start);
 mod->flags = Mod_ReadFlagsFromMD1(mod->name, mem->flags);
}

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

variable_types:
buffer
void *

variable_types: filesize int

variable_types:
specifiedskinname
char [128]

variable_types:
skinfileskinname
char [128]

variable_types:
tenebraeskinname
char [128]

variable_types:
loadname
char []

variable_types: start int

variable_types: end int

variable_types: total int

variable_types: numsurfs int

variable_types: numskins int

variable_types: surfn int

variable_types: struct md3model_t { int surfinf; int md3model; int ofstags; int numtags; int numframes; } *

variable_types: struct md3Header_t { int ident; int version; char name[64]; int flags; int numFrames; int numTags; int numSurfaces; int numSkins; int ofsFrames; int ofsTags; int ofsSurfaces; int ofsEnd; } *

variable_types: struct surfinf_t { char name[64]; int texnum; } *

variable_types: struct md3Surface_t { int ident; char name[64]; int flags; int numFrames; int numShaders; int numVerts; int numTriangles; int ofsTriangles; int ofsShaders; int ofsSt; int ofsXyzNormals; int ofsEnd; } *

variable_types: struct md3Shader_t { char name[64]; int shaderIndex; } *

variable_types: struct md3Frame_s { float bounds[2][3]; float localOrigin[3]; float radius; char name[16]; } *

variable_types: fr int

variable_types:
st
struct md3St_t { float s; float t; } *

variable_types: struct md3Triangle_t { int indexes[3]; } *

variable_types: struct md3XyzNormal_t { short xyz[3]; unsigned short normal; } *

variable_types:
sfile
char *

variable_types:
sfilestart
char *

variable_types:
nl
char *

variable_types: len int

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

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


GetTag

original_code:
int GetTag(model_t *mod, char *tagname, int frame, float **org, m3by3_t **ang)
{
 md3model_t *mhead;
 md3tag_t *tag;
 int tnum;
 float bad[3]={0};
 m3by3_t badm= {{0}};
 *org = bad;
 *ang = &badm;
 if (mod->type != mod_alias3)
  return false;
 mhead = (md3model_t *)Mod_Extradata (mod);
 if (frame > mhead->numframes)
  frame = 0;
 tag = (md3tag_t *)((char *)mhead + mhead->ofstags);
 tag += frame*mhead->numtags;
 for(tnum=0;tnum<mhead->numtags; tnum++)
 {
  if (!strcasecmp(tag->name, tagname))
  {
   *org = tag->org;
   *ang = &tag->ang;
   return true;
  }
  tag++;
 }
 return false;
}

canonical_original_code:
int GetTag(struct model_s *mod, char *tagname, int frame, float **org, float (**ang)[3][3])
{
 struct md3model_t *mhead;
 struct md3tag_t *tag;
 int tnum;
 float bad[3] = {0};
 float badm[3][3] = {{0}};
 *org = bad;
 *ang = &badm;
 if (mod->type != mod_alias3)
  return false;
 mhead = (struct md3model_t *)Mod_Extradata (mod);
 if (frame > mhead->numframes)
  frame = 0;
 tag = (struct md3tag_t *)((char *)mhead + mhead->ofstags);
 tag += frame*mhead->numtags;
 for(tnum=0;tnum<mhead->numtags; tnum++)
 {
  if (!strcasecmp(tag->name, tagname))
  {
   *org = tag->org;
   *ang = &tag->ang;
   return true;
  }
  tag++;
 }
 return false;
}

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

variable_types:
tagname
char *

variable_types: frame int

variable_types:
org
float **

variable_types: struct md3tag_t { char name[64]; float org[3]; float ang[3][3]; } *

variable_types: tnum int

variable_types:
bad
float [3]

variable_types:
badm
float [3][3]

user_defined_types: struct md3model_t { int surfinf; int md3model; int ofstags; int numtags; int numframes; }

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

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


decompiled_code:
char *__fastcall Skin_AsNameOrId(unsigned int *a1)
{
unsigned int *v1; // rbp
int v2; // eax
__int64 v3; // rcx
__int64 v5; // rcx
const char *v6; // rdx
unsigned int v7; // er12
int v8; // eax

v1 = a1 + 271;
v2 = Skin_ForcingType((__int64)(a1 + 271));
if ( v2 == 2 )
{
v5 = *a1;
v6 = "%d";
LABEL_6:
snprintf(name_1, 0x80uLL, v6, v5);
return name_1;
}
if ( v2 == 3 )
{
v7 = TP_PlayersNumber(*a1, v1);
if ( !v7 )
return 0LL;
v8 = TP_ThisPOV_IsHisTeam(v1);
v6 = (const char *)&unk_2C80;
v5 = v7;
if ( !v8 )
v6 = (const char *)&unk_2C84;
goto LABEL_6;
}
if ( v2 != 1 )
return 0LL;
Util_ToValidFileName(a1 + 257, name_1, 128LL, v3, 0LL);
return name_1;
}

canonical_decompiled_code:
char *__fastcall func1(unsigned int *a1)
{
unsigned int *v1; // rbp
int v2; // eax
__int64 v3; // rcx
__int64 v5; // rcx
const char *v6; // rdx
unsigned int v7; // er12
int v8; // eax

v1 = a1 + 271;
v2 = func0((__int64)(a1 + 271));
if ( v2 == 2 )
{
v5 = *a1;
v6 = "%d";
LABEL_6:
snprintf(name_1, 0x80uLL, v6, v5);
return name_1;
}
if ( v2 == 3 )
{
v7 = TP_PlayersNumber(*a1, v1);
if ( !v7 )
return 0LL;
v8 = TP_ThisPOV_IsHisTeam(v1);
v6 = (const char *)&unk_2C80;
v5 = v7;
if ( !v8 )
v6 = (const char *)&unk_2C84;
goto LABEL_6;
}
if ( v2 != 1 )
return 0LL;
Util_ToValidFileName(a1 + 257, name_1, 128LL, v3, 0LL);
return name_1;
}

original_code:
char *Skin_AsNameOrId (player_info_t *sc) {
 static char name[128];
 int pn;
 char* mask;
 switch (Skin_ForcingType(sc->team)) {
 case 1:
  Util_ToValidFileName(sc->name, name, sizeof(name));
  return name;
 break;
 case 2:
  snprintf(name, sizeof(name), "%d", sc->userid);
  return name;
 break;
 case 3:
  pn = TP_PlayersNumber(sc->userid, sc->team);
  if (pn) {
   mask = TP_ThisPOV_IsHisTeam(sc->team) ? "t%d" : "e%d";
   snprintf(name, sizeof(name), mask, pn);
   return name;
  }
 break;
 }
 return ((void *)0);
}

canonical_original_code:
char *Skin_AsNameOrId(struct player_info_s *sc) {
 static char name[128];
 int pn;
 char *mask;
 switch (Skin_ForcingType(sc->team)) {
 case 1:
  Util_ToValidFileName(sc->name, name, sizeof(name));
  return name;
 break;
 case 2:
  snprintf(name, sizeof(name), "%d", sc->userid);
  return name;
 break;
 case 3:
  pn = TP_PlayersNumber(sc->userid, sc->team);
  if (pn) {
   mask = TP_ThisPOV_IsHisTeam(sc->team) ? "t%d" : "e%d";
   snprintf(name, sizeof(name), mask, pn);
   return name;
  }
 break;
 }
 return ((void *)0);
}

variable_types: struct player_info_s { int userid; char userinfo[1024]; char name[16]; float entertime; int frags; int ping; unsigned char pl; int topcolor; int bottomcolor; int _topcolor; int _bottomcolor; int real_topcolor; int real_bottomcolor; char team[1024]; char _team[1024]; int fps_msec; int last_fps; int fps; int fps_frames; double fps_measure_time; enum qbool { false=0, true=1 } isnear; int spectator; unsigned char translations[-1]; struct skin_t { char name[16]; enum qbool { false=0, true=1 } failedload; enum qbool { false=0, true=1 } warned; int width; int bpp; int texnum; struct cache_user_s { void *data; } cache; } *skin; int stats[32]; enum qbool { false=0, true=1 } skin_refresh; enum qbool { false=0, true=1 } ignored; enum qbool { false=0, true=1 } validated; char f_server[16]; enum qbool { false=0, true=1 } dead; } *

variable_types:
name
char [128]

variable_types: pn int

variable_types:
mask
char *

return_type: char *

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


decompiled_code:
char *__fastcall Skin_FindName(__int64 a1)
{
int v1; // ebp
char *v2; // rcx
int v3; // eax
_BYTE *v4; // rsi
char *v6; // rax
char *v7; // rcx
int v8; // eax

if ( allskins )
{
strlcpy(&name_0, &allskins, 128LL);
}
else
{
v6 = Skin_AsNameOrId((unsigned int *)a1);
if ( v6 && *v6 || (v6 = (char *)Info_ValueForKey(a1 + 4, "skin")) != 0LL && *v6 )
strlcpy(&name_0, v6, 128LL);
else
strlcpy(&name_0, baseskin[1], 128LL);
}
skinforcing_team = TP_SkinForcingTeam();
if ( *((_DWORD *)&s + 133) | *((_DWORD *)&s + 134) & 0x100 )
goto LABEL_14;
v1 = *((_DWORD *)&s + 145);
if ( *((_DWORD *)&s + 131) && !strcmp((const char *)(a1 + 1084), skinforcing_team) )
{
if ( v1 )
{
v7 = &s
+ 0x77F3899B42FC5D78LL * ((a1 - (__int64)(&s + 1394296)) >> 3)
+ 20704 * (*((_DWORD *)&s + 143) & 0x3F)
+ 656;
if ( *(_DWORD *)v7 == *((_DWORD *)&s + 143) )
{
v8 = *((_DWORD *)v7 + 23);
if ( (v8 & 0xC0) == 192 )
{
v4 = (_BYTE *)cl_teambothskin[1];
}
else if ( (v8 & 0x40) != 0 )
{
v4 = (_BYTE *)cl_teamquadskin[1];
}
else
{
if ( (v8 & 0x80u) == 0 )
goto LABEL_27;
v4 = (_BYTE *)cl_teampentskin[1];
}
if ( v4 && *v4 )
goto LABEL_28;
}
}
LABEL_27:
v4 = (_BYTE *)cl_teamskin[1];
if ( *v4 )
goto LABEL_28;
goto LABEL_14;
}
if ( v1 )
{
v2 = &s
+ 0x77F3899B42FC5D78LL * ((a1 - (__int64)(&s + 1394296)) >> 3)
+ 20704 * (*((_DWORD *)&s + 143) & 0x3F)
+ 656;
if ( *(_DWORD *)v2 == *((_DWORD *)&s + 143) )
{
v3 = *((_DWORD *)v2 + 23);
if ( (v3 & 0xC0) == 192 )
{
v4 = (_BYTE *)cl_enemybothskin[1];
}
else if ( (v3 & 0x40) != 0 )
{
v4 = (_BYTE *)cl_enemyquadskin[1];
}
else
{
if ( (v3 & 0x80u) == 0 )
goto LABEL_13;
v4 = (_BYTE *)cl_enemypentskin[1];
}
if ( v4 && *v4 )
goto LABEL_28;
}
}
LABEL_13:
v4 = (_BYTE *)cl_enemyskin[1];
if ( *v4 )
LABEL_28:
strlcpy(&name_0, v4, 128LL);
LABEL_14:
if ( !strstr(&name_0, "..") && name_0 != 46 )
return &name_0;
strlcpy(&name_0, baseskin[1], 128LL);
return &name_0;
}

original_code:
char *Skin_FindName (player_info_t *sc) {
 static char name[128];
 if (allskins[0]) {
  strlcpy(name, allskins, sizeof(name));
 } else {
  char *s = Skin_AsNameOrId(sc);
  if (!s || !s[0])
   s = Info_ValueForKey(sc->userinfo, "skin");
  if (s && s[0])
   strlcpy(name, s, sizeof(name));
  else
   strlcpy(name, baseskin.string, sizeof(name));
 }
 skinforcing_team = TP_SkinForcingTeam();
 if (!cl.teamfortress && !(cl.fpd & 256)) {
  char *skinname = ((void *)0);
  player_state_t *state;
  qbool teammate;
  teammate = (cl.teamplay && !strcmp(sc->team, skinforcing_team)) ? true : false;
  if (!cl.validsequence)
   goto nopowerups;
  state = cl.frames[cl.parsecount & (64 - 1)].playerstate + (sc - cl.players);
  if (state->messagenum != cl.parsecount)
   goto nopowerups;
  if ((state->effects & (64 | 128)) == (64 | 128) )
   skinname = teammate ? cl_teambothskin.string : cl_enemybothskin.string;
  else if (state->effects & 64)
   skinname = teammate ? cl_teamquadskin.string : cl_enemyquadskin.string;
  else if (state->effects & 128)
   skinname = teammate ? cl_teampentskin.string : cl_enemypentskin.string;
 nopowerups:
  if (!skinname || !skinname[0])
   skinname = teammate ? cl_teamskin.string : cl_enemyskin.string;
  if (skinname[0])
   strlcpy(name, skinname, sizeof(name));
 }
 if (strstr(name, "..") || *name == '.')
  strlcpy(name, baseskin.string, sizeof(name));
 return name;
}

canonical_original_code:
char *Skin_FindName(struct player_info_s *sc) {
 static char name[128];
 if (allskins[0]) {
  strlcpy(name, allskins, sizeof(name));
 } else {
  char *s = Skin_AsNameOrId(sc);
  if (!s || !s[0])
   s = Info_ValueForKey(sc->userinfo, "skin");
  if (s && s[0])
   strlcpy(name, s, sizeof(name));
  else
   strlcpy(name, baseskin.string, sizeof(name));
 }
 skinforcing_team = TP_SkinForcingTeam();
 if (!cl.teamfortress && !(cl.fpd & 256)) {
  char *skinname = ((void *)0);
  struct player_state_t *state;
  enum qbool teammate;
  teammate = (cl.teamplay && !strcmp(sc->team, skinforcing_team)) ? true : false;
  if (!cl.validsequence)
   goto nopowerups;
  state = cl.frames[cl.parsecount & (64 - 1)].playerstate + (sc - cl.players);
  if (state->messagenum != cl.parsecount)
   goto nopowerups;
  if ((state->effects & (64 | 128)) == (64 | 128) )
   skinname = teammate ? cl_teambothskin.string : cl_enemybothskin.string;
  else if (state->effects & 64)
   skinname = teammate ? cl_teamquadskin.string : cl_enemyquadskin.string;
  else if (state->effects & 128)
   skinname = teammate ? cl_teampentskin.string : cl_enemypentskin.string;
 nopowerups:
  if (!skinname || !skinname[0])
   skinname = teammate ? cl_teamskin.string : cl_enemyskin.string;
  if (skinname[0])
   strlcpy(name, skinname, sizeof(name));
 }
 if (strstr(name, "..") || *name == '.')
  strlcpy(name, baseskin.string, sizeof(name));
 return name;
}

variable_types:
s
char *

variable_types:
skinname
char *

variable_types: struct player_state_t { int messagenum; double state_time; struct usercmd_s { unsigned char msec; float angles[3]; short forwardmove; unsigned char buttons; unsigned char impulse; } command; float origin[3]; float viewangles[3]; float velocity[3]; int weaponframe; int modelindex; int frame; int skinnum; int effects; int flags; unsigned char alpha; unsigned char vw_index; unsigned char pm_type; float waterjumptime; enum qbool { false=0, true=1 } onground; enum qbool { false=0, true=1 } jump_held; int jump_msec; } *

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

user_defined_types: struct player_state_t { int messagenum; double state_time; struct usercmd_s command; float origin[3]; float viewangles[3]; float velocity[3]; int weaponframe; int modelindex; int frame; int skinnum; int effects; int flags; unsigned char alpha; unsigned char vw_index; unsigned char pm_type; float waterjumptime; enum qbool onground; enum qbool jump_held; int jump_msec; }


decompiled_code:
__int64 __fastcall Skin_PixelsLoad(__int64 a1, _DWORD *a2, _DWORD *a3, _DWORD *a4, _DWORD *a5, _DWORD *a6)
{
__int64 result; // rax

*a4 = 0;
*a3 = 0;
*a2 = 0;
result = GL_LoadImagePixels(a1, 0LL, 0LL, 256LL);
if ( result )
{
*a2 = *a5;
*a3 = *a6;
*a4 = 4;
}
else
{
result = Image_LoadPCX(0LL, a1, 0LL, 0LL, a5, a6);
if ( result )
{
*a2 = 320;
*a3 = 200;
*a4 = 1;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, _DWORD *a2, _DWORD *a3, _DWORD *a4, _DWORD *a5, _DWORD *a6)
{
__int64 result; // rax

*a4 = 0;
*a3 = 0;
*a2 = 0;
result = GL_LoadImagePixels(a1, 0LL, 0LL, 256LL);
if ( result )
{
*a2 = *a5;
*a3 = *a6;
*a4 = 4;
}
else
{
result = Image_LoadPCX(0LL, a1, 0LL, 0LL, a5, a6);
if ( result )
{
*a2 = 320;
*a3 = 200;
*a4 = 1;
}
}
return result;
}

original_code:
byte *Skin_PixelsLoad(char *name, int *max_w, int *max_h, int *bpp, int *real_width, int *real_height)
{
 byte *pic;
 *max_w = *max_h = *bpp = 0;
 if ((pic = GL_LoadImagePixels (name, 0, 0, (1<<8), real_width, real_height))) {
  *max_w = *real_width;
  *max_h = *real_height;
  *bpp = 4;
  return pic;
 }
 if ((pic = Image_LoadPCX (((void *)0), name, 0, 0, real_width, real_height)))
 {
  *max_w = 320;
  *max_h = 200;
  *bpp = 1;
  return pic;
 }
 return ((void *)0);
}

canonical_original_code:
unsigned char *Skin_PixelsLoad(char *name, int *max_w, int *max_h, int *bpp, int *real_width, int *real_height)
{
 unsigned char *pic;
 *max_w = *max_h = *bpp = 0;
 if ((pic = GL_LoadImagePixels (name, 0, 0, (1<<8), real_width, real_height))) {
  *max_w = *real_width;
  *max_h = *real_height;
  *bpp = 4;
  return pic;
 }
 if ((pic = Image_LoadPCX (((void *)0), name, 0, 0, real_width, real_height)))
 {
  *max_w = 320;
  *max_h = 200;
  *bpp = 1;
  return pic;
 }
 return ((void *)0);
}

variable_types:
name
char *

variable_types:
bpp
int *

variable_types:
pic
unsigned char *

return_type: unsigned char *


original_code:
byte *Skin_Cache (skin_t *skin, qbool no_baseskin)
{
 int y, max_w, max_h, bpp, real_width = -1, real_height = -1;
 byte *pic = ((void *)0), *out, *pix;
 char name[128];
 if (noskins.value == 1)
  return ((void *)0);
 if (skin->failedload)
  return ((void *)0);
 if ((out = (byte *) Cache_Check (&skin->cache)))
  return out;
 snprintf (name, sizeof(name), "skins/%s.pcx", skin->name);
 if (!(pic = Skin_PixelsLoad(name, &max_w, &max_h, &bpp, &real_width, &real_height)) || real_width > max_w || real_height > max_h)
 {
  if(pic) { free(pic); pic = ((void *)0); };
  if (no_baseskin)
  {
   skin->warned = true;
   return ((void *)0);
  }
  else if (!skin->warned)
  {
   Com_Printf ("&cf22Couldn't load skin:&r %s\n", name);
  }
  skin->warned = true;
 }
 if (!pic)
 {
  snprintf (name, sizeof(name), "skins/%s.pcx", baseskin.string);
  if (!(pic = Skin_PixelsLoad(name, &max_w, &max_h, &bpp, &real_width, &real_height)) || real_width > max_w || real_height > max_h)
  {
   if(pic) { free(pic); pic = ((void *)0); };
   skin->failedload = true;
   return ((void *)0);
  }
 }
 if (!(out = pix = (byte *) Cache_Alloc (&skin->cache, max_w * max_h * bpp, skin->name)))
  Sys_Error ("Skin_Cache: couldn't allocate");
 memset (out, 0, max_w * max_h * bpp);
 for (y = 0; y < real_height; y++, pix += (max_w * bpp))
 {
  memcpy (pix, pic + y * real_width * bpp, real_width * bpp);
 }
 if(pic) { free(pic); pic = ((void *)0); };
 skin->bpp = bpp;
 skin->width = real_width;
 skin->height = real_height;
 skin->texnum = 0;
 skin->failedload = false;
 return out;
}

canonical_original_code:
unsigned char *Skin_Cache(struct skin_t *skin, enum qbool no_baseskin)
{
 int y; int max_w; int max_h; int bpp; int real_width = -1; int real_height = -1;
 unsigned char *pic = ((void *)0); unsigned char *out; unsigned char *pix;
 char name[128];
 if (noskins.value == 1)
  return ((void *)0);
 if (skin->failedload)
  return ((void *)0);
 if ((out = (unsigned char *) Cache_Check (&skin->cache)))
  return out;
 snprintf (name, sizeof(name), "skins/%s.pcx", skin->name);
 if (!(pic = Skin_PixelsLoad(name, &max_w, &max_h, &bpp, &real_width, &real_height)) || real_width > max_w || real_height > max_h)
 {
  if(pic) { free(pic); pic = ((void *)0); };
  if (no_baseskin)
  {
   skin->warned = true;
   return ((void *)0);
  }
  else if (!skin->warned)
  {
   Com_Printf ("&cf22Couldn't load skin:&r %s\n", name);
  }
  skin->warned = true;
 }
 if (!pic)
 {
  snprintf (name, sizeof(name), "skins/%s.pcx", baseskin.string);
  if (!(pic = Skin_PixelsLoad(name, &max_w, &max_h, &bpp, &real_width, &real_height)) || real_width > max_w || real_height > max_h)
  {
   if(pic) { free(pic); pic = ((void *)0); };
   skin->failedload = true;
   return ((void *)0);
  }
 }
 if (!(out = pix = (unsigned char *) Cache_Alloc (&skin->cache, max_w * max_h * bpp, skin->name)))
  Sys_Error ("Skin_Cache: couldn't allocate");
 memset (out, 0, max_w * max_h * bpp);
 for (y = 0; y < real_height; y++, pix += (max_w * bpp))
 {
  memcpy (pix, pic + y * real_width * bpp, real_width * bpp);
 }
 if(pic) { free(pic); pic = ((void *)0); };
 skin->bpp = bpp;
 skin->width = real_width;
 skin->height = real_height;
 skin->texnum = 0;
 skin->failedload = false;
 return out;
}

variable_types: struct skin_t { char name[16]; enum qbool { false=0, true=1 } failedload; enum qbool { false=0, true=1 } warned; int width; int bpp; int texnum; struct cache_user_s { void *data; } cache; } *

variable_types: y int

variable_types: bpp int

variable_types:
out
unsigned char *

variable_types:
pix
unsigned char *

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


decompiled_code:
int __fastcall Skin_Find_Ex(__int64 a1, const char *a2)
{
int v3; // er12
const char *v4; // rbx
int result; // eax
char *v6; // rdi
char v7[168]; // [rsp+0h] [rbp-A8h] BYREF

if ( !a2 || !*a2 )
{
a2 = baseskin[1];
if ( !*a2 )
a2 = "base";
}
strlcpy(v7, a2, 128LL);
COM_StripExtension(v7, v7);
v3 = numskins;
if ( numskins > 0 )
{
v4 = skins;
do
{
result = strcmp(v7, v4);
if ( !result )
{
if ( a1 )
*(_QWORD *)(a1 + 19552) = v4;
return result;
}
v4 += 48;
}
while ( v4 != &skins[48 * (v3 - 1) + 48] );
if ( v3 == 128 )
{
Com_Printf("MAX_CACHED_SKINS reached, flushing skins\n");
Skin_Skins_f();
v3 = numskins;
}
}
v6 = &skins[48 * v3];
if ( a1 )
*(_QWORD *)(a1 + 19552) = v6;
*(_OWORD *)&skins[48 * v3] = 0LL;
*((_OWORD *)v6 + 1) = 0LL;
*((_OWORD *)v6 + 2) = 0LL;
numskins = v3 + 1;
return strlcpy(v6, v7, 16LL);
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1, const char *a2)
{
int v3; // er12
const char *v4; // rbx
int result; // eax
char *v6; // rdi
char v7[168]; // [rsp+0h] [rbp-A8h] BYREF

if ( !a2 || !*a2 )
{
a2 = baseskin[1];
if ( !*a2 )
a2 = "base";
}
strlcpy(v7, a2, 128LL);
COM_StripExtension(v7, v7);
v3 = numskins;
if ( numskins > 0 )
{
v4 = skins;
do
{
result = strcmp(v7, v4);
if ( !result )
{
if ( a1 )
*(_QWORD *)(a1 + 19552) = v4;
return result;
}
v4 += 48;
}
while ( v4 != &skins[48 * (v3 - 1) + 48] );
if ( v3 == 128 )
{
Com_Printf("MAX_CACHED_SKINS reached, flushing skins\n");
func5();
v3 = numskins;
}
}
v6 = &skins[48 * v3];
if ( a1 )
*(_QWORD *)(a1 + 19552) = v6;
*(_OWORD *)&skins[48 * v3] = 0LL;
*((_OWORD *)v6 + 1) = 0LL;
*((_OWORD *)v6 + 2) = 0LL;
numskins = v3 + 1;
return strlcpy(v6, v7, 16LL);
}

original_code:
void Skin_Find_Ex (player_info_t *sc, char *skin_name) {
 skin_t *skin;
 int i;
 char name[128];
 if (!skin_name || !skin_name[0])
 {
  skin_name = baseskin.string;
  if (!skin_name[0])
   skin_name = "base";
 }
 strlcpy(name, skin_name, sizeof(name));
 COM_StripExtension(name, name);
 for (i = 0; i < numskins; i++)
 {
  if (!strcmp(name, skins[i].name))
  {
   if (sc)
    sc->skin = &skins[i];
   return;
  }
 }
 if (numskins == 128)
 {
  Com_Printf ("MAX_CACHED_SKINS reached, flushing skins\n");
  Skin_Skins_f();
 }
 skin = &skins[numskins];
 if (sc)
  sc->skin = skin;
 numskins++;
 memset (skin, 0, sizeof(*skin));
 strlcpy(skin->name, name, sizeof(skin->name));
}

canonical_original_code:
void Skin_Find_Ex(struct player_info_s *sc, char *skin_name) {
 struct skin_t *skin;
 int i;
 char name[128];
 if (!skin_name || !skin_name[0])
 {
  skin_name = baseskin.string;
  if (!skin_name[0])
   skin_name = "base";
 }
 strlcpy(name, skin_name, sizeof(name));
 COM_StripExtension(name, name);
 for (i = 0; i < numskins; i++)
 {
  if (!strcmp(name, skins[i].name))
  {
   if (sc)
    sc->skin = &skins[i];
   return;
  }
 }
 if (numskins == 128)
 {
  Com_Printf ("MAX_CACHED_SKINS reached, flushing skins\n");
  Skin_Skins_f();
 }
 skin = &skins[numskins];
 if (sc)
  sc->skin = skin;
 numskins++;
 memset (skin, 0, sizeof(*skin));
 strlcpy(skin->name, name, sizeof(skin->name));
}

variable_types: i int


decompiled_code:
int __fastcall Skin_Find(__int64 a1)
{
char *v1; // rax

v1 = Skin_FindName(a1);
return Skin_Find_Ex(a1, v1);
}

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

v1 = func2(a1);
return func6(a1, v1);
}

original_code:
void Skin_Find (player_info_t *sc)
{
 Skin_Find_Ex(sc, Skin_FindName(sc));
}

canonical_original_code:
void Skin_Find(struct player_info_s *sc)
{
 Skin_Find_Ex(sc, Skin_FindName(sc));
}

variable_types: struct player_info_s { int userid; char userinfo[1024]; char name[16]; float entertime; int frags; int ping; unsigned char pl; int topcolor; int bottomcolor; int _topcolor; int _bottomcolor; int real_topcolor; int real_bottomcolor; char team[1024]; char _team[1024]; int fps_msec; int last_fps; int fps; int fps_frames; double fps_measure_time; enum qbool { false=0, true=1 } isnear; int spectator; unsigned char translations[-1]; struct skin_t { char name[16]; enum qbool { false=0, true=1 } failedload; enum qbool { false=0, true=1 } warned; int width; int bpp; int texnum; struct cache_user_s { void *data; } cache; } *skin; int stats[32]; enum qbool { false=0, true=1 } skin_refresh; enum qbool { false=0, true=1 } ignored; enum qbool { false=0, true=1 } validated; char f_server[16]; enum qbool { false=0, true=1 } dead; } *