freeSpawnLists

decompiled_code:
__int64 freeSpawnLists()
{
__int64 result; // rax
regex_t *v1; // rdi

while ( 1 )
{
result = (unsigned int)maxspawn_cmds[0];
if ( !maxspawn_cmds[0] )
break;
--maxspawn_cmds[0];
gi[34](*((const char **)&spawncmds + 3 * (int)result - 3));
v1 = (regex_t *)*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2);
if ( v1 )
{
regfree(v1);
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0] + 2));
}
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax
regex_t *v1; // rdi

while ( 1 )
{
result = (unsigned int)maxspawn_cmds[0];
if ( !maxspawn_cmds[0] )
break;
--maxspawn_cmds[0];
gi[34](*((const char **)&spawncmds + 3 * (int)result - 3));
v1 = (regex_t *)*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2);
if ( v1 )
{
regfree(v1);
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0] + 2));
}
}
return result;
}

original_code:
void freeSpawnLists(void) {
    while (maxspawn_cmds) {
        maxspawn_cmds--;
        gi.TagFree(spawncmds[maxspawn_cmds].spawncmd);
        if (spawncmds[maxspawn_cmds].r) {
            regfree(spawncmds[maxspawn_cmds].r);
            gi.TagFree(spawncmds[maxspawn_cmds].r);
        }
    }
}

canonical_original_code:
void freeSpawnLists() {
    while (maxspawn_cmds) {
        maxspawn_cmds--;
        gi.TagFree(spawncmds[maxspawn_cmds].spawncmd);
        if (spawncmds[maxspawn_cmds].r) {
            regfree(spawncmds[maxspawn_cmds].r);
            gi.TagFree(spawncmds[maxspawn_cmds].r);
        }
    }
}


freeOneLevelSpawnLists

decompiled_code:
int *freeOneLevelSpawnLists()
{
int *result; // rax
int v1; // ebx
int v2; // ebp
regex_t *v3; // rdi
char *v4; // rsi

result = maxspawn_cmds;
if ( maxspawn_cmds[0] > 0 )
{
v1 = 0;
do
{
if ( *((_DWORD *)&spawncmds + 6 * v1 + 3) )
{
gi[34](*((const char **)&spawncmds + 3 * v1));
v3 = (regex_t *)*((_QWORD *)&spawncmds + 3 * v1 + 2);
if ( v3 )
{
regfree(v3);
gi[34](*((const char **)&spawncmds + 3 * v1 + 2));
}
v2 = maxspawn_cmds[0];
if ( v1 + 1 < maxspawn_cmds[0] )
{
v4 = (char *)&spawncmds + 24 * v1 + 24;
memmove(v4 - 24, v4, 24LL * (maxspawn_cmds[0] - v1));
}
maxspawn_cmds[0] = v2 - 1;
}
else
{
++v1;
}
result = maxspawn_cmds;
}
while ( v1 < maxspawn_cmds[0] );
}
return result;
}

canonical_decompiled_code:
int *func2()
{
int *result; // rax
int v1; // ebx
int v2; // ebp
regex_t *v3; // rdi
char *v4; // rsi

result = maxspawn_cmds;
if ( maxspawn_cmds[0] > 0 )
{
v1 = 0;
do
{
if ( *((_DWORD *)&spawncmds + 6 * v1 + 3) )
{
gi[34](*((const char **)&spawncmds + 3 * v1));
v3 = (regex_t *)*((_QWORD *)&spawncmds + 3 * v1 + 2);
if ( v3 )
{
regfree(v3);
gi[34](*((const char **)&spawncmds + 3 * v1 + 2));
}
v2 = maxspawn_cmds[0];
if ( v1 + 1 < maxspawn_cmds[0] )
{
v4 = (char *)&spawncmds + 24 * v1 + 24;
memmove(v4 - 24, v4, 24LL * (maxspawn_cmds[0] - v1));
}
maxspawn_cmds[0] = v2 - 1;
}
else
{
++v1;
}
result = maxspawn_cmds;
}
while ( v1 < maxspawn_cmds[0] );
}
return result;
}

original_code:
void freeOneLevelSpawnLists(void) {
    int spawn = 0;
    while (spawn < maxspawn_cmds) {
        if (spawncmds[spawn].onelevelflag) {
            gi.TagFree(spawncmds[spawn].spawncmd);
            if (spawncmds[spawn].r) {
                regfree(spawncmds[spawn].r);
                gi.TagFree(spawncmds[spawn].r);
            }
            if (spawn + 1 < maxspawn_cmds) {
                memmove((spawncmds + spawn), (spawncmds + spawn + 1), sizeof (spawncmd_t) * (maxspawn_cmds - spawn));
            }
            maxspawn_cmds--;
        } else {
            spawn++;
        }
    }
}

canonical_original_code:
void freeOneLevelSpawnLists() {
    int spawn = 0;
    while (spawn < maxspawn_cmds) {
        if (spawncmds[spawn].onelevelflag) {
            gi.TagFree(spawncmds[spawn].spawncmd);
            if (spawncmds[spawn].r) {
                regfree(spawncmds[spawn].r);
                gi.TagFree(spawncmds[spawn].r);
            }
            if (spawn + 1 < maxspawn_cmds) {
                memmove((spawncmds + spawn), (spawncmds + spawn + 1), sizeof (spawncmd_t) * (maxspawn_cmds - spawn));
            }
            maxspawn_cmds--;
        } else {
            spawn++;
        }
    }
}

variable_types: spawn int

return_type: void


readSpawnLists

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

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

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

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

original_code:
void readSpawnLists(void) {
    qboolean ret;
    freeSpawnLists();
    ret = ReadSpawnFile(configfile_spawn->string, 0);
    Q_snprintf(buffer, sizeof(buffer), "%s/%s", moddir, configfile_spawn->string);
    if (ReadSpawnFile(buffer, 0)) {
        ret = 1;
    }
    if (!ret) {
        gi.dprintf("WARNING: %s could not be found\n", configfile_spawn->string);
        logEvent(LT_INTERNALWARN, 0, ((void *)0), va("%s could not be found", configfile_spawn->string), 14, 0.0);
    }
}

canonical_original_code:
void readSpawnLists() {
    enum qboolean ret;
    freeSpawnLists();
    ret = ReadSpawnFile(configfile_spawn->string, 0);
    Q_snprintf(buffer, sizeof(buffer), "%s/%s", moddir, configfile_spawn->string);
    if (ReadSpawnFile(buffer, 0)) {
        ret = 1;
    }
    if (!ret) {
        gi.dprintf("WARNING: %s could not be found\n", configfile_spawn->string);
        logEvent(LT_INTERNALWARN, 0, ((void *)0), va("%s could not be found", configfile_spawn->string), 14, 0.0);
    }
}

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


reloadSpawnFileRun

decompiled_code:
__int64 __fastcall reloadSpawnFileRun(__int64 a1, __int64 a2)
{
readSpawnLists();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Disbled entities reloaded.\n");
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
func3();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Disbled entities reloaded.\n");
}

original_code:
void reloadSpawnFileRun(int startarg, edict_t *ent, int client) {
    readSpawnLists();
    gi.cprintf(ent, 2, "Disbled entities reloaded.\n");
}

canonical_original_code:
void reloadSpawnFileRun(int startarg, struct edict_s *ent, int client) {
    readSpawnLists();
    gi.cprintf(ent, 2, "Disbled entities reloaded.\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; }


checkforspawncmd

decompiled_code:
__int64 __fastcall checkforspawncmd(char *string, int a2)
{
char v2; // al
unsigned int v3; // edx

v2 = *((_BYTE *)&spawncmds + 24 * a2 + 8);
if ( v2 == 1 )
return Q_stricmp(string, *((_QWORD *)&spawncmds + 3 * a2)) == 0;
if ( v2 == 2 )
return regexec(*((const regex_t **)&spawncmds + 3 * a2 + 2), string, 0LL, 0LL, 0) != 1;
v3 = 0;
if ( !v2 )
v3 = startContains(string, *((_QWORD *)&spawncmds + 3 * a2));
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *string, int a2)
{
char v2; // al
unsigned int v3; // edx

v2 = *((_BYTE *)&spawncmds + 24 * a2 + 8);
if ( v2 == 1 )
return Q_stricmp(string, *((_QWORD *)&spawncmds + 3 * a2)) == 0;
if ( v2 == 2 )
return regexec(*((const regex_t **)&spawncmds + 3 * a2 + 2), string, 0LL, 0LL, 0) != 1;
v3 = 0;
if ( !v2 )
v3 = startContains(string, *((_QWORD *)&spawncmds + 3 * a2));
return v3;
}

canonical_original_code:
enum qboolean checkforspawncmd(char *cp, int spawncmd) {
    switch (spawncmds[spawncmd].type) {
        case 0:
            return startContains(cp, spawncmds[spawncmd].spawncmd);
        case 1:
            return !Q_stricmp(cp, spawncmds[spawncmd].spawncmd);
        case 2:
            return (regexec(spawncmds[spawncmd].r, cp, 0, 0, 0) != REG_NOMATCH);
    }
    return 0;
}

variable_types:
cp
char *

variable_types: spawncmd int

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


checkDisabledEntities

decompiled_code:
__int64 __fastcall checkDisabledEntities(char *src)
{
int v1; // ebx
__int64 result; // rax

strncpy(&buffer, src, 0x10000uLL);
q_strupr(&buffer);
if ( !maxspawn_cmds[0] )
return 0LL;
v1 = 0;
while ( 1 )
{
result = checkforspawncmd(&buffer, v1);
if ( (_DWORD)result )
break;
if ( maxspawn_cmds[0] <= (unsigned int)++v1 )
return result;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(char *src)
{
int v1; // ebx
__int64 result; // rax

strncpy(&buffer, src, 0x10000uLL);
q_strupr(&buffer);
if ( !maxspawn_cmds[0] )
return 0LL;
v1 = 0;
while ( 1 )
{
result = func5(&buffer, v1);
if ( (_DWORD)result )
break;
if ( maxspawn_cmds[0] <= (unsigned int)++v1 )
return result;
}
return 1LL;
}

canonical_original_code:
enum qboolean checkDisabledEntities(char *cp) {
    unsigned int i;
    strncpy(buffer, cp, sizeof(buffer));
    q_strupr(buffer);
    for (i = 0; i < maxspawn_cmds; i++) {
        if (checkforspawncmd(buffer, i)) {
            return 1;
        }
    }
    return 0;
}

variable_types:
i
unsigned int


listspawnsRun

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

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

original_code:
void listspawnsRun(int startarg, edict_t *ent, int client) {
    addCmdQueue(client, QCMD_DISPSPAWN, 0, 0, 0);
    gi.cprintf(ent, 2, "Start disbled-entities List:\n");
}

canonical_original_code:
void listspawnsRun(int startarg, struct edict_s *ent, int client) {
    addCmdQueue(client, QCMD_DISPSPAWN, 0, 0, 0);
    gi.cprintf(ent, 2, "Start disbled-entities List:\n");
}

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


displayNextSpawn

decompiled_code:
__int64 __fastcall displayNextSpawn(__int64 a1, unsigned int a2, __int64 a3)
{
char v4; // al

if ( maxspawn_cmds[0] <= a3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "End disbled-entities List\n");
v4 = *((_BYTE *)&spawncmds + 24 * a3 + 8);
switch ( v4 )
{
case 1:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d EX:\"%s\"\n",
a3 + 1,
*((const char **)&spawncmds + 3 * a3));
break;
case 2:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d RE:\"%s\"\n",
a3 + 1,
*((const char **)&spawncmds + 3 * a3));
break;
case 0:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d SW:\"%s\"\n",
a3 + 1,
*((const char **)&spawncmds + 3 * a3));
break;
}
return addCmdQueue(a2, 25LL, a3 + 1, 0LL, 0.0);
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, unsigned int a2, __int64 a3)
{
char v4; // al

if ( maxspawn_cmds[0] <= a3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "End disbled-entities List\n");
v4 = *((_BYTE *)&spawncmds + 24 * a3 + 8);
switch ( v4 )
{
case 1:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d EX:\"%s\"\n",
a3 + 1,
*((const char **)&spawncmds + 3 * a3));
break;
case 2:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d RE:\"%s\"\n",
a3 + 1,
*((const char **)&spawncmds + 3 * a3));
break;
case 0:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d SW:\"%s\"\n",
a3 + 1,
*((const char **)&spawncmds + 3 * a3));
break;
}
return addCmdQueue(a2, 25LL, a3 + 1, 0LL, 0.0);
}

original_code:
void displayNextSpawn(edict_t *ent, int client, long spawncmd) {
    if (spawncmd < maxspawn_cmds) {
        switch (spawncmds[spawncmd].type) {
            case 0:
                gi.cprintf(ent, 2, "%4d SW:\"%s\"\n", spawncmd + 1, spawncmds[spawncmd].spawncmd);
                break;
            case 1:
                gi.cprintf(ent, 2, "%4d EX:\"%s\"\n", spawncmd + 1, spawncmds[spawncmd].spawncmd);
                break;
            case 2:
                gi.cprintf(ent, 2, "%4d RE:\"%s\"\n", spawncmd + 1, spawncmds[spawncmd].spawncmd);
                break;
        }
        spawncmd++;
        addCmdQueue(client, QCMD_DISPSPAWN, 0, spawncmd, 0);
    } else {
        gi.cprintf(ent, 2, "End disbled-entities List\n");
    }
}

canonical_original_code:
void displayNextSpawn(struct edict_s *ent, int client, long spawncmd) {
    if (spawncmd < maxspawn_cmds) {
        switch (spawncmds[spawncmd].type) {
            case 0:
                gi.cprintf(ent, 2, "%4d SW:\"%s\"\n", spawncmd + 1, spawncmds[spawncmd].spawncmd);
                break;
            case 1:
                gi.cprintf(ent, 2, "%4d EX:\"%s\"\n", spawncmd + 1, spawncmds[spawncmd].spawncmd);
                break;
            case 2:
                gi.cprintf(ent, 2, "%4d RE:\"%s\"\n", spawncmd + 1, spawncmds[spawncmd].spawncmd);
                break;
        }
        spawncmd++;
        addCmdQueue(client, QCMD_DISPSPAWN, 0, spawncmd, 0);
    } else {
        gi.cprintf(ent, 2, "End disbled-entities List\n");
    }
}

variable_types: spawncmd long

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


spawncmdRun

decompiled_code:
int *__fastcall spawncmdRun(unsigned int a1, __int64 a2)
{
__int64 v2; // rbx
const char *v3; // rbx
int v4; // er12
int v5; // er15
int v6; // ecx
char v7; // al
int *result; // rax
int v9; // er12
_QWORD *v10; // rax

if ( maxspawn_cmds[0] > 49 )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Sorry, maximum number of disbled-entitie commands has been reached.\n");
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 1) )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v2 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v2, "SW") )
{
if ( (unsigned int)Q_stricmp(v2, "EX") )
{
if ( (unsigned int)Q_stricmp(v2, "RE") )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 2;
}
else
{
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 1;
}
}
else
{
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 0;
}
*((_DWORD *)&spawncmds + 6 * maxspawn_cmds[0] + 3) = 0;
v3 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v3) )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v4 = strlen(v3);
v5 = maxspawn_cmds[0];
*((_QWORD *)&spawncmds + 3 * v5) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v4 + 20), 765LL);
processstring(*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0]), v3, (unsigned int)(v4 + 19), 0LL);
if ( *((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) != 2 )
{
*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2) = 0LL;
v6 = maxspawn_cmds[0];
v7 = *((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8);
if ( v7 != 1 )
goto LABEL_8;
goto LABEL_23;
}
q_strupr(v3);
v9 = maxspawn_cmds[0];
*((_QWORD *)&spawncmds + 3 * v9 + 2) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 765LL);
v10 = (_QWORD *)*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2);
*v10 = 0LL;
v10[1] = 0LL;
v10[2] = 0LL;
v10[3] = 0LL;
v10[4] = 0LL;
v10[5] = 0LL;
v10[6] = 0LL;
v10[7] = 0LL;
if ( !regcomp(*((regex_t **)&spawncmds + 3 * maxspawn_cmds[0] + 2), v3, 0) )
{
v6 = maxspawn_cmds[0];
v7 = *((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8);
if ( v7 != 1 )
{
if ( v7 != 2 )
{
LABEL_8:
if ( !v7 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d SW:\"%s\" added\n",
(unsigned int)(v6 + 1),
*((const char **)&spawncmds + 3 * v6));
goto LABEL_10;
}
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d RE:\"%s\" added\n",
(unsigned int)(maxspawn_cmds[0] + 1),
*((const char **)&spawncmds + 3 * maxspawn_cmds[0]));
LABEL_10:
result = maxspawn_cmds;
++maxspawn_cmds[0];
return result;
}
LABEL_23:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d EX:\"%s\" added\n",
(unsigned int)(v6 + 1),
*((const char **)&spawncmds + 3 * v6));
goto LABEL_10;
}
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0]));
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0] + 2));
*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2) = 0LL;
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Regular expression couldn't compile!\n");
}

canonical_decompiled_code:
int *__fastcall func9(unsigned int a1, __int64 a2)
{
__int64 v2; // rbx
const char *v3; // rbx
int v4; // er12
int v5; // er15
int v6; // ecx
char v7; // al
int *result; // rax
int v9; // er12
_QWORD *v10; // rax

if ( maxspawn_cmds[0] > 49 )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Sorry, maximum number of disbled-entitie commands has been reached.\n");
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 1) )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v2 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v2, "SW") )
{
if ( (unsigned int)Q_stricmp(v2, "EX") )
{
if ( (unsigned int)Q_stricmp(v2, "RE") )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 2;
}
else
{
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 1;
}
}
else
{
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 0;
}
*((_DWORD *)&spawncmds + 6 * maxspawn_cmds[0] + 3) = 0;
v3 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v3) )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v4 = strlen(v3);
v5 = maxspawn_cmds[0];
*((_QWORD *)&spawncmds + 3 * v5) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v4 + 20), 765LL);
processstring(*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0]), v3, (unsigned int)(v4 + 19), 0LL);
if ( *((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) != 2 )
{
*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2) = 0LL;
v6 = maxspawn_cmds[0];
v7 = *((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8);
if ( v7 != 1 )
goto LABEL_8;
goto LABEL_23;
}
q_strupr(v3);
v9 = maxspawn_cmds[0];
*((_QWORD *)&spawncmds + 3 * v9 + 2) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 765LL);
v10 = (_QWORD *)*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2);
*v10 = 0LL;
v10[1] = 0LL;
v10[2] = 0LL;
v10[3] = 0LL;
v10[4] = 0LL;
v10[5] = 0LL;
v10[6] = 0LL;
v10[7] = 0LL;
if ( !regcomp(*((regex_t **)&spawncmds + 3 * maxspawn_cmds[0] + 2), v3, 0) )
{
v6 = maxspawn_cmds[0];
v7 = *((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8);
if ( v7 != 1 )
{
if ( v7 != 2 )
{
LABEL_8:
if ( !v7 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d SW:\"%s\" added\n",
(unsigned int)(v6 + 1),
*((const char **)&spawncmds + 3 * v6));
goto LABEL_10;
}
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d RE:\"%s\" added\n",
(unsigned int)(maxspawn_cmds[0] + 1),
*((const char **)&spawncmds + 3 * maxspawn_cmds[0]));
LABEL_10:
result = maxspawn_cmds;
++maxspawn_cmds[0];
return result;
}
LABEL_23:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d EX:\"%s\" added\n",
(unsigned int)(v6 + 1),
*((const char **)&spawncmds + 3 * v6));
goto LABEL_10;
}
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0]));
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0] + 2));
*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2) = 0LL;
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Regular expression couldn't compile!\n");
}

original_code:
void spawncmdRun(int startarg, edict_t *ent, int client) {
    char *cmd;
    int len;
    if (maxspawn_cmds >= 50) {
        gi.cprintf(ent, 2, "Sorry, maximum number of disbled-entitie commands has been reached.\n");
        return;
    }
    if (gi.argc() <= startarg + 1) {
        gi.cprintf(ent, 2, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
        return;
    }
    cmd = gi.argv(startarg);
    if (Q_stricmp(cmd, "SW") == 0) {
        spawncmds[maxspawn_cmds].type = 0;
    } else if (Q_stricmp(cmd, "EX") == 0) {
        spawncmds[maxspawn_cmds].type = 1;
    } else if (Q_stricmp(cmd, "RE") == 0) {
        spawncmds[maxspawn_cmds].type = 2;
    } else {
        gi.cprintf(ent, 2, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
        return;
    }
    spawncmds[maxspawn_cmds].onelevelflag = 0;
    cmd = gi.argv(startarg + 1);
    if (isBlank(cmd)) {
        gi.cprintf(ent, 2, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
        return;
    }
    len = strlen(cmd) + 20;
    spawncmds[maxspawn_cmds].spawncmd = gi.TagMalloc(len, 765);
    processstring(spawncmds[maxspawn_cmds].spawncmd, cmd, len - 1, 0);
    if (spawncmds[maxspawn_cmds].type == 2) {
        q_strupr(cmd);
        spawncmds[maxspawn_cmds].r = gi.TagMalloc(sizeof (*spawncmds[maxspawn_cmds].r), 765);
        memset(spawncmds[maxspawn_cmds].r, 0x0, sizeof (*spawncmds[maxspawn_cmds].r));
        if (regcomp(spawncmds[maxspawn_cmds].r, cmd, 0)) {
            gi.TagFree(spawncmds[maxspawn_cmds].spawncmd);
            gi.TagFree(spawncmds[maxspawn_cmds].r);
            spawncmds[maxspawn_cmds].r = 0;
            gi.cprintf(ent, 2, "Regular expression couldn't compile!\n");
            return;
        }
    } else {
        spawncmds[maxspawn_cmds].r = 0;
    }
    switch (spawncmds[maxspawn_cmds].type) {
        case 0:
            gi.cprintf(ent, 2, "%4d SW:\"%s\" added\n", maxspawn_cmds + 1, spawncmds[maxspawn_cmds].spawncmd);
            break;
        case 1:
            gi.cprintf(ent, 2, "%4d EX:\"%s\" added\n", maxspawn_cmds + 1, spawncmds[maxspawn_cmds].spawncmd);
            break;
        case 2:
            gi.cprintf(ent, 2, "%4d RE:\"%s\" added\n", maxspawn_cmds + 1, spawncmds[maxspawn_cmds].spawncmd);
            break;
    }
    maxspawn_cmds++;
}

canonical_original_code:
void spawncmdRun(int startarg, struct edict_s *ent, int client) {
    char *cmd;
    int len;
    if (maxspawn_cmds >= 50) {
        gi.cprintf(ent, 2, "Sorry, maximum number of disbled-entitie commands has been reached.\n");
        return;
    }
    if (gi.argc() <= startarg + 1) {
        gi.cprintf(ent, 2, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
        return;
    }
    cmd = gi.argv(startarg);
    if (Q_stricmp(cmd, "SW") == 0) {
        spawncmds[maxspawn_cmds].type = 0;
    } else if (Q_stricmp(cmd, "EX") == 0) {
        spawncmds[maxspawn_cmds].type = 1;
    } else if (Q_stricmp(cmd, "RE") == 0) {
        spawncmds[maxspawn_cmds].type = 2;
    } else {
        gi.cprintf(ent, 2, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
        return;
    }
    spawncmds[maxspawn_cmds].onelevelflag = 0;
    cmd = gi.argv(startarg + 1);
    if (isBlank(cmd)) {
        gi.cprintf(ent, 2, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
        return;
    }
    len = strlen(cmd) + 20;
    spawncmds[maxspawn_cmds].spawncmd = gi.TagMalloc(len, 765);
    processstring(spawncmds[maxspawn_cmds].spawncmd, cmd, len - 1, 0);
    if (spawncmds[maxspawn_cmds].type == 2) {
        q_strupr(cmd);
        spawncmds[maxspawn_cmds].r = gi.TagMalloc(sizeof (*spawncmds[maxspawn_cmds].r), 765);
        memset(spawncmds[maxspawn_cmds].r, 0x0, sizeof (*spawncmds[maxspawn_cmds].r));
        if (regcomp(spawncmds[maxspawn_cmds].r, cmd, 0)) {
            gi.TagFree(spawncmds[maxspawn_cmds].spawncmd);
            gi.TagFree(spawncmds[maxspawn_cmds].r);
            spawncmds[maxspawn_cmds].r = 0;
            gi.cprintf(ent, 2, "Regular expression couldn't compile!\n");
            return;
        }
    } else {
        spawncmds[maxspawn_cmds].r = 0;
    }
    switch (spawncmds[maxspawn_cmds].type) {
        case 0:
            gi.cprintf(ent, 2, "%4d SW:\"%s\" added\n", maxspawn_cmds + 1, spawncmds[maxspawn_cmds].spawncmd);
            break;
        case 1:
            gi.cprintf(ent, 2, "%4d EX:\"%s\" added\n", maxspawn_cmds + 1, spawncmds[maxspawn_cmds].spawncmd);
            break;
        case 2:
            gi.cprintf(ent, 2, "%4d RE:\"%s\" added\n", maxspawn_cmds + 1, spawncmds[maxspawn_cmds].spawncmd);
            break;
    }
    maxspawn_cmds++;
}

variable_types:
cmd
char *

variable_types: len int

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


spawnDelRun

decompiled_code:
__int64 __fastcall spawnDelRun(int a1, __int64 a2)
{
const char *v2; // rax
int v3; // ebx
int v4; // er13
regex_t *v5; // rdi
int v6; // er12

if ( ((int (*)(void))gi[39])() <= a1 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !spawndel spawnnum\n");
v2 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)a1);
v3 = atoi(v2);
if ( v3 <= 0 || maxspawn_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !spawndel spawnnum\n");
v4 = v3 - 1;
gi[34](*((const char **)&spawncmds + 3 * v3 - 3));
v5 = (regex_t *)*((_QWORD *)&spawncmds + 3 * v3 - 1);
if ( v5 )
{
regfree(v5);
gi[34](*((const char **)&spawncmds + 3 * v4 + 2));
}
v6 = maxspawn_cmds[0];
if ( maxspawn_cmds[0] > v3 )
memmove((char *)&spawncmds + 24 * v3 - 24, (char *)&spawncmds + 24 * v3, 24LL * (maxspawn_cmds[0] - v4));
maxspawn_cmds[0] = v6 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Disbled-entities command deleted\n");
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, __int64 a2)
{
const char *v2; // rax
int v3; // ebx
int v4; // er13
regex_t *v5; // rdi
int v6; // er12

if ( ((int (*)(void))gi[39])() <= a1 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !spawndel spawnnum\n");
v2 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)a1);
v3 = atoi(v2);
if ( v3 <= 0 || maxspawn_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !spawndel spawnnum\n");
v4 = v3 - 1;
gi[34](*((const char **)&spawncmds + 3 * v3 - 3));
v5 = (regex_t *)*((_QWORD *)&spawncmds + 3 * v3 - 1);
if ( v5 )
{
regfree(v5);
gi[34](*((const char **)&spawncmds + 3 * v4 + 2));
}
v6 = maxspawn_cmds[0];
if ( maxspawn_cmds[0] > v3 )
memmove((char *)&spawncmds + 24 * v3 - 24, (char *)&spawncmds + 24 * v3, 24LL * (maxspawn_cmds[0] - v4));
maxspawn_cmds[0] = v6 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Disbled-entities command deleted\n");
}

original_code:
void spawnDelRun(int startarg, edict_t *ent, int client) {
    int spawn;
    if (gi.argc() <= startarg) {
        gi.cprintf(ent, 2, "[sv] !spawndel spawnnum\n");
        return;
    }
    spawn = atoi(gi.argv(startarg));
    if (spawn < 1 || spawn > maxspawn_cmds) {
        gi.cprintf(ent, 2, "[sv] !spawndel spawnnum\n");
        return;
    }
    spawn--;
    gi.TagFree(spawncmds[spawn].spawncmd);
    if (spawncmds[spawn].r) {
        regfree(spawncmds[spawn].r);
        gi.TagFree(spawncmds[spawn].r);
    }
    if (spawn + 1 < maxspawn_cmds) {
        memmove((spawncmds + spawn), (spawncmds + spawn + 1), sizeof (spawncmd_t) * (maxspawn_cmds - spawn));
    }
    maxspawn_cmds--;
    gi.cprintf(ent, 2, "Disbled-entities command deleted\n");
}

canonical_original_code:
void spawnDelRun(int startarg, struct edict_s *ent, int client) {
    int spawn;
    if (gi.argc() <= startarg) {
        gi.cprintf(ent, 2, "[sv] !spawndel spawnnum\n");
        return;
    }
    spawn = atoi(gi.argv(startarg));
    if (spawn < 1 || spawn > maxspawn_cmds) {
        gi.cprintf(ent, 2, "[sv] !spawndel spawnnum\n");
        return;
    }
    spawn--;
    gi.TagFree(spawncmds[spawn].spawncmd);
    if (spawncmds[spawn].r) {
        regfree(spawncmds[spawn].r);
        gi.TagFree(spawncmds[spawn].r);
    }
    if (spawn + 1 < maxspawn_cmds) {
        memmove((spawncmds + spawn), (spawncmds + spawn + 1), sizeof (spawncmd_t) * (maxspawn_cmds - spawn));
    }
    maxspawn_cmds--;
    gi.cprintf(ent, 2, "Disbled-entities command deleted\n");
}

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


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

if ( spawnentities_internal_enable
&& spawnentities_enable
&& (unsigned int)checkDisabledEntities(*(char **)(entity_classname_offset + a1)) )
{
result = entity_classname_offset;
*(_QWORD *)(a1 + entity_classname_offset) = 0LL;
*(_DWORD *)(a1 + 96) = 0;
}
else
{
logEvent(20LL, 0LL, 0LL, *(_QWORD *)(a1 + entity_classname_offset), 0LL, 0.0);
result = ((__int64 (__fastcall *)(__int64))gi[18])(a1);
}
return result;
}

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

if ( spawnentities_internal_enable
&& spawnentities_enable
&& (unsigned int)func6(*(char **)(entity_classname_offset + a1)) )
{
result = entity_classname_offset;
*(_QWORD *)(a1 + entity_classname_offset) = 0LL;
*(_DWORD *)(a1 + 96) = 0;
}
else
{
logEvent(20LL, 0LL, 0LL, *(_QWORD *)(a1 + entity_classname_offset), 0LL, 0.0);
result = ((__int64 (__fastcall *)(__int64))gi[18])(a1);
}
return result;
}

original_code:
void linkentity_internal(edict_t *ent) {
    if (spawnentities_internal_enable && spawnentities_enable) {
        if (checkDisabledEntities(*((char **) ((unsigned long) ent + entity_classname_offset)))) {
            char **classnameptr = ((char **) ((unsigned long) ent + entity_classname_offset));
            *classnameptr = ((void *)0);
            ent->inuse = 0;
            return;
        }
    }
    logEvent(LT_ENTITYCREATE, 0, ((void *)0), *((char **) ((unsigned long) ent + entity_classname_offset)), 0, 0.0);
    gi.linkentity(ent);
}

canonical_original_code:
void linkentity_internal(struct edict_s *ent) {
    if (spawnentities_internal_enable && spawnentities_enable) {
        if (checkDisabledEntities(*((char **) ((unsigned long) ent + entity_classname_offset)))) {
            char **classnameptr = ((char **) ((unsigned long) ent + entity_classname_offset));
            *classnameptr = ((void *)0);
            ent->inuse = 0;
            return;
        }
    }
    logEvent(LT_ENTITYCREATE, 0, ((void *)0), *((char **) ((unsigned long) ent + entity_classname_offset)), 0, 0.0);
    gi.linkentity(ent);
}

variable_types:
classnameptr
char **

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


decompiled_code:
__int64 __fastcall unlinkentity_internal(__int64 a1)
{
logEvent(21LL, 0LL, 0LL, *(_QWORD *)(a1 + entity_classname_offset), 0LL, 0.0);
return ((__int64 (__fastcall *)(__int64))gi[19])(a1);
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
logEvent(21LL, 0LL, 0LL, *(_QWORD *)(a1 + entity_classname_offset), 0LL, 0.0);
return ((__int64 (__fastcall *)(__int64))gi[19])(a1);
}

original_code:
void unlinkentity_internal(edict_t *ent) {
    logEvent(LT_ENTITYDELETE, 0, ((void *)0), *((char **) ((unsigned long) ent + entity_classname_offset)), 0, 0.0);
    gi.unlinkentity(ent);
}

canonical_original_code:
void unlinkentity_internal(struct edict_s *ent) {
    logEvent(LT_ENTITYDELETE, 0, ((void *)0), *((char **) ((unsigned long) ent + entity_classname_offset)), 0, 0.0);
    gi.unlinkentity(ent);
}

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


freeLRconLists

decompiled_code:
__int64 freeLRconLists()
{
__int64 result; // rax
regex_t *v1; // rdi

while ( 1 )
{
result = (unsigned int)maxlrcon_cmds[0];
if ( !maxlrcon_cmds[0] )
break;
--maxlrcon_cmds[0];
gi[34](*((const char **)&lrconcmds + 4 * (int)result - 3));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
v1 = (regex_t *)*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3);
if ( v1 )
{
regfree(v1);
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3));
}
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax
regex_t *v1; // rdi

while ( 1 )
{
result = (unsigned int)maxlrcon_cmds[0];
if ( !maxlrcon_cmds[0] )
break;
--maxlrcon_cmds[0];
gi[34](*((const char **)&lrconcmds + 4 * (int)result - 3));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
v1 = (regex_t *)*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3);
if ( v1 )
{
regfree(v1);
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3));
}
}
return result;
}

original_code:
void freeLRconLists(void) {
    while (maxlrcon_cmds) {
        maxlrcon_cmds--;
        gi.TagFree(lrconcmds[maxlrcon_cmds].password);
        gi.TagFree(lrconcmds[maxlrcon_cmds].lrconcmd);
        if (lrconcmds[maxlrcon_cmds].r) {
            regfree(lrconcmds[maxlrcon_cmds].r);
            gi.TagFree(lrconcmds[maxlrcon_cmds].r);
        }
    }
}

canonical_original_code:
void freeLRconLists() {
    while (maxlrcon_cmds) {
        maxlrcon_cmds--;
        gi.TagFree(lrconcmds[maxlrcon_cmds].password);
        gi.TagFree(lrconcmds[maxlrcon_cmds].lrconcmd);
        if (lrconcmds[maxlrcon_cmds].r) {
            regfree(lrconcmds[maxlrcon_cmds].r);
            gi.TagFree(lrconcmds[maxlrcon_cmds].r);
        }
    }
}


readLRconLists

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

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

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

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

original_code:
void readLRconLists(void) {
    qboolean ret;
    freeLRconLists();
    ret = ReadLRconFile(configfile_rcon->string);
    Q_snprintf(buffer, sizeof(buffer), "%s/%s", moddir, configfile_rcon->string);
    if (ReadLRconFile(buffer)) {
        ret = 1;
    }
    if (!ret) {
        gi.dprintf("WARNING: %s could not be found\n", configfile_rcon->string);
        logEvent(LT_INTERNALWARN, 0, ((void *)0), va("%s could not be found", configfile_rcon->string), 12, 0.0);
    }
}

canonical_original_code:
void readLRconLists() {
    enum qboolean ret;
    freeLRconLists();
    ret = ReadLRconFile(configfile_rcon->string);
    Q_snprintf(buffer, sizeof(buffer), "%s/%s", moddir, configfile_rcon->string);
    if (ReadLRconFile(buffer)) {
        ret = 1;
    }
    if (!ret) {
        gi.dprintf("WARNING: %s could not be found\n", configfile_rcon->string);
        logEvent(LT_INTERNALWARN, 0, ((void *)0), va("%s could not be found", configfile_rcon->string), 12, 0.0);
    }
}


reloadlrconfileRun

decompiled_code:
__int64 __fastcall reloadlrconfileRun(__int64 a1, __int64 a2)
{
readLRconLists();
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Lrcons reloaded.\n");
}

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

original_code:
void reloadlrconfileRun(int startarg, edict_t *ent, int client) {
    readLRconLists();
    gi.cprintf(ent, 2, "Lrcons reloaded.\n");
}

canonical_original_code:
void reloadlrconfileRun(int startarg, struct edict_s *ent, int client) {
    readLRconLists();
    gi.cprintf(ent, 2, "Lrcons reloaded.\n");
}

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


checklrcon

decompiled_code:
__int64 __fastcall checklrcon(char *src, int a2)
{
char v2; // al
unsigned int v3; // edx
char v5[280]; // [rsp+0h] [rbp-118h] BYREF

v2 = *((_BYTE *)&lrconcmds + 32 * a2 + 16);
if ( v2 == 1 )
return Q_stricmp(src, *((_QWORD *)&lrconcmds + 4 * a2)) == 0;
if ( v2 == 2 )
{
strncpy(v5, src, 0xFFuLL);
q_strupr(v5);
v3 = regexec(*((const regex_t **)&lrconcmds + 4 * a2 + 3), v5, 0LL, 0LL, 0) != 1;
}
else
{
v3 = 0;
if ( !v2 )
v3 = startContains(src, *((_QWORD *)&lrconcmds + 4 * a2));
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func4(char *src, int a2)
{
char v2; // al
unsigned int v3; // edx
char v5[280]; // [rsp+0h] [rbp-118h] BYREF

v2 = *((_BYTE *)&lrconcmds + 32 * a2 + 16);
if ( v2 == 1 )
return Q_stricmp(src, *((_QWORD *)&lrconcmds + 4 * a2)) == 0;
if ( v2 == 2 )
{
strncpy(v5, src, 0xFFuLL);
q_strupr(v5);
v3 = regexec(*((const regex_t **)&lrconcmds + 4 * a2 + 3), v5, 0LL, 0LL, 0) != 1;
}
else
{
v3 = 0;
if ( !v2 )
v3 = startContains(src, *((_QWORD *)&lrconcmds + 4 * a2));
}
return v3;
}

canonical_original_code:
enum qboolean checklrcon(char *cp, int lrcon) {
    char strbuffer[256];
    switch (lrconcmds[lrcon].type) {
        case 0:
            return startContains(cp, lrconcmds[lrcon].lrconcmd);
        case 1:
            return !Q_stricmp(cp, lrconcmds[lrcon].lrconcmd);
        case 2:
            strncpy(strbuffer, cp, sizeof (strbuffer) - 1);
            q_strupr(strbuffer);
            return (regexec(lrconcmds[lrcon].r, strbuffer, 0, 0, 0) != REG_NOMATCH);
    }
    return 0;
}

variable_types: lrcon int

variable_types:
strbuffer
char [256]


decompiled_code:
__int64 __fastcall run_lrcon(__int64 a1, unsigned int a2)
{
_BYTE **v2; // r13
unsigned int v3; // er12
char *v4; // rbx
char v5; // al
char *v6; // rbp
_BYTE *v7; // rdx
char v8; // al
char v10[88]; // [rsp+10h] [rbp-58h] BYREF

if ( !maxlrcon_cmds[0] )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "Unknown lrcon command\n");
v2 = (_BYTE **)((char *)&lrconcmds + 8);
v3 = 0;
while ( 1 )
{
v6 = (char *)((__int64 (*)(void))gi[41])();
if ( *v6 == 32 || *v6 == 9 )
{
v4 = v6;
do
{
do
++v4;
while ( *v4 == 32 );
}
while ( *v4 == 9 );
}
else
{
v4 = v6;
}
v7 = *v2;
v8 = *v4;
if ( (*v4 & 0xDF) != 0 )
{
do
{
if ( *v7 != v8 )
break;
++v4;
++v7;
v8 = *v4;
}
while ( (*v4 & 0xDF) != 0 );
if ( !*v7 && v8 == 32 )
{
v5 = *v4;
if ( *v4 == 32 || v5 == 9 )
{
do
{
do
v5 = *++v4;
while ( *v4 == 32 );
}
while ( v5 == 9 );
}
if ( v5 && (unsigned int)checklrcon(v4, v3) && !strchr(v4, 59) && !strchr(v4, 10) )
break;
}
}
++v3;
v2 += 4;
if ( maxlrcon_cmds[0] <= v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "Unknown lrcon command\n");
}
if ( rcon_insecure )
{
if ( rcon_random_password )
{
if ( password_timeout != 0.0 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a1,
2LL,
"Sorry, another lrcon command is being processed, please try again later\n");
generateRandomString(v10, 20LL);
strncpy(orginal_rcon_password, *(const char **)(rconpassword + 8LL), 0x31uLL);
gi[37]("rcon_password", v10);
password_timeout = (float)lrcon_timeout + ltime;
Q_snprintf(&buffer, 0x10000LL, "rcon %s %s\n", v10, v4);
stuffcmd(a1, &buffer);
Q_snprintf(&buffer, 0x10000LL, "rcon %s sv !resetrcon\n", v10);
}
else
{
Q_snprintf(&buffer, 0x10000LL, "rcon %s %s\n", *(const char **)(rconpassword + 8LL), v4);
}
stuffcmd(a1, &buffer);
}
else
{
Q_snprintf(&buffer, 0x10000LL, "%s\n", v4);
gi[42](&buffer);
}
return logEvent(11LL, a2, a1, v6, 0LL, 0.0);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, unsigned int a2)
{
_BYTE **v2; // r13
unsigned int v3; // er12
char *v4; // rbx
char v5; // al
char *v6; // rbp
_BYTE *v7; // rdx
char v8; // al
char v10[88]; // [rsp+10h] [rbp-58h] BYREF

if ( !maxlrcon_cmds[0] )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "Unknown lrcon command\n");
v2 = (_BYTE **)((char *)&lrconcmds + 8);
v3 = 0;
while ( 1 )
{
v6 = (char *)((__int64 (*)(void))gi[41])();
if ( *v6 == 32 || *v6 == 9 )
{
v4 = v6;
do
{
do
++v4;
while ( *v4 == 32 );
}
while ( *v4 == 9 );
}
else
{
v4 = v6;
}
v7 = *v2;
v8 = *v4;
if ( (*v4 & 0xDF) != 0 )
{
do
{
if ( *v7 != v8 )
break;
++v4;
++v7;
v8 = *v4;
}
while ( (*v4 & 0xDF) != 0 );
if ( !*v7 && v8 == 32 )
{
v5 = *v4;
if ( *v4 == 32 || v5 == 9 )
{
do
{
do
v5 = *++v4;
while ( *v4 == 32 );
}
while ( v5 == 9 );
}
if ( v5 && (unsigned int)func4(v4, v3) && !strchr(v4, 59) && !strchr(v4, 10) )
break;
}
}
++v3;
v2 += 4;
if ( maxlrcon_cmds[0] <= v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "Unknown lrcon command\n");
}
if ( rcon_insecure )
{
if ( rcon_random_password )
{
if ( password_timeout != 0.0 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a1,
2LL,
"Sorry, another lrcon command is being processed, please try again later\n");
generateRandomString(v10, 20LL);
strncpy(orginal_rcon_password, *(const char **)(rconpassword + 8LL), 0x31uLL);
gi[37]("rcon_password", v10);
password_timeout = (float)lrcon_timeout + ltime;
Q_snprintf(&buffer, 0x10000LL, "rcon %s %s\n", v10, v4);
stuffcmd(a1, &buffer);
Q_snprintf(&buffer, 0x10000LL, "rcon %s sv !resetrcon\n", v10);
}
else
{
Q_snprintf(&buffer, 0x10000LL, "rcon %s %s\n", *(const char **)(rconpassword + 8LL), v4);
}
stuffcmd(a1, &buffer);
}
else
{
Q_snprintf(&buffer, 0x10000LL, "%s\n", v4);
gi[42](&buffer);
}
return logEvent(11LL, a2, a1, v6, 0LL, 0.0);
}

original_code:
void run_lrcon(edict_t *ent, int client) {
    unsigned int i;
    for (i = 0; i < maxlrcon_cmds; i++) {
        char *cp = gi.args(), *pp, *orgcp;
        orgcp = cp;
        {while(*cp == ' ' || *cp == '\t') { cp++; } };
        pp = lrconcmds[i].password;
        while (*cp && *cp != ' ') {
            if (*pp != *cp) {
                break;
            }
            cp++;
            pp++;
        }
        if (*pp != 0) {
            continue;
        }
        if (*cp != ' ') {
            continue;
        }
        {while(*cp == ' ' || *cp == '\t') { cp++; } };
        if (*cp) {
            if (checklrcon(cp, i) && strchr(cp, ';') == ((void *)0) && strchr(cp, '\n') == ((void *)0)) {
                if (rcon_insecure) {
                    if (rcon_random_password) {
                        char cbuffer[20 + 1];
                        if (password_timeout) {
                            gi.cprintf(ent, 2, "Sorry, another lrcon command is being processed, please try again later\n");
                            return;
                        }
                        generateRandomString(cbuffer, 20);
                        strncpy(orginal_rcon_password, rconpassword->string, sizeof (orginal_rcon_password) - 1);
                        gi.cvar_set("rcon_password", cbuffer);
                        password_timeout = ltime + lrcon_timeout;
                        Q_snprintf(buffer, sizeof(buffer), "rcon %s %s\n", cbuffer, cp);
                        stuffcmd(ent, buffer);
                        Q_snprintf(buffer, sizeof(buffer), "rcon %s sv !resetrcon\n", cbuffer, cp);
                    } else {
                        Q_snprintf(buffer, sizeof(buffer), "rcon %s %s\n", rconpassword->string, cp);
                    }
                    stuffcmd(ent, buffer);
                } else {
                    Q_snprintf(buffer, sizeof(buffer), "%s\n", cp);
                    gi.AddCommandString(buffer);
                }
                logEvent(LT_CLIENTLRCON, client, ent, orgcp, 0, 0.0);
                return;
            }
        }
    }
    gi.cprintf(ent, 2, "Unknown lrcon command\n");
}

canonical_original_code:
void run_lrcon(struct edict_s *ent, int client) {
    unsigned int i;
    for (i = 0; i < maxlrcon_cmds; i++) {
        char *cp = gi.args(); char *pp; char *orgcp;
        orgcp = cp;
        {while(*cp == ' ' || *cp == '\t') { cp++; } };
        pp = lrconcmds[i].password;
        while (*cp && *cp != ' ') {
            if (*pp != *cp) {
                break;
            }
            cp++;
            pp++;
        }
        if (*pp != 0) {
            continue;
        }
        if (*cp != ' ') {
            continue;
        }
        {while(*cp == ' ' || *cp == '\t') { cp++; } };
        if (*cp) {
            if (checklrcon(cp, i) && strchr(cp, ';') == ((void *)0) && strchr(cp, '\n') == ((void *)0)) {
                if (rcon_insecure) {
                    if (rcon_random_password) {
                        char cbuffer[-1];
                        if (password_timeout) {
                            gi.cprintf(ent, 2, "Sorry, another lrcon command is being processed, please try again later\n");
                            return;
                        }
                        generateRandomString(cbuffer, 20);
                        strncpy(orginal_rcon_password, rconpassword->string, sizeof (orginal_rcon_password) - 1);
                        gi.cvar_set("rcon_password", cbuffer);
                        password_timeout = ltime + lrcon_timeout;
                        Q_snprintf(buffer, sizeof(buffer), "rcon %s %s\n", cbuffer, cp);
                        stuffcmd(ent, buffer);
                        Q_snprintf(buffer, sizeof(buffer), "rcon %s sv !resetrcon\n", cbuffer, cp);
                    } else {
                        Q_snprintf(buffer, sizeof(buffer), "rcon %s %s\n", rconpassword->string, cp);
                    }
                    stuffcmd(ent, buffer);
                } else {
                    Q_snprintf(buffer, sizeof(buffer), "%s\n", cp);
                    gi.AddCommandString(buffer);
                }
                logEvent(LT_CLIENTLRCON, client, ent, orgcp, 0, 0.0);
                return;
            }
        }
    }
    gi.cprintf(ent, 2, "Unknown lrcon command\n");
}

variable_types:
pp
char *

variable_types:
orgcp
char *

variable_types:
cbuffer
char [-1]

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


decompiled_code:
float *lrcon_reset_rcon_password()
{
float *result; // rax

result = password_timeout;
if ( password_timeout[0] != 0.0 )
{
password_timeout[0] = 0.0;
result = (float *)((__int64 (__fastcall *)(const char *, char *))gi[37])("rcon_password", orginal_rcon_password);
}
return result;
}

canonical_decompiled_code:
float *func6()
{
float *result; // rax

result = password_timeout;
if ( password_timeout[0] != 0.0 )
{
password_timeout[0] = 0.0;
result = (float *)((__int64 (__fastcall *)(const char *, char *))gi[37])("rcon_password", orginal_rcon_password);
}
return result;
}

original_code:
void lrcon_reset_rcon_password(int startarg, edict_t *ent, int client) {
    if (password_timeout == 0) {
        return;
    }
    password_timeout = 0;
    gi.cvar_set("rcon_password", orginal_rcon_password);
}

canonical_original_code:
void lrcon_reset_rcon_password(int startarg, struct edict_s *ent, int client) {
    if (password_timeout == 0) {
        return;
    }
    password_timeout = 0;
    gi.cvar_set("rcon_password", orginal_rcon_password);
}

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


decompiled_code:
float *check_lrcon_password()
{
float *result; // rax

result = password_timeout;
if ( password_timeout[0] != 0.0 )
{
result = &ltime;
if ( password_timeout[0] < ltime )
result = lrcon_reset_rcon_password();
}
return result;
}

canonical_decompiled_code:
float *func7()
{
float *result; // rax

result = password_timeout;
if ( password_timeout[0] != 0.0 )
{
result = &ltime;
if ( password_timeout[0] < ltime )
result = func6();
}
return result;
}

original_code:
void check_lrcon_password(void) {
    if (password_timeout && (password_timeout < ltime)) {
        lrcon_reset_rcon_password(0, 0, 0);
    }
}

canonical_original_code:
void check_lrcon_password() {
    if (password_timeout && (password_timeout < ltime)) {
        lrcon_reset_rcon_password(0, 0, 0);
    }
}


listlrconsRun

decompiled_code:
__int64 __fastcall listlrconsRun(__int64 a1, __int64 a2, unsigned int a3)
{
addCmdQueue(a3, 23LL, 0LL, 0LL, 0.0);
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Start lrcon's List:\n");
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, unsigned int a3)
{
addCmdQueue(a3, 23LL, 0LL, 0LL, 0.0);
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "Start lrcon's List:\n");
}

original_code:
void listlrconsRun(int startarg, edict_t *ent, int client) {
    addCmdQueue(client, QCMD_DISPLRCONS, 0, 0, 0);
    gi.cprintf(ent, 2, "Start lrcon's List:\n");
}

canonical_original_code:
void listlrconsRun(int startarg, struct edict_s *ent, int client) {
    addCmdQueue(client, QCMD_DISPLRCONS, 0, 0, 0);
    gi.cprintf(ent, 2, "Start lrcon's List:\n");
}

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


displayNextLRCon

decompiled_code:
__int64 __fastcall displayNextLRCon(__int64 a1, unsigned int a2, __int64 a3)
{
char v4; // al

if ( maxlrcon_cmds[0] <= a3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "End lrcon's List\n");
v4 = *((_BYTE *)&lrconcmds + 32 * a3 + 16);
switch ( v4 )
{
case 1:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d EX:\"%s\" \"%s\"\n",
a3 + 1,
*((const char **)&lrconcmds + 4 * a3 + 1),
*((const char **)&lrconcmds + 4 * a3));
break;
case 2:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d RE:\"%s\" \"%s\"\n",
a3 + 1,
*((const char **)&lrconcmds + 4 * a3 + 1),
*((const char **)&lrconcmds + 4 * a3));
break;
case 0:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d SW:\"%s\" \"%s\"\n",
a3 + 1,
*((const char **)&lrconcmds + 4 * a3 + 1),
*((const char **)&lrconcmds + 4 * a3));
break;
}
return addCmdQueue(a2, 23LL, a3 + 1, 0LL, 0.0);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, unsigned int a2, __int64 a3)
{
char v4; // al

if ( maxlrcon_cmds[0] <= a3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "End lrcon's List\n");
v4 = *((_BYTE *)&lrconcmds + 32 * a3 + 16);
switch ( v4 )
{
case 1:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d EX:\"%s\" \"%s\"\n",
a3 + 1,
*((const char **)&lrconcmds + 4 * a3 + 1),
*((const char **)&lrconcmds + 4 * a3));
break;
case 2:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d RE:\"%s\" \"%s\"\n",
a3 + 1,
*((const char **)&lrconcmds + 4 * a3 + 1),
*((const char **)&lrconcmds + 4 * a3));
break;
case 0:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a1,
2LL,
"%4d SW:\"%s\" \"%s\"\n",
a3 + 1,
*((const char **)&lrconcmds + 4 * a3 + 1),
*((const char **)&lrconcmds + 4 * a3));
break;
}
return addCmdQueue(a2, 23LL, a3 + 1, 0LL, 0.0);
}

original_code:
void displayNextLRCon(edict_t *ent, int client, long lrconnum) {
    if (lrconnum < maxlrcon_cmds) {
        switch (lrconcmds[lrconnum].type) {
            case 0:
                gi.cprintf(ent, 2, "%4d SW:\"%s\" \"%s\"\n", lrconnum + 1, lrconcmds[lrconnum].password, lrconcmds[lrconnum].lrconcmd);
                break;
            case 1:
                gi.cprintf(ent, 2, "%4d EX:\"%s\" \"%s\"\n", lrconnum + 1, lrconcmds[lrconnum].password, lrconcmds[lrconnum].lrconcmd);
                break;
            case 2:
                gi.cprintf(ent, 2, "%4d RE:\"%s\" \"%s\"\n", lrconnum + 1, lrconcmds[lrconnum].password, lrconcmds[lrconnum].lrconcmd);
                break;
        }
        lrconnum++;
        addCmdQueue(client, QCMD_DISPLRCONS, 0, lrconnum, 0);
    } else {
        gi.cprintf(ent, 2, "End lrcon's List\n");
    }
}

canonical_original_code:
void displayNextLRCon(struct edict_s *ent, int client, long lrconnum) {
    if (lrconnum < maxlrcon_cmds) {
        switch (lrconcmds[lrconnum].type) {
            case 0:
                gi.cprintf(ent, 2, "%4d SW:\"%s\" \"%s\"\n", lrconnum + 1, lrconcmds[lrconnum].password, lrconcmds[lrconnum].lrconcmd);
                break;
            case 1:
                gi.cprintf(ent, 2, "%4d EX:\"%s\" \"%s\"\n", lrconnum + 1, lrconcmds[lrconnum].password, lrconcmds[lrconnum].lrconcmd);
                break;
            case 2:
                gi.cprintf(ent, 2, "%4d RE:\"%s\" \"%s\"\n", lrconnum + 1, lrconcmds[lrconnum].password, lrconcmds[lrconnum].lrconcmd);
                break;
        }
        lrconnum++;
        addCmdQueue(client, QCMD_DISPLRCONS, 0, lrconnum, 0);
    } else {
        gi.cprintf(ent, 2, "End lrcon's List\n");
    }
}

variable_types: lrconnum long

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


lrconRun

decompiled_code:
int *__fastcall lrconRun(unsigned int a1, __int64 a2)
{
__int64 v2; // r12
const char *v3; // rbx
int v4; // eax
int v5; // er12
const char *v6; // rbx
int v7; // er12
int v8; // er13
int v9; // ecx
char v10; // al
int *result; // rax
int v12; // er12
_QWORD *v13; // rax

if ( maxlrcon_cmds[0] > 1023 )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Sorry, maximum number of lrcon's has been reached.\n");
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 2) )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
v2 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v2, "SW") )
{
if ( (unsigned int)Q_stricmp(v2, "EX") )
{
if ( (unsigned int)Q_stricmp(v2, "RE") )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
*((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) = 2;
}
else
{
*((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) = 1;
}
}
else
{
*((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) = 0;
}
v3 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v3) )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
v4 = strlen(v3);
v5 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v5 + 1) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])(
(unsigned int)(v4 + 1),
766LL);
strcpy(*((char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1), v3);
v6 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 2);
if ( (unsigned int)isBlank(v6) )
{
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1));
result = (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
}
else
{
v7 = strlen(v6);
v8 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v8) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v7 + 20), 766LL);
processstring(*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0]), v6, (unsigned int)(v7 + 19), 0LL);
if ( *((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) != 2 )
{
*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3) = 0LL;
v9 = maxlrcon_cmds[0];
v10 = *((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16);
if ( v10 != 1 )
goto LABEL_9;
goto LABEL_25;
}
q_strupr(v6);
v12 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v12 + 3) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 766LL);
v13 = (_QWORD *)*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3);
*v13 = 0LL;
v13[1] = 0LL;
v13[2] = 0LL;
v13[3] = 0LL;
v13[4] = 0LL;
v13[5] = 0LL;
v13[6] = 0LL;
v13[7] = 0LL;
if ( !regcomp(*((regex_t **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3), v6, 0) )
{
v9 = maxlrcon_cmds[0];
v10 = *((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16);
if ( v10 != 1 )
{
if ( v10 != 2 )
{
LABEL_9:
if ( !v10 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d SW:\"%s\" \"%s\" added\n",
(unsigned int)(v9 + 1),
*((const char **)&lrconcmds + 4 * v9 + 1),
*((const char **)&lrconcmds + 4 * v9));
goto LABEL_11;
}
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d RE:\"%s\" \"%s\" added\n",
(unsigned int)(maxlrcon_cmds[0] + 1),
*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1),
*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
LABEL_11:
result = maxlrcon_cmds;
++maxlrcon_cmds[0];
return result;
}
LABEL_25:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d EX:\"%s\" \"%s\" added\n",
(unsigned int)(v9 + 1),
*((const char **)&lrconcmds + 4 * v9 + 1),
*((const char **)&lrconcmds + 4 * v9));
goto LABEL_11;
}
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3));
*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3) = 0LL;
result = (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Regular expression couldn't compile!\n");
}
return result;
}

canonical_decompiled_code:
int *__fastcall func10(unsigned int a1, __int64 a2)
{
__int64 v2; // r12
const char *v3; // rbx
int v4; // eax
int v5; // er12
const char *v6; // rbx
int v7; // er12
int v8; // er13
int v9; // ecx
char v10; // al
int *result; // rax
int v12; // er12
_QWORD *v13; // rax

if ( maxlrcon_cmds[0] > 1023 )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Sorry, maximum number of lrcon's has been reached.\n");
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 2) )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
v2 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v2, "SW") )
{
if ( (unsigned int)Q_stricmp(v2, "EX") )
{
if ( (unsigned int)Q_stricmp(v2, "RE") )
return (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
*((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) = 2;
}
else
{
*((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) = 1;
}
}
else
{
*((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) = 0;
}
v3 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v3) )
return (int *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
v4 = strlen(v3);
v5 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v5 + 1) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])(
(unsigned int)(v4 + 1),
766LL);
strcpy(*((char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1), v3);
v6 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 2);
if ( (unsigned int)isBlank(v6) )
{
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1));
result = (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
}
else
{
v7 = strlen(v6);
v8 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v8) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v7 + 20), 766LL);
processstring(*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0]), v6, (unsigned int)(v7 + 19), 0LL);
if ( *((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16) != 2 )
{
*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3) = 0LL;
v9 = maxlrcon_cmds[0];
v10 = *((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16);
if ( v10 != 1 )
goto LABEL_9;
goto LABEL_25;
}
q_strupr(v6);
v12 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v12 + 3) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 766LL);
v13 = (_QWORD *)*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3);
*v13 = 0LL;
v13[1] = 0LL;
v13[2] = 0LL;
v13[3] = 0LL;
v13[4] = 0LL;
v13[5] = 0LL;
v13[6] = 0LL;
v13[7] = 0LL;
if ( !regcomp(*((regex_t **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3), v6, 0) )
{
v9 = maxlrcon_cmds[0];
v10 = *((_BYTE *)&lrconcmds + 32 * maxlrcon_cmds[0] + 16);
if ( v10 != 1 )
{
if ( v10 != 2 )
{
LABEL_9:
if ( !v10 )
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d SW:\"%s\" \"%s\" added\n",
(unsigned int)(v9 + 1),
*((const char **)&lrconcmds + 4 * v9 + 1),
*((const char **)&lrconcmds + 4 * v9));
goto LABEL_11;
}
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d RE:\"%s\" \"%s\" added\n",
(unsigned int)(maxlrcon_cmds[0] + 1),
*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1),
*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
LABEL_11:
result = maxlrcon_cmds;
++maxlrcon_cmds[0];
return result;
}
LABEL_25:
((void (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d EX:\"%s\" \"%s\" added\n",
(unsigned int)(v9 + 1),
*((const char **)&lrconcmds + 4 * v9 + 1),
*((const char **)&lrconcmds + 4 * v9));
goto LABEL_11;
}
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3));
*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3) = 0LL;
result = (int *)((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"Regular expression couldn't compile!\n");
}
return result;
}

original_code:
void lrconRun(int startarg, edict_t *ent, int client) {
    char *cmd;
    int len;
    if (maxlrcon_cmds >= 1024) {
        gi.cprintf(ent, 2, "Sorry, maximum number of lrcon's has been reached.\n");
        return;
    }
    if (gi.argc() <= startarg + 2) {
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    cmd = gi.argv(startarg);
    if (Q_stricmp(cmd, "SW") == 0) {
        lrconcmds[maxlrcon_cmds].type = 0;
    } else if (Q_stricmp(cmd, "EX") == 0) {
        lrconcmds[maxlrcon_cmds].type = 1;
    } else if (Q_stricmp(cmd, "RE") == 0) {
        lrconcmds[maxlrcon_cmds].type = 2;
    } else {
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    cmd = gi.argv(startarg + 1);
    if (isBlank(cmd)) {
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    len = strlen(cmd) + 1;
    lrconcmds[maxlrcon_cmds].password = gi.TagMalloc(len, 766);
    strcpy(lrconcmds[maxlrcon_cmds].password, cmd);
    cmd = gi.argv(startarg + 2);
    if (isBlank(cmd)) {
        gi.TagFree(lrconcmds[maxlrcon_cmds].password);
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    len = strlen(cmd) + 20;
    lrconcmds[maxlrcon_cmds].lrconcmd = gi.TagMalloc(len, 766);
    processstring(lrconcmds[maxlrcon_cmds].lrconcmd, cmd, len - 1, 0);
    if (lrconcmds[maxlrcon_cmds].type == 2) {
        q_strupr(cmd);
        lrconcmds[maxlrcon_cmds].r = gi.TagMalloc(sizeof (*lrconcmds[maxlrcon_cmds].r), 766);
        memset(lrconcmds[maxlrcon_cmds].r, 0x0, sizeof (*lrconcmds[maxlrcon_cmds].r));
        if (regcomp(lrconcmds[maxlrcon_cmds].r, cmd, 0)) {
            gi.TagFree(lrconcmds[maxlrcon_cmds].password);
            gi.TagFree(lrconcmds[maxlrcon_cmds].lrconcmd);
            gi.TagFree(lrconcmds[maxlrcon_cmds].r);
            lrconcmds[maxlrcon_cmds].r = 0;
            gi.cprintf(ent, 2, "Regular expression couldn't compile!\n");
            return;
        }
    } else {
        lrconcmds[maxlrcon_cmds].r = 0;
    }
    switch (lrconcmds[maxlrcon_cmds].type) {
        case 0:
            gi.cprintf(ent, 2, "%4d SW:\"%s\" \"%s\" added\n", maxlrcon_cmds + 1, lrconcmds[maxlrcon_cmds].password, lrconcmds[maxlrcon_cmds].lrconcmd);
            break;
        case 1:
            gi.cprintf(ent, 2, "%4d EX:\"%s\" \"%s\" added\n", maxlrcon_cmds + 1, lrconcmds[maxlrcon_cmds].password, lrconcmds[maxlrcon_cmds].lrconcmd);
            break;
        case 2:
            gi.cprintf(ent, 2, "%4d RE:\"%s\" \"%s\" added\n", maxlrcon_cmds + 1, lrconcmds[maxlrcon_cmds].password, lrconcmds[maxlrcon_cmds].lrconcmd);
            break;
    }
    maxlrcon_cmds++;
}

canonical_original_code:
void lrconRun(int startarg, struct edict_s *ent, int client) {
    char *cmd;
    int len;
    if (maxlrcon_cmds >= 1024) {
        gi.cprintf(ent, 2, "Sorry, maximum number of lrcon's has been reached.\n");
        return;
    }
    if (gi.argc() <= startarg + 2) {
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    cmd = gi.argv(startarg);
    if (Q_stricmp(cmd, "SW") == 0) {
        lrconcmds[maxlrcon_cmds].type = 0;
    } else if (Q_stricmp(cmd, "EX") == 0) {
        lrconcmds[maxlrcon_cmds].type = 1;
    } else if (Q_stricmp(cmd, "RE") == 0) {
        lrconcmds[maxlrcon_cmds].type = 2;
    } else {
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    cmd = gi.argv(startarg + 1);
    if (isBlank(cmd)) {
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    len = strlen(cmd) + 1;
    lrconcmds[maxlrcon_cmds].password = gi.TagMalloc(len, 766);
    strcpy(lrconcmds[maxlrcon_cmds].password, cmd);
    cmd = gi.argv(startarg + 2);
    if (isBlank(cmd)) {
        gi.TagFree(lrconcmds[maxlrcon_cmds].password);
        gi.cprintf(ent, 2, "[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n");
        return;
    }
    len = strlen(cmd) + 20;
    lrconcmds[maxlrcon_cmds].lrconcmd = gi.TagMalloc(len, 766);
    processstring(lrconcmds[maxlrcon_cmds].lrconcmd, cmd, len - 1, 0);
    if (lrconcmds[maxlrcon_cmds].type == 2) {
        q_strupr(cmd);
        lrconcmds[maxlrcon_cmds].r = gi.TagMalloc(sizeof (*lrconcmds[maxlrcon_cmds].r), 766);
        memset(lrconcmds[maxlrcon_cmds].r, 0x0, sizeof (*lrconcmds[maxlrcon_cmds].r));
        if (regcomp(lrconcmds[maxlrcon_cmds].r, cmd, 0)) {
            gi.TagFree(lrconcmds[maxlrcon_cmds].password);
            gi.TagFree(lrconcmds[maxlrcon_cmds].lrconcmd);
            gi.TagFree(lrconcmds[maxlrcon_cmds].r);
            lrconcmds[maxlrcon_cmds].r = 0;
            gi.cprintf(ent, 2, "Regular expression couldn't compile!\n");
            return;
        }
    } else {
        lrconcmds[maxlrcon_cmds].r = 0;
    }
    switch (lrconcmds[maxlrcon_cmds].type) {
        case 0:
            gi.cprintf(ent, 2, "%4d SW:\"%s\" \"%s\" added\n", maxlrcon_cmds + 1, lrconcmds[maxlrcon_cmds].password, lrconcmds[maxlrcon_cmds].lrconcmd);
            break;
        case 1:
            gi.cprintf(ent, 2, "%4d EX:\"%s\" \"%s\" added\n", maxlrcon_cmds + 1, lrconcmds[maxlrcon_cmds].password, lrconcmds[maxlrcon_cmds].lrconcmd);
            break;
        case 2:
            gi.cprintf(ent, 2, "%4d RE:\"%s\" \"%s\" added\n", maxlrcon_cmds + 1, lrconcmds[maxlrcon_cmds].password, lrconcmds[maxlrcon_cmds].lrconcmd);
            break;
    }
    maxlrcon_cmds++;
}

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


lrconDelRun

decompiled_code:
__int64 __fastcall lrconDelRun(int a1, __int64 a2)
{
const char *v2; // rax
int v3; // ebx
int v4; // er13
char *v5; // r12
regex_t *v6; // rdi
int v7; // er12

if ( ((int (*)(void))gi[39])() <= a1 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !lrcondel lrconnum\n");
v2 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)a1);
v3 = atoi(v2);
if ( v3 <= 0 || maxlrcon_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !lrcondel lrconnum\n");
v4 = v3 - 1;
v5 = (char *)&lrconcmds + 32 * v3 - 32;
gi[34](*((const char **)v5 + 1));
gi[34](*(const char **)v5);
v6 = (regex_t *)*((_QWORD *)v5 + 3);
if ( v6 )
{
regfree(v6);
gi[34](*((const char **)&lrconcmds + 4 * v4 + 3));
}
v7 = maxlrcon_cmds[0];
if ( maxlrcon_cmds[0] > v3 )
memmove((char *)&lrconcmds + 32 * v3 - 32, (char *)&lrconcmds + 32 * v3, 32LL * (maxlrcon_cmds[0] - v4));
maxlrcon_cmds[0] = v7 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "lrcon deleted\n");
}

canonical_decompiled_code:
__int64 __fastcall func11(int a1, __int64 a2)
{
const char *v2; // rax
int v3; // ebx
int v4; // er13
char *v5; // r12
regex_t *v6; // rdi
int v7; // er12

if ( ((int (*)(void))gi[39])() <= a1 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !lrcondel lrconnum\n");
v2 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])((unsigned int)a1);
v3 = atoi(v2);
if ( v3 <= 0 || maxlrcon_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !lrcondel lrconnum\n");
v4 = v3 - 1;
v5 = (char *)&lrconcmds + 32 * v3 - 32;
gi[34](*((const char **)v5 + 1));
gi[34](*(const char **)v5);
v6 = (regex_t *)*((_QWORD *)v5 + 3);
if ( v6 )
{
regfree(v6);
gi[34](*((const char **)&lrconcmds + 4 * v4 + 3));
}
v7 = maxlrcon_cmds[0];
if ( maxlrcon_cmds[0] > v3 )
memmove((char *)&lrconcmds + 32 * v3 - 32, (char *)&lrconcmds + 32 * v3, 32LL * (maxlrcon_cmds[0] - v4));
maxlrcon_cmds[0] = v7 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "lrcon deleted\n");
}

original_code:
void lrconDelRun(int startarg, edict_t *ent, int client) {
    int lrcon;
    if (gi.argc() <= startarg) {
        gi.cprintf(ent, 2, "[sv] !lrcondel lrconnum\n");
        return;
    }
    lrcon = atoi(gi.argv(startarg));
    if (lrcon < 1 || lrcon > maxlrcon_cmds) {
        gi.cprintf(ent, 2, "[sv] !lrcondel lrconnum\n");
        return;
    }
    lrcon--;
    gi.TagFree(lrconcmds[lrcon].password);
    gi.TagFree(lrconcmds[lrcon].lrconcmd);
    if (lrconcmds[lrcon].r) {
        regfree(lrconcmds[lrcon].r);
        gi.TagFree(lrconcmds[lrcon].r);
    }
    if (lrcon + 1 < maxlrcon_cmds) {
        memmove((lrconcmds + lrcon), (lrconcmds + lrcon + 1), sizeof (lrconcmd_t) * (maxlrcon_cmds - lrcon));
    }
    maxlrcon_cmds--;
    gi.cprintf(ent, 2, "lrcon deleted\n");
}

canonical_original_code:
void lrconDelRun(int startarg, struct edict_s *ent, int client) {
    int lrcon;
    if (gi.argc() <= startarg) {
        gi.cprintf(ent, 2, "[sv] !lrcondel lrconnum\n");
        return;
    }
    lrcon = atoi(gi.argv(startarg));
    if (lrcon < 1 || lrcon > maxlrcon_cmds) {
        gi.cprintf(ent, 2, "[sv] !lrcondel lrconnum\n");
        return;
    }
    lrcon--;
    gi.TagFree(lrconcmds[lrcon].password);
    gi.TagFree(lrconcmds[lrcon].lrconcmd);
    if (lrconcmds[lrcon].r) {
        regfree(lrconcmds[lrcon].r);
        gi.TagFree(lrconcmds[lrcon].r);
    }
    if (lrcon + 1 < maxlrcon_cmds) {
        memmove((lrconcmds + lrcon), (lrconcmds + lrcon + 1), sizeof (lrconcmd_t) * (maxlrcon_cmds - lrcon));
    }
    maxlrcon_cmds--;
    gi.cprintf(ent, 2, "lrcon deleted\n");
}

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


getCommandFromQueue

original_code:
qboolean getCommandFromQueue(int client, byte *command, unsigned long *data, char **str) {
    unsigned int i;
    for (i = 0; i < proxyinfo[client].maxCmds; i++) {
        if (proxyinfo[client].cmdQueue[i].timeout < ltime) {
            *command = proxyinfo[client].cmdQueue[i].command;
            *data = proxyinfo[client].cmdQueue[i].data;
            if (str) {
                *str = proxyinfo[client].cmdQueue[i].str;
            }
            proxyinfo[client].maxCmds--;
            if (i < proxyinfo[client].maxCmds) {
                memmove(
                    proxyinfo[client].cmdQueue + i,
                    proxyinfo[client].cmdQueue + i + 1,
                    (proxyinfo[client].maxCmds - i) * sizeof (cmd_queue_t)
                );
            }
            return 1;
        }
    }
    return 0;
}

canonical_original_code:
enum qboolean getCommandFromQueue(int client, unsigned char *command, unsigned long *data, char **str) {
    unsigned int i;
    for (i = 0; i < proxyinfo[client].maxCmds; i++) {
        if (proxyinfo[client].cmdQueue[i].timeout < ltime) {
            *command = proxyinfo[client].cmdQueue[i].command;
            *data = proxyinfo[client].cmdQueue[i].data;
            if (str) {
                *str = proxyinfo[client].cmdQueue[i].str;
            }
            proxyinfo[client].maxCmds--;
            if (i < proxyinfo[client].maxCmds) {
                memmove(
                    proxyinfo[client].cmdQueue + i,
                    proxyinfo[client].cmdQueue + i + 1,
                    (proxyinfo[client].maxCmds - i) * sizeof (cmd_queue_t)
                );
            }
            return 1;
        }
    }
    return 0;
}

variable_types:
command
unsigned char *

variable_types:
data
unsigned long *

variable_types:
str
char **


removeClientCommand

decompiled_code:
__int64 __fastcall removeClientCommand(int a1, char a2)
{
__int64 v2; // rbp
__int64 v3; // rdx
__int64 result; // rax
unsigned int v6; // ebx
unsigned int v7; // eax
char *v8; // rsi

v2 = 13496LL * a1;
v3 = proxyinfo + v2;
result = *(unsigned int *)(proxyinfo + v2 + 1208);
if ( (_DWORD)result )
{
v6 = 0;
do
{
if ( *(_BYTE *)(v3 + 24LL * v6 + 8) == a2 )
{
v7 = result - 1;
*(_DWORD *)(v3 + 1208) = v7;
if ( v7 > v6 )
{
v8 = (char *)(v3 + 8 + 8 * (3LL * v6 + 3));
memmove(v8 - 24, v8, 24LL * (v7 - v6));
}
}
else
{
++v6;
}
v3 = proxyinfo + v2;
result = *(unsigned int *)(proxyinfo + v2 + 1208);
}
while ( v6 < (unsigned int)result );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, char a2)
{
__int64 v2; // rbp
__int64 v3; // rdx
__int64 result; // rax
unsigned int v6; // ebx
unsigned int v7; // eax
char *v8; // rsi

v2 = 13496LL * a1;
v3 = proxyinfo + v2;
result = *(unsigned int *)(proxyinfo + v2 + 1208);
if ( (_DWORD)result )
{
v6 = 0;
do
{
if ( *(_BYTE *)(v3 + 24LL * v6 + 8) == a2 )
{
v7 = result - 1;
*(_DWORD *)(v3 + 1208) = v7;
if ( v7 > v6 )
{
v8 = (char *)(v3 + 8 + 8 * (3LL * v6 + 3));
memmove(v8 - 24, v8, 24LL * (v7 - v6));
}
}
else
{
++v6;
}
v3 = proxyinfo + v2;
result = *(unsigned int *)(proxyinfo + v2 + 1208);
}
while ( v6 < (unsigned int)result );
}
return result;
}

original_code:
void removeClientCommand(int client, byte command) {
    unsigned int i = 0;
    while (i < proxyinfo[client].maxCmds) {
        if (proxyinfo[client].cmdQueue[i].command == command) {
            proxyinfo[client].maxCmds--;
            if (i < proxyinfo[client].maxCmds) {
                memmove(proxyinfo[client].cmdQueue + i, proxyinfo[client].cmdQueue + i + 1, (proxyinfo[client].maxCmds - i) * sizeof (cmd_queue_t));
            }
        } else {
            i++;
        }
    }
}

canonical_original_code:
void removeClientCommand(int client, unsigned char command) {
    unsigned int i = 0;
    while (i < proxyinfo[client].maxCmds) {
        if (proxyinfo[client].cmdQueue[i].command == command) {
            proxyinfo[client].maxCmds--;
            if (i < proxyinfo[client].maxCmds) {
                memmove(proxyinfo[client].cmdQueue + i, proxyinfo[client].cmdQueue + i + 1, (proxyinfo[client].maxCmds - i) * sizeof (cmd_queue_t));
            }
        } else {
            i++;
        }
    }
}

variable_types: client int

variable_types:
command
unsigned char