hexDump

decompiled_code:
int __fastcall hexDump(const char *a1, __int64 a2, int a3)
{
__int64 v4; // r14
char v5; // cl
int v6; // eax
char v8[88]; // [rsp+10h] [rbp-58h] BYREF

if ( a1 )
printf("%s:\n", a1);
if ( !a3 )
return puts(" ZERO LENGTH");
if ( a3 < 0 )
return printf(" NEGATIVE LENGTH: %i\n", (unsigned int)a3);
v4 = 0LL;
do
{
if ( (v4 & 0xF) == 0 )
{
if ( v4 )
printf(" %s\n", v8);
printf(" %04x ", (unsigned int)v4);
}
printf(" %02x", *(unsigned __int8 *)(a2 + v4));
v5 = *(_BYTE *)(a2 + v4);
v6 = v4 & 0xF;
if ( (unsigned __int8)(v5 - 32) > 0x5Eu )
v8[v4 & 0xF] = 46;
else
v8[v4 & 0xF] = v5;
++v4;
v8[v6 + 1] = 0;
}
while ( a3 != v4 );
while ( (a3 & 0xF) != 0 )
{
++a3;
printf(" ");
}
return printf(" %s\n", v8);
}

canonical_decompiled_code:
int __fastcall func6(const char *a1, __int64 a2, int a3)
{
__int64 v4; // r14
char v5; // cl
int v6; // eax
char v8[88]; // [rsp+10h] [rbp-58h] BYREF

if ( a1 )
printf("%s:\n", a1);
if ( !a3 )
return puts(" ZERO LENGTH");
if ( a3 < 0 )
return printf(" NEGATIVE LENGTH: %i\n", (unsigned int)a3);
v4 = 0LL;
do
{
if ( (v4 & 0xF) == 0 )
{
if ( v4 )
printf(" %s\n", v8);
printf(" %04x ", (unsigned int)v4);
}
printf(" %02x", *(unsigned __int8 *)(a2 + v4));
v5 = *(_BYTE *)(a2 + v4);
v6 = v4 & 0xF;
if ( (unsigned __int8)(v5 - 32) > 0x5Eu )
v8[v4 & 0xF] = 46;
else
v8[v4 & 0xF] = v5;
++v4;
v8[v6 + 1] = 0;
}
while ( a3 != v4 );
while ( (a3 & 0xF) != 0 )
{
++a3;
printf(" ");
}
return printf(" %s\n", v8);
}

original_code:
void hexDump (char *desc, void *addr, int len)
{
    int i;
    unsigned char buff[17];
    unsigned char *pc = (unsigned char*)addr;
    if (desc != ((void *)0))
        printf ("%s:\n", desc);
    if (len == 0) {
        printf("  ZERO LENGTH\n");
        return;
    }
    if (len < 0) {
        printf("  NEGATIVE LENGTH: %i\n",len);
        return;
    }
    for (i = 0; i < len; i++) {
        if ((i % 16) == 0) {
            if (i != 0)
                printf ("  %s\n", buff);
            printf ("  %04x ", i);
        }
        printf (" %02x", pc[i]);
        if ((pc[i] < 0x20) || (pc[i] > 0x7e))
            buff[i % 16] = '.';
        else
            buff[i % 16] = pc[i];
        buff[(i % 16) + 1] = '\0';
    }
    while ((i % 16) != 0) {
        printf ("   ");
        i++;
    }
    printf ("  %s\n", buff);
}

canonical_original_code:
void hexDump(char *desc, void *addr, int len)
{
    int i;
    unsigned char buff[17];
    unsigned char *pc = (unsigned char*)addr;
    if (desc != ((void *)0))
        printf ("%s:\n", desc);
    if (len == 0) {
        printf("  ZERO LENGTH\n");
        return;
    }
    if (len < 0) {
        printf("  NEGATIVE LENGTH: %i\n",len);
        return;
    }
    for (i = 0; i < len; i++) {
        if ((i % 16) == 0) {
            if (i != 0)
                printf ("  %s\n", buff);
            printf ("  %04x ", i);
        }
        printf (" %02x", pc[i]);
        if ((pc[i] < 0x20) || (pc[i] > 0x7e))
            buff[i % 16] = '.';
        else
            buff[i % 16] = pc[i];
        buff[(i % 16) + 1] = '\0';
    }
    while ((i % 16) != 0) {
        printf ("   ");
        i++;
    }
    printf ("  %s\n", buff);
}

variable_types:
desc
char *

variable_types:
addr
void *

variable_types: len int

variable_types: i int

variable_types:
buff
unsigned char [17]

variable_types:
pc
unsigned char *


decompiled_code:
__int64 __fastcall G_SHA256Hash(__m128i *a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
__m128i v5; // xmm1
__m128i v6; // [rsp+0h] [rbp-B8h] BYREF
__m128i v7; // [rsp+10h] [rbp-A8h] BYREF
char v8[152]; // [rsp+20h] [rbp-98h] BYREF

SHA256_Init(v8);
SHA256_Update(v8, a2, a3);
result = SHA256_Final(&v6, v8);
v5 = _mm_loadu_si128(&v7);
*a1 = _mm_loadu_si128(&v6);
a1[1] = v5;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__m128i *a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
__m128i v5; // xmm1
__m128i v6; // [rsp+0h] [rbp-B8h] BYREF
__m128i v7; // [rsp+10h] [rbp-A8h] BYREF
char v8[152]; // [rsp+20h] [rbp-98h] BYREF

SHA256_Init(v8);
SHA256_Update(v8, a2, a3);
result = SHA256_Final(&v6, v8);
v5 = _mm_loadu_si128(&v7);
*a1 = _mm_loadu_si128(&v6);
a1[1] = v5;
return result;
}

original_code:
void G_SHA256Hash(byte *dest, byte *src, size_t src_len)
{
    byte hash[32];
    SHA256_CTX sha256;
    SHA256_Init(&sha256);
    SHA256_Update(&sha256, src, src_len);
    SHA256_Final(hash, &sha256);
    memcpy(dest, hash, 32);
}

canonical_original_code:
void G_SHA256Hash(unsigned char *dest, unsigned char *src, unsigned long src_len)
{
    unsigned char hash[32];
    struct SHA256state_st sha256;
    SHA256_Init(&sha256);
    SHA256_Update(&sha256, src, src_len);
    SHA256_Final(hash, &sha256);
    memcpy(dest, hash, 32);
}

variable_types:
dest
unsigned char *

variable_types:
src
unsigned char *

variable_types:
hash
unsigned char [32]

variable_types: struct SHA256state_st { unsigned int h[8]; unsigned int Nl; unsigned int data[16]; unsigned int num; }

return_type: void


freeSpawnLists

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

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

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

LABEL_1:
result = (unsigned int)maxspawn_cmds[0];
while ( (_DWORD)result )
{
maxspawn_cmds[0] = result - 1;
gi[34](*((const char **)&spawncmds + 3 * (int)result - 3));
result = maxspawn_cmds[0];
v1 = (regex_t *)*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2);
if ( v1 )
{
regfree(v1);
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0] + 2));
goto LABEL_1;
}
}
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:
__int64 freeOneLevelSpawnLists()
{
int v0; // ebp
regex_t *v1; // rdi
int v2; // ebx
__int64 result; // rax
int v4; // er15
char *v5; // rbx
char *v6; // rsi

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

canonical_decompiled_code:
__int64 func2()
{
int v0; // ebp
regex_t *v1; // rdi
int v2; // ebx
__int64 result; // rax
int v4; // er15
char *v5; // rbx
char *v6; // rsi

if ( maxspawn_cmds[0] > 0 )
{
v0 = 0;
do
{
while ( 1 )
{
v4 = v0 + 1;
v5 = (char *)&spawncmds + 24 * v0;
if ( *((_DWORD *)v5 + 3) )
break;
result = (unsigned int)maxspawn_cmds[0];
++v0;
if ( v4 >= maxspawn_cmds[0] )
return result;
}
gi[34](*(const char **)v5);
v1 = (regex_t *)*((_QWORD *)v5 + 2);
if ( v1 )
{
regfree(v1);
gi[34](*((const char **)v5 + 2));
}
v2 = maxspawn_cmds[0];
if ( maxspawn_cmds[0] > v4 )
{
v6 = (char *)&spawncmds + 24 * v0 + 24;
memmove(v6 - 24, v6, 24LL * (maxspawn_cmds[0] - v0));
}
result = (unsigned int)(v2 - 1);
maxspawn_cmds[0] = result;
}
while ( v0 < (int)result );
}
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


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)
{
_QWORD *v2; // rax
char v3; // dl

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

canonical_decompiled_code:
__int64 __fastcall func5(char *string, int a2)
{
_QWORD *v2; // rax
char v3; // dl

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

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

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

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

strncpy(&buffer, src, 0x10000uLL);
q_strupr(&buffer);
if ( !maxspawn_cmds[0] )
return 0LL;
v1 = 0;
while ( !(unsigned int)func5(&buffer, v1) )
{
if ( maxspawn_cmds[0] <= (unsigned int)++v1 )
return 0LL;
}
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)
{
__int64 v3; // r12
const char **v4; // rax
char v5; // cl

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

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, unsigned int a2, __int64 a3)
{
__int64 v3; // r12
const char **v4; // rax
char v5; // cl

if ( maxspawn_cmds[0] <= a3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "End disbled-entities List\n");
v3 = a3 + 1;
v4 = (const char **)((char *)&spawncmds + 24 * a3);
v5 = *((_BYTE *)v4 + 8);
switch ( v5 )
{
case 1:
((void (*)(__int64, __int64, const char *, ...))gi[2])(a1, 2LL, "%4d EX:\"%s\"\n", a3 + 1, *v4);
break;
case 2:
((void (*)(__int64, __int64, const char *, ...))gi[2])(a1, 2LL, "%4d RE:\"%s\"\n", a3 + 1, *v4);
break;
case 0:
((void (*)(__int64, __int64, const char *, ...))gi[2])(a1, 2LL, "%4d SW:\"%s\"\n", a3 + 1, *v4);
break;
}
return addCmdQueue(a2, 25LL, v3, 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:
__int64 __fastcall spawncmdRun(unsigned int a1, __int64 a2)
{
__int64 v3; // rbp
__int64 v4; // rax
const char *v5; // r14
int v6; // eax
__int64 v7; // r15
__int64 result; // rax
int v9; // ecx
char *v10; // rdx
char v11; // dl
__int64 v12; // rcx
const char *v13; // rdx
__int64 v14; // r8
int v15; // er15
_OWORD *v16; // rax
bool v17; // zf
char *v18; // rsi
void (*v19)(const char *, ...); // rcx
int v20; // [rsp+8h] [rbp-40h]

if ( maxspawn_cmds[0] > 49 )
return ((__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 ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v3 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v3, "SW") )
{
if ( (unsigned int)Q_stricmp(v3, "EX") )
{
if ( (unsigned int)Q_stricmp(v3, "RE") )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v4 = maxspawn_cmds[0];
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 2;
}
else
{
v4 = maxspawn_cmds[0];
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 1;
}
}
else
{
v4 = maxspawn_cmds[0];
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 0;
}
*((_DWORD *)&spawncmds + 6 * v4 + 3) = 0;
v5 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v5) )
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(a2, 2LL, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v6 = strlen(v5);
v7 = maxspawn_cmds[0];
v20 = v6;
*((_QWORD *)&spawncmds + 3 * v7) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v6 + 20), 765LL);
processstring(*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0]), v5, (unsigned int)(v20 + 19), 0LL);
result = maxspawn_cmds[0];
v9 = maxspawn_cmds[0];
v10 = (char *)&spawncmds + 24 * maxspawn_cmds[0];
if ( v10[8] != 2 )
{
*((_QWORD *)v10 + 2) = 0LL;
v11 = v10[8];
v12 = (unsigned int)(v9 + 1);
if ( v11 != 1 )
{
LABEL_8:
if ( v11 )
{
LABEL_9:
maxspawn_cmds[0] = v12;
return result;
}
v13 = "%4d SW:\"%s\" added\n";
v14 = *((_QWORD *)&spawncmds + 3 * result);
LABEL_14:
result = ((__int64 (__fastcall *)(__int64, __int64, const char *, __int64, __int64))gi[2])(a2, 2LL, v13, v12, v14);
LODWORD(v12) = maxspawn_cmds[0] + 1;
goto LABEL_9;
}
goto LABEL_15;
}
q_strupr(v5);
v15 = maxspawn_cmds[0];
*((_QWORD *)&spawncmds + 3 * v15 + 2) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 765LL);
v16 = (_OWORD *)*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2);
*v16 = 0LL;
v16[1] = 0LL;
v16[2] = 0LL;
v16[3] = 0LL;
v17 = regcomp(*((regex_t **)&spawncmds + 3 * maxspawn_cmds[0] + 2), v5, 0) == 0;
result = maxspawn_cmds[0];
if ( v17 )
{
v18 = (char *)&spawncmds + 24 * maxspawn_cmds[0];
v12 = (unsigned int)(maxspawn_cmds[0] + 1);
v11 = v18[8];
if ( v11 != 1 )
{
if ( v11 == 2 )
{
v14 = *(_QWORD *)v18;
v13 = "%4d RE:\"%s\" added\n";
goto LABEL_14;
}
goto LABEL_8;
}
LABEL_15:
v13 = "%4d EX:\"%s\" added\n";
v14 = *((_QWORD *)&spawncmds + 3 * result);
goto LABEL_14;
}
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0]));
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0] + 2));
v19 = gi[2];
*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2) = 0LL;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))v19)(
a2,
2LL,
"Regular expression couldn't compile!\n");
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned int a1, __int64 a2)
{
__int64 v3; // rbp
__int64 v4; // rax
const char *v5; // r14
int v6; // eax
__int64 v7; // r15
__int64 result; // rax
int v9; // ecx
char *v10; // rdx
char v11; // dl
__int64 v12; // rcx
const char *v13; // rdx
__int64 v14; // r8
int v15; // er15
_OWORD *v16; // rax
bool v17; // zf
char *v18; // rsi
void (*v19)(const char *, ...); // rcx
int v20; // [rsp+8h] [rbp-40h]

if ( maxspawn_cmds[0] > 49 )
return ((__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 ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v3 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v3, "SW") )
{
if ( (unsigned int)Q_stricmp(v3, "EX") )
{
if ( (unsigned int)Q_stricmp(v3, "RE") )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(
a2,
2LL,
"[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v4 = maxspawn_cmds[0];
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 2;
}
else
{
v4 = maxspawn_cmds[0];
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 1;
}
}
else
{
v4 = maxspawn_cmds[0];
*((_BYTE *)&spawncmds + 24 * maxspawn_cmds[0] + 8) = 0;
}
*((_DWORD *)&spawncmds + 6 * v4 + 3) = 0;
v5 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
if ( (unsigned int)isBlank(v5) )
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))gi[2])(a2, 2LL, "[sv] !spawncmd [SW/EX/RE] \"command\"\n");
v6 = strlen(v5);
v7 = maxspawn_cmds[0];
v20 = v6;
*((_QWORD *)&spawncmds + 3 * v7) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v6 + 20), 765LL);
processstring(*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0]), v5, (unsigned int)(v20 + 19), 0LL);
result = maxspawn_cmds[0];
v9 = maxspawn_cmds[0];
v10 = (char *)&spawncmds + 24 * maxspawn_cmds[0];
if ( v10[8] != 2 )
{
*((_QWORD *)v10 + 2) = 0LL;
v11 = v10[8];
v12 = (unsigned int)(v9 + 1);
if ( v11 != 1 )
{
LABEL_8:
if ( v11 )
{
LABEL_9:
maxspawn_cmds[0] = v12;
return result;
}
v13 = "%4d SW:\"%s\" added\n";
v14 = *((_QWORD *)&spawncmds + 3 * result);
LABEL_14:
result = ((__int64 (__fastcall *)(__int64, __int64, const char *, __int64, __int64))gi[2])(a2, 2LL, v13, v12, v14);
LODWORD(v12) = maxspawn_cmds[0] + 1;
goto LABEL_9;
}
goto LABEL_15;
}
q_strupr(v5);
v15 = maxspawn_cmds[0];
*((_QWORD *)&spawncmds + 3 * v15 + 2) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 765LL);
v16 = (_OWORD *)*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2);
*v16 = 0LL;
v16[1] = 0LL;
v16[2] = 0LL;
v16[3] = 0LL;
v17 = regcomp(*((regex_t **)&spawncmds + 3 * maxspawn_cmds[0] + 2), v5, 0) == 0;
result = maxspawn_cmds[0];
if ( v17 )
{
v18 = (char *)&spawncmds + 24 * maxspawn_cmds[0];
v12 = (unsigned int)(maxspawn_cmds[0] + 1);
v11 = v18[8];
if ( v11 != 1 )
{
if ( v11 == 2 )
{
v14 = *(_QWORD *)v18;
v13 = "%4d RE:\"%s\" added\n";
goto LABEL_14;
}
goto LABEL_8;
}
LABEL_15:
v13 = "%4d EX:\"%s\" added\n";
v14 = *((_QWORD *)&spawncmds + 3 * result);
goto LABEL_14;
}
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0]));
gi[34](*((const char **)&spawncmds + 3 * maxspawn_cmds[0] + 2));
v19 = gi[2];
*((_QWORD *)&spawncmds + 3 * maxspawn_cmds[0] + 2) = 0LL;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))v19)(
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; // eax
__int64 v4; // rbp
int v5; // er15
const char **v6; // r14
regex_t *v7; // rdi
int v8; // ecx
int v10; // [rsp+Ch] [rbp-3Ch]

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);
v4 = v3;
if ( v3 <= 0 || maxspawn_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !spawndel spawnnum\n");
v5 = v3 - 1;
v6 = (const char **)((char *)&spawncmds + 24 * v3 - 24);
gi[34](*v6);
v7 = (regex_t *)v6[2];
if ( v7 )
{
regfree(v7);
gi[34](v6[2]);
}
v8 = maxspawn_cmds[0];
if ( maxspawn_cmds[0] > (int)v4 )
{
v10 = maxspawn_cmds[0];
memmove((char *)&spawncmds + 24 * v4 - 24, (char *)&spawncmds + 24 * v4, 24LL * (maxspawn_cmds[0] - v5));
v8 = v10;
}
maxspawn_cmds[0] = v8 - 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; // eax
__int64 v4; // rbp
int v5; // er15
const char **v6; // r14
regex_t *v7; // rdi
int v8; // ecx
int v10; // [rsp+Ch] [rbp-3Ch]

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);
v4 = v3;
if ( v3 <= 0 || maxspawn_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !spawndel spawnnum\n");
v5 = v3 - 1;
v6 = (const char **)((char *)&spawncmds + 24 * v3 - 24);
gi[34](*v6);
v7 = (regex_t *)v6[2];
if ( v7 )
{
regfree(v7);
gi[34](v6[2]);
}
v8 = maxspawn_cmds[0];
if ( maxspawn_cmds[0] > (int)v4 )
{
v10 = maxspawn_cmds[0];
memmove((char *)&spawncmds + 24 * v4 - 24, (char *)&spawncmds + 24 * v4, 24LL * (maxspawn_cmds[0] - v5));
v8 = v10;
}
maxspawn_cmds[0] = v8 - 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 *)(entity_classname_offset + a1) = 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 *)(entity_classname_offset + a1) = 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

LABEL_1:
result = (unsigned int)maxlrcon_cmds[0];
while ( (_DWORD)result )
{
maxlrcon_cmds[0] = result - 1;
gi[34](*((const char **)&lrconcmds + 4 * (int)result - 3));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
result = 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));
goto LABEL_1;
}
}
return result;
}

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

LABEL_1:
result = (unsigned int)maxlrcon_cmds[0];
while ( (_DWORD)result )
{
maxlrcon_cmds[0] = result - 1;
gi[34](*((const char **)&lrconcmds + 4 * (int)result - 3));
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0]));
result = 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));
goto LABEL_1;
}
}
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)
{
_QWORD *v2; // rbx
char v3; // al
__int64 result; // rax
__int64 v5; // rdx
char v6[280]; // [rsp+0h] [rbp-118h] BYREF

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

canonical_decompiled_code:
__int64 __fastcall func4(char *src, int a2)
{
_QWORD *v2; // rbx
char v3; // al
__int64 result; // rax
__int64 v5; // rdx
char v6[280]; // [rsp+0h] [rbp-118h] BYREF

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

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)
{
unsigned int v2; // er14
_BYTE **v3; // r13
char *v4; // r15
char v5; // al
char *v6; // r12
_BYTE *v7; // rdx
char v9; // al
char v10[88]; // [rsp+20h] [rbp-58h] BYREF

if ( maxlrcon_cmds[0] )
{
v2 = 0;
v3 = (_BYTE **)((char *)&lrconcmds + 8);
do
{
v4 = (char *)((__int64 (*)(void))gi[41])();
v5 = *v4;
v6 = v4;
if ( *v4 == 9 || v5 == 32 )
{
do
{
do
v5 = *++v6;
while ( v5 == 32 );
}
while ( v5 == 9 );
}
v7 = *v3;
if ( (v5 & 0xDF) != 0 )
{
while ( *v7 == v5 )
{
v5 = *++v6;
++v7;
if ( (v5 & 0xDF) == 0 )
{
if ( *v7 || v5 != 32 )
break;
do
{
do
v9 = *++v6;
while ( v9 == 32 );
}
while ( v9 == 9 );
if ( !v9 || !(unsigned int)checklrcon(v6, v2) || strchr(v6, 59) || strchr(v6, 10) )
break;
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, v6);
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), v6);
}
stuffcmd(a1, &buffer);
}
else
{
Q_snprintf(&buffer, 0x10000LL, "%s\n", v6);
gi[42](&buffer);
}
return logEvent(11LL, a2, a1, v4, 0LL, 0.0);
}
}
}
++v2;
v3 += 4;
}
while ( maxlrcon_cmds[0] > v2 );
}
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "Unknown lrcon command\n");
}

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

if ( maxlrcon_cmds[0] )
{
v2 = 0;
v3 = (_BYTE **)((char *)&lrconcmds + 8);
do
{
v4 = (char *)((__int64 (*)(void))gi[41])();
v5 = *v4;
v6 = v4;
if ( *v4 == 9 || v5 == 32 )
{
do
{
do
v5 = *++v6;
while ( v5 == 32 );
}
while ( v5 == 9 );
}
v7 = *v3;
if ( (v5 & 0xDF) != 0 )
{
while ( *v7 == v5 )
{
v5 = *++v6;
++v7;
if ( (v5 & 0xDF) == 0 )
{
if ( *v7 || v5 != 32 )
break;
do
{
do
v9 = *++v6;
while ( v9 == 32 );
}
while ( v9 == 9 );
if ( !v9 || !(unsigned int)func4(v6, v2) || strchr(v6, 59) || strchr(v6, 10) )
break;
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, v6);
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), v6);
}
stuffcmd(a1, &buffer);
}
else
{
Q_snprintf(&buffer, 0x10000LL, "%s\n", v6);
gi[42](&buffer);
}
return logEvent(11LL, a2, a1, v4, 0LL, 0.0);
}
}
}
++v2;
v3 += 4;
}
while ( maxlrcon_cmds[0] > v2 );
}
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a1, 2LL, "Unknown lrcon command\n");
}

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

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:
__int64 __fastcall lrconRun(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
char *v6; // r8
__int64 v7; // r14
int v8; // eax
int v9; // eax
__int64 v10; // rbx
const char *v11; // r15
int v12; // eax
__int64 v13; // rbx
__int64 v14; // rdx
int v15; // ecx
char *v16; // rax
__int64 result; // rax
__int64 v18; // rcx
__int64 *v19; // r14
const char *v20; // rdx
__int64 v21; // r9
__int64 v22; // r8
__int64 v23; // rbx
_OWORD *v24; // rax
char *v25; // rsi
void (*v26)(const char *, ...); // rcx
__int64 v27; // r8
char *s; // [rsp+8h] [rbp-40h]
int sa; // [rsp+8h] [rbp-40h]

if ( maxlrcon_cmds[0] > 1023 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), __int64))gi[2])(
a2,
2LL,
"Sorry, maximum number of lrcon's has been reached.\n",
gi[2],
a5);
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 2) )
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
v7 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v7, "SW") )
{
if ( (unsigned int)Q_stricmp(v7, "EX") )
{
if ( (unsigned int)Q_stricmp(v7, "RE") )
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
*((_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;
}
s = (char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
v8 = isBlank(s);
v6 = s;
if ( v8 )
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
v9 = strlen(s);
v10 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v10 + 1) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])(
(unsigned int)(v9 + 1),
766LL);
strcpy(*((char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1), s);
v11 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 2);
if ( (unsigned int)isBlank(v11) )
{
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1));
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
}
v12 = strlen(v11);
v13 = maxlrcon_cmds[0];
sa = v12;
*((_QWORD *)&lrconcmds + 4 * v13) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v12 + 20), 766LL);
processstring(*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0]), v11, (unsigned int)(sa + 19), 0LL);
v14 = maxlrcon_cmds[0];
v15 = maxlrcon_cmds[0];
v16 = (char *)&lrconcmds + 32 * maxlrcon_cmds[0];
if ( v16[16] != 2 )
{
*((_QWORD *)v16 + 3) = 0LL;
result = (unsigned __int8)v16[16];
v18 = (unsigned int)(v15 + 1);
if ( (_BYTE)result != 1 )
goto LABEL_9;
goto LABEL_19;
}
q_strupr(v11, v11, maxlrcon_cmds[0]);
v23 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v23 + 3) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 766LL);
v24 = (_OWORD *)*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3);
*v24 = 0LL;
v24[1] = 0LL;
v24[2] = 0LL;
v24[3] = 0LL;
if ( !regcomp(*((regex_t **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3), v11, 0) )
{
v14 = maxlrcon_cmds[0];
v18 = (unsigned int)(maxlrcon_cmds[0] + 1);
v25 = (char *)&lrconcmds + 32 * maxlrcon_cmds[0];
result = (unsigned __int8)v25[16];
if ( (_BYTE)result != 1 )
{
if ( (_BYTE)result != 2 )
{
LABEL_9:
if ( !(_BYTE)result )
{
result = ((__int64 (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d SW:\"%s\" \"%s\" added\n",
v18,
*((const char **)&lrconcmds + 4 * v14 + 1),
*((const char **)&lrconcmds + 4 * v14));
LODWORD(v18) = maxlrcon_cmds[0] + 1;
}
goto LABEL_11;
}
v21 = *(_QWORD *)v25;
v22 = *((_QWORD *)v25 + 1);
v20 = "%4d RE:\"%s\" \"%s\" added\n";
LABEL_20:
result = ((__int64 (__fastcall *)(__int64, __int64, const char *, __int64, __int64, __int64))gi[2])(
a2,
2LL,
v20,
v18,
v22,
v21);
LODWORD(v18) = maxlrcon_cmds[0] + 1;
LABEL_11:
maxlrcon_cmds[0] = v18;
return result;
}
LABEL_19:
v19 = (__int64 *)((char *)&lrconcmds + 32 * v14);
v20 = "%4d EX:\"%s\" \"%s\" added\n";
v21 = *v19;
v22 = v19[1];
goto LABEL_20;
}
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));
v26 = gi[2];
*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3) = 0LL;
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), __int64))v26)(
a2,
2LL,
"Regular expression couldn't compile!\n",
v26,
v27);
}

canonical_decompiled_code:
__int64 __fastcall func10(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
char *v6; // r8
__int64 v7; // r14
int v8; // eax
int v9; // eax
__int64 v10; // rbx
const char *v11; // r15
int v12; // eax
__int64 v13; // rbx
__int64 v14; // rdx
int v15; // ecx
char *v16; // rax
__int64 result; // rax
__int64 v18; // rcx
__int64 *v19; // r14
const char *v20; // rdx
__int64 v21; // r9
__int64 v22; // r8
__int64 v23; // rbx
_OWORD *v24; // rax
char *v25; // rsi
void (*v26)(const char *, ...); // rcx
__int64 v27; // r8
char *s; // [rsp+8h] [rbp-40h]
int sa; // [rsp+8h] [rbp-40h]

if ( maxlrcon_cmds[0] > 1023 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), __int64))gi[2])(
a2,
2LL,
"Sorry, maximum number of lrcon's has been reached.\n",
gi[2],
a5);
if ( ((int (*)(void))gi[39])() <= (int)(a1 + 2) )
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
v7 = ((__int64 (__fastcall *)(_QWORD))gi[40])(a1);
if ( (unsigned int)Q_stricmp(v7, "SW") )
{
if ( (unsigned int)Q_stricmp(v7, "EX") )
{
if ( (unsigned int)Q_stricmp(v7, "RE") )
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), char *))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
*((_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;
}
s = (char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 1);
v8 = isBlank(s);
v6 = s;
if ( v8 )
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
v9 = strlen(s);
v10 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v10 + 1) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])(
(unsigned int)(v9 + 1),
766LL);
strcpy(*((char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1), s);
v11 = (const char *)((__int64 (__fastcall *)(_QWORD))gi[40])(a1 + 2);
if ( (unsigned int)isBlank(v11) )
{
gi[34](*((const char **)&lrconcmds + 4 * maxlrcon_cmds[0] + 1));
return ((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD))gi[2])(
a2,
2LL,
"[sv] !lrcon [SW/EX/RE] \"password\" \"command\"\n",
gi[2],
v6);
}
v12 = strlen(v11);
v13 = maxlrcon_cmds[0];
sa = v12;
*((_QWORD *)&lrconcmds + 4 * v13) = ((__int64 (__fastcall *)(_QWORD, __int64))gi[33])((unsigned int)(v12 + 20), 766LL);
processstring(*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0]), v11, (unsigned int)(sa + 19), 0LL);
v14 = maxlrcon_cmds[0];
v15 = maxlrcon_cmds[0];
v16 = (char *)&lrconcmds + 32 * maxlrcon_cmds[0];
if ( v16[16] != 2 )
{
*((_QWORD *)v16 + 3) = 0LL;
result = (unsigned __int8)v16[16];
v18 = (unsigned int)(v15 + 1);
if ( (_BYTE)result != 1 )
goto LABEL_9;
goto LABEL_19;
}
q_strupr(v11, v11, maxlrcon_cmds[0]);
v23 = maxlrcon_cmds[0];
*((_QWORD *)&lrconcmds + 4 * v23 + 3) = ((__int64 (__fastcall *)(__int64, __int64))gi[33])(64LL, 766LL);
v24 = (_OWORD *)*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3);
*v24 = 0LL;
v24[1] = 0LL;
v24[2] = 0LL;
v24[3] = 0LL;
if ( !regcomp(*((regex_t **)&lrconcmds + 4 * maxlrcon_cmds[0] + 3), v11, 0) )
{
v14 = maxlrcon_cmds[0];
v18 = (unsigned int)(maxlrcon_cmds[0] + 1);
v25 = (char *)&lrconcmds + 32 * maxlrcon_cmds[0];
result = (unsigned __int8)v25[16];
if ( (_BYTE)result != 1 )
{
if ( (_BYTE)result != 2 )
{
LABEL_9:
if ( !(_BYTE)result )
{
result = ((__int64 (*)(__int64, __int64, const char *, ...))gi[2])(
a2,
2LL,
"%4d SW:\"%s\" \"%s\" added\n",
v18,
*((const char **)&lrconcmds + 4 * v14 + 1),
*((const char **)&lrconcmds + 4 * v14));
LODWORD(v18) = maxlrcon_cmds[0] + 1;
}
goto LABEL_11;
}
v21 = *(_QWORD *)v25;
v22 = *((_QWORD *)v25 + 1);
v20 = "%4d RE:\"%s\" \"%s\" added\n";
LABEL_20:
result = ((__int64 (__fastcall *)(__int64, __int64, const char *, __int64, __int64, __int64))gi[2])(
a2,
2LL,
v20,
v18,
v22,
v21);
LODWORD(v18) = maxlrcon_cmds[0] + 1;
LABEL_11:
maxlrcon_cmds[0] = v18;
return result;
}
LABEL_19:
v19 = (__int64 *)((char *)&lrconcmds + 32 * v14);
v20 = "%4d EX:\"%s\" \"%s\" added\n";
v21 = *v19;
v22 = v19[1];
goto LABEL_20;
}
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));
v26 = gi[2];
*((_QWORD *)&lrconcmds + 4 * maxlrcon_cmds[0] + 3) = 0LL;
return ((__int64 (__fastcall *)(__int64, __int64, const char *, void (*)(const char *, ...), __int64))v26)(
a2,
2LL,
"Regular expression couldn't compile!\n",
v26,
v27);
}

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; // eax
__int64 v4; // rbp
int v5; // er14
const char **v6; // r15
regex_t *v7; // rdi
int v8; // er15
void (*v9)(const char *, ...); // rcx

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);
v4 = v3;
if ( v3 <= 0 || maxlrcon_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !lrcondel lrconnum\n");
v5 = v3 - 1;
v6 = (const char **)((char *)&lrconcmds + 32 * v3 - 32);
gi[34](v6[1]);
gi[34](*v6);
v7 = (regex_t *)v6[3];
if ( v7 )
{
regfree(v7);
gi[34](v6[3]);
}
v8 = maxlrcon_cmds[0];
if ( maxlrcon_cmds[0] > (int)v4 )
memmove((char *)&lrconcmds + 32 * v4 - 32, (char *)&lrconcmds + 32 * v4, 32LL * (maxlrcon_cmds[0] - v5));
v9 = gi[2];
maxlrcon_cmds[0] = v8 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))v9)(a2, 2LL, "lrcon deleted\n");
}

canonical_decompiled_code:
__int64 __fastcall func11(int a1, __int64 a2)
{
const char *v2; // rax
int v3; // eax
__int64 v4; // rbp
int v5; // er14
const char **v6; // r15
regex_t *v7; // rdi
int v8; // er15
void (*v9)(const char *, ...); // rcx

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);
v4 = v3;
if ( v3 <= 0 || maxlrcon_cmds[0] < v3 )
return ((__int64 (__fastcall *)(__int64, __int64, const char *))gi[2])(a2, 2LL, "[sv] !lrcondel lrconnum\n");
v5 = v3 - 1;
v6 = (const char **)((char *)&lrconcmds + 32 * v3 - 32);
gi[34](v6[1]);
gi[34](*v6);
v7 = (regex_t *)v6[3];
if ( v7 )
{
regfree(v7);
gi[34](v6[3]);
}
v8 = maxlrcon_cmds[0];
if ( maxlrcon_cmds[0] > (int)v4 )
memmove((char *)&lrconcmds + 32 * v4 - 32, (char *)&lrconcmds + 32 * v4, 32LL * (maxlrcon_cmds[0] - v5));
v9 = gi[2];
maxlrcon_cmds[0] = v8 - 1;
return ((__int64 (__fastcall *)(__int64, __int64, const char *))v9)(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 **