decompiled_code:
__int64 AC_UpdateList()
{
__int64 result; // rax
char v1[48]; // [rsp+0h] [rbp-78h] BYREF
__int64 v2; // [rsp+30h] [rbp-48h]
__int64 v3; // [rsp+38h] [rbp-40h]
__int64 v4; // [rsp+40h] [rbp-38h]
__int64 v5; // [rsp+48h] [rbp-30h]
__int64 v6; // [rsp+50h] [rbp-28h]
__int64 v7; // [rsp+58h] [rbp-20h]
int v8; // [rsp+60h] [rbp-18h]

result = (unsigned int)(int)*(float *)(q2adminanticheat_enable + 32LL);
if ( (_DWORD)result )
{
if ( q2adminanticheat_file && !(unsigned int)isBlank(*(_QWORD *)(q2adminanticheat_file + 8LL)) )
{
strncpy(v1, *(const char **)(q2adminanticheat_file + 8LL), 0x64uLL);
}
else
{
strcpy(v1, "http://q2.packetflinger.com/dl/q2admin/ac.cfg");
v2 = 0LL;
v3 = 0LL;
v4 = 0LL;
v5 = 0LL;
v6 = 0LL;
v7 = 0LL;
v8 = 0;
}
if ( (unsigned int)AC_GetRemoteFile(v1) )
{
result = ((__int64 (__fastcall *)(const char *))gi[1])("Remote anticheat config downloaded\n");
}
else
{
((void (__fastcall *)(const char *))gi[1])("WARNING: http://q2.packetflinger.com/dl/q2admin/ac.cfg could not be found\n");
result = logEvent(17LL, 0LL, 0LL, "http://q2.packetflinger.com/dl/q2admin/ac.cfg could not be found", 11LL, 0.0);
}
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax
char v1[48]; // [rsp+0h] [rbp-78h] BYREF
__int64 v2; // [rsp+30h] [rbp-48h]
__int64 v3; // [rsp+38h] [rbp-40h]
__int64 v4; // [rsp+40h] [rbp-38h]
__int64 v5; // [rsp+48h] [rbp-30h]
__int64 v6; // [rsp+50h] [rbp-28h]
__int64 v7; // [rsp+58h] [rbp-20h]
int v8; // [rsp+60h] [rbp-18h]

result = (unsigned int)(int)*(float *)(q2adminanticheat_enable + 32LL);
if ( (_DWORD)result )
{
if ( q2adminanticheat_file && !(unsigned int)isBlank(*(_QWORD *)(q2adminanticheat_file + 8LL)) )
{
strncpy(v1, *(const char **)(q2adminanticheat_file + 8LL), 0x64uLL);
}
else
{
strcpy(v1, "http://q2.packetflinger.com/dl/q2admin/ac.cfg");
v2 = 0LL;
v3 = 0LL;
v4 = 0LL;
v5 = 0LL;
v6 = 0LL;
v7 = 0LL;
v8 = 0;
}
if ( (unsigned int)func0(v1) )
{
result = ((__int64 (__fastcall *)(const char *))gi[1])("Remote anticheat config downloaded\n");
}
else
{
((void (__fastcall *)(const char *))gi[1])("WARNING: http://q2.packetflinger.com/dl/q2admin/ac.cfg could not be found\n");
result = logEvent(17LL, 0LL, 0LL, "http://q2.packetflinger.com/dl/q2admin/ac.cfg could not be found", 11LL, 0.0);
}
}
return result;
}

original_code:
void AC_UpdateList(void) {
    if ((int) q2adminanticheat_enable->value) {
        qboolean ret;
        char cfgAnticheatRemoteList[100];
        if (!q2adminanticheat_file || isBlank(q2adminanticheat_file->string)) {
            strncpy(cfgAnticheatRemoteList, "http://q2.packetflinger.com/dl/q2admin/ac.cfg", sizeof(cfgAnticheatRemoteList));
        } else {
            strncpy(cfgAnticheatRemoteList, q2adminanticheat_file->string, sizeof(cfgAnticheatRemoteList));
        }
        ret = AC_GetRemoteFile(cfgAnticheatRemoteList);
        if (!ret) {
            gi.dprintf("WARNING: " "http://q2.packetflinger.com/dl/q2admin/ac.cfg" " could not be found\n");
            logEvent(LT_INTERNALWARN, 0, ((void *)0), "http://q2.packetflinger.com/dl/q2admin/ac.cfg" " could not be found", 11, 0.0);
   return;
        }
  gi.dprintf("Remote anticheat config downloaded\n");
    }
}

canonical_original_code:
void AC_UpdateList() {
    if ((int) q2adminanticheat_enable->value) {
        enum qboolean ret;
        char cfgAnticheatRemoteList[100];
        if (!q2adminanticheat_file || isBlank(q2adminanticheat_file->string)) {
            strncpy(cfgAnticheatRemoteList, "http://q2.packetflinger.com/dl/q2admin/ac.cfg", sizeof(cfgAnticheatRemoteList));
        } else {
            strncpy(cfgAnticheatRemoteList, q2adminanticheat_file->string, sizeof(cfgAnticheatRemoteList));
        }
        ret = AC_GetRemoteFile(cfgAnticheatRemoteList);
        if (!ret) {
            gi.dprintf("WARNING: " "http://q2.packetflinger.com/dl/q2admin/ac.cfg" " could not be found\n");
            logEvent(LT_INTERNALWARN, 0, ((void *)0), "http://q2.packetflinger.com/dl/q2admin/ac.cfg" " could not be found", 11, 0.0);
   return;
        }
  gi.dprintf("Remote anticheat config downloaded\n");
    }
}

variable_types:
ret
enum qboolean { qfalse=0, qtrue=1 }

variable_types:
cfgAnticheatRemoteList
char [100]


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

result = (unsigned int)(int)*(float *)(q2adminanticheat_enable + 32LL);
if ( (_DWORD)result )
{
AC_UpdateList();
strncpy(&buffer, "exec ac.cfg\n", 0x10000uLL);
result = ((__int64 (__fastcall *)(char *))gi[42])(&buffer);
}
return result;
}

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

result = (unsigned int)(int)*(float *)(q2adminanticheat_enable + 32LL);
if ( (_DWORD)result )
{
func1();
strncpy(&buffer, "exec ac.cfg\n", 0x10000uLL);
result = ((__int64 (__fastcall *)(char *))gi[42])(&buffer);
}
return result;
}

original_code:
void AC_LoadExceptions(void) {
    if ((int) q2adminanticheat_enable->value) {
        AC_UpdateList();
        strncpy(buffer, "exec " "ac.cfg" "\n", sizeof(buffer));
        gi.AddCommandString(buffer);
    }
}

canonical_original_code:
void AC_LoadExceptions() {
    if ((int) q2adminanticheat_enable->value) {
        AC_UpdateList();
        strncpy(buffer, "exec " "ac.cfg" "\n", sizeof(buffer));
        gi.AddCommandString(buffer);
    }
}

return_type: void


decompiled_code:
__int64 __fastcall AC_ReloadExceptions(__int64 a1, __int64 a2)
{
AC_LoadExceptions();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Exceptionlist loaded.\n");
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
func2();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Exceptionlist loaded.\n");
}

original_code:
void AC_ReloadExceptions(int startarg, edict_t *ent, int client) {
    AC_LoadExceptions();
    gi.cprintf(ent, 2, "Exceptionlist loaded.\n");
}

canonical_original_code:
void AC_ReloadExceptions(int startarg, struct edict_s *ent, int client) {
    AC_LoadExceptions();
    gi.cprintf(ent, 2, "Exceptionlist loaded.\n");
}

variable_types: startarg int

variable_types: struct edict_s { struct entity_state_s { int number; float origin[3]; float angles[3]; float old_origin[3]; int modelindex; int modelindex2; int frame; int skinnum; int effects; int renderfx; int solid; int sound; int event; } s; struct gclient_s { struct player_state_t { struct pmove_state_t { enum pmtype_t { PM_NORMAL=0, PM_SPECTATOR=1, PM_DEAD=2, PM_GIB=3, PM_FREEZE=4 } pm_type; short origin[3]; short velocity[3]; unsigned char pm_flags; unsigned char pm_time; short gravity; short delta_angles[3]; } pmove; float viewangles[3]; float viewoffset[3]; float kick_angles[3]; float gunangles[3]; float gunoffset[3]; int gunindex; int gunframe; float blend[4]; float fov; int rdflags; short stats[32]; } ps; int ping; struct client_persistant_t { char userinfo[512]; char netname[16]; int hand; enum qboolean { qfalse=0, qtrue=1 } connected; int health; int max_health; int savedFlags; int selected_item; int inventory[256]; int max_bullets; int max_shells; int max_rockets; int max_grenades; int max_cells; int max_slugs; struct gitem_s { char *classname; enum qboolean { qfalse=0, qtrue=1 } (*pickup)(struct edict_s *ent, struct edict_s *other); void (*use)(struct edict_s *ent, struct gitem_s *item); void (*drop)(struct edict_s *ent, struct gitem_s *item); void (*weaponthink)(struct edict_s *ent); char *pickup_sound; char *world_model; int world_model_flags; char *view_model; char *icon; char *pickup_name; int count_width; int quantity; char *ammo; int flags; int weapmodel; void *info; int tag; char *precaches; } *weapon; struct gitem_s *lastweapon; int power_cubes; int score; int game_helpchanged; int helpchanged; enum qboolean { qfalse=0, qtrue=1 } spectator; } pers; struct client_respawn_t { struct client_persistant_t coop_respawn; int enterframe; int score; float cmd_angles[3]; enum qboolean { qfalse=0, qtrue=1 } spectator; } resp; struct pmove_state_t old_pmove; enum qboolean { qfalse=0, qtrue=1 } showscores; enum qboolean { qfalse=0, qtrue=1 } showinventory; enum qboolean { qfalse=0, qtrue=1 } showhelp; enum qboolean { qfalse=0, qtrue=1 } showhelpicon; int ammo_index; int buttons; int oldbuttons; int latched_buttons; enum qboolean { qfalse=0, qtrue=1 } weapon_thunk; struct gitem_s *newweapon; int damage_armor; int damage_parmor; int damage_blood; int damage_knockback; float damage_from[3]; float killer_yaw; enum weaponstate_t { WEAPON_READY=0, WEAPON_ACTIVATING=1, WEAPON_DROPPING=2, WEAPON_FIRING=3 } weaponstate; float kick_angles[3]; float kick_origin[3]; float v_dmg_roll; float fall_time; float damage_alpha; float bonus_alpha; float damage_blend[3]; float v_angle[3]; float bobtime; float oldviewangles[3]; float oldvelocity[3]; float next_drown_time; int old_waterlevel; int breather_sound; int machinegun_shots; int anim_end; int anim_priority; enum qboolean { qfalse=0, qtrue=1 } anim_duck; enum qboolean { qfalse=0, qtrue=1 } anim_run; int quad_framenum; int invincible_framenum; int breather_framenum; int enviro_framenum; enum qboolean { qfalse=0, qtrue=1 } grenade_blew_up; float grenade_time; int silencer_shots; int weapon_sound; float pickup_msg_time; float flood_locktill; float flood_when[10]; int flood_whenhead; float respawn_time; struct edict_s *chase_target; enum qboolean { qfalse=0, qtrue=1 } update_chase; } *client; enum qboolean { qfalse=0, qtrue=1 } inuse; int linkcount; struct link_s { struct link_s *prev; } area; int num_clusters; int clusternums[16]; int headnode; int areanum; int svflags; float mins[3]; float absmin[3]; enum solid_t { SOLID_NOT=0, SOLID_TRIGGER=1, SOLID_BBOX=2, SOLID_BSP=3 } solid; int clipmask; struct edict_s *owner; int movetype; int flags; char *model; float freetime; char *message; char *classname; int spawnflags; float timestamp; float angle; char *target; char *targetname; char *killtarget; char *team; char *pathtarget; char *deathtarget; char *combattarget; struct edict_s *target_ent; float speed; float movedir[3]; float pos1[3]; float velocity[3]; float avelocity[3]; int mass; float air_finished; float gravity; struct edict_s *goalentity; struct edict_s *movetarget; float yaw_speed; float ideal_yaw; float nextthink; void (*prethink)(struct edict_s *ent); void (*think)(struct edict_s *self); void (*blocked)(struct edict_s *self, struct edict_s *other); void (*touch)(struct edict_s *self, struct edict_s *other, struct cplane_s { float normal[3]; float dist; unsigned char type; unsigned char signbits; unsigned char pad[2]; } *plane, struct csurface_s { char name[16]; int flags; int value; } *surf); void (*use)(struct edict_s *self, struct edict_s *other, struct edict_s *activator); void (*pain)(struct edict_s *self, struct edict_s *other, float kick, int damage); void (*die)(struct edict_s *self, struct edict_s *inflictor, struct edict_s *attacker, int damage, float point[3]); float touch_debounce_time; float pain_debounce_time; float damage_debounce_time; float fly_sound_debounce_time; float last_move_time; int health; int max_health; int gib_health; int deadflag; enum qboolean { qfalse=0, qtrue=1 } show_hostile; float powerarmor_time; char *map; int viewheight; int takedamage; int dmg; int radius_dmg; float dmg_radius; int sounds; int count; struct edict_s *chain; struct edict_s *enemy; struct edict_s *oldenemy; struct edict_s *activator; struct edict_s *groundentity; int groundentity_linkcount; struct edict_s *teamchain; struct edict_s *teammaster; struct edict_s *mynoise; struct edict_s *mynoise2; int noise_index; int noise_index2; float volume; float attenuation; float wait; float delay; float random; float teleport_time; int watertype; int waterlevel; float move_origin[3]; float move_angles[3]; int light_level; int style; struct gitem_s *item; struct moveinfo_t { float start_origin[3]; float start_angles[3]; float end_origin[3]; float end_angles[3]; int sound_start; int sound_middle; int sound_end; float accel; float speed; float decel; float distance; float wait; int state; float dir[3]; float current_speed; float move_speed; float next_speed; float remaining_distance; float decel_distance; void (*endfunc)(struct edict_s *); } moveinfo; struct monsterinfo_t { struct mmove_t { int firstframe; int lastframe; struct mframe_t { void (*aifunc)(struct edict_s *self, float dist); float dist; void (*thinkfunc)(struct edict_s *self); } *frame; void (*endfunc)(struct edict_s *self); } *currentmove; int aiflags; int nextframe; float scale; void (*stand)(struct edict_s *self); void (*idle)(struct edict_s *self); void (*search)(struct edict_s *self); void (*walk)(struct edict_s *self); void (*run)(struct edict_s *self); void (*dodge)(struct edict_s *self, struct edict_s *other, float eta); void (*attack)(struct edict_s *self); void (*melee)(struct edict_s *self); void (*sight)(struct edict_s *self, struct edict_s *other); enum qboolean { qfalse=0, qtrue=1 } (*checkattack)(struct edict_s *self); float pausetime; float attack_finished; float saved_goal[3]; float search_time; float trail_time; float last_sighting[3]; int attack_state; int lefty; float idle_time; int linkcount; int power_armor_type; int power_armor_power; } monsterinfo; } *

variable_types: client int

user_defined_types: struct edict_s { struct entity_state_s s; struct gclient_s *client; enum qboolean inuse; int linkcount; struct link_s area; int num_clusters; int clusternums[16]; int headnode; int areanum; int svflags; float mins[3]; float absmin[3]; enum solid_t solid; int clipmask; struct edict_s *owner; int movetype; int flags; char *model; float freetime; char *message; char *classname; int spawnflags; float timestamp; float angle; char *target; char *targetname; char *killtarget; char *team; char *pathtarget; char *deathtarget; char *combattarget; struct edict_s *target_ent; float speed; float movedir[3]; float pos1[3]; float velocity[3]; float avelocity[3]; int mass; float air_finished; float gravity; struct edict_s *goalentity; struct edict_s *movetarget; float yaw_speed; float ideal_yaw; float nextthink; void (*prethink)(struct edict_s *ent); void (*think)(struct edict_s *self); void (*blocked)(struct edict_s *self, struct edict_s *other); void (*touch)(struct edict_s *self, struct edict_s *other, struct cplane_s *plane, struct csurface_s *surf); void (*use)(struct edict_s *self, struct edict_s *other, struct edict_s *activator); void (*pain)(struct edict_s *self, struct edict_s *other, float kick, int damage); void (*die)(struct edict_s *self, struct edict_s *inflictor, struct edict_s *attacker, int damage, float point[3]); float touch_debounce_time; float pain_debounce_time; float damage_debounce_time; float fly_sound_debounce_time; float last_move_time; int health; int max_health; int gib_health; int deadflag; enum qboolean show_hostile; float powerarmor_time; char *map; int viewheight; int takedamage; int dmg; int radius_dmg; float dmg_radius; int sounds; int count; struct edict_s *chain; struct edict_s *enemy; struct edict_s *oldenemy; struct edict_s *activator; struct edict_s *groundentity; int groundentity_linkcount; struct edict_s *teamchain; struct edict_s *teammaster; struct edict_s *mynoise; struct edict_s *mynoise2; int noise_index; int noise_index2; float volume; float attenuation; float wait; float delay; float random; float teleport_time; int watertype; int waterlevel; float move_origin[3]; float move_angles[3]; int light_level; int style; struct gitem_s *item; struct moveinfo_t moveinfo; struct monsterinfo_t monsterinfo; }

user_defined_types: struct monsterinfo_t { struct mmove_t *currentmove; int aiflags; int nextframe; float scale; void (*stand)(struct edict_s *self); void (*idle)(struct edict_s *self); void (*search)(struct edict_s *self); void (*walk)(struct edict_s *self); void (*run)(struct edict_s *self); void (*dodge)(struct edict_s *self, struct edict_s *other, float eta); void (*attack)(struct edict_s *self); void (*melee)(struct edict_s *self); void (*sight)(struct edict_s *self, struct edict_s *other); enum qboolean (*checkattack)(struct edict_s *self); float pausetime; float attack_finished; float saved_goal[3]; float search_time; float trail_time; float last_sighting[3]; int attack_state; int lefty; float idle_time; int linkcount; int power_armor_type; int power_armor_power; }

user_defined_types: struct gclient_s { struct player_state_t ps; int ping; struct client_persistant_t pers; struct client_respawn_t resp; struct pmove_state_t old_pmove; enum qboolean showscores; enum qboolean showinventory; enum qboolean showhelp; enum qboolean showhelpicon; int ammo_index; int buttons; int oldbuttons; int latched_buttons; enum qboolean weapon_thunk; struct gitem_s *newweapon; int damage_armor; int damage_parmor; int damage_blood; int damage_knockback; float damage_from[3]; float killer_yaw; enum weaponstate_t weaponstate; float kick_angles[3]; float kick_origin[3]; float v_dmg_roll; float fall_time; float damage_alpha; float bonus_alpha; float damage_blend[3]; float v_angle[3]; float bobtime; float oldviewangles[3]; float oldvelocity[3]; float next_drown_time; int old_waterlevel; int breather_sound; int machinegun_shots; int anim_end; int anim_priority; enum qboolean anim_duck; enum qboolean anim_run; int quad_framenum; int invincible_framenum; int breather_framenum; int enviro_framenum; enum qboolean grenade_blew_up; float grenade_time; int silencer_shots; int weapon_sound; float pickup_msg_time; float flood_locktill; float flood_when[10]; int flood_whenhead; float respawn_time; struct edict_s *chase_target; enum qboolean update_chase; }

user_defined_types: struct player_state_t { struct pmove_state_t pmove; float viewangles[3]; float viewoffset[3]; float kick_angles[3]; float gunangles[3]; float gunoffset[3]; int gunindex; int gunframe; float blend[4]; float fov; int rdflags; short stats[32]; }

user_defined_types: struct client_persistant_t { char userinfo[512]; char netname[16]; int hand; enum qboolean connected; int health; int max_health; int savedFlags; int selected_item; int inventory[256]; int max_bullets; int max_shells; int max_rockets; int max_grenades; int max_cells; int max_slugs; struct gitem_s *weapon; struct gitem_s *lastweapon; int power_cubes; int score; int game_helpchanged; int helpchanged; enum qboolean spectator; }

user_defined_types: struct client_respawn_t { struct client_persistant_t coop_respawn; int enterframe; int score; float cmd_angles[3]; enum qboolean spectator; }

user_defined_types: struct mmove_t { int firstframe; int lastframe; struct mframe_t *frame; void (*endfunc)(struct edict_s *self); }

user_defined_types: struct pmove_state_t { enum pmtype_t pm_type; short origin[3]; short velocity[3]; unsigned char pm_flags; unsigned char pm_time; short gravity; short delta_angles[3]; }

user_defined_types: struct gitem_s { char *classname; enum qboolean (*pickup)(struct edict_s *ent, struct edict_s *other); void (*use)(struct edict_s *ent, struct gitem_s *item); void (*drop)(struct edict_s *ent, struct gitem_s *item); void (*weaponthink)(struct edict_s *ent); char *pickup_sound; char *world_model; int world_model_flags; char *view_model; char *icon; char *pickup_name; int count_width; int quantity; char *ammo; int flags; int weapmodel; void *info; int tag; char *precaches; }


FinishVPNLookup

decompiled_code:
void __fastcall FinishVPNLookup(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbp
__int64 v4; // r14
int v5; // er13
__int64 v6; // r12
__int64 v7; // r15
__int64 v8; // rdx
unsigned int v9; // ebp
__int64 v10; // r13
__int64 v11; // r12
__int64 v12; // rax
__int64 v13; // r14
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rdx
__int64 v19; // rax
__int64 v20; // r14
const char *v21; // rax
const char *v22; // rax
__int64 v23; // [rsp-538h] [rbp-538h] BYREF

if ( a3 )
{
v3 = *a1;
v4 = *((_QWORD *)&ge + 16);
v5 = *((_DWORD *)&ge + 34);
v6 = proxyinfo;
v7 = json_create(a3, &v23, 32LL);
if ( v7 )
{
v8 = (v3 - v4) % v5;
v9 = (v3 - v4) / v5 - 1;
v10 = 13496LL * (int)v9;
v11 = v10 + v6;
v12 = json_getProperty(v7, "security", v8);
v13 = v12;
if ( v12 )
{
v14 = json_getPropertyValue(v12, "vpn");
*(_DWORD *)(v11 + 13420) = Q_stricmp(v14, "true") == 0;
v15 = json_getPropertyValue(v13, "proxy");
*(_DWORD *)(v11 + 13424) = Q_stricmp(v15, "true") == 0;
v16 = json_getPropertyValue(v13, "tor");
*(_DWORD *)(v11 + 13428) = Q_stricmp(v16, "true") == 0;
v17 = json_getPropertyValue(v13, "relay");
LOBYTE(v18) = (unsigned int)Q_stricmp(v17, "true") == 0;
*(_DWORD *)(v11 + 13432) = (unsigned __int8)v18;
if ( *(_DWORD *)(v11 + 13420) || *(_DWORD *)(v11 + 13424) || *(_DWORD *)(v11 + 13428) || (_BYTE)v18 )
{
*(_DWORD *)(v11 + 13416) = 2;
v19 = json_getProperty(v7, "network", v18);
v20 = v19;
if ( v19 )
{
v21 = (const char *)json_getPropertyValue(v19, "network");
strncpy((char *)(v11 + 13436), v21, 0x32uLL);
v22 = (const char *)json_getPropertyValue(v20, "autonomous_system_number");
strncpy((char *)(v11 + 13486), v22, 0xAuLL);
}
}
}
if ( *(_DWORD *)(v11 + 13416) == 2 )
{
if ( vpn_kick )
{
Q_snprintf(
&buffer,
0x10000LL,
"VPN connections not allowed, please reconnect without it\n",
(unsigned int)(maxMsgLevel + 1));
((void (__fastcall *)(_QWORD, __int64, void *))gi[2])(*a1, 2LL, &buffer);
addCmdQueue(v9, 3LL, 0LL, &buffer, 1.0);
((void (*)(_QWORD, __int64, const char *, ...))gi[2])(
0LL,
2LL,
"%s disconnected for using a VPN [%s - %s]\n",
(const char *)(*(_QWORD *)(*a1 + 88LL) + 704LL),
(const char *)(proxyinfo + v10 + 1512),
(const char *)(v11 + 13486));
}
}
}
else
{
gi[1]("json parsing error\n");
}
}
}

canonical_decompiled_code:
void __fastcall func0(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbp
__int64 v4; // r14
int v5; // er13
__int64 v6; // r12
__int64 v7; // r15
__int64 v8; // rdx
unsigned int v9; // ebp
__int64 v10; // r13
__int64 v11; // r12
__int64 v12; // rax
__int64 v13; // r14
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rdx
__int64 v19; // rax
__int64 v20; // r14
const char *v21; // rax
const char *v22; // rax
__int64 v23; // [rsp-538h] [rbp-538h] BYREF

if ( a3 )
{
v3 = *a1;
v4 = *((_QWORD *)&ge + 16);
v5 = *((_DWORD *)&ge + 34);
v6 = proxyinfo;
v7 = json_create(a3, &v23, 32LL);
if ( v7 )
{
v8 = (v3 - v4) % v5;
v9 = (v3 - v4) / v5 - 1;
v10 = 13496LL * (int)v9;
v11 = v10 + v6;
v12 = json_getProperty(v7, "security", v8);
v13 = v12;
if ( v12 )
{
v14 = json_getPropertyValue(v12, "vpn");
*(_DWORD *)(v11 + 13420) = Q_stricmp(v14, "true") == 0;
v15 = json_getPropertyValue(v13, "proxy");
*(_DWORD *)(v11 + 13424) = Q_stricmp(v15, "true") == 0;
v16 = json_getPropertyValue(v13, "tor");
*(_DWORD *)(v11 + 13428) = Q_stricmp(v16, "true") == 0;
v17 = json_getPropertyValue(v13, "relay");
LOBYTE(v18) = (unsigned int)Q_stricmp(v17, "true") == 0;
*(_DWORD *)(v11 + 13432) = (unsigned __int8)v18;
if ( *(_DWORD *)(v11 + 13420) || *(_DWORD *)(v11 + 13424) || *(_DWORD *)(v11 + 13428) || (_BYTE)v18 )
{
*(_DWORD *)(v11 + 13416) = 2;
v19 = json_getProperty(v7, "network", v18);
v20 = v19;
if ( v19 )
{
v21 = (const char *)json_getPropertyValue(v19, "network");
strncpy((char *)(v11 + 13436), v21, 0x32uLL);
v22 = (const char *)json_getPropertyValue(v20, "autonomous_system_number");
strncpy((char *)(v11 + 13486), v22, 0xAuLL);
}
}
}
if ( *(_DWORD *)(v11 + 13416) == 2 )
{
if ( vpn_kick )
{
Q_snprintf(
&buffer,
0x10000LL,
"VPN connections not allowed, please reconnect without it\n",
(unsigned int)(maxMsgLevel + 1));
((void (__fastcall *)(_QWORD, __int64, void *))gi[2])(*a1, 2LL, &buffer);
addCmdQueue(v9, 3LL, 0LL, &buffer, 1.0);
((void (*)(_QWORD, __int64, const char *, ...))gi[2])(
0LL,
2LL,
"%s disconnected for using a VPN [%s - %s]\n",
(const char *)(*(_QWORD *)(*a1 + 88LL) + 704LL),
(const char *)(proxyinfo + v10 + 1512),
(const char *)(v11 + 13486));
}
}
}
else
{
gi[1]("json parsing error\n");
}
}
}

original_code:
void FinishVPNLookup(download_t *download, int code, byte *buff, int len)
{
    vpn_t *v;
    json_t mem[32];
    const json_t *root;
    const json_t *security;
    const json_t *net;
    const char *vpn, *proxy, *tor, *relay;
    int i = (((char *)download->initiator - (char *)ge.edicts) / ge.edict_size) - 1;
    if (buff) {
        v = &proxyinfo[i].vpn;
        root = json_create(buff, mem, sizeof(mem)/sizeof(*mem));
        if (!root) {
            gi.dprintf("json parsing error\n");
            return;
        }
        security = json_getProperty(root, "security");
        if (security) {
            v->is_vpn = Q_stricmp(json_getPropertyValue(security, "vpn"), "true") == 0;
            v->is_proxy = Q_stricmp(json_getPropertyValue(security, "proxy"), "true") == 0;
            v->is_tor = Q_stricmp(json_getPropertyValue(security, "tor"), "true") == 0;
            v->is_relay = Q_stricmp(json_getPropertyValue(security, "relay"), "true") == 0;
            if (v->is_vpn || v->is_proxy || v->is_tor || v->is_relay) {
                v->state = VPN_POSITIVE;
                net = json_getProperty(root, "network");
                if (net) {
                    strncpy(v->network, json_getPropertyValue(net, "network"), sizeof(v->network));
                    strncpy(v->asn, json_getPropertyValue(net, "autonomous_system_number"), sizeof(v->asn));
                }
            }
        }
        if (v->state == VPN_POSITIVE && vpn_kick) {
            Q_snprintf(buffer, sizeof(buffer), "VPN connections not allowed, please reconnect without it\n", maxMsgLevel + 1);
            gi.cprintf(download->initiator, 2, buffer);
            addCmdQueue(i, QCMD_DISCONNECT, 1, 0, buffer);
            gi.cprintf(((void *)0), 2, "%s disconnected for using a VPN [%s - %s]\n",
                    download->initiator->client->pers.netname, proxyinfo[i].ipaddress, v->asn
            );
        }
    }
}

canonical_original_code:
void FinishVPNLookup(struct download_s *download, int code, unsigned char *buff, int len)
{
    struct vpn_t *v;
    struct json_s mem[32];
    struct json_s *root;
    struct json_s *security;
    struct json_s *net;
    char *vpn; char *proxy; char *tor; char *relay;
    int i = (((char *)download->initiator - (char *)ge.edicts) / ge.edict_size) - 1;
    if (buff) {
        v = &proxyinfo[i].vpn;
        root = json_create(buff, mem, sizeof(mem)/sizeof(*mem));
        if (!root) {
            gi.dprintf("json parsing error\n");
            return;
        }
        security = json_getProperty(root, "security");
        if (security) {
            v->is_vpn = Q_stricmp(json_getPropertyValue(security, "vpn"), "true") == 0;
            v->is_proxy = Q_stricmp(json_getPropertyValue(security, "proxy"), "true") == 0;
            v->is_tor = Q_stricmp(json_getPropertyValue(security, "tor"), "true") == 0;
            v->is_relay = Q_stricmp(json_getPropertyValue(security, "relay"), "true") == 0;
            if (v->is_vpn || v->is_proxy || v->is_tor || v->is_relay) {
                v->state = VPN_POSITIVE;
                net = json_getProperty(root, "network");
                if (net) {
                    strncpy(v->network, json_getPropertyValue(net, "network"), sizeof(v->network));
                    strncpy(v->asn, json_getPropertyValue(net, "autonomous_system_number"), sizeof(v->asn));
                }
            }
        }
        if (v->state == VPN_POSITIVE && vpn_kick) {
            Q_snprintf(buffer, sizeof(buffer), "VPN connections not allowed, please reconnect without it\n", maxMsgLevel + 1);
            gi.cprintf(download->initiator, 2, buffer);
            addCmdQueue(i, QCMD_DISCONNECT, 1, 0, buffer);
            gi.cprintf(((void *)0), 2, "%s disconnected for using a VPN [%s - %s]\n",
                    download->initiator->client->pers.netname, proxyinfo[i].ipaddress, v->asn
            );
        }
    }
}

variable_types: struct download_s { struct edict_s { struct entity_state_s { int number; float origin[3]; float angles[3]; float old_origin[3]; int modelindex; int modelindex2; int frame; int skinnum; int effects; int renderfx; int solid; int sound; int event; } s; struct gclient_s { struct player_state_t { struct pmove_state_t { enum pmtype_t { PM_NORMAL=0, PM_SPECTATOR=1, PM_DEAD=2, PM_GIB=3, PM_FREEZE=4 } pm_type; short origin[3]; short velocity[3]; unsigned char pm_flags; unsigned char pm_time; short gravity; short delta_angles[3]; } pmove; float viewangles[3]; float viewoffset[3]; float kick_angles[3]; float gunangles[3]; float gunoffset[3]; int gunindex; int gunframe; float blend[4]; float fov; int rdflags; short stats[32]; } ps; int ping; struct client_persistant_t { char userinfo[512]; char netname[16]; int hand; enum qboolean { qfalse=0, qtrue=1 } connected; int health; int max_health; int savedFlags; int selected_item; int inventory[256]; int max_bullets; int max_shells; int max_rockets; int max_grenades; int max_cells; int max_slugs; struct gitem_s { char *classname; enum qboolean { qfalse=0, qtrue=1 } (*pickup)(struct edict_s *ent, struct edict_s *other); void (*use)(struct edict_s *ent, struct gitem_s *item); void (*drop)(struct edict_s *ent, struct gitem_s *item); void (*weaponthink)(struct edict_s *ent); char *pickup_sound; char *world_model; int world_model_flags; char *view_model; char *icon; char *pickup_name; int count_width; int quantity; char *ammo; int flags; int weapmodel; void *info; int tag; char *precaches; } *weapon; struct gitem_s *lastweapon; int power_cubes; int score; int game_helpchanged; int helpchanged; enum qboolean { qfalse=0, qtrue=1 } spectator; } pers; struct client_respawn_t { struct client_persistant_t coop_respawn; int enterframe; int score; float cmd_angles[3]; enum qboolean { qfalse=0, qtrue=1 } spectator; } resp; struct pmove_state_t old_pmove; enum qboolean { qfalse=0, qtrue=1 } showscores; enum qboolean { qfalse=0, qtrue=1 } showinventory; enum qboolean { qfalse=0, qtrue=1 } showhelp; enum qboolean { qfalse=0, qtrue=1 } showhelpicon; int ammo_index; int buttons; int oldbuttons; int latched_buttons; enum qboolean { qfalse=0, qtrue=1 } weapon_thunk; struct gitem_s *newweapon; int damage_armor; int damage_parmor; int damage_blood; int damage_knockback; float damage_from[3]; float killer_yaw; enum weaponstate_t { WEAPON_READY=0, WEAPON_ACTIVATING=1, WEAPON_DROPPING=2, WEAPON_FIRING=3 } weaponstate; float kick_angles[3]; float kick_origin[3]; float v_dmg_roll; float fall_time; float damage_alpha; float bonus_alpha; float damage_blend[3]; float v_angle[3]; float bobtime; float oldviewangles[3]; float oldvelocity[3]; float next_drown_time; int old_waterlevel; int breather_sound; int machinegun_shots; int anim_end; int anim_priority; enum qboolean { qfalse=0, qtrue=1 } anim_duck; enum qboolean { qfalse=0, qtrue=1 } anim_run; int quad_framenum; int invincible_framenum; int breather_framenum; int enviro_framenum; enum qboolean { qfalse=0, qtrue=1 } grenade_blew_up; float grenade_time; int silencer_shots; int weapon_sound; float pickup_msg_time; float flood_locktill; float flood_when[10]; int flood_whenhead; float respawn_time; struct edict_s *chase_target; enum qboolean { qfalse=0, qtrue=1 } update_chase; } *client; enum qboolean { qfalse=0, qtrue=1 } inuse; int linkcount; struct link_s { struct link_s *prev; } area; int num_clusters; int clusternums[16]; int headnode; int areanum; int svflags; float mins[3]; float absmin[3]; enum solid_t { SOLID_NOT=0, SOLID_TRIGGER=1, SOLID_BBOX=2, SOLID_BSP=3 } solid; int clipmask; struct edict_s *owner; int movetype; int flags; char *model; float freetime; char *message; char *classname; int spawnflags; float timestamp; float angle; char *target; char *targetname; char *killtarget; char *team; char *pathtarget; char *deathtarget; char *combattarget; struct edict_s *target_ent; float speed; float movedir[3]; float pos1[3]; float velocity[3]; float avelocity[3]; int mass; float air_finished; float gravity; struct edict_s *goalentity; struct edict_s *movetarget; float yaw_speed; float ideal_yaw; float nextthink; void (*prethink)(struct edict_s *ent); void (*think)(struct edict_s *self); void (*blocked)(struct edict_s *self, struct edict_s *other); void (*touch)(struct edict_s *self, struct edict_s *other, struct cplane_s { float normal[3]; float dist; unsigned char type; unsigned char signbits; unsigned char pad[2]; } *plane, struct csurface_s { char name[16]; int flags; int value; } *surf); void (*use)(struct edict_s *self, struct edict_s *other, struct edict_s *activator); void (*pain)(struct edict_s *self, struct edict_s *other, float kick, int damage); void (*die)(struct edict_s *self, struct edict_s *inflictor, struct edict_s *attacker, int damage, float point[3]); float touch_debounce_time; float pain_debounce_time; float damage_debounce_time; float fly_sound_debounce_time; float last_move_time; int health; int max_health; int gib_health; int deadflag; enum qboolean { qfalse=0, qtrue=1 } show_hostile; float powerarmor_time; char *map; int viewheight; int takedamage; int dmg; int radius_dmg; float dmg_radius; int sounds; int count; struct edict_s *chain; struct edict_s *enemy; struct edict_s *oldenemy; struct edict_s *activator; struct edict_s *groundentity; int groundentity_linkcount; struct edict_s *teamchain; struct edict_s *teammaster; struct edict_s *mynoise; struct edict_s *mynoise2; int noise_index; int noise_index2; float volume; float attenuation; float wait; float delay; float random; float teleport_time; int watertype; int waterlevel; float move_origin[3]; float move_angles[3]; int light_level; int style; struct gitem_s *item; struct moveinfo_t { float start_origin[3]; float start_angles[3]; float end_origin[3]; float end_angles[3]; int sound_start; int sound_middle; int sound_end; float accel; float speed; float decel; float distance; float wait; int state; float dir[3]; float current_speed; float move_speed; float next_speed; float remaining_distance; float decel_distance; void (*endfunc)(struct edict_s *); } moveinfo; struct monsterinfo_t { struct mmove_t { int firstframe; int lastframe; struct mframe_t { void (*aifunc)(struct edict_s *self, float dist); float dist; void (*thinkfunc)(struct edict_s *self); } *frame; void (*endfunc)(struct edict_s *self); } *currentmove; int aiflags; int nextframe; float scale; void (*stand)(struct edict_s *self); void (*idle)(struct edict_s *self); void (*search)(struct edict_s *self); void (*walk)(struct edict_s *self); void (*run)(struct edict_s *self); void (*dodge)(struct edict_s *self, struct edict_s *other, float eta); void (*attack)(struct edict_s *self); void (*melee)(struct edict_s *self); void (*sight)(struct edict_s *self, struct edict_s *other); enum qboolean { qfalse=0, qtrue=1 } (*checkattack)(struct edict_s *self); float pausetime; float attack_finished; float saved_goal[3]; float search_time; float trail_time; float last_sighting[3]; int attack_state; int lefty; float idle_time; int linkcount; int power_armor_type; int power_armor_power; } monsterinfo; } *initiator; enum dltype_t { DL_NONE=0, DL_VPNAPI=1 } type; char path[1024]; void (*onFinish)(struct download_s *, int, unsigned char *, int); } *

variable_types: code int

variable_types:
buff
unsigned char *

variable_types: len int

variable_types: struct vpn_t { enum vpn_state_t { VPN_UNKNOWN=0, VPN_CHECKING=1, VPN_POSITIVE=2, VPN_NEGATIVE=3 } state; enum qboolean { qfalse=0, qtrue=1 } is_vpn; enum qboolean { qfalse=0, qtrue=1 } is_proxy; enum qboolean { qfalse=0, qtrue=1 } is_tor; enum qboolean { qfalse=0, qtrue=1 } is_relay; char network[50]; char asn[10]; } *

variable_types: struct json_s { struct json_s *sibling; char *name; union { char *value; struct { struct json_s *child; struct json_s *last_child; } c; } u; enum jsonType_t { JSON_OBJ=0, JSON_ARRAY=1, JSON_TEXT=2, JSON_BOOLEAN=3, JSON_INTEGER=4, JSON_REAL=5, JSON_NULL=6 } type; } [32]

variable_types: struct json_s { struct json_s *sibling; char *name; union { char *value; struct { struct json_s *child; struct json_s *last_child; } c; } u; enum jsonType_t { JSON_OBJ=0, JSON_ARRAY=1, JSON_TEXT=2, JSON_BOOLEAN=3, JSON_INTEGER=4, JSON_REAL=5, JSON_NULL=6 } type; } *

variable_types:
vpn
char *

variable_types:
proxy
char *

variable_types:
tor
char *

variable_types:
relay
char *

variable_types: i int

user_defined_types: struct download_s { struct edict_s *initiator; enum dltype_t type; char path[1024]; void (*onFinish)(struct download_s *, int, unsigned char *, int); }

user_defined_types: struct vpn_t { enum vpn_state_t state; enum qboolean is_vpn; enum qboolean is_proxy; enum qboolean is_tor; enum qboolean is_relay; char network[50]; char asn[10]; }

user_defined_types: struct json_s { struct json_s *sibling; char *name; union { char *value; struct { struct json_s *child; struct json_s *last_child; } c; } u; enum jsonType_t type; }


isVPN

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

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

canonical_original_code:
enum qboolean isVPN(int clientnum)
{
    return qfalse;
}

variable_types: clientnum int

return_type: enum qboolean { qfalse=0, qtrue=1 }


vpnUsersRun

decompiled_code:
__int64 vpnUsersRun()
{
__int64 result; // rax
__int64 v1; // rbp
int v2; // ebx
__int64 v3; // rax

result = (unsigned int)(int)*(float *)(maxclients + 32LL);
if ( (int)result > 0 )
{
v1 = 0LL;
v2 = 0;
do
{
v3 = proxyinfo + v1;
if ( *(_BYTE *)(proxyinfo + v1 + 1557) )
{
if ( *(_DWORD *)(v3 + 13416) == 2 )
((void (*)(_QWORD, __int64, const char *, ...))gi[2])(
0LL,
2LL,
" %s [%s - %s]\n",
(const char *)(v3 + 1558),
(const char *)(v3 + 13436),
(const char *)(v3 + 13486));
}
++v2;
v1 += 13496LL;
result = (unsigned int)(int)*(float *)(maxclients + 32LL);
}
while ( (int)result > v2 );
}
return result;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 result; // rax
__int64 v1; // rbp
int v2; // ebx
__int64 v3; // rax

result = (unsigned int)(int)*(float *)(maxclients + 32LL);
if ( (int)result > 0 )
{
v1 = 0LL;
v2 = 0;
do
{
v3 = proxyinfo + v1;
if ( *(_BYTE *)(proxyinfo + v1 + 1557) )
{
if ( *(_DWORD *)(v3 + 13416) == 2 )
((void (*)(_QWORD, __int64, const char *, ...))gi[2])(
0LL,
2LL,
" %s [%s - %s]\n",
(const char *)(v3 + 1558),
(const char *)(v3 + 13436),
(const char *)(v3 + 13486));
}
++v2;
v1 += 13496LL;
result = (unsigned int)(int)*(float *)(maxclients + 32LL);
}
while ( (int)result > v2 );
}
return result;
}

original_code:
void vpnUsersRun(int startarg, edict_t *ent, int client)
{
    int i;
    for (i=0; i<(int)maxclients->value; i++) {
        if (!proxyinfo[i].inuse) {
            continue;
        }
        if (proxyinfo[i].vpn.state == VPN_POSITIVE) {
            gi.cprintf(((void *)0), 2, "  %s [%s - %s]\n", proxyinfo[i].name, proxyinfo[i].vpn.network, proxyinfo[i].vpn.asn);
        }
    }
}

canonical_original_code:
void vpnUsersRun(int startarg, struct edict_s *ent, int client)
{
    int i;
    for (i=0; i<(int)maxclients->value; i++) {
        if (!proxyinfo[i].inuse) {
            continue;
        }
        if (proxyinfo[i].vpn.state == VPN_POSITIVE) {
            gi.cprintf(((void *)0), 2, "  %s [%s - %s]\n", proxyinfo[i].name, proxyinfo[i].vpn.network, proxyinfo[i].vpn.asn);
        }
    }
}

user_defined_types: struct entity_state_s { int number; float origin[3]; float angles[3]; float old_origin[3]; int modelindex; int modelindex2; int frame; int skinnum; int effects; int renderfx; int solid; int sound; int event; }

user_defined_types: enum solid_t { SOLID_NOT=0, SOLID_TRIGGER=1, SOLID_BBOX=2, SOLID_BSP=3 }

user_defined_types: struct moveinfo_t { float start_origin[3]; float start_angles[3]; float end_origin[3]; float end_angles[3]; int sound_start; int sound_middle; int sound_end; float accel; float speed; float decel; float distance; float wait; int state; float dir[3]; float current_speed; float move_speed; float next_speed; float remaining_distance; float decel_distance; void (*endfunc)(struct edict_s *); }

user_defined_types: enum weaponstate_t { WEAPON_READY=0, WEAPON_ACTIVATING=1, WEAPON_DROPPING=2, WEAPON_FIRING=3 }

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

user_defined_types: struct csurface_s { char name[16]; int flags; int value; }

user_defined_types: enum pmtype_t { PM_NORMAL=0, PM_SPECTATOR=1, PM_DEAD=2, PM_GIB=3, PM_FREEZE=4 }

user_defined_types: struct mframe_t { void (*aifunc)(struct edict_s *self, float dist); float dist; void (*thinkfunc)(struct edict_s *self); }


decompiled_code:
__int64 __fastcall getR1chHashList(char *src)
{
__int64 result; // rax
char *v2; // rbp
char v3[32]; // [rsp+0h] [rbp-F8h] BYREF
__int64 v4; // [rsp+20h] [rbp-D8h]
__int64 v5; // [rsp+28h] [rbp-D0h]
__int64 v6; // [rsp+30h] [rbp-C8h]
__int64 v7; // [rsp+38h] [rbp-C0h]
__int64 v8; // [rsp+40h] [rbp-B8h]
__int64 v9; // [rsp+48h] [rbp-B0h]
__int64 v10; // [rsp+50h] [rbp-A8h]
__int64 v11; // [rsp+58h] [rbp-A0h]
int v12; // [rsp+60h] [rbp-98h]
char dest[136]; // [rsp+70h] [rbp-88h] BYREF

result = (__int64)strncpy(dest, *(const char **)(q2adminhashlist_enable + 8LL), 0x64uLL);
if ( dest[0] == 49 )
{
if ( q2adminhashlist_dir && !(unsigned int)isBlank(*(_QWORD *)(q2adminhashlist_dir + 8LL)) )
{
v2 = strncpy(v3, *(const char **)(q2adminhashlist_dir + 8LL), 0x64uLL);
*(_WORD *)&v2[strlen(v2)] = 47;
strcat(v2, src);
}
else
{
strcpy(v3, "http://www.q2admin.net/server");
v4 = 0LL;
v5 = 0LL;
v6 = 0LL;
v7 = 0LL;
v8 = 0LL;
v9 = 0LL;
v10 = 0LL;
v11 = 0LL;
v12 = 0;
*(_WORD *)&v3[strlen(v3)] = 47;
strcat(v3, src);
}
result = ReadRemoteHashListFile((__int64)v3, src);
if ( !(_DWORD)result )
{
gi[1]("WARNING: http://www.q2admin.net/server could not be found\n");
result = logEvent(17LL, 0LL, 0LL, "http://www.q2admin.net/server could not be found", 11LL, 0.0);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *src)
{
__int64 result; // rax
char *v2; // rbp
char v3[32]; // [rsp+0h] [rbp-F8h] BYREF
__int64 v4; // [rsp+20h] [rbp-D8h]
__int64 v5; // [rsp+28h] [rbp-D0h]
__int64 v6; // [rsp+30h] [rbp-C8h]
__int64 v7; // [rsp+38h] [rbp-C0h]
__int64 v8; // [rsp+40h] [rbp-B8h]
__int64 v9; // [rsp+48h] [rbp-B0h]
__int64 v10; // [rsp+50h] [rbp-A8h]
__int64 v11; // [rsp+58h] [rbp-A0h]
int v12; // [rsp+60h] [rbp-98h]
char dest[136]; // [rsp+70h] [rbp-88h] BYREF

result = (__int64)strncpy(dest, *(const char **)(q2adminhashlist_enable + 8LL), 0x64uLL);
if ( dest[0] == 49 )
{
if ( q2adminhashlist_dir && !(unsigned int)isBlank(*(_QWORD *)(q2adminhashlist_dir + 8LL)) )
{
v2 = strncpy(v3, *(const char **)(q2adminhashlist_dir + 8LL), 0x64uLL);
*(_WORD *)&v2[strlen(v2)] = 47;
strcat(v2, src);
}
else
{
strcpy(v3, "http://www.q2admin.net/server");
v4 = 0LL;
v5 = 0LL;
v6 = 0LL;
v7 = 0LL;
v8 = 0LL;
v9 = 0LL;
v10 = 0LL;
v11 = 0LL;
v12 = 0;
*(_WORD *)&v3[strlen(v3)] = 47;
strcat(v3, src);
}
result = func0((__int64)v3, src);
if ( !(_DWORD)result )
{
gi[1]("WARNING: http://www.q2admin.net/server could not be found\n");
result = logEvent(17LL, 0LL, 0LL, "http://www.q2admin.net/server could not be found", 11LL, 0.0);
}
}
return result;
}

original_code:
void getR1chHashList(char *hashname) {
    char cfgHashList_enabled[100];
    strncpy(cfgHashList_enabled, q2adminhashlist_enable->string, sizeof(cfgHashList_enabled));
    if (cfgHashList_enabled[0] == '1') {
        qboolean ret;
        char cfgHashRemoteList[100];
        if (!q2adminhashlist_dir || isBlank(q2adminhashlist_dir->string)) {
            strcat(strcat(strncpy(cfgHashRemoteList, "http://www.q2admin.net/server", sizeof(cfgHashRemoteList)), "/"), hashname);
        } else {
            strcat(strcat(strncpy(cfgHashRemoteList, q2adminhashlist_dir->string, sizeof(cfgHashRemoteList)), "/"), hashname);
        }
        ret = ReadRemoteHashListFile(cfgHashRemoteList, hashname);
        if (!ret) {
            gi.dprintf("WARNING: " "http://www.q2admin.net/server" " could not be found\n");
            logEvent(LT_INTERNALWARN, 0, ((void *)0), "http://www.q2admin.net/server" " could not be found", 11, 0.0);
        }
    }
}

canonical_original_code:
void getR1chHashList(char *hashname) {
    char cfgHashList_enabled[100];
    strncpy(cfgHashList_enabled, q2adminhashlist_enable->string, sizeof(cfgHashList_enabled));
    if (cfgHashList_enabled[0] == '1') {
        enum qboolean ret;
        char cfgHashRemoteList[100];
        if (!q2adminhashlist_dir || isBlank(q2adminhashlist_dir->string)) {
            strcat(strcat(strncpy(cfgHashRemoteList, "http://www.q2admin.net/server", sizeof(cfgHashRemoteList)), "/"), hashname);
        } else {
            strcat(strcat(strncpy(cfgHashRemoteList, q2adminhashlist_dir->string, sizeof(cfgHashRemoteList)), "/"), hashname);
        }
        ret = ReadRemoteHashListFile(cfgHashRemoteList, hashname);
        if (!ret) {
            gi.dprintf("WARNING: " "http://www.q2admin.net/server" " could not be found\n");
            logEvent(LT_INTERNALWARN, 0, ((void *)0), "http://www.q2admin.net/server" " could not be found", 11, 0.0);
        }
    }
}

variable_types:
hashname
char *

variable_types:
ret
enum qboolean { qfalse=0, qtrue=1 }

variable_types:
cfgHashRemoteList
char [100]


loadhashlist

decompiled_code:
char *loadhashlist()
{
char *result; // rax
char v1[120]; // [rsp+0h] [rbp-78h] BYREF

result = strncpy(v1, *(const char **)(q2adminhashlist_enable + 8LL), 0x64uLL);
if ( v1[0] == 49 )
{
getR1chHashList("anticheat-cvars.txt");
getR1chHashList("anticheat-hashes.txt");
getR1chHashList("anticheat-tokens.txt");
*(_QWORD *)&buffer = 0x6164707563617673LL;
*((_DWORD *)&buffer + 2) = 681332;
result = (char *)((__int64 (*)(void))gi[42])();
}
return result;
}

canonical_decompiled_code:
char *func2()
{
char *result; // rax
char v1[120]; // [rsp+0h] [rbp-78h] BYREF

result = strncpy(v1, *(const char **)(q2adminhashlist_enable + 8LL), 0x64uLL);
if ( v1[0] == 49 )
{
func1("anticheat-cvars.txt");
func1("anticheat-hashes.txt");
func1("anticheat-tokens.txt");
*(_QWORD *)&buffer = 0x6164707563617673LL;
*((_DWORD *)&buffer + 2) = 681332;
result = (char *)((__int64 (*)(void))gi[42])();
}
return result;
}

original_code:
void loadhashlist(void) {
    char cfgHashList_enabled[100];
    strncpy(cfgHashList_enabled, q2adminhashlist_enable->string, sizeof(cfgHashList_enabled));
    if (cfgHashList_enabled[0] == '1') {
        getR1chHashList("anticheat-cvars.txt");
        getR1chHashList("anticheat-hashes.txt");
        getR1chHashList("anticheat-tokens.txt");
        strcpy(buffer, "svacupdate\n");
        gi.AddCommandString(buffer);
    }
}

canonical_original_code:
void loadhashlist() {
    char cfgHashList_enabled[100];
    strncpy(cfgHashList_enabled, q2adminhashlist_enable->string, sizeof(cfgHashList_enabled));
    if (cfgHashList_enabled[0] == '1') {
        getR1chHashList("anticheat-cvars.txt");
        getR1chHashList("anticheat-hashes.txt");
        getR1chHashList("anticheat-tokens.txt");
        strcpy(buffer, "svacupdate\n");
        gi.AddCommandString(buffer);
    }
}


reloadhashlistRun

decompiled_code:
__int64 __fastcall reloadhashlistRun(__int64 a1, __int64 a2)
{
loadhashlist();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Remote hashlist loaded.\n");
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
func2();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Remote hashlist loaded.\n");
}

original_code:
void reloadhashlistRun(int startarg, edict_t *ent, int client) {
    loadhashlist();
    gi.cprintf(ent, 2, "Remote hashlist loaded.\n");
}

canonical_original_code:
void reloadhashlistRun(int startarg, struct edict_s *ent, int client) {
    loadhashlist();
    gi.cprintf(ent, 2, "Remote hashlist loaded.\n");
}

variable_types: startarg int

variable_types: struct edict_s { struct entity_state_s { int number; float origin[3]; float angles[3]; float old_origin[3]; int modelindex; int modelindex2; int frame; int skinnum; int effects; int renderfx; int solid; int sound; int event; } s; struct gclient_s { struct player_state_t { struct pmove_state_t { enum pmtype_t { PM_NORMAL=0, PM_SPECTATOR=1, PM_DEAD=2, PM_GIB=3, PM_FREEZE=4 } pm_type; short origin[3]; short velocity[3]; unsigned char pm_flags; unsigned char pm_time; short gravity; short delta_angles[3]; } pmove; float viewangles[3]; float viewoffset[3]; float kick_angles[3]; float gunangles[3]; float gunoffset[3]; int gunindex; int gunframe; float blend[4]; float fov; int rdflags; short stats[32]; } ps; int ping; struct client_persistant_t { char userinfo[512]; char netname[16]; int hand; enum qboolean { qfalse=0, qtrue=1 } connected; int health; int max_health; int savedFlags; int selected_item; int inventory[256]; int max_bullets; int max_shells; int max_rockets; int max_grenades; int max_cells; int max_slugs; struct gitem_s { char *classname; enum qboolean { qfalse=0, qtrue=1 } (*pickup)(struct edict_s *ent, struct edict_s *other); void (*use)(struct edict_s *ent, struct gitem_s *item); void (*drop)(struct edict_s *ent, struct gitem_s *item); void (*weaponthink)(struct edict_s *ent); char *pickup_sound; char *world_model; int world_model_flags; char *view_model; char *icon; char *pickup_name; int count_width; int quantity; char *ammo; int flags; int weapmodel; void *info; int tag; char *precaches; } *weapon; struct gitem_s *lastweapon; int power_cubes; int score; int game_helpchanged; int helpchanged; enum qboolean { qfalse=0, qtrue=1 } spectator; } pers; struct client_respawn_t { struct client_persistant_t coop_respawn; int enterframe; int score; float cmd_angles[3]; enum qboolean { qfalse=0, qtrue=1 } spectator; } resp; struct pmove_state_t old_pmove; enum qboolean { qfalse=0, qtrue=1 } showscores; enum qboolean { qfalse=0, qtrue=1 } showinventory; enum qboolean { qfalse=0, qtrue=1 } showhelp; enum qboolean { qfalse=0, qtrue=1 } showhelpicon; int ammo_index; int buttons; int oldbuttons; int latched_buttons; enum qboolean { qfalse=0, qtrue=1 } weapon_thunk; struct gitem_s *newweapon; int damage_armor; int damage_parmor; int damage_blood; int damage_knockback; float damage_from[3]; float killer_yaw; enum weaponstate_t { WEAPON_READY=0, WEAPON_ACTIVATING=1, WEAPON_DROPPING=2, WEAPON_FIRING=3 } weaponstate; float kick_angles[3]; float kick_origin[3]; float v_dmg_roll; float fall_time; float damage_alpha; float bonus_alpha; float damage_blend[3]; float v_angle[3]; float bobtime; float oldviewangles[3]; float oldvelocity[3]; float next_drown_time; int old_waterlevel; int breather_sound; int machinegun_shots; int anim_end; int anim_priority; enum qboolean { qfalse=0, qtrue=1 } anim_duck; enum qboolean { qfalse=0, qtrue=1 } anim_run; int quad_framenum; int invincible_framenum; int breather_framenum; int enviro_framenum; enum qboolean { qfalse=0, qtrue=1 } grenade_blew_up; float grenade_time; int silencer_shots; int weapon_sound; float pickup_msg_time; float flood_locktill; float flood_when[10]; int flood_whenhead; float respawn_time; struct edict_s *chase_target; enum qboolean { qfalse=0, qtrue=1 } update_chase; } *client; enum qboolean { qfalse=0, qtrue=1 } inuse; int linkcount; struct link_s { struct link_s *prev; } area; int num_clusters; int clusternums[16]; int headnode; int areanum; int svflags; float mins[3]; float absmin[3]; enum solid_t { SOLID_NOT=0, SOLID_TRIGGER=1, SOLID_BBOX=2, SOLID_BSP=3 } solid; int clipmask; struct edict_s *owner; int movetype; int flags; char *model; float freetime; char *message; char *classname; int spawnflags; float timestamp; float angle; char *target; char *targetname; char *killtarget; char *team; char *pathtarget; char *deathtarget; char *combattarget; struct edict_s *target_ent; float speed; float movedir[3]; float pos1[3]; float velocity[3]; float avelocity[3]; int mass; float air_finished; float gravity; struct edict_s *goalentity; struct edict_s *movetarget; float yaw_speed; float ideal_yaw; float nextthink; void (*prethink)(struct edict_s *ent); void (*think)(struct edict_s *self); void (*blocked)(struct edict_s *self, struct edict_s *other); void (*touch)(struct edict_s *self, struct edict_s *other, struct cplane_s { float normal[3]; float dist; unsigned char type; unsigned char signbits; unsigned char pad[2]; } *plane, struct csurface_s { char name[16]; int flags; int value; } *surf); void (*use)(struct edict_s *self, struct edict_s *other, struct edict_s *activator); void (*pain)(struct edict_s *self, struct edict_s *other, float kick, int damage); void (*die)(struct edict_s *self, struct edict_s *inflictor, struct edict_s *attacker, int damage, float point[3]); float touch_debounce_time; float pain_debounce_time; float damage_debounce_time; float fly_sound_debounce_time; float last_move_time; int health; int max_health; int gib_health; int deadflag; enum qboolean { qfalse=0, qtrue=1 } show_hostile; float powerarmor_time; char *map; int viewheight; int takedamage; int dmg; int radius_dmg; float dmg_radius; int sounds; int count; struct edict_s *chain; struct edict_s *enemy; struct edict_s *oldenemy; struct edict_s *activator; struct edict_s *groundentity; int groundentity_linkcount; struct edict_s *teamchain; struct edict_s *teammaster; struct edict_s *mynoise; struct edict_s *mynoise2; int noise_index; int noise_index2; float volume; float attenuation; float wait; float delay; float random; float teleport_time; int watertype; int waterlevel; float move_origin[3]; float move_angles[3]; int light_level; int style; struct gitem_s *item; struct moveinfo_t { float start_origin[3]; float start_angles[3]; float end_origin[3]; float end_angles[3]; int sound_start; int sound_middle; int sound_end; float accel; float speed; float decel; float distance; float wait; int state; float dir[3]; float current_speed; float move_speed; float next_speed; float remaining_distance; float decel_distance; void (*endfunc)(struct edict_s *); } moveinfo; struct monsterinfo_t { struct mmove_t { int firstframe; int lastframe; struct mframe_t { void (*aifunc)(struct edict_s *self, float dist); float dist; void (*thinkfunc)(struct edict_s *self); } *frame; void (*endfunc)(struct edict_s *self); } *currentmove; int aiflags; int nextframe; float scale; void (*stand)(struct edict_s *self); void (*idle)(struct edict_s *self); void (*search)(struct edict_s *self); void (*walk)(struct edict_s *self); void (*run)(struct edict_s *self); void (*dodge)(struct edict_s *self, struct edict_s *other, float eta); void (*attack)(struct edict_s *self); void (*melee)(struct edict_s *self); void (*sight)(struct edict_s *self, struct edict_s *other); enum qboolean { qfalse=0, qtrue=1 } (*checkattack)(struct edict_s *self); float pausetime; float attack_finished; float saved_goal[3]; float search_time; float trail_time; float last_sighting[3]; int attack_state; int lefty; float idle_time; int linkcount; int power_armor_type; int power_armor_power; } monsterinfo; } *

variable_types: client int

user_defined_types: struct edict_s { struct entity_state_s s; struct gclient_s *client; enum qboolean inuse; int linkcount; struct link_s area; int num_clusters; int clusternums[16]; int headnode; int areanum; int svflags; float mins[3]; float absmin[3]; enum solid_t solid; int clipmask; struct edict_s *owner; int movetype; int flags; char *model; float freetime; char *message; char *classname; int spawnflags; float timestamp; float angle; char *target; char *targetname; char *killtarget; char *team; char *pathtarget; char *deathtarget; char *combattarget; struct edict_s *target_ent; float speed; float movedir[3]; float pos1[3]; float velocity[3]; float avelocity[3]; int mass; float air_finished; float gravity; struct edict_s *goalentity; struct edict_s *movetarget; float yaw_speed; float ideal_yaw; float nextthink; void (*prethink)(struct edict_s *ent); void (*think)(struct edict_s *self); void (*blocked)(struct edict_s *self, struct edict_s *other); void (*touch)(struct edict_s *self, struct edict_s *other, struct cplane_s *plane, struct csurface_s *surf); void (*use)(struct edict_s *self, struct edict_s *other, struct edict_s *activator); void (*pain)(struct edict_s *self, struct edict_s *other, float kick, int damage); void (*die)(struct edict_s *self, struct edict_s *inflictor, struct edict_s *attacker, int damage, float point[3]); float touch_debounce_time; float pain_debounce_time; float damage_debounce_time; float fly_sound_debounce_time; float last_move_time; int health; int max_health; int gib_health; int deadflag; enum qboolean show_hostile; float powerarmor_time; char *map; int viewheight; int takedamage; int dmg; int radius_dmg; float dmg_radius; int sounds; int count; struct edict_s *chain; struct edict_s *enemy; struct edict_s *oldenemy; struct edict_s *activator; struct edict_s *groundentity; int groundentity_linkcount; struct edict_s *teamchain; struct edict_s *teammaster; struct edict_s *mynoise; struct edict_s *mynoise2; int noise_index; int noise_index2; float volume; float attenuation; float wait; float delay; float random; float teleport_time; int watertype; int waterlevel; float move_origin[3]; float move_angles[3]; int light_level; int style; struct gitem_s *item; struct moveinfo_t moveinfo; struct monsterinfo_t monsterinfo; }

user_defined_types: struct monsterinfo_t { struct mmove_t *currentmove; int aiflags; int nextframe; float scale; void (*stand)(struct edict_s *self); void (*idle)(struct edict_s *self); void (*search)(struct edict_s *self); void (*walk)(struct edict_s *self); void (*run)(struct edict_s *self); void (*dodge)(struct edict_s *self, struct edict_s *other, float eta); void (*attack)(struct edict_s *self); void (*melee)(struct edict_s *self); void (*sight)(struct edict_s *self, struct edict_s *other); enum qboolean (*checkattack)(struct edict_s *self); float pausetime; float attack_finished; float saved_goal[3]; float search_time; float trail_time; float last_sighting[3]; int attack_state; int lefty; float idle_time; int linkcount; int power_armor_type; int power_armor_power; }

user_defined_types: struct gclient_s { struct player_state_t ps; int ping; struct client_persistant_t pers; struct client_respawn_t resp; struct pmove_state_t old_pmove; enum qboolean showscores; enum qboolean showinventory; enum qboolean showhelp; enum qboolean showhelpicon; int ammo_index; int buttons; int oldbuttons; int latched_buttons; enum qboolean weapon_thunk; struct gitem_s *newweapon; int damage_armor; int damage_parmor; int damage_blood; int damage_knockback; float damage_from[3]; float killer_yaw; enum weaponstate_t weaponstate; float kick_angles[3]; float kick_origin[3]; float v_dmg_roll; float fall_time; float damage_alpha; float bonus_alpha; float damage_blend[3]; float v_angle[3]; float bobtime; float oldviewangles[3]; float oldvelocity[3]; float next_drown_time; int old_waterlevel; int breather_sound; int machinegun_shots; int anim_end; int anim_priority; enum qboolean anim_duck; enum qboolean anim_run; int quad_framenum; int invincible_framenum; int breather_framenum; int enviro_framenum; enum qboolean grenade_blew_up; float grenade_time; int silencer_shots; int weapon_sound; float pickup_msg_time; float flood_locktill; float flood_when[10]; int flood_whenhead; float respawn_time; struct edict_s *chase_target; enum qboolean update_chase; }

user_defined_types: struct player_state_t { struct pmove_state_t pmove; float viewangles[3]; float viewoffset[3]; float kick_angles[3]; float gunangles[3]; float gunoffset[3]; int gunindex; int gunframe; float blend[4]; float fov; int rdflags; short stats[32]; }


readCheckVarLists

decompiled_code:
__int64 readCheckVarLists()
{
int v0; // ebx
__int64 result; // rax
__int64 v2; // rax

maxcheckvars[0] = 0;
v0 = ReadCheckVarFile(*((const char **)configfile_cvar + 1));
Q_snprintf(&buffer, 0x10000LL, "%s/%s", (const char *)&moddir, *((const char **)configfile_cvar + 1));
result = v0 | (unsigned int)ReadCheckVarFile(&buffer);
if ( !(_DWORD)result )
{
gi[2](0LL, (unsigned int)"WARNING: %s could not be found\n", *((_QWORD *)configfile_cvar + 1));
v2 = va("%s could not be found", configfile_cvar);
result = logEvent(17LL, 0LL, 0LL, v2, 18LL, 0.0);
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
int v0; // ebx
__int64 result; // rax
__int64 v2; // rax

maxcheckvars[0] = 0;
v0 = func0(*((const char **)configfile_cvar + 1));
Q_snprintf(&buffer, 0x10000LL, "%s/%s", (const char *)&moddir, *((const char **)configfile_cvar + 1));
result = v0 | (unsigned int)func0(&buffer);
if ( !(_DWORD)result )
{
gi[2](0LL, (unsigned int)"WARNING: %s could not be found\n", *((_QWORD *)configfile_cvar + 1));
v2 = va("%s could not be found", configfile_cvar);
result = logEvent(17LL, 0LL, 0LL, v2, 18LL, 0.0);
}
return result;
}

original_code:
void readCheckVarLists(void) {
    qboolean ret;
    maxcheckvars = 0;
    ret = ReadCheckVarFile(configfile_cvar->string);
    Q_snprintf(buffer, sizeof(buffer), "%s/%s", moddir, configfile_cvar->string);
    if (ReadCheckVarFile(buffer)) {
        ret = 1;
    }
    if (!ret) {
        gi.cprintf(((void *)0), "WARNING: %s could not be found\n", configfile_cvar->string);
        logEvent(LT_INTERNALWARN, 0, ((void *)0), va("%s could not be found", configfile_cvar), 18, 0.0);
    }
}

canonical_original_code:
void readCheckVarLists() {
    enum qboolean ret;
    maxcheckvars = 0;
    ret = ReadCheckVarFile(configfile_cvar->string);
    Q_snprintf(buffer, sizeof(buffer), "%s/%s", moddir, configfile_cvar->string);
    if (ReadCheckVarFile(buffer)) {
        ret = 1;
    }
    if (!ret) {
        gi.cprintf(((void *)0), "WARNING: %s could not be found\n", configfile_cvar->string);
        logEvent(LT_INTERNALWARN, 0, ((void *)0), va("%s could not be found", configfile_cvar), 18, 0.0);
    }
}


reloadCheckVarFileRun

decompiled_code:
__int64 __fastcall reloadCheckVarFileRun(__int64 a1, __int64 a2)
{
readCheckVarLists();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Check-Variables reloaded.\n");
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
func1();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Check-Variables reloaded.\n");
}

original_code:
void reloadCheckVarFileRun(int startarg, edict_t *ent, int client) {
    readCheckVarLists();
    gi.cprintf(ent, 2, "Check-Variables reloaded.\n");
}

canonical_original_code:
void reloadCheckVarFileRun(int startarg, struct edict_s *ent, int client) {
    readCheckVarLists();
    gi.cprintf(ent, 2, "Check-Variables reloaded.\n");
}

user_defined_types: struct client_persistant_t { char userinfo[512]; char netname[16]; int hand; enum qboolean connected; int health; int max_health; int savedFlags; int selected_item; int inventory[256]; int max_bullets; int max_shells; int max_rockets; int max_grenades; int max_cells; int max_slugs; struct gitem_s *weapon; struct gitem_s *lastweapon; int power_cubes; int score; int game_helpchanged; int helpchanged; enum qboolean spectator; }

user_defined_types: struct client_respawn_t { struct client_persistant_t coop_respawn; int enterframe; int score; float cmd_angles[3]; enum qboolean spectator; }

user_defined_types: struct mmove_t { int firstframe; int lastframe; struct mframe_t *frame; void (*endfunc)(struct edict_s *self); }

user_defined_types: struct pmove_state_t { enum pmtype_t pm_type; short origin[3]; short velocity[3]; unsigned char pm_flags; unsigned char pm_time; short gravity; short delta_angles[3]; }


checkVariableTest

decompiled_code:
__int64 __fastcall checkVariableTest(__int64 a1, unsigned int a2, int a3)
{
int v3; // ebx
__int64 v6; // rdi

v3 = 0;
if ( checkvarcmds_enable )
{
v3 = a3;
if ( maxcheckvars[0] <= a3 )
v3 = 0;
if ( maxcheckvars[0] )
{
v6 = proxyinfo + 13496LL * (int)a2;
*(_DWORD *)(v6 + 10624) = v3;
generateRandomString(v6 + 10600, 20LL);
Q_snprintf(
&buffer,
0x10000LL,
"%s $%s\n",
(const char *)(proxyinfo + 13496LL * (int)a2 + 10600),
&checkvarList[128 * (__int64)v3]);
stuffcmd(a1, &buffer);
++v3;
}
}
return addCmdQueue(a2, 54LL, v3, 0LL, (float)checkvar_poll_time);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, unsigned int a2, int a3)
{
int v3; // ebx
__int64 v6; // rdi

v3 = 0;
if ( checkvarcmds_enable )
{
v3 = a3;
if ( maxcheckvars[0] <= a3 )
v3 = 0;
if ( maxcheckvars[0] )
{
v6 = proxyinfo + 13496LL * (int)a2;
*(_DWORD *)(v6 + 10624) = v3;
generateRandomString(v6 + 10600, 20LL);
Q_snprintf(
&buffer,
0x10000LL,
"%s $%s\n",
(const char *)(proxyinfo + 13496LL * (int)a2 + 10600),
&checkvarList[128 * (__int64)v3]);
stuffcmd(a1, &buffer);
++v3;
}
}
return addCmdQueue(a2, 54LL, v3, 0LL, (float)checkvar_poll_time);
}

original_code:
void checkVariableTest(edict_t *ent, int client, int idx) {
    if (checkvarcmds_enable) {
        if (idx >= maxcheckvars) {
            idx = 0;
        }
        if (maxcheckvars) {
            proxyinfo[client].checkvar_idx = idx;
            generateRandomString(proxyinfo[client].hack_checkvar, 20);
            Q_snprintf(
              buffer,
     sizeof(buffer),
     "%s $%s\n",
     proxyinfo[client].hack_checkvar,
     checkvarList[idx].variablename
   );
            stuffcmd(ent, buffer);
            idx++;
        }
    } else {
        idx = 0;
    }
    addCmdQueue(client, QCMD_CHECKVARTESTS, (float) checkvar_poll_time, idx, 0);
}

canonical_original_code:
void checkVariableTest(struct edict_s *ent, int client, int idx) {
    if (checkvarcmds_enable) {
        if (idx >= maxcheckvars) {
            idx = 0;
        }
        if (maxcheckvars) {
            proxyinfo[client].checkvar_idx = idx;
            generateRandomString(proxyinfo[client].hack_checkvar, 20);
            Q_snprintf(
              buffer,
     sizeof(buffer),
     "%s $%s\n",
     proxyinfo[client].hack_checkvar,
     checkvarList[idx].variablename
   );
            stuffcmd(ent, buffer);
            idx++;
        }
    } else {
        idx = 0;
    }
    addCmdQueue(client, QCMD_CHECKVARTESTS, (float) checkvar_poll_time, idx, 0);
}

variable_types: idx int

user_defined_types: struct gitem_s { char *classname; enum qboolean (*pickup)(struct edict_s *ent, struct edict_s *other); void (*use)(struct edict_s *ent, struct gitem_s *item); void (*drop)(struct edict_s *ent, struct gitem_s *item); void (*weaponthink)(struct edict_s *ent); char *pickup_sound; char *world_model; int world_model_flags; char *view_model; char *icon; char *pickup_name; int count_width; int quantity; char *ammo; int flags; int weapmodel; void *info; int tag; char *precaches; }


checkVariableValid

decompiled_code:
int __fastcall checkVariableValid(__int64 a1, int a2, const char *a3)
{
int v3; // ebp
char *v4; // rax
__int64 v5; // rbp
double v6; // xmm0_8
char *v7; // rax

v3 = *(_DWORD *)(proxyinfo + 13496LL * a2 + 10624);
LODWORD(v4) = *(_DWORD *)&checkvarList[128 * (__int64)v3 + 120];
if ( (_DWORD)v4 )
{
if ( (_DWORD)v4 == 1 )
{
v6 = atof(a3);
v7 = &checkvarList[128 * (__int64)v3];
if ( *((double *)v7 + 14) > v6 )
{
Q_snprintf(&buffer, 0x10000LL, "%s %g\n", &checkvarList[128 * (__int64)v3], *((double *)v7 + 14));
LODWORD(v4) = stuffcmd(a1, &buffer);
}
else
{
v4 = &checkvarList[128 * (__int64)v3];
if ( v6 > *((double *)v4 + 13) )
{
Q_snprintf(&buffer, 0x10000LL, "%s %g\n", &checkvarList[128 * (__int64)v3], *((double *)v4 + 13));
LODWORD(v4) = stuffcmd(a1, &buffer);
}
}
}
}
else
{
v5 = (__int64)v3 << 7;
LODWORD(v4) = strcmp(&checkvarList[v5 + 50], a3);
if ( (_DWORD)v4 )
{
Q_snprintf(&buffer, 0x10000LL, "%s %s\n", &checkvarList[v5], &checkvarList[v5 + 50]);
LODWORD(v4) = stuffcmd(a1, &buffer);
}
}
return (int)v4;
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, int a2, const char *a3)
{
int v3; // ebp
char *v4; // rax
__int64 v5; // rbp
double v6; // xmm0_8
char *v7; // rax

v3 = *(_DWORD *)(proxyinfo + 13496LL * a2 + 10624);
LODWORD(v4) = *(_DWORD *)&checkvarList[128 * (__int64)v3 + 120];
if ( (_DWORD)v4 )
{
if ( (_DWORD)v4 == 1 )
{
v6 = atof(a3);
v7 = &checkvarList[128 * (__int64)v3];
if ( *((double *)v7 + 14) > v6 )
{
Q_snprintf(&buffer, 0x10000LL, "%s %g\n", &checkvarList[128 * (__int64)v3], *((double *)v7 + 14));
LODWORD(v4) = stuffcmd(a1, &buffer);
}
else
{
v4 = &checkvarList[128 * (__int64)v3];
if ( v6 > *((double *)v4 + 13) )
{
Q_snprintf(&buffer, 0x10000LL, "%s %g\n", &checkvarList[128 * (__int64)v3], *((double *)v4 + 13));
LODWORD(v4) = stuffcmd(a1, &buffer);
}
}
}
}
else
{
v5 = (__int64)v3 << 7;
LODWORD(v4) = strcmp(&checkvarList[v5 + 50], a3);
if ( (_DWORD)v4 )
{
Q_snprintf(&buffer, 0x10000LL, "%s %s\n", &checkvarList[v5], &checkvarList[v5 + 50]);
LODWORD(v4) = stuffcmd(a1, &buffer);
}
}
return (int)v4;
}

original_code:
void checkVariableValid(edict_t *ent, int client, char *value) {
    switch (checkvarList[proxyinfo[client].checkvar_idx].type) {
        case 0:
            if (strcmp(checkvarList[proxyinfo[client].checkvar_idx].value, value) != 0) {
                Q_snprintf(
                  buffer,
      sizeof(buffer),
      "%s %s\n",
      checkvarList[proxyinfo[client].checkvar_idx].variablename,
      checkvarList[proxyinfo[client].checkvar_idx].value
    );
                stuffcmd(ent, buffer);
            }
            break;
        case 1:
        {
            double fvalue = atof(value);
            if (fvalue < checkvarList[proxyinfo[client].checkvar_idx].lower) {
                Q_snprintf(
                  buffer,
      sizeof(buffer),
      "%s %g\n",
      checkvarList[proxyinfo[client].checkvar_idx].variablename,
      checkvarList[proxyinfo[client].checkvar_idx].lower
    );
                stuffcmd(ent, buffer);
            } else if (fvalue > checkvarList[proxyinfo[client].checkvar_idx].upper) {
                Q_snprintf(
                  buffer,
      sizeof(buffer),
      "%s %g\n",
      checkvarList[proxyinfo[client].checkvar_idx].variablename,
      checkvarList[proxyinfo[client].checkvar_idx].upper
    );
                stuffcmd(ent, buffer);
            }
            break;
        }
    }
}

canonical_original_code:
void checkVariableValid(struct edict_s *ent, int client, char *value) {
    switch (checkvarList[proxyinfo[client].checkvar_idx].type) {
        case 0:
            if (strcmp(checkvarList[proxyinfo[client].checkvar_idx].value, value) != 0) {
                Q_snprintf(
                  buffer,
      sizeof(buffer),
      "%s %s\n",
      checkvarList[proxyinfo[client].checkvar_idx].variablename,
      checkvarList[proxyinfo[client].checkvar_idx].value
    );
                stuffcmd(ent, buffer);
            }
            break;
        case 1:
        {
            double fvalue = atof(value);
            if (fvalue < checkvarList[proxyinfo[client].checkvar_idx].lower) {
                Q_snprintf(
                  buffer,
      sizeof(buffer),
      "%s %g\n",
      checkvarList[proxyinfo[client].checkvar_idx].variablename,
      checkvarList[proxyinfo[client].checkvar_idx].lower
    );
                stuffcmd(ent, buffer);
            } else if (fvalue > checkvarList[proxyinfo[client].checkvar_idx].upper) {
                Q_snprintf(
                  buffer,
      sizeof(buffer),
      "%s %g\n",
      checkvarList[proxyinfo[client].checkvar_idx].variablename,
      checkvarList[proxyinfo[client].checkvar_idx].upper
    );
                stuffcmd(ent, buffer);
            }
            break;
        }
    }
}

variable_types:
value
char *

variable_types: fvalue double

user_defined_types: struct entity_state_s { int number; float origin[3]; float angles[3]; float old_origin[3]; int modelindex; int modelindex2; int frame; int skinnum; int effects; int renderfx; int solid; int sound; int event; }


listcheckvarsRun

decompiled_code:
__int64 __fastcall listcheckvarsRun(__int64 a1, __int64 a2, unsigned int a3)
{
addCmdQueue(a3, 53LL, 0LL, 0LL, 0.0);
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Start Check-Variables List:\n");
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, unsigned int a3)
{
addCmdQueue(a3, 53LL, 0LL, 0LL, 0.0);
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Start Check-Variables List:\n");
}

original_code:
void listcheckvarsRun(int startarg, edict_t *ent, int client) {
    addCmdQueue(client, QCMD_DISPCHECKVAR, 0, 0, 0);
    gi.cprintf(ent, 2, "Start Check-Variables List:\n");
}

canonical_original_code:
void listcheckvarsRun(int startarg, struct edict_s *ent, int client) {
    addCmdQueue(client, QCMD_DISPCHECKVAR, 0, 0, 0);
    gi.cprintf(ent, 2, "Start Check-Variables List:\n");
}

user_defined_types: enum solid_t { SOLID_NOT=0, SOLID_TRIGGER=1, SOLID_BBOX=2, SOLID_BSP=3 }


displayNextCheckvar

decompiled_code:
__int64 __fastcall displayNextCheckvar(__int64 a1, unsigned int a2, __int64 a3)
{
int v4; // eax

if ( maxcheckvars[0] <= a3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "End Check-Variables List\n");
v4 = *(_DWORD *)&checkvarList[128 * a3 + 120];
if ( v4 )
{
if ( v4 == 1 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d RG: %s = %g to %g\n",
a3 + 1,
*(double *)&checkvarList[128 * a3 + 112],
*(double *)&checkvarList[128 * a3 + 104]);
}
else
{
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d CT: %s = \"%s\"\n",
a3 + 1,
&checkvarList[128 * a3],
&checkvarList[128 * a3 + 50]);
}
return addCmdQueue(a2, 53LL, a3 + 1, 0LL, 0.0);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, unsigned int a2, __int64 a3)
{
int v4; // eax

if ( maxcheckvars[0] <= a3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "End Check-Variables List\n");
v4 = *(_DWORD *)&checkvarList[128 * a3 + 120];
if ( v4 )
{
if ( v4 == 1 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d RG: %s = %g to %g\n",
a3 + 1,
*(double *)&checkvarList[128 * a3 + 112],
*(double *)&checkvarList[128 * a3 + 104]);
}
else
{
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d CT: %s = \"%s\"\n",
a3 + 1,
&checkvarList[128 * a3],
&checkvarList[128 * a3 + 50]);
}
return addCmdQueue(a2, 53LL, a3 + 1, 0LL, 0.0);
}

original_code:
void displayNextCheckvar(edict_t *ent, int client, long checkvarcmd) {
    if (checkvarcmd < maxcheckvars) {
        switch (checkvarList[checkvarcmd].type) {
            case 0:
                gi.cprintf(ent, 2, "%4d CT: %s = \"%s\"\n", checkvarcmd + 1, checkvarList[checkvarcmd].variablename, checkvarList[checkvarcmd].value);
                break;
            case 1:
                gi.cprintf(ent, 2, "%4d RG: %s = %g to %g\n", checkvarcmd + 1, checkvarList[checkvarcmd].variablename, checkvarList[checkvarcmd].lower, checkvarList[checkvarcmd].upper);
                break;
        }
        checkvarcmd++;
        addCmdQueue(client, QCMD_DISPCHECKVAR, 0, checkvarcmd, 0);
    } else {
        gi.cprintf(ent, 2, "End Check-Variables List\n");
    }
}

canonical_original_code:
void displayNextCheckvar(struct edict_s *ent, int client, long checkvarcmd) {
    if (checkvarcmd < maxcheckvars) {
        switch (checkvarList[checkvarcmd].type) {
            case 0:
                gi.cprintf(ent, 2, "%4d CT: %s = \"%s\"\n", checkvarcmd + 1, checkvarList[checkvarcmd].variablename, checkvarList[checkvarcmd].value);
                break;
            case 1:
                gi.cprintf(ent, 2, "%4d RG: %s = %g to %g\n", checkvarcmd + 1, checkvarList[checkvarcmd].variablename, checkvarList[checkvarcmd].lower, checkvarList[checkvarcmd].upper);
                break;
        }
        checkvarcmd++;
        addCmdQueue(client, QCMD_DISPCHECKVAR, 0, checkvarcmd, 0);
    } else {
        gi.cprintf(ent, 2, "End Check-Variables List\n");
    }
}

variable_types: checkvarcmd long

user_defined_types: struct moveinfo_t { float start_origin[3]; float start_angles[3]; float end_origin[3]; float end_angles[3]; int sound_start; int sound_middle; int sound_end; float accel; float speed; float decel; float distance; float wait; int state; float dir[3]; float current_speed; float move_speed; float next_speed; float remaining_distance; float decel_distance; void (*endfunc)(struct edict_s *); }


checkvarcmdRun

decompiled_code:
int *__fastcall checkvarcmdRun(unsigned int a1, __int64 a2)
{
unsigned int v3; // er13
__int64 v4; // r12
__int64 v5; // r12
int *result; // rax
int v7; // eax
__int64 v8; // rax
int v9; // eax
const char *v10; // rdi
int v11; // ebx
int v12; // er12
const char *v13; // rax
int v14; // ebx

if ( maxcheckvars[0] > 49 )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Sorry, maximum number of variables to check has been reached.\n");
v3 = a1 + 2;
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 2) )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
v4 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v4, "CT") )
{
if ( (unsigned int)Q_stricmp(v4, "RG") )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
*(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120] = 1;
}
else
{
*(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120] = 0;
}
v5 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v5) )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
processstring(&checkvarList[128 * (__int64)maxcheckvars[0]], v5, 49LL, 0LL);
v7 = *(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120];
if ( !v7 )
{
v8 = ((__int64 (__fastcall *)(_QWORD))gi[40])(v3);
processstring(&checkvarList[128 * (__int64)maxcheckvars[0] + 50], v8, 49LL, 0LL);
LABEL_16:
v9 = *(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120];
if ( v9 )
{
if ( v9 == 1 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d RG: %s = %g to %g\n",
(unsigned int)(maxcheckvars[0] + 1),
*(double *)&checkvarList[128 * (__int64)maxcheckvars[0] + 112],
*(double *)&checkvarList[128 * (__int64)maxcheckvars[0] + 104]);
}
else
{
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d CT: %s = \"%s\"\n",
(unsigned int)(maxcheckvars[0] + 1),
&checkvarList[128 * (__int64)maxcheckvars[0]],
&checkvarList[128 * (__int64)maxcheckvars[0] + 50]);
}
goto LABEL_14;
}
if ( v7 == 1 )
{
v10 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(v3);
v11 = a1 + 3;
v12 = maxcheckvars[0];
*(double *)&checkvarList[128 * (__int64)v12 + 112] = atof(v10);
if ( ((int (*)(void))gi[39])() <= v11 )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
v13 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)v11);
v14 = maxcheckvars[0];
*(double *)&checkvarList[128 * (__int64)v14 + 104] = atof(v13);
goto LABEL_16;
}
LABEL_14:
result = maxcheckvars;
++maxcheckvars[0];
return result;
}

canonical_decompiled_code:
int *__fastcall func7(unsigned int a1, __int64 a2)
{
unsigned int v3; // er13
__int64 v4; // r12
__int64 v5; // r12
int *result; // rax
int v7; // eax
__int64 v8; // rax
int v9; // eax
const char *v10; // rdi
int v11; // ebx
int v12; // er12
const char *v13; // rax
int v14; // ebx

if ( maxcheckvars[0] > 49 )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Sorry, maximum number of variables to check has been reached.\n");
v3 = a1 + 2;
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 2) )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
v4 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v4, "CT") )
{
if ( (unsigned int)Q_stricmp(v4, "RG") )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
*(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120] = 1;
}
else
{
*(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120] = 0;
}
v5 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v5) )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
processstring(&checkvarList[128 * (__int64)maxcheckvars[0]], v5, 49LL, 0LL);
v7 = *(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120];
if ( !v7 )
{
v8 = ((__int64 (__fastcall *)(_QWORD))gi[40])(v3);
processstring(&checkvarList[128 * (__int64)maxcheckvars[0] + 50], v8, 49LL, 0LL);
LABEL_16:
v9 = *(_DWORD *)&checkvarList[128 * (__int64)maxcheckvars[0] + 120];
if ( v9 )
{
if ( v9 == 1 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d RG: %s = %g to %g\n",
(unsigned int)(maxcheckvars[0] + 1),
*(double *)&checkvarList[128 * (__int64)maxcheckvars[0] + 112],
*(double *)&checkvarList[128 * (__int64)maxcheckvars[0] + 104]);
}
else
{
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d CT: %s = \"%s\"\n",
(unsigned int)(maxcheckvars[0] + 1),
&checkvarList[128 * (__int64)maxcheckvars[0]],
&checkvarList[128 * (__int64)maxcheckvars[0] + 50]);
}
goto LABEL_14;
}
if ( v7 == 1 )
{
v10 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(v3);
v11 = a1 + 3;
v12 = maxcheckvars[0];
*(double *)&checkvarList[128 * (__int64)v12 + 112] = atof(v10);
if ( ((int (*)(void))gi[39])() <= v11 )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
v13 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)v11);
v14 = maxcheckvars[0];
*(double *)&checkvarList[128 * (__int64)v14 + 104] = atof(v13);
goto LABEL_16;
}
LABEL_14:
result = maxcheckvars;
++maxcheckvars[0];
return result;
}

original_code:
void checkvarcmdRun(int startarg, edict_t *ent, int client) {
    char *cmd;
    if (maxcheckvars >= 50) {
        gi.cprintf(ent, 2, "Sorry, maximum number of variables to check has been reached.\n");
        return;
    }
    if (gi.argc() <= startarg + 2) {
        gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
        return;
    }
    cmd = gi.argv(startarg);
    startarg++;
    if (Q_stricmp(cmd, "CT") == 0) {
        checkvarList[maxcheckvars].type = 0;
    } else if (Q_stricmp(cmd, "RG") == 0) {
        checkvarList[maxcheckvars].type = 1;
    } else {
        gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
        return;
    }
    cmd = gi.argv(startarg);
    startarg++;
    if (isBlank(cmd)) {
        gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
        return;
    }
    processstring(checkvarList[maxcheckvars].variablename, cmd, sizeof (checkvarList[maxcheckvars].variablename) - 1, 0);
    switch (checkvarList[maxcheckvars].type) {
        case 0:
            cmd = gi.argv(startarg);
            processstring(checkvarList[maxcheckvars].value, cmd, sizeof (checkvarList[maxcheckvars].value) - 1, 0);
            break;
        case 1:
            cmd = gi.argv(startarg);
            startarg++;
            checkvarList[maxcheckvars].lower = atof(cmd);
            if (gi.argc() <= startarg) {
                gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
                return;
            }
            cmd = gi.argv(startarg);
            checkvarList[maxcheckvars].upper = atof(cmd);
            break;
    }
    switch (checkvarList[maxcheckvars].type) {
        case 0:
            gi.cprintf(ent, 2, "%4d CT: %s = \"%s\"\n", maxcheckvars + 1, checkvarList[maxcheckvars].variablename, checkvarList[maxcheckvars].value);
            break;
        case 1:
            gi.cprintf(ent, 2, "%4d RG: %s = %g to %g\n", maxcheckvars + 1, checkvarList[maxcheckvars].variablename, checkvarList[maxcheckvars].lower, checkvarList[maxcheckvars].upper);
            break;
    }
    maxcheckvars++;
}

canonical_original_code:
void checkvarcmdRun(int startarg, struct edict_s *ent, int client) {
    char *cmd;
    if (maxcheckvars >= 50) {
        gi.cprintf(ent, 2, "Sorry, maximum number of variables to check has been reached.\n");
        return;
    }
    if (gi.argc() <= startarg + 2) {
        gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
        return;
    }
    cmd = gi.argv(startarg);
    startarg++;
    if (Q_stricmp(cmd, "CT") == 0) {
        checkvarList[maxcheckvars].type = 0;
    } else if (Q_stricmp(cmd, "RG") == 0) {
        checkvarList[maxcheckvars].type = 1;
    } else {
        gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
        return;
    }
    cmd = gi.argv(startarg);
    startarg++;
    if (isBlank(cmd)) {
        gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
        return;
    }
    processstring(checkvarList[maxcheckvars].variablename, cmd, sizeof (checkvarList[maxcheckvars].variablename) - 1, 0);
    switch (checkvarList[maxcheckvars].type) {
        case 0:
            cmd = gi.argv(startarg);
            processstring(checkvarList[maxcheckvars].value, cmd, sizeof (checkvarList[maxcheckvars].value) - 1, 0);
            break;
        case 1:
            cmd = gi.argv(startarg);
            startarg++;
            checkvarList[maxcheckvars].lower = atof(cmd);
            if (gi.argc() <= startarg) {
                gi.cprintf(ent, 2, "[sv] !checkvarcmd [CT/RG] \"variable\" [\"value\" | \"lower\" \"upper\"]\n");
                return;
            }
            cmd = gi.argv(startarg);
            checkvarList[maxcheckvars].upper = atof(cmd);
            break;
    }
    switch (checkvarList[maxcheckvars].type) {
        case 0:
            gi.cprintf(ent, 2, "%4d CT: %s = \"%s\"\n", maxcheckvars + 1, checkvarList[maxcheckvars].variablename, checkvarList[maxcheckvars].value);
            break;
        case 1:
            gi.cprintf(ent, 2, "%4d RG: %s = %g to %g\n", maxcheckvars + 1, checkvarList[maxcheckvars].variablename, checkvarList[maxcheckvars].lower, checkvarList[maxcheckvars].upper);
            break;
    }
    maxcheckvars++;
}

variable_types:
cmd
char *

user_defined_types: enum weaponstate_t { WEAPON_READY=0, WEAPON_ACTIVATING=1, WEAPON_DROPPING=2, WEAPON_FIRING=3 }


checkvarDelRun

decompiled_code:
__int64 __fastcall checkvarDelRun(int a1, __int64 a2)
{
const char *v2; // rax
int v3; // eax
int v4; // ebx

if ( ((int (*)(void))gi[39])() <= a1 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !checkvardel checkvarnum\n");
v2 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)a1);
v3 = atoi(v2);
if ( v3 <= 0 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !checkvardel checkvarnum\n");
v4 = maxcheckvars[0];
if ( maxcheckvars[0] < v3 )
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(a2, 2LL, "[sv] !checkvardel checkvarnum\n");
if ( maxcheckvars[0] > v3 )
memmove(
&checkvarList[128 * (__int64)v3 - 128],
&checkvarList[128 * (__int64)v3],
(__int64)(maxcheckvars[0] - (v3 - 1)) << 7);
maxcheckvars[0] = v4 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Check-Variable command deleted\n");
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, __int64 a2)
{
const char *v2; // rax
int v3; // eax
int v4; // ebx

if ( ((int (*)(void))gi[39])() <= a1 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !checkvardel checkvarnum\n");
v2 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)a1);
v3 = atoi(v2);
if ( v3 <= 0 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !checkvardel checkvarnum\n");
v4 = maxcheckvars[0];
if ( maxcheckvars[0] < v3 )
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(a2, 2LL, "[sv] !checkvardel checkvarnum\n");
if ( maxcheckvars[0] > v3 )
memmove(
&checkvarList[128 * (__int64)v3 - 128],
&checkvarList[128 * (__int64)v3],
(__int64)(maxcheckvars[0] - (v3 - 1)) << 7);
maxcheckvars[0] = v4 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Check-Variable command deleted\n");
}

original_code:
void checkvarDelRun(int startarg, edict_t *ent, int client) {
    int checkvar;
    if (gi.argc() <= startarg) {
        gi.cprintf(ent, 2, "[sv] !checkvardel checkvarnum\n");
        return;
    }
    checkvar = atoi(gi.argv(startarg));
    if (checkvar < 1 || checkvar > maxcheckvars) {
        gi.cprintf(ent, 2, "[sv] !checkvardel checkvarnum\n");
        return;
    }
    checkvar--;
    if (checkvar + 1 < maxcheckvars) {
        memmove((checkvarList + checkvar), (checkvarList + checkvar + 1), sizeof (checkvar_t) * (maxcheckvars - checkvar));
    }
    maxcheckvars--;
    gi.cprintf(ent, 2, "Check-Variable command deleted\n");
}

canonical_original_code:
void checkvarDelRun(int startarg, struct edict_s *ent, int client) {
    int checkvar;
    if (gi.argc() <= startarg) {
        gi.cprintf(ent, 2, "[sv] !checkvardel checkvarnum\n");
        return;
    }
    checkvar = atoi(gi.argv(startarg));
    if (checkvar < 1 || checkvar > maxcheckvars) {
        gi.cprintf(ent, 2, "[sv] !checkvardel checkvarnum\n");
        return;
    }
    checkvar--;
    if (checkvar + 1 < maxcheckvars) {
        memmove((checkvarList + checkvar), (checkvarList + checkvar + 1), sizeof (checkvar_t) * (maxcheckvars - checkvar));
    }
    maxcheckvars--;
    gi.cprintf(ent, 2, "Check-Variable command deleted\n");
}

variable_types: checkvar int

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


VariableMixingErrorMessage

repo: jarcec/rbclips

decompiled_code:
__int64 __fastcall VariableMixingErrorMessage(__int64 a1, __int64 a2)
{
PrintErrorID(a1, "ANALYSIS", 3LL, 1LL);
EnvPrintRouter(a1, "werror", "Variable ?");
EnvPrintRouter(a1, "werror", *(_QWORD *)(a2 + 24));
return EnvPrintRouter(a1, "werror", " is used as both a single and multifield variable in the LHS\n");
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
PrintErrorID(a1, "ANALYSIS", 3LL, 1LL);
EnvPrintRouter(a1, "werror", "Variable ?");
EnvPrintRouter(a1, "werror", *(_QWORD *)(a2 + 24));
return EnvPrintRouter(a1, "werror", " is used as both a single and multifield variable in the LHS\n");
}

original_code:
static void VariableMixingErrorMessage(
  void *theEnv,
  struct symbolHashNode *theVariable)
  {
   PrintErrorID(theEnv,"ANALYSIS",3,1);
   EnvPrintRouter(theEnv,"werror","Variable ?");
   EnvPrintRouter(theEnv,"werror",(((struct symbolHashNode *) (theVariable))->contents));
   EnvPrintRouter(theEnv,"werror"," is used as both a single and multifield variable in the LHS\n");
  }

canonical_original_code:
static void VariableMixingErrorMessage(void *theEnv, struct symbolHashNode *theVariable)
  {
   PrintErrorID(theEnv,"ANALYSIS",3,1);
   EnvPrintRouter(theEnv,"werror","Variable ?");
   EnvPrintRouter(theEnv,"werror",(((struct symbolHashNode *) (theVariable))->contents));
   EnvPrintRouter(theEnv,"werror"," is used as both a single and multifield variable in the LHS\n");
  }

variable_types:
theEnv
void *

variable_types: struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; } *


DeallocatePrettyPrintData

decompiled_code:
__int64 __fastcall DeallocatePrettyPrintData(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rsi

result = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 416LL);
v2 = *(_QWORD *)(result + 32);
if ( v2 )
result = rm(a1, v2, *(unsigned int *)(result + 16));
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rsi

result = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 416LL);
v2 = *(_QWORD *)(result + 32);
if ( v2 )
result = rm(a1, v2, *(unsigned int *)(result + 16));
return result;
}

original_code:
static void DeallocatePrettyPrintData(
  void *theEnv)
  {
   if (((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PrettyPrintBuffer != ((void *)0))
     { rm(theEnv,((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PrettyPrintBuffer,((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBufferMax); }
  }

canonical_original_code:
static void DeallocatePrettyPrintData(void *theEnv)
  {
   if (((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PrettyPrintBuffer != ((void *)0))
     { rm(theEnv,((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PrettyPrintBuffer,((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBufferMax); }
  }

user_defined_types: struct prettyPrintData { int PPBufferStatus; int PPBufferEnabled; int IndentationDepth; int PPBufferPos; unsigned int PPBufferMax; int PPBackupOnce; int PPBackupTwice; char *PrettyPrintBuffer; }

user_defined_types: struct environmentData { unsigned int initialized; unsigned long environmentIndex; void *context; void *routerContext; void **theData; void (**cleanupFunctions)(void *); struct environmentCleanupFunction *listOfCleanupEnvironmentFunctions; struct environmentData *next; }

user_defined_types: struct environmentCleanupFunction { char *name; void (*func)(void *); int priority; struct environmentCleanupFunction *next; }


InitializePrettyPrintData

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

AllocateEnvironmentData(a1, 52LL, 40LL, DeallocatePrettyPrintData);
result = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 416LL);
*(_DWORD *)(result + 4) = 1;
return result;
}

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

AllocateEnvironmentData(a1, 52LL, 40LL, DeallocatePrettyPrintData);
result = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 416LL);
*(_DWORD *)(result + 4) = 1;
return result;
}

original_code:
void InitializePrettyPrintData(
  void *theEnv)
  {
   AllocateEnvironmentData(theEnv,52,sizeof(struct prettyPrintData),DeallocatePrettyPrintData);
   ((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBufferEnabled = 1;
  }

canonical_original_code:
void InitializePrettyPrintData(void *theEnv)
  {
   AllocateEnvironmentData(theEnv,52,sizeof(struct prettyPrintData),DeallocatePrettyPrintData);
   ((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBufferEnabled = 1;
  }


DestroyPPBuffer

original_code:
void DestroyPPBuffer(void *theEnv)
  {
   ((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBackupOnce = 0;
   ((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBackupTwice = 0;
   ((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBufferPos = 0;
   if (((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PrettyPrintBuffer != ((void *)0)) rm(theEnv,((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PrettyPrintBuffer,((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBufferMax);
   ((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PrettyPrintBuffer = ((void *)0);
   ((struct prettyPrintData *) (((struct environmentData *) theEnv)->theData[52]))->PPBufferMax = 0;
  }