decompiled_code:
__int64 __fastcall matedit_name(__int64 a1, _BYTE *a2)
{
__int64 v3; // rbp
void *v4; // rdi
__int64 result; // rax
__int64 v6; // rax

if ( a2 && *a2 )
{
v3 = *(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL);
v4 = *(void **)(v3 + 8);
if ( v4 )
{
free(v4);
}
else if ( logFail )
{
v6 = Format(
"clear_free_lists: unable to purge_data as it was NULL from: %s %s %d",
"olc_mat.c",
"matedit_name",
247LL);
log_string(v6);
}
*(_QWORD *)(v3 + 8) = 0LL;
*(_QWORD *)(v3 + 8) = str_dup(a2, "olc_mat.c", "matedit_name", 248LL);
send_to_char("Name set.\n\r", a1);
result = 1LL;
}
else
{
send_to_char("Syntax: name [name]\n\r", a1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, _BYTE *a2)
{
__int64 v3; // rbp
void *v4; // rdi
__int64 result; // rax
__int64 v6; // rax

if ( a2 && *a2 )
{
v3 = *(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL);
v4 = *(void **)(v3 + 8);
if ( v4 )
{
free(v4);
}
else if ( logFail )
{
v6 = Format(
"clear_free_lists: unable to purge_data as it was NULL from: %s %s %d",
"olc_mat.c",
"matedit_name",
247LL);
log_string(v6);
}
*(_QWORD *)(v3 + 8) = 0LL;
*(_QWORD *)(v3 + 8) = str_dup(a2, "olc_mat.c", "matedit_name", 248LL);
send_to_char("Name set.\n\r", a1);
result = 1LL;
}
else
{
send_to_char("Syntax: name [name]\n\r", a1);
result = 0LL;
}
return result;
}

original_code:
bool matedit_name( CHAR_DATA *ch, char *argument )
{
 MAT_TYPE *pMat;
 ( pMat = (MAT_TYPE *)ch->desc->pEdit );
 if ( ((argument) == ((void *)0) || (argument)[0] == '\0') )
 {
 send_to_char( "Syntax:  name [name]\n\r", ch );
 return 0;
 }
 do { if(pMat->name) { free((void *)pMat->name); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", __FUNCTION__, 247)); } } pMat->name = ((void *)0); } while(0);
 pMat->name = _str_dup(argument, "olc_mat.c", __FUNCTION__, 248);
 send_to_char( "Name set.\n\r", ch );
 return 1;
}

canonical_original_code:
unsigned char matedit_name(struct char_data *ch, char *argument)
{
 struct material_type *pMat;
 ( pMat = (struct material_type *)ch->desc->pEdit );
 if ( ((argument) == ((void *)0) || (argument)[0] == '\0') )
 {
 send_to_char( "Syntax:  name [name]\n\r", ch );
 return 0;
 }
 do { if(pMat->name) { free((void *)pMat->name); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", __FUNCTION__, 247)); } } pMat->name = ((void *)0); } while(0);
 pMat->name = _str_dup(argument, "olc_mat.c", __FUNCTION__, 248);
 send_to_char( "Name set.\n\r", ch );
 return 1;
}

variable_types: struct material_type { struct material_type *next; char *name; int assignedValue; } *

return_type: unsigned char

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }

user_defined_types: struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; }


repo: ptrayal/dungeonworld

decompiled_code:
__int64 __fastcall matedit_show(__int64 a1)
{
__int64 v1; // rbp
__int64 v2; // rax
__int64 v3; // rax

v1 = *(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL);
v2 = Format("Name: %s\n\r", *(const char **)(v1 + 8));
send_to_char(v2, a1);
v3 = Format("assignedValue: %d (Non-Settable)\n\r", *(unsigned int *)(v1 + 16));
send_to_char(v3, a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
__int64 v1; // rbp
__int64 v2; // rax
__int64 v3; // rax

v1 = *(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL);
v2 = Format("Name: %s\n\r", *(const char **)(v1 + 8));
send_to_char(v2, a1);
v3 = Format("assignedValue: %d (Non-Settable)\n\r", *(unsigned int *)(v1 + 16));
send_to_char(v3, a1);
return 0LL;
}

original_code:
bool matedit_show( CHAR_DATA *ch, char *argument ) {
 MAT_TYPE *pMat;
 ( pMat = (MAT_TYPE *)ch->desc->pEdit );
 send_to_char(Format("Name: %s\n\r", pMat->name), ch);
 send_to_char(Format("assignedValue: %d (Non-Settable)\n\r", pMat->assignedValue), ch);
 return 0;
}

canonical_original_code:
unsigned char matedit_show(struct char_data *ch, char *argument) {
 struct material_type *pMat;
 ( pMat = (struct material_type *)ch->desc->pEdit );
 send_to_char(Format("Name: %s\n\r", pMat->name), ch);
 send_to_char(Format("assignedValue: %d (Non-Settable)\n\r", pMat->assignedValue), ch);
 return 0;
}

variable_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; } *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; } *pShop; struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; } *mprogs; struct area_data { struct area_data *next; struct help_area_data { struct help_area_data *next; struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; } *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; } *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; } *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; } *pIndexData; struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t { int WriteOOB; enum bool_t { false=0, true=1 } Negotiated[-1]; enum bool_t { false=0, true=1 } bIACMode; enum bool_t { false=0, true=1 } bNegotiated; enum bool_t { false=0, true=1 } bRenegotiate; enum bool_t { false=0, true=1 } bNeedMXPVersion; enum bool_t { false=0, true=1 } bBlockMXP; enum bool_t { false=0, true=1 } bTTYPE; enum bool_t { false=0, true=1 } bECHO; enum bool_t { false=0, true=1 } bNAWS; enum bool_t { false=0, true=1 } bCHARSET; enum bool_t { false=0, true=1 } bMSDP; enum bool_t { false=0, true=1 } bMSSP; enum bool_t { false=0, true=1 } bATCP; enum bool_t { false=0, true=1 } bMSP; enum bool_t { false=0, true=1 } bMXP; enum bool_t { false=0, true=1 } bMCCP; enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 } b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t { enum bool_t { false=0, true=1 } bReport; enum bool_t { false=0, true=1 } bDirty; int ValueInt; char *pValueString; } **pVariables; } *pProtocol; } *desc; struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; } *affected; struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; } *pnote; struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; } *extra_descr; struct affect_data *affected; struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; } *pIndexData; struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; } *exit[6]; struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; } *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; } *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; } *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data { struct pc_data *next; struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; } *pcdata; struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; } *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; } *

variable_types:
argument
char *

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct material_type { struct material_type *next; char *name; int assignedValue; }

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }

user_defined_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t *pProtocol; }

user_defined_types: struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data *extra_descr; struct affect_data *affected; struct obj_index_data *pIndexData; struct room_index_data *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; }

user_defined_types: struct pc_data { struct pc_data *next; struct buf_type *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; }

user_defined_types: struct area_data { struct area_data *next; struct help_area_data *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; }

user_defined_types: struct protocol_t { int WriteOOB; enum bool_t Negotiated[-1]; enum bool_t bIACMode; enum bool_t bNegotiated; enum bool_t bRenegotiate; enum bool_t bNeedMXPVersion; enum bool_t bBlockMXP; enum bool_t bTTYPE; enum bool_t bECHO; enum bool_t bNAWS; enum bool_t bCHARSET; enum bool_t bMSDP; enum bool_t bMSSP; enum bool_t bATCP; enum bool_t bMSP; enum bool_t bMXP; enum bool_t bMCCP; enum support_t b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t **pVariables; }

user_defined_types: struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *exit[6]; struct reset_data *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; }

user_defined_types: struct help_area_data { struct help_area_data *next; struct help_data *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; }

user_defined_types: struct MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }


decompiled_code:
void *new_mat()
{
void *result; // rax

result = calloc(1uLL, 0x18uLL);
if ( !result )
{
logfmt(
"Unable to calloc new data from file: %s function: %s, line: %d\t *** ABORTING ***",
"olc_mat.c",
"new_mat",
41LL);
abort();
}
return result;
}

canonical_decompiled_code:
void *func2()
{
void *result; // rax

result = calloc(1uLL, 0x18uLL);
if ( !result )
{
logfmt(
"Unable to calloc new data from file: %s function: %s, line: %d\t *** ABORTING ***",
"olc_mat.c",
"new_mat",
41LL);
abort();
}
return result;
}

original_code:
MAT_TYPE *new_mat()
{
 MAT_TYPE *mat;
 do { if (!((mat) = (MAT_TYPE *) calloc ((1), sizeof(MAT_TYPE)))) { logfmt("Unable to calloc new data from file: %s function: %s, line: %d\t *** ABORTING ***", "olc_mat.c", __FUNCTION__, 41); abort(); } } while(0);
 mat->next = ((void *)0);
 mat->name = ((void *)0);
 mat->assignedValue = 0;
 return mat;
}

canonical_original_code:
struct material_type *new_mat()
{
 struct material_type *mat;
 do { if (!((mat) = (struct material_type *) calloc ((1), sizeof(MAT_TYPE)))) { logfmt("Unable to calloc new data from file: %s function: %s, line: %d\t *** ABORTING ***", "olc_mat.c", __FUNCTION__, 41); abort(); } } while(0);
 mat->next = ((void *)0);
 mat->name = ((void *)0);
 mat->assignedValue = 0;
 return mat;
}

return_type: struct material_type { struct material_type *next; char *name; int assignedValue; } *


decompiled_code:
void __fastcall free_mat(void *ptr)
{
void *v2; // rdi
__int64 v3; // rax

if ( !ptr )
abort();
v2 = (void *)*((_QWORD *)ptr + 1);
if ( v2 )
{
free(v2);
}
else if ( logFail )
{
v3 = Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", "free_mat", 53LL);
log_string(v3);
}
free(ptr);
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
void *v2; // rdi
__int64 v3; // rax

if ( !ptr )
abort();
v2 = (void *)*((_QWORD *)ptr + 1);
if ( v2 )
{
free(v2);
}
else if ( logFail )
{
v3 = Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", "free_mat", 53LL);
log_string(v3);
}
free(ptr);
}

original_code:
void free_mat(MAT_TYPE *mat) {
 do { if(!(mat)) abort(); }while(0);
 do { if(mat->name) { free((void *)mat->name); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", __FUNCTION__, 53)); } } mat->name = ((void *)0); } while(0);
 do { if(mat) { free((void *)mat); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", __FUNCTION__, 54)); } } mat = ((void *)0); } while(0);
}

canonical_original_code:
void free_mat(struct material_type *mat) {
 do { if(!(mat)) abort(); }while(0);
 do { if(mat->name) { free((void *)mat->name); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", __FUNCTION__, 53)); } } mat->name = ((void *)0); } while(0);
 do { if(mat) { free((void *)mat); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "olc_mat.c", __FUNCTION__, 54)); } } mat = ((void *)0); } while(0);
}

return_type: void


decompiled_code:
void clear_materials()
{
_QWORD *v0; // rbx
void *v1; // rdi

log_string("Cleaning: mat_list");
v0 = mat_list;
if ( mat_list )
{
do
{
v1 = v0;
v0 = (_QWORD *)*v0;
free_mat(v1);
}
while ( v0 );
}
mat_list = 0LL;
}

canonical_decompiled_code:
void func4()
{
_QWORD *v0; // rbx
void *v1; // rdi

log_string("Cleaning: mat_list");
v0 = mat_list;
if ( mat_list )
{
do
{
v1 = v0;
v0 = (_QWORD *)*v0;
func3(v1);
}
while ( v0 );
}
mat_list = 0LL;
}

original_code:
void clear_materials(void) {
 MAT_TYPE *mat, *mat_next;
 log_string("Cleaning: mat_list");
 for(mat = mat_list; mat; mat = mat_next) {
  mat_next = mat->next;
  free_mat(mat);
 }
 mat_list = ((void *)0);
 return;
}

canonical_original_code:
void clear_materials() {
 struct material_type *mat; struct material_type *mat_next;
 log_string("Cleaning: mat_list");
 for(mat = mat_list; mat; mat = mat_next) {
  mat_next = mat->next;
  free_mat(mat);
 }
 mat_list = ((void *)0);
 return;
}


decompiled_code:
void __fastcall confirm_material(_BYTE *a1)
{
_QWORD *v2; // rbx
_QWORD *v3; // rbx
_QWORD *v4; // rax
_BYTE *v5; // rdi

if ( a1 && *a1 && !(unsigned __int8)is_number() )
{
v2 = mat_list;
if ( mat_list )
{
while ( 1 )
{
v4 = v2;
v2 = (_QWORD *)*v2;
v5 = (_BYTE *)v4[1];
if ( v5 )
{
if ( *v5 && !(unsigned __int8)_strcmp(v5, a1, "olc_mat.c", "confirm_material", 106LL) )
break;
}
if ( !v2 )
goto LABEL_6;
}
}
else
{
LABEL_6:
++matValue;
v3 = new_mat();
v3[1] = str_dup(a1, "olc_mat.c", "confirm_material", 113LL);
*((_DWORD *)v3 + 4) = matValue;
*v3 = mat_list;
mat_list = v3;
}
}
}

canonical_decompiled_code:
void __fastcall func5(_BYTE *a1)
{
_QWORD *v2; // rbx
_QWORD *v3; // rbx
_QWORD *v4; // rax
_BYTE *v5; // rdi

if ( a1 && *a1 && !(unsigned __int8)is_number() )
{
v2 = mat_list;
if ( mat_list )
{
while ( 1 )
{
v4 = v2;
v2 = (_QWORD *)*v2;
v5 = (_BYTE *)v4[1];
if ( v5 )
{
if ( *v5 && !(unsigned __int8)_strcmp(v5, a1, "olc_mat.c", "confirm_material", 106LL) )
break;
}
if ( !v2 )
goto LABEL_6;
}
}
else
{
LABEL_6:
++matValue;
v3 = func2();
v3[1] = str_dup(a1, "olc_mat.c", "confirm_material", 113LL);
*((_DWORD *)v3 + 4) = matValue;
*v3 = mat_list;
mat_list = v3;
}
}
}

original_code:
void confirm_material(const char *name) {
 MAT_TYPE *mat, *mat_next;
 if(((name) == ((void *)0) || (name)[0] == '\0'))
  return;
 if(is_number(name))
  return;
 for(mat = mat_list; mat; mat = mat_next) {
  mat_next = mat->next;
  if(((mat->name) == ((void *)0) || (mat->name)[0] == '\0'))
   continue;
  if(!__strcmp(mat->name, name, "olc_mat.c", __FUNCTION__, 106))
   return;
 }
 matValue++;
 mat = new_mat();
 mat->name = _str_dup(name, "olc_mat.c", __FUNCTION__, 113);
 mat->assignedValue = matValue;
 mat->next = mat_list;
 mat_list = mat;
 return;
}

canonical_original_code:
void confirm_material(char *name) {
 struct material_type *mat; struct material_type *mat_next;
 if(((name) == ((void *)0) || (name)[0] == '\0'))
  return;
 if(is_number(name))
  return;
 for(mat = mat_list; mat; mat = mat_next) {
  mat_next = mat->next;
  if(((mat->name) == ((void *)0) || (mat->name)[0] == '\0'))
   continue;
  if(!__strcmp(mat->name, name, "olc_mat.c", __FUNCTION__, 106))
   return;
 }
 matValue++;
 mat = new_mat();
 mat->name = _str_dup(name, "olc_mat.c", __FUNCTION__, 113);
 mat->assignedValue = matValue;
 mat->next = mat_list;
 mat_list = mat;
 return;
}

variable_types:
name
char *


decompiled_code:
__int64 __fastcall matedit_create(__int64 a1, _BYTE *a2)
{
__int64 result; // rax
_QWORD *v3; // r12

if ( a2 && *a2 )
{
if ( find_mat(a2) )
{
send_to_char("MATEdit: That material already exists\n\r", a1);
result = 0LL;
}
else
{
v3 = new_mat();
v3[1] = str_dup(a2, "olc_mat.c", "matedit_create", 222LL);
*((_DWORD *)v3 + 4) = 0;
*v3 = mat_list;
mat_list = v3;
*(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL) = v3;
send_to_char("Material created.\n\r", a1);
save_materials();
result = 1LL;
}
}
else
{
send_to_char("Syntax: create [name]\n\r", a1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, _BYTE *a2)
{
__int64 result; // rax
_QWORD *v3; // r12

if ( a2 && *a2 )
{
if ( find_mat(a2) )
{
send_to_char("MATEdit: That material already exists\n\r", a1);
result = 0LL;
}
else
{
v3 = func2();
v3[1] = str_dup(a2, "olc_mat.c", "matedit_create", 222LL);
*((_DWORD *)v3 + 4) = 0;
*v3 = mat_list;
mat_list = v3;
*(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL) = v3;
send_to_char("Material created.\n\r", a1);
func6();
result = 1LL;
}
}
else
{
send_to_char("Syntax: create [name]\n\r", a1);
result = 0LL;
}
return result;
}

original_code:
bool matedit_create( CHAR_DATA *ch, char *argument )
{
 MAT_TYPE *pMat;
 if ( ((argument) == ((void *)0) || (argument)[0] == '\0'))
 {
 send_to_char( "Syntax:  create [name]\n\r", ch );
 return 0;
 }
 pMat = find_mat( argument );
 if ( pMat )
 {
  send_to_char( "MATEdit:  That material already exists\n\r", ch );
  return 0;
 }
 pMat = new_mat();
 pMat->name = _str_dup(argument, "olc_mat.c", __FUNCTION__, 222);
 pMat->assignedValue = 0;
 pMat->next = mat_list;
 mat_list = pMat;
 ch->desc->pEdit = (void *)pMat;
 send_to_char( "Material created.\n\r", ch );
 save_materials();
 return 1;
}

canonical_original_code:
unsigned char matedit_create(struct char_data *ch, char *argument)
{
 struct material_type *pMat;
 if ( ((argument) == ((void *)0) || (argument)[0] == '\0'))
 {
 send_to_char( "Syntax:  create [name]\n\r", ch );
 return 0;
 }
 pMat = find_mat( argument );
 if ( pMat )
 {
  send_to_char( "MATEdit:  That material already exists\n\r", ch );
  return 0;
 }
 pMat = new_mat();
 pMat->name = _str_dup(argument, "olc_mat.c", __FUNCTION__, 222);
 pMat->assignedValue = 0;
 pMat->next = mat_list;
 mat_list = pMat;
 ch->desc->pEdit = (void *)pMat;
 send_to_char( "Material created.\n\r", ch );
 save_materials();
 return 1;
}

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }


matedit

decompiled_code:
__int64 __fastcall matedit(__int64 a1, const char *a2)
{
__int64 v2; // r12
__int64 v3; // rbx
const char *v4; // rsi
__int64 result; // rax
char v6[256]; // [rsp+0h] [rbp-228h] BYREF
char v7[296]; // [rsp+100h] [rbp-128h] BYREF

smash_tilde(a2);
strcpy(v6, a2);
v2 = one_argument(a2, v7);
if ( !(unsigned __int8)_strcmp(v7, "done", "olc_mat.c", "matedit", 276LL) )
{
save_materials();
send_to_char("Materials Saved to disk.\n\r", a1);
result = edit_done(a1);
}
else
{
v3 = 0LL;
v4 = "create";
if ( v7[0] )
{
while ( (unsigned __int8)str_prefix(v7, v4) )
{
++v3;
v4 = (&matedit_table)[2 * v3];
if ( !v4 )
return interpret(a1, v6);
}
result = ((__int64 (__fastcall *)(__int64, __int64))(&matedit_table)[2 * (int)v3 + 1])(a1, v2);
}
else
{
result = matedit_show(a1);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, const char *a2)
{
__int64 v2; // r12
__int64 v3; // rbx
const char *v4; // rsi
__int64 result; // rax
char v6[256]; // [rsp+0h] [rbp-228h] BYREF
char v7[296]; // [rsp+100h] [rbp-128h] BYREF

smash_tilde(a2);
strcpy(v6, a2);
v2 = one_argument(a2, v7);
if ( !(unsigned __int8)_strcmp(v7, "done", "olc_mat.c", "matedit", 276LL) )
{
func6();
send_to_char("Materials Saved to disk.\n\r", a1);
result = edit_done(a1);
}
else
{
v3 = 0LL;
v4 = "create";
if ( v7[0] )
{
while ( (unsigned __int8)str_prefix(v7, v4) )
{
++v3;
v4 = (&matedit_table)[2 * v3];
if ( !v4 )
return interpret(a1, v6);
}
result = ((__int64 (__fastcall *)(__int64, __int64))(&matedit_table)[2 * (int)v3 + 1])(a1, v2);
}
else
{
result = func1(a1);
}
}
return result;
}

original_code:
void matedit( CHAR_DATA *ch, char *argument )
{
    MAT_TYPE *pMat;
    char command[256];
    char arg[256];
    int cmd;
    ( pMat = (MAT_TYPE *)ch->desc->pEdit );
    smash_tilde( argument );
    strcpy( arg, argument );
    argument = one_argument( argument, command );
    if ( !__strcmp(command, "done", "olc_mat.c", __FUNCTION__, 276) )
    {
     save_materials();
     send_to_char("Materials Saved to disk.\n\r", ch);
  edit_done( ch );
  return;
    }
    if ( ((command) == ((void *)0) || (command)[0] == '\0') )
    {
  matedit_show( ch, argument );
  return;
    }
    for ( cmd = 0; matedit_table[cmd].name != ((void *)0); cmd++ )
    {
 if ( !str_prefix( command, matedit_table[cmd].name ) )
 {
     if ( (*matedit_table[cmd].olc_fun) ( ch, argument ) )
     {
   return;
     }
     else
   return;
 }
    }
    interpret( ch, arg );
    return;
}

canonical_original_code:
void matedit(struct char_data *ch, char *argument)
{
    struct material_type *pMat;
    char command[256];
    char arg[256];
    int cmd;
    ( pMat = (struct material_type *)ch->desc->pEdit );
    smash_tilde( argument );
    strcpy( arg, argument );
    argument = one_argument( argument, command );
    if ( !__strcmp(command, "done", "olc_mat.c", __FUNCTION__, 276) )
    {
     save_materials();
     send_to_char("Materials Saved to disk.\n\r", ch);
  edit_done( ch );
  return;
    }
    if ( ((command) == ((void *)0) || (command)[0] == '\0') )
    {
  matedit_show( ch, argument );
  return;
    }
    for ( cmd = 0; matedit_table[cmd].name != ((void *)0); cmd++ )
    {
 if ( !str_prefix( command, matedit_table[cmd].name ) )
 {
     if ( (*matedit_table[cmd].olc_fun) ( ch, argument ) )
     {
   return;
     }
     else
   return;
 }
    }
    interpret( ch, arg );
    return;
}

variable_types:
command
char [256]

variable_types:
arg
char [256]

variable_types: cmd int

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct material_type { struct material_type *next; char *name; int assignedValue; }

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }

user_defined_types: struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; }


decompiled_code:
__int64 __fastcall do_matedit(__int64 a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v3; // rbp
__int64 v4; // rbp
__int64 v5[2]; // [rsp+0h] [rbp-1218h] BYREF
char v6[4592]; // [rsp+10h] [rbp-1208h] BYREF

v5[0] = 0LL;
v5[1] = 0LL;
result = 0LL;
memset(v6, 0, sizeof(v6));
if ( (*(_BYTE *)(a1 + 320) & 1) == 0 )
{
v3 = (_BYTE *)one_argument(a2, v5);
if ( find_mat(v5) )
{
v4 = *(_QWORD *)(a1 + 88);
*(_QWORD *)(v4 + 1632) = find_mat(v5);
result = *(_QWORD *)(a1 + 88);
*(_DWORD *)(result + 1648) = 7;
}
else if ( !(unsigned __int8)_strcmp(v5, "create", "olc_mat.c", "do_matedit", 328LL) )
{
if ( find_mat(v3) )
{
result = send_to_char("That material already exists!\n\r", a1);
}
else if ( v3 && *v3 )
{
result = matedit_create(a1, v3);
}
else
{
result = send_to_char("Syntax: edit material create [name]\n\r", a1);
}
}
else
{
result = send_to_char("MATEdit: There is no default material to edit.\n\r", a1);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2)
{
__int64 result; // rax
_BYTE *v3; // rbp
__int64 v4; // rbp
__int64 v5[2]; // [rsp+0h] [rbp-1218h] BYREF
char v6[4592]; // [rsp+10h] [rbp-1208h] BYREF

v5[0] = 0LL;
v5[1] = 0LL;
result = 0LL;
memset(v6, 0, sizeof(v6));
if ( (*(_BYTE *)(a1 + 320) & 1) == 0 )
{
v3 = (_BYTE *)one_argument(a2, v5);
if ( find_mat(v5) )
{
v4 = *(_QWORD *)(a1 + 88);
*(_QWORD *)(v4 + 1632) = find_mat(v5);
result = *(_QWORD *)(a1 + 88);
*(_DWORD *)(result + 1648) = 7;
}
else if ( !(unsigned __int8)_strcmp(v5, "create", "olc_mat.c", "do_matedit", 328LL) )
{
if ( find_mat(v3) )
{
result = send_to_char("That material already exists!\n\r", a1);
}
else if ( v3 && *v3 )
{
result = func7(a1, v3);
}
else
{
result = send_to_char("Syntax: edit material create [name]\n\r", a1);
}
}
else
{
result = send_to_char("MATEdit: There is no default material to edit.\n\r", a1);
}
}
return result;
}

original_code:
void do_matedit( CHAR_DATA *ch, char *argument )
{
    char arg1[4608]={'\0'};
    if ( ((((ch)->act) & ((1)))) )
 return;
    argument = one_argument( argument, arg1 );
    if ( find_mat(arg1) )
    {
 ch->desc->pEdit = (void *)find_mat(arg1);
 ch->desc->editor = 7;
 return;
    }
    else
    {
 if ( !__strcmp(arg1, "create", "olc_mat.c", __FUNCTION__, 328) )
 {
  if(find_mat(argument)) {
   send_to_char("That material already exists!\n\r", ch);
   return;
  }
     if ( ((argument) == ((void *)0) || (argument)[0] == '\0'))
     {
  send_to_char( "Syntax:  edit material create [name]\n\r", ch );
  return;
     }
  matedit_create(ch, argument);
     return;
 }
    }
    send_to_char( "MATEdit:  There is no default material to edit.\n\r", ch );
    return;
}

canonical_original_code:
void do_matedit(struct char_data *ch, char *argument)
{
    char arg1[4608] = {'\0'};
    if ( ((((ch)->act) & ((1)))) )
 return;
    argument = one_argument( argument, arg1 );
    if ( find_mat(arg1) )
    {
 ch->desc->pEdit = (void *)find_mat(arg1);
 ch->desc->editor = 7;
 return;
    }
    else
    {
 if ( !__strcmp(arg1, "create", "olc_mat.c", __FUNCTION__, 328) )
 {
  if(find_mat(argument)) {
   send_to_char("That material already exists!\n\r", ch);
   return;
  }
     if ( ((argument) == ((void *)0) || (argument)[0] == '\0'))
     {
  send_to_char( "Syntax:  edit material create [name]\n\r", ch );
  return;
     }
  matedit_create(ch, argument);
     return;
 }
    }
    send_to_char( "MATEdit:  There is no default material to edit.\n\r", ch );
    return;
}

user_defined_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t *pProtocol; }

user_defined_types: struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data *extra_descr; struct affect_data *affected; struct obj_index_data *pIndexData; struct room_index_data *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; }

user_defined_types: struct pc_data { struct pc_data *next; struct buf_type *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; }

user_defined_types: struct area_data { struct area_data *next; struct help_area_data *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; }

user_defined_types: struct protocol_t { int WriteOOB; enum bool_t Negotiated[-1]; enum bool_t bIACMode; enum bool_t bNegotiated; enum bool_t bRenegotiate; enum bool_t bNeedMXPVersion; enum bool_t bBlockMXP; enum bool_t bTTYPE; enum bool_t bECHO; enum bool_t bNAWS; enum bool_t bCHARSET; enum bool_t bMSDP; enum bool_t bMSSP; enum bool_t bATCP; enum bool_t bMSP; enum bool_t bMXP; enum bool_t bMCCP; enum support_t b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t **pVariables; }

user_defined_types: struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *exit[6]; struct reset_data *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; }

user_defined_types: struct help_area_data { struct help_area_data *next; struct help_data *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; }

user_defined_types: struct MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }


original_code:
void do_matlist(CHAR_DATA *ch, char *argument) {
 MAT_TYPE *mat, *mat_next;
 BUFFER *output = __new_buf("olc_mat.c", __FUNCTION__, 351);
 int col = 0;
 for(mat = mat_list; mat; mat = mat_next) {
  mat_next = mat->next;
  add_buf(output, Format("%-15s", mat->name) );
  if(++col == 5) {
   col = 0;
   add_buf(output, "\n\r");
  }
 }
 page_to_char(buf_string(output), ch);
 free_buf(output);
 return;
}

canonical_original_code:
void do_matlist(struct char_data *ch, char *argument) {
 struct material_type *mat; struct material_type *mat_next;
 struct buf_type *output = __new_buf("olc_mat.c", __FUNCTION__, 351);
 int col = 0;
 for(mat = mat_list; mat; mat = mat_next) {
  mat_next = mat->next;
  add_buf(output, Format("%-15s", mat->name) );
  if(++col == 5) {
   col = 0;
   add_buf(output, "\n\r");
  }
 }
 page_to_char(buf_string(output), ch);
 free_buf(output);
 return;
}

variable_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *

variable_types: col int

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }


decompiled_code:
__int64 __fastcall sort_cmd_table(const void *a1, const void *a2)
{
int v2; // edx
char *v3; // rsi
char v4; // al
char *v5; // rdi
__int64 v6; // rcx
char v7; // dl

v2 = *(_DWORD *)a2;
v3 = (&cmd_table)[3 * *(int *)a1];
v4 = *v3;
if ( !*v3 )
return 0LL;
v5 = (&cmd_table)[3 * v2];
v6 = 0LL;
while ( 1 )
{
v7 = v5[v6];
if ( v7 != v4 )
break;
LABEL_3:
v4 = v3[++v6];
if ( !v4 )
return 0LL;
}
if ( v7 >= v4 && v7 )
{
if ( v7 > v4 )
return 0xFFFFFFFFLL;
goto LABEL_3;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(const void *a1, const void *a2)
{
int v2; // edx
char *v3; // rsi
char v4; // al
char *v5; // rdi
__int64 v6; // rcx
char v7; // dl

v2 = *(_DWORD *)a2;
v3 = (&cmd_table)[3 * *(int *)a1];
v4 = *v3;
if ( !*v3 )
return 0LL;
v5 = (&cmd_table)[3 * v2];
v6 = 0LL;
while ( 1 )
{
v7 = v5[v6];
if ( v7 != v4 )
break;
LABEL_3:
v4 = v3[++v6];
if ( !v4 )
return 0LL;
}
if ( v7 >= v4 && v7 )
{
if ( v7 > v4 )
return 0xFFFFFFFFLL;
goto LABEL_3;
}
return 1LL;
}

original_code:
int sort_cmd_table( const void *v1, const void *v2 )
{
 int idx1 = *(int *) v1;
 int idx2 = *(int *) v2;
 int i = 0;
 for (i = 0; cmd_table[idx1].name[i] != '\0'; i++)
 {
  if (cmd_table[idx1].name[i] == cmd_table[idx2].name[i]) continue;
  if (cmd_table[idx2].name[i] == '\0') return 1;
  if (cmd_table[idx1].name[i] > cmd_table[idx2].name[i]) return 1;
  if (cmd_table[idx1].name[i] < cmd_table[idx2].name[i]) return -1;
 }
 return 0;
}

canonical_original_code:
int sort_cmd_table(void *v1, void *v2)
{
 int idx1 = *(int *) v1;
 int idx2 = *(int *) v2;
 int i = 0;
 for (i = 0; cmd_table[idx1].name[i] != '\0'; i++)
 {
  if (cmd_table[idx1].name[i] == cmd_table[idx2].name[i]) continue;
  if (cmd_table[idx2].name[i] == '\0') return 1;
  if (cmd_table[idx1].name[i] > cmd_table[idx2].name[i]) return 1;
  if (cmd_table[idx1].name[i] < cmd_table[idx2].name[i]) return -1;
 }
 return 0;
}

variable_types: i int

return_type: int


original_code:
void do_commands( CHAR_DATA *ch, char *argument )
{
 int index[4608*4];
 int cmd = 0;
 int col = 0;
 int count = 0;
 int i = 0;
 for ( count = 0; cmd_table[count].name[0] != '\0'; count++ )
    {
     index[count] = count;
    }
 qsort(index, count, sizeof(int), sort_cmd_table);
    for ( i = 0; i < count; i++ )
 {
  cmd = index[i];
  if ( cmd_table[cmd].level < (60 - 9)
   && cmd_table[cmd].level <= get_trust( ch )
   && cmd_table[cmd].show)
  {
   send_to_char( Format("%-12s", cmd_table[cmd].name), ch );
   if ( ++col % 4 == 0 )
    send_to_char( "\n\r", ch );
  }
 }
 if ( col % 4 != 0 )
  send_to_char( "\n\r", ch );
 return;
}

canonical_original_code:
void do_commands(struct char_data *ch, char *argument)
{
 int index[-1];
 int cmd = 0;
 int col = 0;
 int count = 0;
 int i = 0;
 for ( count = 0; cmd_table[count].name[0] != '\0'; count++ )
    {
     index[count] = count;
    }
 qsort(index, count, sizeof(int), sort_cmd_table);
    for ( i = 0; i < count; i++ )
 {
  cmd = index[i];
  if ( cmd_table[cmd].level < (60 - 9)
   && cmd_table[cmd].level <= get_trust( ch )
   && cmd_table[cmd].show)
  {
   send_to_char( Format("%-12s", cmd_table[cmd].name), ch );
   if ( ++col % 4 == 0 )
    send_to_char( "\n\r", ch );
  }
 }
 if ( col % 4 != 0 )
  send_to_char( "\n\r", ch );
 return;
}

variable_types:
index
int [-1]

variable_types: count int

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }

user_defined_types: struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; }


decompiled_code:
__int64 __fastcall do_wizhelp(__int64 a1)
{
int *v1; // rdx
unsigned __int64 v2; // rax
int v3; // er15
int v4; // er13
_BYTE *v5; // rcx
__int64 i; // r14
__int64 v7; // rbx
__int64 result; // rax
int v9; // er12
__int16 v10; // bp
__int64 v11; // rax
__int64 v12; // rax
char v13; // [rsp+Ch] [rbp-1203Ch]
int base[18446]; // [rsp+10h] [rbp-12038h] BYREF

v1 = base;
v2 = (unsigned int)((_DWORD)&cmd_table + 24);
v3 = 0;
do
{
*v1 = v3;
v4 = v3++;
v5 = *(_BYTE **)v2;
++v1;
v2 += 24LL;
}
while ( *v5 );
qsort(base, v3, 4uLL, (__compar_fn_t)sort_cmd_table);
for ( i = 52LL; i != 61; ++i )
{
v12 = Format("\n\r\tWLevel\tn: %d (\tO%s\tn)\n\r", (unsigned int)i, wiz_title_list[-i + 60]);
result = send_to_char(v12, a1);
if ( v3 > 0 )
{
v7 = 0LL;
v13 = 0;
do
{
v9 = base[v7];
v10 = *((_WORD *)&cmd_table + 12 * v9 + 9);
if ( v10 > 50 && v10 <= (int)get_trust(a1) )
{
if ( *((_WORD *)&cmd_table + 12 * v9 + 11) )
{
if ( v10 == (_DWORD)i )
{
v11 = Format(
"[\tC%-3d\tn] \t<send href='help %s' hint='Click to see help on %s'>%-12s\t</send> |",
(unsigned int)v10,
(&cmd_table)[3 * v9],
(&cmd_table)[3 * v9],
(&cmd_table)[3 * v9]);
send_to_char(v11, a1);
if ( (++v13 & 3) == 0 )
send_to_char("\n\r", a1);
}
}
}
result = (unsigned int)v7++;
}
while ( v4 > (int)result );
if ( (v13 & 3) != 0 )
result = send_to_char("\n\r", a1);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
int *v1; // rdx
unsigned __int64 v2; // rax
int v3; // er15
int v4; // er13
_BYTE *v5; // rcx
__int64 i; // r14
__int64 v7; // rbx
__int64 result; // rax
int v9; // er12
__int16 v10; // bp
__int64 v11; // rax
__int64 v12; // rax
char v13; // [rsp+Ch] [rbp-1203Ch]
int base[18446]; // [rsp+10h] [rbp-12038h] BYREF

v1 = base;
v2 = (unsigned int)((_DWORD)&cmd_table + 24);
v3 = 0;
do
{
*v1 = v3;
v4 = v3++;
v5 = *(_BYTE **)v2;
++v1;
v2 += 24LL;
}
while ( *v5 );
qsort(base, v3, 4uLL, (__compar_fn_t)sort_cmd_table);
for ( i = 52LL; i != 61; ++i )
{
v12 = Format("\n\r\tWLevel\tn: %d (\tO%s\tn)\n\r", (unsigned int)i, wiz_title_list[-i + 60]);
result = send_to_char(v12, a1);
if ( v3 > 0 )
{
v7 = 0LL;
v13 = 0;
do
{
v9 = base[v7];
v10 = *((_WORD *)&cmd_table + 12 * v9 + 9);
if ( v10 > 50 && v10 <= (int)get_trust(a1) )
{
if ( *((_WORD *)&cmd_table + 12 * v9 + 11) )
{
if ( v10 == (_DWORD)i )
{
v11 = Format(
"[\tC%-3d\tn] \t<send href='help %s' hint='Click to see help on %s'>%-12s\t</send> |",
(unsigned int)v10,
(&cmd_table)[3 * v9],
(&cmd_table)[3 * v9],
(&cmd_table)[3 * v9]);
send_to_char(v11, a1);
if ( (++v13 & 3) == 0 )
send_to_char("\n\r", a1);
}
}
}
result = (unsigned int)v7++;
}
while ( v4 > (int)result );
if ( (v13 & 3) != 0 )
result = send_to_char("\n\r", a1);
}
}
return result;
}

original_code:
void do_wizhelp( CHAR_DATA *ch, char *argument )
{
 int index[4608*4];
 int cmd = 0;
 int col = 0;
 int clevel = 0;
 int i = 0;
 int count = 0;
 for ( count = 0; cmd_table[count].name[0] != '\0'; count++ )
    {
     index[count] = count;
    }
 qsort(index, count, sizeof(int), sort_cmd_table);
 for( clevel = (60 - 9) + 1; clevel < 60 + 1; clevel++ )
 {
  send_to_char(Format("\n\r\tWLevel\tn: %d (\tO%s\tn)\n\r", clevel, wiz_title_list[60 -clevel]), ch);
     for ( i = 0; i < count; i++ )
  {
   cmd = index[i];
   if ( cmd_table[cmd].level >= (60 - 9)
    && cmd_table[cmd].level <= get_trust( ch )
    && cmd_table[cmd].show
    && cmd_table[cmd].level == clevel)
   {
    send_to_char( Format("[\tC%-3d\tn] \t<send href='help %s' hint='Click to see help on %s'>%-12s\t</send> |", cmd_table[cmd].level, cmd_table[cmd].name, cmd_table[cmd].name, cmd_table[cmd].name), ch );
    if ( ++col % 4 == 0 )
     send_to_char( "\n\r", ch );
   }
  }
  if ( col % 4 != 0 )
   send_to_char( "\n\r", ch );
  col = 0;
 }
 return;
}

canonical_original_code:
void do_wizhelp(struct char_data *ch, char *argument)
{
 int index[-1];
 int cmd = 0;
 int col = 0;
 int clevel = 0;
 int i = 0;
 int count = 0;
 for ( count = 0; cmd_table[count].name[0] != '\0'; count++ )
    {
     index[count] = count;
    }
 qsort(index, count, sizeof(int), sort_cmd_table);
 for( clevel = (60 - 9) + 1; clevel < 60 + 1; clevel++ )
 {
  send_to_char(Format("\n\r\tWLevel\tn: %d (\tO%s\tn)\n\r", clevel, wiz_title_list[60 -clevel]), ch);
     for ( i = 0; i < count; i++ )
  {
   cmd = index[i];
   if ( cmd_table[cmd].level >= (60 - 9)
    && cmd_table[cmd].level <= get_trust( ch )
    && cmd_table[cmd].show
    && cmd_table[cmd].level == clevel)
   {
    send_to_char( Format("[\tC%-3d\tn] \t<send href='help %s' hint='Click to see help on %s'>%-12s\t</send> |", cmd_table[cmd].level, cmd_table[cmd].name, cmd_table[cmd].name, cmd_table[cmd].name), ch );
    if ( ++col % 4 == 0 )
     send_to_char( "\n\r", ch );
   }
  }
  if ( col % 4 != 0 )
   send_to_char( "\n\r", ch );
  col = 0;
 }
 return;
}

variable_types: clevel int

user_defined_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t *pProtocol; }

user_defined_types: struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data *extra_descr; struct affect_data *affected; struct obj_index_data *pIndexData; struct room_index_data *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; }

user_defined_types: struct pc_data { struct pc_data *next; struct buf_type *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; }

user_defined_types: struct area_data { struct area_data *next; struct help_area_data *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; }

user_defined_types: struct protocol_t { int WriteOOB; enum bool_t Negotiated[-1]; enum bool_t bIACMode; enum bool_t bNegotiated; enum bool_t bRenegotiate; enum bool_t bNeedMXPVersion; enum bool_t bBlockMXP; enum bool_t bTTYPE; enum bool_t bECHO; enum bool_t bNAWS; enum bool_t bCHARSET; enum bool_t bMSDP; enum bool_t bMSSP; enum bool_t bATCP; enum bool_t bMSP; enum bool_t bMXP; enum bool_t bMCCP; enum support_t b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t **pVariables; }

user_defined_types: struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *exit[6]; struct reset_data *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; }

user_defined_types: struct help_area_data { struct help_area_data *next; struct help_data *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; }


decompiled_code:
__int64 __fastcall do_function(__int64 a1, __int64 (__fastcall *a2)(__int64, __int64), __int64 a3)
{
return a2(a1, a3);
}

original_code:
void do_function (CHAR_DATA *ch, DO_FUN *do_fun, const char *argument)
{
 (*do_fun) (ch, (char *)argument);
}

canonical_original_code:
void do_function(struct char_data *ch, void (*do_fun)(struct char_data *ch, char *argument), char *argument)
{
 (*do_fun) (ch, (char *)argument);
}

variable_types: void (*)(struct char_data *ch, char *argument)

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }


decompiled_code:
__int64 __fastcall is_number(_BYTE *a1)
{
char v1; // bl
__int64 result; // rax
_BYTE *v3; // rbp
const unsigned __int16 *v4; // rax

v1 = *a1;
result = 0LL;
if ( *a1 )
{
v3 = a1;
if ( ((v1 - 43) & 0xFD) == 0 )
{
v1 = a1[1];
if ( !v1 )
return 1LL;
v3 = a1 + 1;
}
v4 = *_ctype_b_loc();
while ( (v4[v1] & 0x800) != 0 )
{
v1 = *++v3;
if ( !*v3 )
return 1LL;
}
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(_BYTE *a1)
{
char v1; // bl
__int64 result; // rax
_BYTE *v3; // rbp
const unsigned __int16 *v4; // rax

v1 = *a1;
result = 0LL;
if ( *a1 )
{
v3 = a1;
if ( ((v1 - 43) & 0xFD) == 0 )
{
v1 = a1[1];
if ( !v1 )
return 1LL;
v3 = a1 + 1;
}
v4 = *_ctype_b_loc();
while ( (v4[v1] & 0x800) != 0 )
{
v1 = *++v3;
if ( !*v3 )
return 1LL;
}
result = 0LL;
}
return result;
}

original_code:
bool is_number ( const char *arg )
{
 if ( *arg == '\0' )
  return 0;
 if ( *arg == '+' || *arg == '-' )
  arg++;
 for ( ; *arg != '\0'; arg++ )
 {
  if ( !((*__ctype_b_loc ())[(int) ((*arg))] & (unsigned short int) _ISdigit) )
   return 0;
 }
 return 1;
}

canonical_original_code:
unsigned char is_number(char *arg)
{
 if ( *arg == '\0' )
  return 0;
 if ( *arg == '+' || *arg == '-' )
  arg++;
 for ( ; *arg != '\0'; arg++ )
 {
  if ( !((*__ctype_b_loc ())[(int) ((*arg))] & (unsigned short) _ISdigit) )
   return 0;
 }
 return 1;
}

variable_types:
arg
char *


decompiled_code:
__int64 __fastcall number_argument(char *src, char *nptr)
{
char v2; // al
char *v3; // rbx
unsigned int v4; // er12

v2 = *src;
if ( *src )
{
v3 = src;
while ( v2 != 46 )
{
v2 = *++v3;
if ( !*v3 )
goto LABEL_5;
}
*v3 = 0;
v4 = atoi(src);
*v3 = 46;
strcpy(nptr, v3 + 1);
}
else
{
LABEL_5:
strcpy(nptr, src);
v4 = 1;
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *src, char *nptr)
{
char v2; // al
char *v3; // rbx
unsigned int v4; // er12

v2 = *src;
if ( *src )
{
v3 = src;
while ( v2 != 46 )
{
v2 = *++v3;
if ( !*v3 )
goto LABEL_5;
}
*v3 = 0;
v4 = atoi(src);
*v3 = 46;
strcpy(nptr, v3 + 1);
}
else
{
LABEL_5:
strcpy(nptr, src);
v4 = 1;
}
return v4;
}

original_code:
int number_argument( char *argument, char *arg )
{
 char *pdot;
 int number;
 for ( pdot = argument; *pdot != '\0'; pdot++ )
 {
 if ( *pdot == '.' )
 {
  *pdot = '\0';
  number = atoi( argument );
  *pdot = '.';
  strcpy( arg, pdot+1 );
  return number;
 }
 }
 strcpy( arg, argument );
 return 1;
}

canonical_original_code:
int number_argument(char *argument, char *arg)
{
 char *pdot;
 int number;
 for ( pdot = argument; *pdot != '\0'; pdot++ )
 {
 if ( *pdot == '.' )
 {
  *pdot = '\0';
  number = atoi( argument );
  *pdot = '.';
  strcpy( arg, pdot+1 );
  return number;
 }
 }
 strcpy( arg, argument );
 return 1;
}

variable_types:
pdot
char *

variable_types: number int


decompiled_code:
__int64 __fastcall mult_argument(char *src, char *nptr)
{
char v2; // al
char *v3; // rbx
unsigned int v4; // er12

v2 = *src;
if ( *src )
{
v3 = src;
while ( v2 != 42 )
{
v2 = *++v3;
if ( !*v3 )
goto LABEL_5;
}
*v3 = 0;
v4 = atoi(src);
*v3 = 42;
strcpy(nptr, v3 + 1);
}
else
{
LABEL_5:
strcpy(nptr, src);
v4 = 1;
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func6(char *src, char *nptr)
{
char v2; // al
char *v3; // rbx
unsigned int v4; // er12

v2 = *src;
if ( *src )
{
v3 = src;
while ( v2 != 42 )
{
v2 = *++v3;
if ( !*v3 )
goto LABEL_5;
}
*v3 = 0;
v4 = atoi(src);
*v3 = 42;
strcpy(nptr, v3 + 1);
}
else
{
LABEL_5:
strcpy(nptr, src);
v4 = 1;
}
return v4;
}

original_code:
int mult_argument(char *argument, char *arg)
{
 char *pdot;
 int number;
 for ( pdot = argument; *pdot != '\0'; pdot++ )
 {
  if ( *pdot == '*' )
  {
   *pdot = '\0';
   number = atoi( argument );
   *pdot = '*';
   strcpy( arg, pdot+1 );
   return number;
  }
 }
 strcpy( arg, argument );
 return 1;
}


decompiled_code:
char *__fastcall one_argument(char *a1, char *a2)
{
const unsigned __int16 **v4; // rdi
char v5; // dl
char v6; // al
char *result; // rax

v4 = _ctype_b_loc();
while ( 1 )
{
v5 = *a1;
if ( ((*v4)[*a1] & 0x2000) == 0 )
break;
++a1;
}
if ( v5 == 39 || v5 == 34 )
++a1;
else
v5 = 32;
v6 = *a1;
if ( *a1 )
{
while ( v5 != v6 )
{
if ( (unsigned __int8)(v6 - 65) < 0x1Au )
v6 += 32;
*a2++ = v6;
v6 = *++a1;
if ( !*a1 )
{
result = a1;
goto LABEL_15;
}
}
result = a1 + 1;
}
else
{
result = a1;
}
LABEL_15:
for ( *a2 = 0; ((*v4)[*result] & 0x2000) != 0; ++result )
;
return result;
}

canonical_decompiled_code:
char *__fastcall func7(char *a1, char *a2)
{
const unsigned __int16 **v4; // rdi
char v5; // dl
char v6; // al
char *result; // rax

v4 = _ctype_b_loc();
while ( 1 )
{
v5 = *a1;
if ( ((*v4)[*a1] & 0x2000) == 0 )
break;
++a1;
}
if ( v5 == 39 || v5 == 34 )
++a1;
else
v5 = 32;
v6 = *a1;
if ( *a1 )
{
while ( v5 != v6 )
{
if ( (unsigned __int8)(v6 - 65) < 0x1Au )
v6 += 32;
*a2++ = v6;
v6 = *++a1;
if ( !*a1 )
{
result = a1;
goto LABEL_15;
}
}
result = a1 + 1;
}
else
{
result = a1;
}
LABEL_15:
for ( *a2 = 0; ((*v4)[*result] & 0x2000) != 0; ++result )
;
return result;
}

original_code:
char *one_argument( char *argument, char *arg_first )
{
 char cEnd;
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short int) _ISspace) )
 argument++;
 cEnd = ' ';
 if ( *argument == '\'' || *argument == '"' )
 cEnd = *argument++;
 while ( *argument != '\0' )
 {
 if ( *argument == cEnd )
 {
  argument++;
  break;
 }
 *arg_first = ((*argument) >= 'A' && (*argument) <= 'Z' ? (*argument)+'a'-'A' : (*argument));
 arg_first++;
 argument++;
 }
 *arg_first = '\0';
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short int) _ISspace) )
 argument++;
 return argument;
}

canonical_original_code:
char *one_argument(char *argument, char *arg_first)
{
 char cEnd;
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short) _ISspace) )
 argument++;
 cEnd = ' ';
 if ( *argument == '\'' || *argument == '"' )
 cEnd = *argument++;
 while ( *argument != '\0' )
 {
 if ( *argument == cEnd )
 {
  argument++;
  break;
 }
 *arg_first = ((*argument) >= 'A' && (*argument) <= 'Z' ? (*argument)+'a'-'A' : (*argument));
 arg_first++;
 argument++;
 }
 *arg_first = '\0';
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short) _ISspace) )
 argument++;
 return argument;
}

variable_types: cEnd char

return_type: char *


decompiled_code:
__int64 __fastcall check_social(__int64 a1, _BYTE *a2, char *a3)
{
char v3; // al
char *v5; // rbx
int v6; // ebp
__int16 v7; // ax
__int64 result; // rax
__int64 v9; // rax
__int64 v10; // rbx
int v11; // eax
__int64 v12; // rbp
char v13[296]; // [rsp+0h] [rbp-128h] BYREF

v3 = social_table;
if ( !social_table )
return 0LL;
v5 = (char *)&social_table;
v6 = 0;
while ( *a2 != v3 || (unsigned __int8)str_prefix(a2, v5) )
{
++v6;
v5 += 88;
v3 = *v5;
if ( !*v5 )
return 0LL;
}
if ( (*(_BYTE *)(a1 + 320) & 1) == 0 && (*(_BYTE *)(a1 + 330) & 8) != 0 )
{
send_to_char("You are anti-social!\n\r", a1);
return 1LL;
}
v7 = *(_WORD *)(a1 + 384);
if ( v7 == 3 )
{
send_to_char("You are too stunned to do that.\n\r", a1);
return 1LL;
}
if ( v7 > 3 )
{
if ( v7 == 4
&& (unsigned __int8)_strcmp((char *)&social_table + 88 * v6, "snore", "interp.c", "check_social", 602LL) )
{
send_to_char("In your dreams, or what?\n\r", a1);
return 1LL;
}
}
else
{
if ( !v7 )
{
send_to_char("Lie still; you are DEAD.\n\r", a1);
return 1LL;
}
if ( (unsigned __int16)(v7 - 1) <= 1u )
{
send_to_char("You are hurt far too bad for that.\n\r", a1);
return 1LL;
}
}
one_argument(a3, v13);
if ( v13[0] )
{
v9 = get_char_room(a1, v13);
v10 = v9;
if ( v9 )
{
if ( a1 == v9 )
{
act_new(*((_QWORD *)&social_table + 11 * v6 + 10), v9, 0LL, v9, 0LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 9), v10, 0LL, v10, 3LL, 5LL);
result = 1LL;
}
else
{
act_new(*((_QWORD *)&social_table + 11 * v6 + 6), a1, 0LL, v9, 1LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 5), a1, 0LL, v10, 3LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 7), a1, 0LL, v10, 2LL, 5LL);
result = 1LL;
if ( (*(_BYTE *)(a1 + 320) & 1) == 0
&& (*(_BYTE *)(v10 + 320) & 1) != 0
&& (*(_BYTE *)(v10 + 378) & 4) == 0
&& *(__int16 *)(v10 + 384) > 4
&& !*(_QWORD *)(v10 + 88) )
{
v11 = number_bits(4LL);
if ( v11 <= 8 )
{
if ( v11 >= 0 )
{
v12 = 88LL * v6;
act_new(*(_QWORD *)((char *)&social_table + v12 + 48), v10, 0LL, a1, 1LL, 5LL);
act_new(*(_QWORD *)((char *)&social_table + v12 + 40), v10, 0LL, a1, 3LL, 5LL);
act_new(*(_QWORD *)((char *)&social_table + v12 + 56), v10, 0LL, a1, 2LL, 5LL);
}
result = 1LL;
}
else
{
if ( (unsigned int)(v11 - 9) <= 3 )
{
act_new("$n slaps $N.", v10, 0LL, a1, 1LL, 5LL);
act_new("You slap $N.", v10, 0LL, a1, 3LL, 5LL);
act_new("$n slaps you.", v10, 0LL, a1, 2LL, 5LL);
}
result = 1LL;
}
}
}
}
else
{
send_to_char("They aren't here.\n\r", a1);
result = 1LL;
}
}
else
{
act_new(*((_QWORD *)&social_table + 11 * v6 + 4), a1, 0LL, 0LL, 0LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 3), a1, 0LL, 0LL, 3LL, 5LL);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, _BYTE *a2, char *a3)
{
char v3; // al
char *v5; // rbx
int v6; // ebp
__int16 v7; // ax
__int64 result; // rax
__int64 v9; // rax
__int64 v10; // rbx
int v11; // eax
__int64 v12; // rbp
char v13[296]; // [rsp+0h] [rbp-128h] BYREF

v3 = social_table;
if ( !social_table )
return 0LL;
v5 = (char *)&social_table;
v6 = 0;
while ( *a2 != v3 || (unsigned __int8)str_prefix(a2, v5) )
{
++v6;
v5 += 88;
v3 = *v5;
if ( !*v5 )
return 0LL;
}
if ( (*(_BYTE *)(a1 + 320) & 1) == 0 && (*(_BYTE *)(a1 + 330) & 8) != 0 )
{
send_to_char("You are anti-social!\n\r", a1);
return 1LL;
}
v7 = *(_WORD *)(a1 + 384);
if ( v7 == 3 )
{
send_to_char("You are too stunned to do that.\n\r", a1);
return 1LL;
}
if ( v7 > 3 )
{
if ( v7 == 4
&& (unsigned __int8)_strcmp((char *)&social_table + 88 * v6, "snore", "interp.c", "check_social", 602LL) )
{
send_to_char("In your dreams, or what?\n\r", a1);
return 1LL;
}
}
else
{
if ( !v7 )
{
send_to_char("Lie still; you are DEAD.\n\r", a1);
return 1LL;
}
if ( (unsigned __int16)(v7 - 1) <= 1u )
{
send_to_char("You are hurt far too bad for that.\n\r", a1);
return 1LL;
}
}
func7(a3, v13);
if ( v13[0] )
{
v9 = get_char_room(a1, v13);
v10 = v9;
if ( v9 )
{
if ( a1 == v9 )
{
act_new(*((_QWORD *)&social_table + 11 * v6 + 10), v9, 0LL, v9, 0LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 9), v10, 0LL, v10, 3LL, 5LL);
result = 1LL;
}
else
{
act_new(*((_QWORD *)&social_table + 11 * v6 + 6), a1, 0LL, v9, 1LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 5), a1, 0LL, v10, 3LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 7), a1, 0LL, v10, 2LL, 5LL);
result = 1LL;
if ( (*(_BYTE *)(a1 + 320) & 1) == 0
&& (*(_BYTE *)(v10 + 320) & 1) != 0
&& (*(_BYTE *)(v10 + 378) & 4) == 0
&& *(__int16 *)(v10 + 384) > 4
&& !*(_QWORD *)(v10 + 88) )
{
v11 = number_bits(4LL);
if ( v11 <= 8 )
{
if ( v11 >= 0 )
{
v12 = 88LL * v6;
act_new(*(_QWORD *)((char *)&social_table + v12 + 48), v10, 0LL, a1, 1LL, 5LL);
act_new(*(_QWORD *)((char *)&social_table + v12 + 40), v10, 0LL, a1, 3LL, 5LL);
act_new(*(_QWORD *)((char *)&social_table + v12 + 56), v10, 0LL, a1, 2LL, 5LL);
}
result = 1LL;
}
else
{
if ( (unsigned int)(v11 - 9) <= 3 )
{
act_new("$n slaps $N.", v10, 0LL, a1, 1LL, 5LL);
act_new("You slap $N.", v10, 0LL, a1, 3LL, 5LL);
act_new("$n slaps you.", v10, 0LL, a1, 2LL, 5LL);
}
result = 1LL;
}
}
}
}
else
{
send_to_char("They aren't here.\n\r", a1);
result = 1LL;
}
}
else
{
act_new(*((_QWORD *)&social_table + 11 * v6 + 4), a1, 0LL, 0LL, 0LL, 5LL);
act_new(*((_QWORD *)&social_table + 11 * v6 + 3), a1, 0LL, 0LL, 3LL, 5LL);
result = 1LL;
}
return result;
}

original_code:
bool check_social( CHAR_DATA *ch, char *command, char *argument )
{
 char arg[256];
 CHAR_DATA *victim;
 int cmd;
 bool found;
 found = 0;
 for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ )
 {
 if ( command[0] == social_table[cmd].name[0]
 && !str_prefix( command, social_table[cmd].name ) )
 {
  found = 1;
  break;
 }
 }
 if ( !found )
 return 0;
 if ( !((((ch)->act) & ((1)))) && ((ch->comm) & ((524288))) )
 {
 send_to_char( "You are anti-social!\n\r", ch );
 return 1;
 }
 switch ( ch->position )
 {
 case 0:
 send_to_char( "Lie still; you are DEAD.\n\r", ch );
 return 1;
 case 2:
 case 1:
 send_to_char( "You are hurt far too bad for that.\n\r", ch );
 return 1;
 case 3:
 send_to_char( "You are too stunned to do that.\n\r", ch );
 return 1;
 case 4:
 if ( !__strcmp(social_table[cmd].name, "snore", "interp.c", __FUNCTION__, 602) )
  break;
 send_to_char( "In your dreams, or what?\n\r", ch );
 return 1;
 }
 one_argument( argument, arg );
 victim = ((void *)0);
 if ( arg[0] == '\0' )
 {
 act_new((social_table[cmd].others_no_arg),(ch),(((void *)0)),(victim),(0),5);
 act_new((social_table[cmd].char_no_arg),(ch),(((void *)0)),(victim),(3),5);
 }
 else if ( ( victim = get_char_room( ch, arg ) ) == ((void *)0) )
 {
 send_to_char( "They aren't here.\n\r", ch );
 }
 else if ( victim == ch )
 {
 act_new((social_table[cmd].others_auto),(ch),(((void *)0)),(victim),(0),5);
 act_new((social_table[cmd].char_auto),(ch),(((void *)0)),(victim),(3),5);
 }
 else
 {
 act_new((social_table[cmd].others_found),(ch),(((void *)0)),(victim),(1),5);
 act_new((social_table[cmd].char_found),(ch),(((void *)0)),(victim),(3),5);
 act_new((social_table[cmd].vict_found),(ch),(((void *)0)),(victim),(2),5);
 if ( !((((ch)->act) & ((1)))) && ((((victim)->act) & ((1))))
 && !((((victim)->affected_by) & (((262144)))))
 && (victim->position > 4)
 && victim->desc == ((void *)0))
 {
  switch ( number_bits( 4 ) )
  {
  case 0:
  case 1: case 2: case 3: case 4:
  case 5: case 6: case 7: case 8:
  act_new((social_table[cmd].others_found),(victim),(((void *)0)),(ch),(1),5);
  act_new((social_table[cmd].char_found),(victim),(((void *)0)),(ch),(3),5);
  act_new((social_table[cmd].vict_found),(victim),(((void *)0)),(ch),(2),5);
  break;
  case 9: case 10: case 11: case 12:
  act_new(("$n slaps $N."),(victim),(((void *)0)),(ch),(1),5);
  act_new(("You slap $N."),(victim),(((void *)0)),(ch),(3),5);
  act_new(("$n slaps you."),(victim),(((void *)0)),(ch),(2),5);
  break;
  }
 }
 }
 return 1;
}

canonical_original_code:
unsigned char check_social(struct char_data *ch, char *command, char *argument)
{
 char arg[256];
 struct char_data *victim;
 int cmd;
 unsigned char found;
 found = 0;
 for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ )
 {
 if ( command[0] == social_table[cmd].name[0]
 && !str_prefix( command, social_table[cmd].name ) )
 {
  found = 1;
  break;
 }
 }
 if ( !found )
 return 0;
 if ( !((((ch)->act) & ((1)))) && ((ch->comm) & ((524288))) )
 {
 send_to_char( "You are anti-social!\n\r", ch );
 return 1;
 }
 switch ( ch->position )
 {
 case 0:
 send_to_char( "Lie still; you are DEAD.\n\r", ch );
 return 1;
 case 2:
 case 1:
 send_to_char( "You are hurt far too bad for that.\n\r", ch );
 return 1;
 case 3:
 send_to_char( "You are too stunned to do that.\n\r", ch );
 return 1;
 case 4:
 if ( !__strcmp(social_table[cmd].name, "snore", "interp.c", __FUNCTION__, 602) )
  break;
 send_to_char( "In your dreams, or what?\n\r", ch );
 return 1;
 }
 one_argument( argument, arg );
 victim = ((void *)0);
 if ( arg[0] == '\0' )
 {
 act_new((social_table[cmd].others_no_arg),(ch),(((void *)0)),(victim),(0),5);
 act_new((social_table[cmd].char_no_arg),(ch),(((void *)0)),(victim),(3),5);
 }
 else if ( ( victim = get_char_room( ch, arg ) ) == ((void *)0) )
 {
 send_to_char( "They aren't here.\n\r", ch );
 }
 else if ( victim == ch )
 {
 act_new((social_table[cmd].others_auto),(ch),(((void *)0)),(victim),(0),5);
 act_new((social_table[cmd].char_auto),(ch),(((void *)0)),(victim),(3),5);
 }
 else
 {
 act_new((social_table[cmd].others_found),(ch),(((void *)0)),(victim),(1),5);
 act_new((social_table[cmd].char_found),(ch),(((void *)0)),(victim),(3),5);
 act_new((social_table[cmd].vict_found),(ch),(((void *)0)),(victim),(2),5);
 if ( !((((ch)->act) & ((1)))) && ((((victim)->act) & ((1))))
 && !((((victim)->affected_by) & (((262144)))))
 && (victim->position > 4)
 && victim->desc == ((void *)0))
 {
  switch ( number_bits( 4 ) )
  {
  case 0:
  case 1: case 2: case 3: case 4:
  case 5: case 6: case 7: case 8:
  act_new((social_table[cmd].others_found),(victim),(((void *)0)),(ch),(1),5);
  act_new((social_table[cmd].char_found),(victim),(((void *)0)),(ch),(3),5);
  act_new((social_table[cmd].vict_found),(victim),(((void *)0)),(ch),(2),5);
  break;
  case 9: case 10: case 11: case 12:
  act_new(("$n slaps $N."),(victim),(((void *)0)),(ch),(1),5);
  act_new(("You slap $N."),(victim),(((void *)0)),(ch),(3),5);
  act_new(("$n slaps you."),(victim),(((void *)0)),(ch),(2),5);
  break;
  }
 }
 }
 return 1;
}

variable_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; } *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; } *pShop; struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; } *mprogs; struct area_data { struct area_data *next; struct help_area_data { struct help_area_data *next; struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; } *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; } *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; } *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; } *pIndexData; struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t { int WriteOOB; enum bool_t { false=0, true=1 } Negotiated[-1]; enum bool_t { false=0, true=1 } bIACMode; enum bool_t { false=0, true=1 } bNegotiated; enum bool_t { false=0, true=1 } bRenegotiate; enum bool_t { false=0, true=1 } bNeedMXPVersion; enum bool_t { false=0, true=1 } bBlockMXP; enum bool_t { false=0, true=1 } bTTYPE; enum bool_t { false=0, true=1 } bECHO; enum bool_t { false=0, true=1 } bNAWS; enum bool_t { false=0, true=1 } bCHARSET; enum bool_t { false=0, true=1 } bMSDP; enum bool_t { false=0, true=1 } bMSSP; enum bool_t { false=0, true=1 } bATCP; enum bool_t { false=0, true=1 } bMSP; enum bool_t { false=0, true=1 } bMXP; enum bool_t { false=0, true=1 } bMCCP; enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 } b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t { enum bool_t { false=0, true=1 } bReport; enum bool_t { false=0, true=1 } bDirty; int ValueInt; char *pValueString; } **pVariables; } *pProtocol; } *desc; struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; } *affected; struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; } *pnote; struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; } *extra_descr; struct affect_data *affected; struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; } *pIndexData; struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; } *exit[6]; struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; } *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; } *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; } *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data { struct pc_data *next; struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; } *pcdata; struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; } *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; } *

variable_types:
command
char *

variable_types:
found
unsigned char

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }


interpret

original_code:
void interpret( CHAR_DATA *ch, char *argument )
{
 char command[256];
 char logline[256];
 int cmd;
 int trust;
 bool found;
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short int) _ISspace) )
 argument++;
 if ( argument[0] == '\0' )
 return;
 ((ch->affected_by) &= ~((65536)));
 if ( !((((ch)->act) & ((1)))) && ((ch->act) & ((16777216))) )
 {
 send_to_char( "You're totally frozen!\n\r", ch );
 return;
 }
 strcpy( logline, argument );
 if ( !((*__ctype_b_loc ())[(int) ((argument[0]))] & (unsigned short int) _ISalpha) && !((*__ctype_b_loc ())[(int) ((argument[0]))] & (unsigned short int) _ISdigit) )
 {
 command[0] = argument[0];
 command[1] = '\0';
 argument++;
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short int) _ISspace) )
  argument++;
 }
 else
 {
 argument = one_argument( argument, command );
 }
 found = 0;
 trust = get_trust( ch );
 for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ )
 {
 if ( command[0] == cmd_table[cmd].name[0]
 && !str_prefix( command, cmd_table[cmd].name )
 && cmd_table[cmd].level <= trust )
 {
  found = 1;
  break;
 }
 }
 if ( cmd_table[cmd].log == 2 )
 strcpy( logline, "" );
 if ( ( !((((ch)->act) & ((1)))) && ((ch->act) & ((4194304))) )
 || fLogAll
 || cmd_table[cmd].log == 1 )
 {
 wiznet(Format("Log %s: %s", ch->name, logline ),ch,((void *)0),(4096),0,get_trust(ch));
 log_string( Format("Log %s: %s", ch->name, logline ) );
 }
 if ( ch->desc != ((void *)0) && ch->desc->snoop_by != ((void *)0) )
 {
 write_to_buffer( ch->desc->snoop_by, "% ", 2 );
 write_to_buffer( ch->desc->snoop_by, logline, 0 );
 write_to_buffer( ch->desc->snoop_by, "\n\r", 2 );
 }
 if ( !found )
 {
 if ( !check_social( ch, command, argument ) )
  send_to_char( "Huh?\n\r", ch );
 return;
 }
 if ( ch->position < cmd_table[cmd].position )
 {
 switch( ch->position )
 {
 case 0:
  send_to_char( "Lie still; you are DEAD.\n\r", ch );
  break;
 case 1:
 case 2:
  send_to_char( "You are hurt far too bad for that.\n\r", ch );
  break;
 case 3:
  send_to_char( "You are too stunned to do that.\n\r", ch );
  break;
 case 4:
  send_to_char( "In your dreams, or what?\n\r", ch );
  break;
 case 5:
  send_to_char( "Nah... You feel too relaxed...\n\r", ch);
  break;
 case 6:
  send_to_char( "Better stand up first.\n\r",ch);
  break;
 case 7:
  send_to_char( "No way!  You are still fighting!\n\r", ch);
  break;
 }
 return;
 }
 (*cmd_table[cmd].do_fun) ( ch, argument );
 tail_chain( );
 return;
}

canonical_original_code:
void interpret(struct char_data *ch, char *argument)
{
 char command[256];
 char logline[256];
 int cmd;
 int trust;
 unsigned char found;
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short) _ISspace) )
 argument++;
 if ( argument[0] == '\0' )
 return;
 ((ch->affected_by) &= ~((65536)));
 if ( !((((ch)->act) & ((1)))) && ((ch->act) & ((16777216))) )
 {
 send_to_char( "You're totally frozen!\n\r", ch );
 return;
 }
 strcpy( logline, argument );
 if ( !((*__ctype_b_loc ())[(int) ((argument[0]))] & (unsigned short) _ISalpha) && !((*__ctype_b_loc ())[(int) ((argument[0]))] & (unsigned short) _ISdigit) )
 {
 command[0] = argument[0];
 command[1] = '\0';
 argument++;
 while ( ((*__ctype_b_loc ())[(int) ((*argument))] & (unsigned short) _ISspace) )
  argument++;
 }
 else
 {
 argument = one_argument( argument, command );
 }
 found = 0;
 trust = get_trust( ch );
 for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ )
 {
 if ( command[0] == cmd_table[cmd].name[0]
 && !str_prefix( command, cmd_table[cmd].name )
 && cmd_table[cmd].level <= trust )
 {
  found = 1;
  break;
 }
 }
 if ( cmd_table[cmd].log == 2 )
 strcpy( logline, "" );
 if ( ( !((((ch)->act) & ((1)))) && ((ch->act) & ((4194304))) )
 || fLogAll
 || cmd_table[cmd].log == 1 )
 {
 wiznet(Format("Log %s: %s", ch->name, logline ),ch,((void *)0),(4096),0,get_trust(ch));
 log_string( Format("Log %s: %s", ch->name, logline ) );
 }
 if ( ch->desc != ((void *)0) && ch->desc->snoop_by != ((void *)0) )
 {
 write_to_buffer( ch->desc->snoop_by, "% ", 2 );
 write_to_buffer( ch->desc->snoop_by, logline, 0 );
 write_to_buffer( ch->desc->snoop_by, "\n\r", 2 );
 }
 if ( !found )
 {
 if ( !check_social( ch, command, argument ) )
  send_to_char( "Huh?\n\r", ch );
 return;
 }
 if ( ch->position < cmd_table[cmd].position )
 {
 switch( ch->position )
 {
 case 0:
  send_to_char( "Lie still; you are DEAD.\n\r", ch );
  break;
 case 1:
 case 2:
  send_to_char( "You are hurt far too bad for that.\n\r", ch );
  break;
 case 3:
  send_to_char( "You are too stunned to do that.\n\r", ch );
  break;
 case 4:
  send_to_char( "In your dreams, or what?\n\r", ch );
  break;
 case 5:
  send_to_char( "Nah... You feel too relaxed...\n\r", ch);
  break;
 case 6:
  send_to_char( "Better stand up first.\n\r",ch);
  break;
 case 7:
  send_to_char( "No way!  You are still fighting!\n\r", ch);
  break;
 }
 return;
 }
 (*cmd_table[cmd].do_fun) ( ch, argument );
 tail_chain( );
 return;
}

variable_types:
argument
char *

variable_types:
command
char [256]

variable_types:
logline
char [256]

variable_types: trust int

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }

user_defined_types: struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; }