original_code:
void do_wizlist(CHAR_DATA *ch, char *argument)
{
 char arg1[256]={'\0'};
 char arg2[256]={'\0'};
 char arg3[256]={'\0'};
 char buf[4608]={'\0'};
 char title[4608]={'\0'};
 BUFFER *buffer;
 WIZ_DATA *pwiz;
 int level = 0;
 int lngth = 0;
 int amt = 0;
 bool found;
 argument = one_argument( argument, arg1 );
 argument = one_argument( argument, arg2 );
 argument = one_argument( argument, arg3 );
 if ((arg1[0] != '\0') && (ch->level == 60))
 {
  if ( !str_prefix( arg1, "add" ) )
  {
   if ( !is_number( arg2 ) || ( arg3[0] == '\0' ) )
   {
    send_to_char( "Syntax: wizlist add <level> <name>\n\r", ch );
    return;
   }
   level = atoi(arg2);
   change_wizlist( ch, 1, level, arg3 );
   return;
  }
  if ( !str_prefix( arg1, "delete" ) )
  {
   if ( arg2[0] == '\0' )
   {
    send_to_char( "Syntax: wizlist delete <name>\n\r", ch );
    return;
   }
   change_wizlist( ch, 0, 0, arg2 );
   return;
  }
  send_to_char( "Syntax:\n\r", ch );
  send_to_char( " wizlist delete <name>\n\r", ch );
  send_to_char( " wizlist add <level> <name>\n\r", ch );
  return;
 }
 if (wiz_list == ((void *)0))
 {
  send_to_char("No immortals listed at this time.\n\r",ch);
  return;
 }
 buffer = __new_buf("wizlist.c", __FUNCTION__, 190);
 sprintf(title,"The Gods of Dungeon World");
 sprintf(buf,"___________________________________________________________________________\n\r");
 add_buf(buffer,buf);
 sprintf(buf," /\\_\\%70s\\_\\\n\r", " ");
 add_buf(buffer,buf);
 lngth = (70 - strlen(title))/2;
 for( ; lngth >= 0; lngth--)
 {
  strcat(title, " ");
 }
 sprintf(buf,"|/\\\\_\\\tW%70s\tn\\_\\\n\r", title);
 add_buf(buffer,buf);
 sprintf(buf,"\\_/_|_|%69s|_|\n\r", " ");
 add_buf(buffer,buf);
 for (level = 60; level > (60 - 9); level--)
 {
  found = 0;
  amt = 0;
  for (pwiz = wiz_list;pwiz != ((void *)0);pwiz = pwiz->next)
  {
   if (pwiz->level == level)
   {
    amt++;
    found = 1;
   }
  }
  if (!found)
  {
   if (level == (60 - 9)+1)
   {
    sprintf(buf," ___|_|%69s|_|\n\r", " ");
    add_buf(buffer,buf);
   }
   continue;
  }
  sprintf(buf," |_|%37s [%d]%30s|_|\n\r", wiz_titles[60 -level], level, " ");
  add_buf(buffer,buf);
  sprintf(buf," |_|\tY%25s******************\tn%29s|_|\n\r", " ", " ");
  add_buf(buffer,buf);
  lngth = 0;
  for (pwiz = wiz_list;pwiz != ((void *)0);pwiz = pwiz->next)
  {
   if (pwiz->level == level)
   {
    if (lngth == 0)
    {
     if (amt > 2)
     {
      sprintf(buf, " |_|%12s%-23s ", pwiz->name, " ");
      add_buf(buffer, buf);
      lngth = 1;
     }
     else if (amt > 1)
     {
      sprintf(buf, " |_|%21s%-23s ", pwiz->name, " ");
      add_buf(buffer, buf);
      lngth = 1;
     }
     else
     {
      sprintf(buf, " |_|%30s%-42s|_|\n\r", pwiz->name, " ");
      add_buf(buffer, buf);
      lngth = 0;
     }
    }
    else if (lngth == 1)
    {
     if (amt > 2)
     {
      sprintf(buf, "%-23s ", pwiz->name);
      add_buf(buffer, buf);
      lngth = 2;
     }
     else
     {
      sprintf(buf, "%-30s|_|\n\r", pwiz->name);
      add_buf(buffer, buf);
      lngth = 0;
     }
    }
    else
    {
     sprintf(buf, "%-21s|_|\n\r", pwiz->name);
     add_buf(buffer, buf);
     lngth = 0;
     amt -= 3;
    }
   }
  }
  if (level == (60 - 9)+1)
  {
   sprintf(buf," ___|_|%72s|_|\n\r", " ");
  }
  else
  {
   sprintf(buf," |_|%72s|_|\n\r", " ");
  }
  add_buf(buffer,buf);
 }
 sprintf(buf,"/ \\ |_|%69s|_|\n\r", " ");
 add_buf(buffer,buf);
 sprintf(buf,"|\\//_/%70s/_/\n\r", " ");
 add_buf(buffer,buf);
 sprintf(buf," \\/_/______________________________________________________________________/_/\n\r");
 add_buf(buffer,buf);
 page_to_char( buf_string(buffer), ch );
 free_buf(buffer);
 return;
}

canonical_original_code:
void do_wizlist(struct char_data *ch, char *argument)
{
 char arg1[256] = {'\0'};
 char arg2[256] = {'\0'};
 char arg3[256] = {'\0'};
 char buf[4608] = {'\0'};
 char title[4608] = {'\0'};
 struct buf_type *buffer;
 struct wiz_data *pwiz;
 int level = 0;
 int lngth = 0;
 int amt = 0;
 unsigned char found;
 argument = one_argument( argument, arg1 );
 argument = one_argument( argument, arg2 );
 argument = one_argument( argument, arg3 );
 if ((arg1[0] != '\0') && (ch->level == 60))
 {
  if ( !str_prefix( arg1, "add" ) )
  {
   if ( !is_number( arg2 ) || ( arg3[0] == '\0' ) )
   {
    send_to_char( "Syntax: wizlist add <level> <name>\n\r", ch );
    return;
   }
   level = atoi(arg2);
   change_wizlist( ch, 1, level, arg3 );
   return;
  }
  if ( !str_prefix( arg1, "delete" ) )
  {
   if ( arg2[0] == '\0' )
   {
    send_to_char( "Syntax: wizlist delete <name>\n\r", ch );
    return;
   }
   change_wizlist( ch, 0, 0, arg2 );
   return;
  }
  send_to_char( "Syntax:\n\r", ch );
  send_to_char( " wizlist delete <name>\n\r", ch );
  send_to_char( " wizlist add <level> <name>\n\r", ch );
  return;
 }
 if (wiz_list == ((void *)0))
 {
  send_to_char("No immortals listed at this time.\n\r",ch);
  return;
 }
 buffer = __new_buf("wizlist.c", __FUNCTION__, 190);
 sprintf(title,"The Gods of Dungeon World");
 sprintf(buf,"___________________________________________________________________________\n\r");
 add_buf(buffer,buf);
 sprintf(buf," /\\_\\%70s\\_\\\n\r", " ");
 add_buf(buffer,buf);
 lngth = (70 - strlen(title))/2;
 for( ; lngth >= 0; lngth--)
 {
  strcat(title, " ");
 }
 sprintf(buf,"|/\\\\_\\\tW%70s\tn\\_\\\n\r", title);
 add_buf(buffer,buf);
 sprintf(buf,"\\_/_|_|%69s|_|\n\r", " ");
 add_buf(buffer,buf);
 for (level = 60; level > (60 - 9); level--)
 {
  found = 0;
  amt = 0;
  for (pwiz = wiz_list;pwiz != ((void *)0);pwiz = pwiz->next)
  {
   if (pwiz->level == level)
   {
    amt++;
    found = 1;
   }
  }
  if (!found)
  {
   if (level == (60 - 9)+1)
   {
    sprintf(buf," ___|_|%69s|_|\n\r", " ");
    add_buf(buffer,buf);
   }
   continue;
  }
  sprintf(buf," |_|%37s [%d]%30s|_|\n\r", wiz_titles[60 -level], level, " ");
  add_buf(buffer,buf);
  sprintf(buf," |_|\tY%25s******************\tn%29s|_|\n\r", " ", " ");
  add_buf(buffer,buf);
  lngth = 0;
  for (pwiz = wiz_list;pwiz != ((void *)0);pwiz = pwiz->next)
  {
   if (pwiz->level == level)
   {
    if (lngth == 0)
    {
     if (amt > 2)
     {
      sprintf(buf, " |_|%12s%-23s ", pwiz->name, " ");
      add_buf(buffer, buf);
      lngth = 1;
     }
     else if (amt > 1)
     {
      sprintf(buf, " |_|%21s%-23s ", pwiz->name, " ");
      add_buf(buffer, buf);
      lngth = 1;
     }
     else
     {
      sprintf(buf, " |_|%30s%-42s|_|\n\r", pwiz->name, " ");
      add_buf(buffer, buf);
      lngth = 0;
     }
    }
    else if (lngth == 1)
    {
     if (amt > 2)
     {
      sprintf(buf, "%-23s ", pwiz->name);
      add_buf(buffer, buf);
      lngth = 2;
     }
     else
     {
      sprintf(buf, "%-30s|_|\n\r", pwiz->name);
      add_buf(buffer, buf);
      lngth = 0;
     }
    }
    else
    {
     sprintf(buf, "%-21s|_|\n\r", pwiz->name);
     add_buf(buffer, buf);
     lngth = 0;
     amt -= 3;
    }
   }
  }
  if (level == (60 - 9)+1)
  {
   sprintf(buf," ___|_|%72s|_|\n\r", " ");
  }
  else
  {
   sprintf(buf," |_|%72s|_|\n\r", " ");
  }
  add_buf(buffer,buf);
 }
 sprintf(buf,"/ \\ |_|%69s|_|\n\r", " ");
 add_buf(buffer,buf);
 sprintf(buf,"|\\//_/%70s/_/\n\r", " ");
 add_buf(buffer,buf);
 sprintf(buf," \\/_/______________________________________________________________________/_/\n\r");
 add_buf(buffer,buf);
 page_to_char( buf_string(buffer), ch );
 free_buf(buffer);
 return;
}

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:
title
char [4608]

variable_types: lngth int

variable_types: amt int

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

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


repo: ptrayal/dungeonworld

decompiled_code:
__int64 clear_wizlist()
{
__int64 result; // rax
_QWORD *v1; // rbp
_QWORD *v2; // rbx
_QWORD *v3; // rax

result = log_string("Cleaning: wiz_list");
v1 = (_QWORD *)wiz_list;
if ( wiz_list )
{
do
{
v2 = v1;
v1 = (_QWORD *)*v1;
v3 = (_QWORD *)wiz_list;
if ( (_QWORD *)wiz_list == v2 )
{
wiz_list = (__int64)v1;
}
else
{
while ( v3 )
{
if ( (_QWORD *)*v3 == v2 )
{
*v3 = v1;
goto LABEL_4;
}
v3 = (_QWORD *)*v3;
}
logfmt("wiz not found in wiz_list.");
}
LABEL_4:
result = free_wiz(v2);
}
while ( v1 );
}
wiz_list = 0LL;
return result;
}

canonical_decompiled_code:
__int64 func5()
{
__int64 result; // rax
_QWORD *v1; // rbp
_QWORD *v2; // rbx
_QWORD *v3; // rax

result = log_string("Cleaning: wiz_list");
v1 = (_QWORD *)wiz_list;
if ( wiz_list )
{
do
{
v2 = v1;
v1 = (_QWORD *)*v1;
v3 = (_QWORD *)wiz_list;
if ( (_QWORD *)wiz_list == v2 )
{
wiz_list = (__int64)v1;
}
else
{
while ( v3 )
{
if ( (_QWORD *)*v3 == v2 )
{
*v3 = v1;
goto LABEL_4;
}
v3 = (_QWORD *)*v3;
}
logfmt("wiz not found in wiz_list.");
}
LABEL_4:
result = free_wiz(v2);
}
while ( v1 );
}
wiz_list = 0LL;
return result;
}

original_code:
void clear_wizlist(void)
{
 WIZ_DATA *wiz, *wiz_next;
 log_string("Cleaning: wiz_list");
 for(wiz = wiz_list; wiz; wiz = wiz_next) {
  wiz_next = wiz->next;
  do { ((void) sizeof ((wiz) ? 1 : 0), __extension__ ({ if (wiz) ; else __assert_fail ("wiz", "wizlist.c", 398, __extension__ __PRETTY_FUNCTION__); })); if (wiz_list == wiz) { wiz_list = wiz->next; } else { WIZ_DATA *prev; for (prev = wiz_list; prev != ((void *)0); prev = prev->next) { if (prev->next == wiz) { prev->next = wiz->next; break; } } if (prev == ((void *)0)) { logfmt("wiz" " not found in " "wiz_list" "."); } } } while(0);
  free_wiz(wiz);
 }
 wiz_list = ((void *)0);
}

canonical_original_code:
void clear_wizlist()
{
 struct wiz_data *wiz; struct wiz_data *wiz_next;
 log_string("Cleaning: wiz_list");
 for(wiz = wiz_list; wiz; wiz = wiz_next) {
  wiz_next = wiz->next;
  do { ((void) sizeof ((wiz) ? 1 : 0), __extension__ ({ if (wiz) ; else __assert_fail ("wiz", "wizlist.c", 398, __extension__ __PRETTY_FUNCTION__); })); if (wiz_list == wiz) { wiz_list = wiz->next; } else { struct wiz_data *prev; for (prev = wiz_list; prev != ((void *)0); prev = prev->next) { if (prev->next == wiz) { prev->next = wiz->next; break; } } if (prev == ((void *)0)) { logfmt("wiz" " not found in " "wiz_list" "."); } } } while(0);
  free_wiz(wiz);
 }
 wiz_list = ((void *)0);
}

variable_types: struct wiz_data { struct wiz_data *next; unsigned char valid; short level; char *name; } *

return_type: void


decompiled_code:
__int64 __fastcall spell_farsight(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax

if ( (*(_BYTE *)(a3 + 376) & 1) != 0 )
result = send_to_char("Maybe it would help if you could see?\n\r", a3);
else
result = do_function(a3, &do_scan, target_name);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax

if ( (*(_BYTE *)(a3 + 376) & 1) != 0 )
result = send_to_char("Maybe it would help if you could see?\n\r", a3);
else
result = do_function(a3, &do_scan, target_name);
return result;
}

original_code:
void spell_farsight( int sn, int level, CHAR_DATA *ch, void *vo,int target)
{
    if (((((ch)->affected_by) & (((1))))))
    {
        send_to_char("Maybe it would help if you could see?\n\r",ch);
        return;
    }
    do_function(ch, &do_scan, target_name);
}

canonical_original_code:
void spell_farsight(int sn, int level, struct char_data *ch, void *vo, int target)
{
    if (((((ch)->affected_by) & (((1))))))
    {
        send_to_char("Maybe it would help if you could see?\n\r",ch);
        return;
    }
    do_function(ch, &do_scan, target_name);
}

variable_types: sn int

variable_types: level int

variable_types:
vo
void *

variable_types: target 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 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 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 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 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 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 reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

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

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 spell_portal(__int64 a1, unsigned int a2, __int64 a3)
{
__int64 v4; // rax
__int64 v5; // rbp
__int16 v6; // dx
__int64 v7; // rax
__int64 v8; // r13
__int64 v10; // rax
__int64 v11; // r13

v4 = get_char_world(a3, target_name);
if ( a3 == v4 )
return send_to_char("You failed.\n\r", a3);
v5 = v4;
if ( !v4 )
return send_to_char("You failed.\n\r", a3);
if ( !*(_QWORD *)(v4 + 128) )
return send_to_char("You failed.\n\r", a3);
if ( !(unsigned __int8)can_see_room(a3) )
return send_to_char("You failed.\n\r", a3);
if ( (*(_DWORD *)(*(_QWORD *)(v5 + 128) + 132LL) & 0x2E00) != 0 )
return send_to_char("You failed.\n\r", a3);
if ( (*(_BYTE *)(*(_QWORD *)(a3 + 128) + 133LL) & 0x20) != 0 )
return send_to_char("You failed.\n\r", a3);
v6 = *(_WORD *)(v5 + 250);
if ( (int)(a2 + 2) < v6 )
return send_to_char("You failed.\n\r", a3);
v7 = *(_QWORD *)(v5 + 320) & 1LL;
if ( v6 > 50 && !v7 )
return send_to_char("You failed.\n\r", a3);
if ( v7 && ((*(_BYTE *)(v5 + 344) & 1) != 0 || (unsigned __int8)saves_spell(a2, v5, 0LL))
|| (unsigned __int8)is_clan(v5) && !(unsigned __int8)is_same_clan(a3, v5) )
{
return send_to_char("You failed.\n\r", a3);
}
v8 = get_eq_char(a3, 17LL);
if ( (int)get_trust(a3) > 51 )
{
if ( !v8 || *(_WORD *)(v8 + 120) != 30 )
goto LABEL_22;
}
else if ( !v8 || *(_WORD *)(v8 + 120) != 30 )
{
return send_to_char("You lack the proper component for this spell.\n\r", a3);
}
act_new("You draw upon the power of $p.", a3, v8, 0LL, 3LL, 5LL);
act_new("It flares brightly and vanishes!", a3, v8, 0LL, 3LL, 5LL);
extract_obj(v8);
LABEL_22:
v10 = get_obj_index(25LL);
v11 = create_object(v10, 0LL);
*(_WORD *)(v11 + 152) = (int)a2 / 25 + 2;
*(_DWORD *)(v11 + 168) = *(__int16 *)(*(_QWORD *)(v5 + 128) + 128LL);
obj_to_room(v11, *(_QWORD *)(a3 + 128));
act_new("$p rises up from the ground.", a3, v11, 0LL, 0LL, 5LL);
return act_new("$p rises up before you.", a3, v11, 0LL, 3LL, 5LL);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, unsigned int a2, __int64 a3)
{
__int64 v4; // rax
__int64 v5; // rbp
__int16 v6; // dx
__int64 v7; // rax
__int64 v8; // r13
__int64 v10; // rax
__int64 v11; // r13

v4 = get_char_world(a3, target_name);
if ( a3 == v4 )
return send_to_char("You failed.\n\r", a3);
v5 = v4;
if ( !v4 )
return send_to_char("You failed.\n\r", a3);
if ( !*(_QWORD *)(v4 + 128) )
return send_to_char("You failed.\n\r", a3);
if ( !(unsigned __int8)can_see_room(a3) )
return send_to_char("You failed.\n\r", a3);
if ( (*(_DWORD *)(*(_QWORD *)(v5 + 128) + 132LL) & 0x2E00) != 0 )
return send_to_char("You failed.\n\r", a3);
if ( (*(_BYTE *)(*(_QWORD *)(a3 + 128) + 133LL) & 0x20) != 0 )
return send_to_char("You failed.\n\r", a3);
v6 = *(_WORD *)(v5 + 250);
if ( (int)(a2 + 2) < v6 )
return send_to_char("You failed.\n\r", a3);
v7 = *(_QWORD *)(v5 + 320) & 1LL;
if ( v6 > 50 && !v7 )
return send_to_char("You failed.\n\r", a3);
if ( v7 && ((*(_BYTE *)(v5 + 344) & 1) != 0 || (unsigned __int8)saves_spell(a2, v5, 0LL))
|| (unsigned __int8)is_clan(v5) && !(unsigned __int8)is_same_clan(a3, v5) )
{
return send_to_char("You failed.\n\r", a3);
}
v8 = get_eq_char(a3, 17LL);
if ( (int)get_trust(a3) > 51 )
{
if ( !v8 || *(_WORD *)(v8 + 120) != 30 )
goto LABEL_22;
}
else if ( !v8 || *(_WORD *)(v8 + 120) != 30 )
{
return send_to_char("You lack the proper component for this spell.\n\r", a3);
}
act_new("You draw upon the power of $p.", a3, v8, 0LL, 3LL, 5LL);
act_new("It flares brightly and vanishes!", a3, v8, 0LL, 3LL, 5LL);
extract_obj(v8);
LABEL_22:
v10 = get_obj_index(25LL);
v11 = create_object(v10, 0LL);
*(_WORD *)(v11 + 152) = (int)a2 / 25 + 2;
*(_DWORD *)(v11 + 168) = *(__int16 *)(*(_QWORD *)(v5 + 128) + 128LL);
obj_to_room(v11, *(_QWORD *)(a3 + 128));
act_new("$p rises up from the ground.", a3, v11, 0LL, 0LL, 5LL);
return act_new("$p rises up before you.", a3, v11, 0LL, 3LL, 5LL);
}

original_code:
void spell_portal( int sn, int level, CHAR_DATA *ch, void *vo,int target)
{
    CHAR_DATA *victim;
    OBJ_DATA *portal, *stone;
        if ( ( victim = get_char_world( ch, target_name ) ) == ((void *)0)
    || victim == ch
    || victim->in_room == ((void *)0)
    || !can_see_room(ch,victim->in_room)
    || ((victim->in_room->room_flags) & ((1024)))
    || ((victim->in_room->room_flags) & ((512)))
    || ((victim->in_room->room_flags) & ((2048)))
    || ((victim->in_room->room_flags) & ((8192)))
    || ((ch->in_room->room_flags) & ((8192)))
    || victim->level >= level + 3
    || (!((((victim)->act) & ((1)))) && victim->level >= (60 - 9))
    || (((((victim)->act) & ((1)))) && ((victim->imm_flags) & ((1))))
    || (((((victim)->act) & ((1)))) && saves_spell( level, victim,0) )
    || (is_clan(victim) && !is_same_clan(ch,victim)))
    {
        send_to_char( "You failed.\n\r", ch );
        return;
    }
    stone = get_eq_char(ch,17);
    if (!(get_trust(ch) >= (60 - 8))
    && (stone == ((void *)0) || stone->item_type != 30))
    {
 send_to_char("You lack the proper component for this spell.\n\r",ch);
 return;
    }
    if (stone != ((void *)0) && stone->item_type == 30)
    {
      act_new(("You draw upon the power of $p."),(ch),(stone),(((void *)0)),(3),5);
      act_new(("It flares brightly and vanishes!"),(ch),(stone),(((void *)0)),(3),5);
      extract_obj(stone);
    }
    portal = create_object(get_obj_index(25),0);
    portal->timer = 2 + level / 25;
    portal->value[3] = victim->in_room->vnum;
    obj_to_room(portal,ch->in_room);
    act_new(("$p rises up from the ground."),(ch),(portal),(((void *)0)),(0),5);
    act_new(("$p rises up before you."),(ch),(portal),(((void *)0)),(3),5);
}

canonical_original_code:
void spell_portal(int sn, int level, struct char_data *ch, void *vo, int target)
{
    struct char_data *victim;
    struct obj_data *portal; struct obj_data *stone;
        if ( ( victim = get_char_world( ch, target_name ) ) == ((void *)0)
    || victim == ch
    || victim->in_room == ((void *)0)
    || !can_see_room(ch,victim->in_room)
    || ((victim->in_room->room_flags) & ((1024)))
    || ((victim->in_room->room_flags) & ((512)))
    || ((victim->in_room->room_flags) & ((2048)))
    || ((victim->in_room->room_flags) & ((8192)))
    || ((ch->in_room->room_flags) & ((8192)))
    || victim->level >= level + 3
    || (!((((victim)->act) & ((1)))) && victim->level >= (60 - 9))
    || (((((victim)->act) & ((1)))) && ((victim->imm_flags) & ((1))))
    || (((((victim)->act) & ((1)))) && saves_spell( level, victim,0) )
    || (is_clan(victim) && !is_same_clan(ch,victim)))
    {
        send_to_char( "You failed.\n\r", ch );
        return;
    }
    stone = get_eq_char(ch,17);
    if (!(get_trust(ch) >= (60 - 8))
    && (stone == ((void *)0) || stone->item_type != 30))
    {
 send_to_char("You lack the proper component for this spell.\n\r",ch);
 return;
    }
    if (stone != ((void *)0) && stone->item_type == 30)
    {
      act_new(("You draw upon the power of $p."),(ch),(stone),(((void *)0)),(3),5);
      act_new(("It flares brightly and vanishes!"),(ch),(stone),(((void *)0)),(3),5);
      extract_obj(stone);
    }
    portal = create_object(get_obj_index(25),0);
    portal->timer = 2 + level / 25;
    portal->value[3] = victim->in_room->vnum;
    obj_to_room(portal,ch->in_room);
    act_new(("$p rises up from the ground."),(ch),(portal),(((void *)0)),(0),5);
    act_new(("$p rises up before you."),(ch),(portal),(((void *)0)),(3),5);
}

variable_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 { 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 *carrying; struct obj_data *on; struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; } *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; 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; } *carried_by; struct extra_descr_data *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 *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 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 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 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 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; }


decompiled_code:
__int64 __fastcall spell_nexus(__int64 a1, unsigned int a2, __int64 a3)
{
__int64 v4; // r14
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // r12
__int64 result; // rax
__int16 v9; // dx
__int64 v10; // rax
__int64 v11; // rbp
__int64 v12; // rax
__int64 v13; // rbp
int v14; // er13
__int64 v15; // rax
__int64 v16; // rbx
__int64 v17; // rsi

v4 = *(_QWORD *)(a3 + 128);
v5 = get_char_world(a3, target_name);
if ( a3 == v5 )
return send_to_char("You failed.\n\r", a3);
v6 = v5;
if ( !v5 )
return send_to_char("You failed.\n\r", a3);
v7 = *(_QWORD *)(v5 + 128);
if ( !v7 )
return send_to_char("You failed.\n\r", a3);
if ( !(unsigned __int8)can_see_room(a3) )
return send_to_char("You failed.\n\r", a3);
if ( !(unsigned __int8)can_see_room(a3) )
return send_to_char("You failed.\n\r", a3);
if ( (*(_DWORD *)(v7 + 132) & 0x400) != 0 )
return send_to_char("You failed.\n\r", a3);
if ( *(_DWORD *)(v7 + 132) & 0x2A00 | *(_DWORD *)(v4 + 132) & 0x2400 )
return send_to_char("You failed.\n\r", a3);
v9 = *(_WORD *)(v6 + 250);
if ( (int)(a2 + 2) < v9 )
return send_to_char("You failed.\n\r", a3);
v10 = *(_QWORD *)(v6 + 320) & 1LL;
if ( v9 > 50 && !v10 )
return send_to_char("You failed.\n\r", a3);
if ( v10 && ((*(_BYTE *)(v6 + 344) & 1) != 0 || (unsigned __int8)saves_spell(a2, v6, 0LL))
|| (unsigned __int8)is_clan(v6) && !(unsigned __int8)is_same_clan(a3, v6) )
{
return send_to_char("You failed.\n\r", a3);
}
v11 = get_eq_char(a3, 17LL);
if ( (int)get_trust(a3) <= 51 )
{
if ( !v11 || *(_WORD *)(v11 + 120) != 30 )
return send_to_char("You lack the proper component for this spell.\n\r", a3);
goto LABEL_27;
}
if ( v11 && *(_WORD *)(v11 + 120) == 30 )
{
LABEL_27:
act_new("You draw upon the power of $p.", a3, v11, 0LL, 3LL, 5LL);
act_new("It flares brightly and vanishes!", a3, v11, 0LL, 3LL, 5LL);
extract_obj(v11);
}
v12 = get_obj_index(25LL);
v13 = create_object(v12, 0LL);
v14 = (int)a2 / 10 + 1;
*(_WORD *)(v13 + 152) = v14;
*(_DWORD *)(v13 + 168) = *(__int16 *)(v7 + 128);
obj_to_room(v13, v4);
act_new("$p rises up from the ground.", a3, v13, 0LL, 0LL, 5LL);
result = act_new("$p rises up before you.", a3, v13, 0LL, 3LL, 5LL);
if ( v4 != v7 )
{
v15 = get_obj_index(25LL);
v16 = create_object(v15, 0LL);
*(_WORD *)(v16 + 152) = v14;
*(_DWORD *)(v16 + 168) = *(__int16 *)(v4 + 128);
result = obj_to_room(v16, v7);
v17 = *(_QWORD *)(v7 + 8);
if ( v17 )
{
act_new("$p rises up from the ground.", v17, v16, 0LL, 0LL, 5LL);
result = act_new("$p rises up from the ground.", *(_QWORD *)(v7 + 8), v16, 0LL, 3LL, 5LL);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, unsigned int a2, __int64 a3)
{
__int64 v4; // r14
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // r12
__int64 result; // rax
__int16 v9; // dx
__int64 v10; // rax
__int64 v11; // rbp
__int64 v12; // rax
__int64 v13; // rbp
int v14; // er13
__int64 v15; // rax
__int64 v16; // rbx
__int64 v17; // rsi

v4 = *(_QWORD *)(a3 + 128);
v5 = get_char_world(a3, target_name);
if ( a3 == v5 )
return send_to_char("You failed.\n\r", a3);
v6 = v5;
if ( !v5 )
return send_to_char("You failed.\n\r", a3);
v7 = *(_QWORD *)(v5 + 128);
if ( !v7 )
return send_to_char("You failed.\n\r", a3);
if ( !(unsigned __int8)can_see_room(a3) )
return send_to_char("You failed.\n\r", a3);
if ( !(unsigned __int8)can_see_room(a3) )
return send_to_char("You failed.\n\r", a3);
if ( (*(_DWORD *)(v7 + 132) & 0x400) != 0 )
return send_to_char("You failed.\n\r", a3);
if ( *(_DWORD *)(v7 + 132) & 0x2A00 | *(_DWORD *)(v4 + 132) & 0x2400 )
return send_to_char("You failed.\n\r", a3);
v9 = *(_WORD *)(v6 + 250);
if ( (int)(a2 + 2) < v9 )
return send_to_char("You failed.\n\r", a3);
v10 = *(_QWORD *)(v6 + 320) & 1LL;
if ( v9 > 50 && !v10 )
return send_to_char("You failed.\n\r", a3);
if ( v10 && ((*(_BYTE *)(v6 + 344) & 1) != 0 || (unsigned __int8)saves_spell(a2, v6, 0LL))
|| (unsigned __int8)is_clan(v6) && !(unsigned __int8)is_same_clan(a3, v6) )
{
return send_to_char("You failed.\n\r", a3);
}
v11 = get_eq_char(a3, 17LL);
if ( (int)get_trust(a3) <= 51 )
{
if ( !v11 || *(_WORD *)(v11 + 120) != 30 )
return send_to_char("You lack the proper component for this spell.\n\r", a3);
goto LABEL_27;
}
if ( v11 && *(_WORD *)(v11 + 120) == 30 )
{
LABEL_27:
act_new("You draw upon the power of $p.", a3, v11, 0LL, 3LL, 5LL);
act_new("It flares brightly and vanishes!", a3, v11, 0LL, 3LL, 5LL);
extract_obj(v11);
}
v12 = get_obj_index(25LL);
v13 = create_object(v12, 0LL);
v14 = (int)a2 / 10 + 1;
*(_WORD *)(v13 + 152) = v14;
*(_DWORD *)(v13 + 168) = *(__int16 *)(v7 + 128);
obj_to_room(v13, v4);
act_new("$p rises up from the ground.", a3, v13, 0LL, 0LL, 5LL);
result = act_new("$p rises up before you.", a3, v13, 0LL, 3LL, 5LL);
if ( v4 != v7 )
{
v15 = get_obj_index(25LL);
v16 = create_object(v15, 0LL);
*(_WORD *)(v16 + 152) = v14;
*(_DWORD *)(v16 + 168) = *(__int16 *)(v4 + 128);
result = obj_to_room(v16, v7);
v17 = *(_QWORD *)(v7 + 8);
if ( v17 )
{
act_new("$p rises up from the ground.", v17, v16, 0LL, 0LL, 5LL);
result = act_new("$p rises up from the ground.", *(_QWORD *)(v7 + 8), v16, 0LL, 3LL, 5LL);
}
}
return result;
}

original_code:
void spell_nexus( int sn, int level, CHAR_DATA *ch, void *vo, int target)
{
    CHAR_DATA *victim;
    OBJ_DATA *portal, *stone;
    ROOM_INDEX_DATA *to_room, *from_room;
    from_room = ch->in_room;
        if ( ( victim = get_char_world( ch, target_name ) ) == ((void *)0)
    || victim == ch
    || (to_room = victim->in_room) == ((void *)0)
    || !can_see_room(ch,to_room) || !can_see_room(ch,from_room)
    || ((to_room->room_flags) & ((1024)))
    || ((from_room->room_flags) & ((1024)))
    || ((to_room->room_flags) & ((512)))
    || ((to_room->room_flags) & ((2048)))
    || ((to_room->room_flags) & ((8192)))
    || ((from_room->room_flags) & ((8192)))
    || victim->level >= level + 3
    || (!((((victim)->act) & ((1)))) && victim->level >= (60 - 9))
    || (((((victim)->act) & ((1)))) && ((victim->imm_flags) & ((1))))
    || (((((victim)->act) & ((1)))) && saves_spell( level, victim,0) )
    || (is_clan(victim) && !is_same_clan(ch,victim)))
    {
        send_to_char( "You failed.\n\r", ch );
        return;
    }
    stone = get_eq_char(ch,17);
    if (!(get_trust(ch) >= (60 - 8))
    && (stone == ((void *)0) || stone->item_type != 30))
    {
        send_to_char("You lack the proper component for this spell.\n\r",ch);
        return;
    }
    if (stone != ((void *)0) && stone->item_type == 30)
    {
        act_new(("You draw upon the power of $p."),(ch),(stone),(((void *)0)),(3),5);
        act_new(("It flares brightly and vanishes!"),(ch),(stone),(((void *)0)),(3),5);
        extract_obj(stone);
    }
    portal = create_object(get_obj_index(25),0);
    portal->timer = 1 + level / 10;
    portal->value[3] = to_room->vnum;
    obj_to_room(portal,from_room);
    act_new(("$p rises up from the ground."),(ch),(portal),(((void *)0)),(0),5);
    act_new(("$p rises up before you."),(ch),(portal),(((void *)0)),(3),5);
    if (to_room == from_room)
 return;
    portal = create_object(get_obj_index(25),0);
    portal->timer = 1 + level/10;
    portal->value[3] = from_room->vnum;
    obj_to_room(portal,to_room);
    if (to_room->people != ((void *)0))
    {
 act_new(("$p rises up from the ground."),(to_room->people),(portal),(((void *)0)),(0),5);
 act_new(("$p rises up from the ground."),(to_room->people),(portal),(((void *)0)),(3),5);
    }
}

canonical_original_code:
void spell_nexus(int sn, int level, struct char_data *ch, void *vo, int target)
{
    struct char_data *victim;
    struct obj_data *portal; struct obj_data *stone;
    struct room_index_data *to_room; struct room_index_data *from_room;
    from_room = ch->in_room;
        if ( ( victim = get_char_world( ch, target_name ) ) == ((void *)0)
    || victim == ch
    || (to_room = victim->in_room) == ((void *)0)
    || !can_see_room(ch,to_room) || !can_see_room(ch,from_room)
    || ((to_room->room_flags) & ((1024)))
    || ((from_room->room_flags) & ((1024)))
    || ((to_room->room_flags) & ((512)))
    || ((to_room->room_flags) & ((2048)))
    || ((to_room->room_flags) & ((8192)))
    || ((from_room->room_flags) & ((8192)))
    || victim->level >= level + 3
    || (!((((victim)->act) & ((1)))) && victim->level >= (60 - 9))
    || (((((victim)->act) & ((1)))) && ((victim->imm_flags) & ((1))))
    || (((((victim)->act) & ((1)))) && saves_spell( level, victim,0) )
    || (is_clan(victim) && !is_same_clan(ch,victim)))
    {
        send_to_char( "You failed.\n\r", ch );
        return;
    }
    stone = get_eq_char(ch,17);
    if (!(get_trust(ch) >= (60 - 8))
    && (stone == ((void *)0) || stone->item_type != 30))
    {
        send_to_char("You lack the proper component for this spell.\n\r",ch);
        return;
    }
    if (stone != ((void *)0) && stone->item_type == 30)
    {
        act_new(("You draw upon the power of $p."),(ch),(stone),(((void *)0)),(3),5);
        act_new(("It flares brightly and vanishes!"),(ch),(stone),(((void *)0)),(3),5);
        extract_obj(stone);
    }
    portal = create_object(get_obj_index(25),0);
    portal->timer = 1 + level / 10;
    portal->value[3] = to_room->vnum;
    obj_to_room(portal,from_room);
    act_new(("$p rises up from the ground."),(ch),(portal),(((void *)0)),(0),5);
    act_new(("$p rises up before you."),(ch),(portal),(((void *)0)),(3),5);
    if (to_room == from_room)
 return;
    portal = create_object(get_obj_index(25),0);
    portal->timer = 1 + level/10;
    portal->value[3] = from_room->vnum;
    obj_to_room(portal,to_room);
    if (to_room->people != ((void *)0))
    {
 act_new(("$p rises up from the ground."),(to_room->people),(portal),(((void *)0)),(0),5);
 act_new(("$p rises up from the ground."),(to_room->people),(portal),(((void *)0)),(3),5);
    }
}

variable_types: struct room_index_data { struct room_index_data *next; 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 *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; } *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; } *

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


decompiled_code:
__int64 __fastcall spell_gain_attributes(__int64 a1, __int64 a2, __int64 a3)
{
int v4; // eax
__int64 v5; // rax
__int64 result; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax

v4 = dice(1LL, 5LL);
switch ( v4 )
{
case 1:
++*(_WORD *)(a3 + 412);
v7 = Format("%s has used gain attributes to increase their strength.", *(const char **)(a3 + 176));
log_string(v7);
result = send_to_char("You feel stronger.\n\r", a3);
break;
case 2:
++*(_WORD *)(a3 + 418);
v8 = Format("%s has used gain attributes to increase their dexterity.", *(const char **)(a3 + 176));
log_string(v8);
result = send_to_char("You feel more agile.\n\r", a3);
break;
case 3:
++*(_WORD *)(a3 + 420);
v9 = Format("%s has used gain attributes to increase their constitution.", *(const char **)(a3 + 176));
log_string(v9);
result = send_to_char("You feel tougher.\n\r", a3);
break;
case 4:
++*(_WORD *)(a3 + 414);
v10 = Format("%s has used gain attributes to increase their intelligence.", *(const char **)(a3 + 176));
log_string(v10);
result = send_to_char("You feel smarter.\n\r", a3);
break;
default:
++*(_WORD *)(a3 + 416);
v5 = Format("%s has used gain attributes to increase their wisdom.", *(const char **)(a3 + 176));
log_string(v5);
result = send_to_char("You feel wiser.\n\r", a3);
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)
{
int v4; // eax
__int64 v5; // rax
__int64 result; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax

v4 = dice(1LL, 5LL);
switch ( v4 )
{
case 1:
++*(_WORD *)(a3 + 412);
v7 = Format("%s has used gain attributes to increase their strength.", *(const char **)(a3 + 176));
log_string(v7);
result = send_to_char("You feel stronger.\n\r", a3);
break;
case 2:
++*(_WORD *)(a3 + 418);
v8 = Format("%s has used gain attributes to increase their dexterity.", *(const char **)(a3 + 176));
log_string(v8);
result = send_to_char("You feel more agile.\n\r", a3);
break;
case 3:
++*(_WORD *)(a3 + 420);
v9 = Format("%s has used gain attributes to increase their constitution.", *(const char **)(a3 + 176));
log_string(v9);
result = send_to_char("You feel tougher.\n\r", a3);
break;
case 4:
++*(_WORD *)(a3 + 414);
v10 = Format("%s has used gain attributes to increase their intelligence.", *(const char **)(a3 + 176));
log_string(v10);
result = send_to_char("You feel smarter.\n\r", a3);
break;
default:
++*(_WORD *)(a3 + 416);
v5 = Format("%s has used gain attributes to increase their wisdom.", *(const char **)(a3 + 176));
log_string(v5);
result = send_to_char("You feel wiser.\n\r", a3);
break;
}
return result;
}

original_code:
void spell_gain_attributes( int sn, int level, CHAR_DATA *ch, void *vo,int target)
{
    int random_stat = 0;
    random_stat = dice(1,5);
    if(random_stat==1)
    {
        ch->perm_stat[0] += 1;
        log_string( Format("%s has used gain attributes to increase their strength.", ch->name ) );
        send_to_char( "You feel stronger.\n\r", ch);
    }
    else if (random_stat==2)
    {
        ch->perm_stat[3] += 1;
        log_string( Format("%s has used gain attributes to increase their dexterity.", ch->name ) );
        send_to_char( "You feel more agile.\n\r", ch);
    }
    else if (random_stat==3)
    {
        ch->perm_stat[4] += 1;
        log_string( Format("%s has used gain attributes to increase their constitution.", ch->name ) );
        send_to_char( "You feel tougher.\n\r", ch);
    }
    else if (random_stat == 4)
    {
        ch->perm_stat[1] += 1;
        log_string( Format("%s has used gain attributes to increase their intelligence.", ch->name ) );
        send_to_char( "You feel smarter.\n\r", ch);
    }
    else
    {
        ch->perm_stat[2] += 1;
        log_string( Format("%s has used gain attributes to increase their wisdom.", ch->name ) );
        send_to_char( "You feel wiser.\n\r", ch);
    }
}

canonical_original_code:
void spell_gain_attributes(int sn, int level, struct char_data *ch, void *vo, int target)
{
    int random_stat = 0;
    random_stat = dice(1,5);
    if(random_stat==1)
    {
        ch->perm_stat[0] += 1;
        log_string( Format("%s has used gain attributes to increase their strength.", ch->name ) );
        send_to_char( "You feel stronger.\n\r", ch);
    }
    else if (random_stat==2)
    {
        ch->perm_stat[3] += 1;
        log_string( Format("%s has used gain attributes to increase their dexterity.", ch->name ) );
        send_to_char( "You feel more agile.\n\r", ch);
    }
    else if (random_stat==3)
    {
        ch->perm_stat[4] += 1;
        log_string( Format("%s has used gain attributes to increase their constitution.", ch->name ) );
        send_to_char( "You feel tougher.\n\r", ch);
    }
    else if (random_stat == 4)
    {
        ch->perm_stat[1] += 1;
        log_string( Format("%s has used gain attributes to increase their intelligence.", ch->name ) );
        send_to_char( "You feel smarter.\n\r", ch);
    }
    else
    {
        ch->perm_stat[2] += 1;
        log_string( Format("%s has used gain attributes to increase their wisdom.", ch->name ) );
        send_to_char( "You feel wiser.\n\r", ch);
    }
}

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


original_code:
void scan_char(CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door)
{
   extern char *const dir_name[];
   extern char *const distance[];
   char buf[256]={'\0'};
   char buf2[256]={'\0'};
   strcat(buf, ( can_see( ch, (victim) ) ? ( ((((victim)->act) & ((1)))) ? (victim)->short_descr : (victim)->name ) : "someone" ));
   strcat(buf, ", ");
   sprintf(buf2, distance[depth], dir_name[door]);
   strcat(buf, buf2);
   strcat(buf, "\n\r");
   send_to_char(buf, ch);
   return;
}

canonical_original_code:
void scan_char(struct char_data *victim, struct char_data *ch, short depth, short door)
{
   extern char *dir_name[];
   extern char *distance[];
   char buf[256] = {'\0'};
   char buf2[256] = {'\0'};
   strcat(buf, ( can_see( ch, (victim) ) ? ( ((((victim)->act) & ((1)))) ? (victim)->short_descr : (victim)->name ) : "someone" ));
   strcat(buf, ", ");
   sprintf(buf2, distance[depth], dir_name[door]);
   strcat(buf, buf2);
   strcat(buf, "\n\r");
   send_to_char(buf, ch);
   return;
}

variable_types:
ch
struct char_data *

variable_types: depth short

variable_types: door short

variable_types:
distance
char *[]

variable_types:
buf
char [256]

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 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 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 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 reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }


original_code:
void scan_list(ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, sh_int door)
{
   CHAR_DATA *rch;
   if (scan_room == ((void *)0)) return;
   if ( door != -1 && scan_room->exit[rev_dir[door]] != ((void *)0)
   && ((scan_room->exit[rev_dir[door]]->exit_info) & ((2))) )
      return;
   for (rch=scan_room->people; rch != ((void *)0); rch=rch->next_in_room)
   {
      if (rch == ch) continue;
      if (!((((rch)->act) & ((1)))) && rch->invis_level > get_trust(ch)) continue;
      if (can_see(ch, rch)) scan_char(rch, ch, depth, door);
   }
   return;
}

canonical_original_code:
void scan_list(struct room_index_data *scan_room, struct char_data *ch, short depth, short door)
{
   struct char_data *rch;
   if (scan_room == ((void *)0)) return;
   if ( door != -1 && scan_room->exit[rev_dir[door]] != ((void *)0)
   && ((scan_room->exit[rev_dir[door]]->exit_info) & ((2))) )
      return;
   for (rch=scan_room->people; rch != ((void *)0); rch=rch->next_in_room)
   {
      if (rch == ch) continue;
      if (!((((rch)->act) & ((1)))) && rch->invis_level > get_trust(ch)) continue;
      if (can_see(ch, rch)) scan_char(rch, ch, depth, door);
   }
   return;
}

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

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 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 MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }


original_code:
void do_scan(CHAR_DATA *ch, char *argument)
{
   extern char *const dir_name[];
   char arg1[256]={'\0'};
   char buf[256]={'\0'};
   ROOM_INDEX_DATA *scan_room;
   EXIT_DATA *pExit;
   sh_int door, depth;
   argument = one_argument(argument, arg1);
   if (arg1[0] == '\0')
   {
      act_new(("$n looks all around."),(ch),(((void *)0)),(((void *)0)),(0),5);
      send_to_char("Looking around you see:\n\r", ch);
      scan_list(ch->in_room, ch, 0, -1);
      for (door=0;door<6;door++)
      {
         if ((pExit = ch ->in_room->exit[door]) != ((void *)0))
            scan_list(pExit->u1.to_room, ch, 1, door);
      }
      return;
   }
   else if (!__strcmp(arg1, "n", "scan.c", __FUNCTION__, 71) || !__strcmp(arg1, "north", "scan.c", __FUNCTION__, 71)) door = 0;
   else if (!__strcmp(arg1, "e", "scan.c", __FUNCTION__, 72) || !__strcmp(arg1, "east", "scan.c", __FUNCTION__, 72)) door = 1;
   else if (!__strcmp(arg1, "s", "scan.c", __FUNCTION__, 73) || !__strcmp(arg1, "south", "scan.c", __FUNCTION__, 73)) door = 2;
   else if (!__strcmp(arg1, "w", "scan.c", __FUNCTION__, 74) || !__strcmp(arg1, "west", "scan.c", __FUNCTION__, 74)) door = 3;
   else if (!__strcmp(arg1, "u", "scan.c", __FUNCTION__, 75) || !__strcmp(arg1, "up", "scan.c", __FUNCTION__, 75)) door = 4;
   else if (!__strcmp(arg1, "d", "scan.c", __FUNCTION__, 76) || !__strcmp(arg1, "down", "scan.c", __FUNCTION__, 76)) door = 5;
   else { send_to_char("Which way do you want to scan?\n\r", ch); return; }
   act_new(("You peer intently $T."),(ch),(((void *)0)),(dir_name[door]),(3),5);
   act_new(("$n peers intently $T."),(ch),(((void *)0)),(dir_name[door]),(0),5);
   sprintf(buf, "Looking %s you see:\n\r", dir_name[door]);
   scan_room = ch->in_room;
   for (depth = 1; depth < 4; depth++)
   {
      if ((pExit = scan_room->exit[door]) != ((void *)0))
      {
         scan_room = pExit->u1.to_room;
         scan_list(pExit->u1.to_room, ch, depth, door);
      }
   }
   return;
}

canonical_original_code:
void do_scan(struct char_data *ch, char *argument)
{
   extern char *dir_name[];
   char arg1[256] = {'\0'};
   char buf[256] = {'\0'};
   struct room_index_data *scan_room;
   struct exit_data *pExit;
   short door; short depth;
   argument = one_argument(argument, arg1);
   if (arg1[0] == '\0')
   {
      act_new(("$n looks all around."),(ch),(((void *)0)),(((void *)0)),(0),5);
      send_to_char("Looking around you see:\n\r", ch);
      scan_list(ch->in_room, ch, 0, -1);
      for (door=0;door<6;door++)
      {
         if ((pExit = ch ->in_room->exit[door]) != ((void *)0))
            scan_list(pExit->u1.to_room, ch, 1, door);
      }
      return;
   }
   else if (!__strcmp(arg1, "n", "scan.c", __FUNCTION__, 71) || !__strcmp(arg1, "north", "scan.c", __FUNCTION__, 71)) door = 0;
   else if (!__strcmp(arg1, "e", "scan.c", __FUNCTION__, 72) || !__strcmp(arg1, "east", "scan.c", __FUNCTION__, 72)) door = 1;
   else if (!__strcmp(arg1, "s", "scan.c", __FUNCTION__, 73) || !__strcmp(arg1, "south", "scan.c", __FUNCTION__, 73)) door = 2;
   else if (!__strcmp(arg1, "w", "scan.c", __FUNCTION__, 74) || !__strcmp(arg1, "west", "scan.c", __FUNCTION__, 74)) door = 3;
   else if (!__strcmp(arg1, "u", "scan.c", __FUNCTION__, 75) || !__strcmp(arg1, "up", "scan.c", __FUNCTION__, 75)) door = 4;
   else if (!__strcmp(arg1, "d", "scan.c", __FUNCTION__, 76) || !__strcmp(arg1, "down", "scan.c", __FUNCTION__, 76)) door = 5;
   else { send_to_char("Which way do you want to scan?\n\r", ch); return; }
   act_new(("You peer intently $T."),(ch),(((void *)0)),(dir_name[door]),(3),5);
   act_new(("$n peers intently $T."),(ch),(((void *)0)),(dir_name[door]),(0),5);
   sprintf(buf, "Looking %s you see:\n\r", dir_name[door]);
   scan_room = ch->in_room;
   for (depth = 1; depth < 4; depth++)
   {
      if ((pExit = scan_room->exit[door]) != ((void *)0))
      {
         scan_room = pExit->u1.to_room;
         scan_list(pExit->u1.to_room, ch, depth, door);
      }
   }
   return;
}

variable_types:
argument
char *

variable_types: struct exit_data { union { struct room_index_data { struct room_index_data *next; 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 *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; } *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *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; } *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 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 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; }


decompiled_code:
__int64 __fastcall flag_lookup(_BYTE *a1, _BYTE **a2)
{
_BYTE **v2; // rbx
_BYTE *v3; // rsi
int v5; // edx
int v6; // eax

v2 = a2;
v3 = *a2;
if ( !v3 )
return 4294967197LL;
do
{
v5 = (char)*a1 + 32;
if ( (unsigned __int8)(*a1 - 65) > 0x19u )
v5 = (char)*a1;
v6 = (char)*v3;
if ( (unsigned __int8)(*v3 - 65) <= 0x19u )
v6 = (char)*v3 + 32;
if ( v5 == v6 && !(unsigned __int8)str_prefix(a1) )
return *((unsigned int *)v2 + 2);
v2 += 2;
v3 = *v2;
}
while ( *v2 );
return 4294967197LL;
}

original_code:
int flag_lookup (const char *name, const struct flag_type *flag_table)
{
    int flag;
    for (flag = 0; flag_table[flag].name != ((void *)0); flag++)
    {
 if (((name[0]) >= 'A' && (name[0]) <= 'Z' ? (name[0])+'a'-'A' : (name[0])) == ((flag_table[flag].name[0]) >= 'A' && (flag_table[flag].name[0]) <= 'Z' ? (flag_table[flag].name[0])+'a'-'A' : (flag_table[flag].name[0]))
 && !str_prefix(name,flag_table[flag].name))
     return flag_table[flag].bit;
    }
    return -99;
}

canonical_original_code:
int flag_lookup(char *name, struct flag_type *flag_table)
{
    int flag;
    for (flag = 0; flag_table[flag].name != ((void *)0); flag++)
    {
 if (((name[0]) >= 'A' && (name[0]) <= 'Z' ? (name[0])+'a'-'A' : (name[0])) == ((flag_table[flag].name[0]) >= 'A' && (flag_table[flag].name[0]) <= 'Z' ? (flag_table[flag].name[0])+'a'-'A' : (flag_table[flag].name[0]))
 && !str_prefix(name,flag_table[flag].name))
     return flag_table[flag].bit;
    }
    return -99;
}

variable_types:
name
char *

variable_types: struct flag_type { char *name; int bit; unsigned char settable; } *

variable_types: flag int

return_type: int


decompiled_code:
__int64 __fastcall clan_lookup(_BYTE *a1)
{
__int64 v1; // rbx
unsigned int v2; // er12
int v3; // edx
int v4; // eax

v1 = 0LL;
while ( 1 )
{
v2 = v1;
v3 = (char)*a1 + 32;
if ( (unsigned __int8)(*a1 - 65) > 0x19u )
v3 = (char)*a1;
v4 = **((char **)&clan_table + 3 * v1);
if ( (unsigned __int8)(v4 - 65) <= 0x19u )
v4 = (char)v4 + 32;
if ( v3 == v4 && !(unsigned __int8)str_prefix(a1) )
break;
if ( ++v1 == 3 )
return 0;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(_BYTE *a1)
{
__int64 v1; // rbx
unsigned int v2; // er12
int v3; // edx
int v4; // eax

v1 = 0LL;
while ( 1 )
{
v2 = v1;
v3 = (char)*a1 + 32;
if ( (unsigned __int8)(*a1 - 65) > 0x19u )
v3 = (char)*a1;
v4 = **((char **)&clan_table + 3 * v1);
if ( (unsigned __int8)(v4 - 65) <= 0x19u )
v4 = (char)v4 + 32;
if ( v3 == v4 && !(unsigned __int8)str_prefix(a1) )
break;
if ( ++v1 == 3 )
return 0;
}
return v2;
}

original_code:
int clan_lookup(const char *name)
{
    int clan;
    for (clan = 0; clan < 3; clan++)
    {
 if (((name[0]) >= 'A' && (name[0]) <= 'Z' ? (name[0])+'a'-'A' : (name[0])) == ((clan_table[clan].name[0]) >= 'A' && (clan_table[clan].name[0]) <= 'Z' ? (clan_table[clan].name[0])+'a'-'A' : (clan_table[clan].name[0]))
 && !str_prefix(name,clan_table[clan].name))
     return clan;
    }
    return 0;
}

canonical_original_code:
int clan_lookup(char *name)
{
    int clan;
    for (clan = 0; clan < 3; clan++)
    {
 if (((name[0]) >= 'A' && (name[0]) <= 'Z' ? (name[0])+'a'-'A' : (name[0])) == ((clan_table[clan].name[0]) >= 'A' && (clan_table[clan].name[0]) <= 'Z' ? (clan_table[clan].name[0])+'a'-'A' : (clan_table[clan].name[0]))
 && !str_prefix(name,clan_table[clan].name))
     return clan;
    }
    return 0;
}

variable_types: clan int