text: /* This file has been generated by the Hex-Rays decompiler.
     Copyright (c) 2007-2017 Hex-Rays <info@hex-rays.com>
  
     Detected compiler: GNU C++
  */
  
  #include <defs.h>
  
  
  //-------------------------------------------------------------------------
  // Function declarations
  
  void *init_proc();
  int sub_8048FC0();
  // int __cdecl freopen64(_DWORD, _DWORD, _DWORD); weak
  // int dup2(int fd, int fd2);
  // int strcmp(const char *s1, const char *s2);
  // int __cdecl open64(_DWORD, _DWORD); weak
  // int putc_unlocked(int c, FILE *stream);
  // int printf(const char *format, ...);
  // int fflush(FILE *stream);
  // void _exit(int status);
  // void free(void *ptr);
  // char *strdup(const char *s);
  // void *memcpy(void *dest, const void *src, size_t n);
  // int mbsinit(const mbstate_t *ps);
  // int ferror(FILE *stream);
  // int fclose(FILE *stream);
  // intmax_t strtoimax(const char *nptr, char **endptr, int base);
  // int __cdecl fseeko64(_DWORD, _DWORD, _DWORD, _DWORD); weak
  // int memcmp(const void *s1, const void *s2, size_t n);
  // char *textdomain(const char *domainname);
  // int iswprint(wint_t wc);
  // int __cdecl fopen64(_DWORD, _DWORD); weak
  // int ferror_unlocked(FILE *stream);
  // size_t fwrite(const void *ptr, size_t size, size_t n, FILE *s);
  // int __cdecl __fxstat64(_DWORD, _DWORD, _DWORD); weak
  // size_t __ctype_get_mb_cur_max(void);
  // size_t fread(void *ptr, size_t size, size_t n, FILE *stream);
  // size_t __fpending(FILE *fp);
  // size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *p);
  // int __cdecl __cxa_atexit(_DWORD, _DWORD, _DWORD); weak
  // void error(int status, int errnum, const char *format, ...);
  // char *getenv(const char *name);
  // void *realloc(void *ptr, size_t size);
  // void *malloc(size_t size);
  // int re_match(struct re_pattern_buffer *buffer, const char *string, int length, int start, struct re_registers *regs);
  // int __freading(FILE *fp);
  // void exit(int status);
  // int __cdecl ftello64(_DWORD); weak
  // char *gettext(const char *msgid);
  // int __cdecl fputs_unlocked(_DWORD, _DWORD); weak
  // int getopt_long(int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind);
  // char *strchr(const char *s, int c);
  // size_t strlen(const char *s);
  // size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
  // int iconv_close(iconv_t cd);
  // int fprintf(FILE *stream, const char *format, ...);
  // int re_search(struct re_pattern_buffer *buffer, const char *string, int length, int start, int range, struct re_registers *regs);
  // int re_compile_fastmap(struct re_pattern_buffer *buffer);
  // void *memset(void *s, int c, size_t n);
  // int *__errno_location(void);
  // void *memchr(const void *s, int c, size_t n);
  // int fileno(FILE *stream);
  // size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, FILE *stream);
  // int strnlen(void); weak
  // char *nl_langinfo(nl_item item);
  // char *setlocale(int category, const char *locale);
  // int toupper(int c);
  // char *strrchr(const char *s, int c);
  // int sprintf(char *s, const char *format, ...);
  // int __cdecl lseek64(_DWORD, _DWORD, _DWORD, _DWORD); weak
  // void qsort(void *base, size_t nmemb, size_t size, __compar_fn_t compar);
  // const char *re_compile_pattern(const char *pattern, size_t length, struct re_pattern_buffer *buffer);
  // char *bindtextdomain(const char *domainname, const char *dirname);
  // int strncmp(const char *s1, const char *s2, size_t n);
  // void abort(void);
  // iconv_t iconv_open(const char *tocode, const char *fromcode);
  // int close(int fd);
  // void __assert_fail(const char *assertion, const char *file, unsigned int line, const char *function);
  // const unsigned __int16 **__ctype_b_loc(void);
  // int putchar_unlocked(int c);
  // int _gmon_start__(void); weak
  void sub_8049533();
  void sub_8049550();
  int sub_8049560();
  int sub_80495D0();
  int sub_80495F0();
  void sub_804964F();
  void sub_804966A();
  int sub_804967A();
  void sub_804975C();
  void sub_8049777();
  int sub_8049787();
  void sub_8049869();
  void sub_8049884();
  int sub_8049894();
  void sub_8049976();
  void sub_8049991();
  signed int sub_80499A1();
  // int __usercall sub_8049A53@<eax>(void (__cdecl *a1)(signed int)@<eax>);
  void sub_8049A9F();
  void sub_8049ABA();
  int sub_8049ACA();
  // int __usercall sub_8049B31@<eax>(int a1@<eax>, int (__cdecl *a2)(void *, int)@<edx>);
  void sub_8049BC8();
  void sub_8049BE3();
  int sub_8049BF3();
  void sub_8049CFC();
  void sub_8049D17();
  int sub_8049D27();
  void sub_8049E1B();
  void sub_8049E36();
  int sub_8049E46();
  int nullsub_4(void); // weak
  int sub_8049EA4();
  void sub_8049F5D();
  void sub_8049F78();
  int sub_8049F88();
  // int __usercall sub_8049FEF@<eax>(int a1@<eax>, int (__cdecl *a2)(void *, int)@<edx>);
  void sub_804A09F();
  void sub_804A0BA();
  void sub_804A1E1();
  void sub_804A1FC();
  int sub_804A20C();
  // int __usercall sub_804A2BE@<eax>(void (__cdecl *a1)(signed int)@<eax>);
  void sub_804A30A();
  void sub_804A325();
  int sub_804A335();
  int __cdecl sub_804A3E5(unsigned __int8 a1);
  int sub_804A3F7();
  int sub_804A422();
  int __cdecl sub_804A44D(_DWORD); // weak
  int __cdecl sub_804A48A(char *s2, size_t n); // idb
  char *__cdecl sub_804A632(char *a1);
  char *__cdecl sub_804A662(char *s);
  int __cdecl sub_804AA77(int *a1);
  char sub_804AB62();
  int __cdecl sub_804AD34(char *s1, int); // idb
  int sub_804AE32(const void *, const void *); // idb
  int compar(const void *, const void *); // idb
  int __cdecl sub_804B032(void *, int); // idb
  void sub_804B0F4();
  void __cdecl sub_804B12D(char *s1);
  void __cdecl sub_804B1C0(char *s1, int a2);
  int __cdecl sub_804BA82(int a1);
  _DWORD __cdecl sub_804BAA8(_DWORD, _DWORD); // weak
  unsigned int __fastcall sub_804BF9B(int a1, int a2);
  _DWORD __cdecl sub_804C395(_DWORD); // weak
  int __cdecl sub_804C9C9(char *string, int length, int start, struct re_registers *regs); // idb
  int __cdecl sub_804CC8F(char *format, int length, int start); // idb
  int sub_804D0C8();
  int sub_804D2D2(void); // weak
  int sub_804D599(void); // weak
  size_t sub_804D9EC();
  void __cdecl __noreturn sub_804DAA6(int status); // idb
  int __cdecl main(int, char **, char **); // idb
  void __noreturn sub_804E683();
  int __cdecl sub_804E697(char *s, int, int, size_t); // idb
  void __cdecl sub_804E80C(int a1, int a2, int a3);
  int __cdecl sub_804E88F(int, int, size_t n); // idb
  int __cdecl sub_804E9CB(int, char *s, int, int, size_t n, int); // idb
  void __noreturn sub_804EAEB();
  int sub_804EBE2(); // weak
  signed int __cdecl sub_804EBE8(int a1);
  FILE *__cdecl sub_804EC37(int a1, int a2, FILE *stream);
  char *__cdecl sub_804EE06(char *s);
  _DWORD __cdecl sub_804EEDF(_DWORD, _DWORD); // weak
  void __cdecl __noreturn sub_804EF24(int c, size_t n); // idb
  char *__cdecl sub_804F512(char *msgid, char *a2);
  int __cdecl sub_804F84D(int *a1, unsigned __int8 a2, char a3);
  void __cdecl __noreturn sub_804F927(_DWORD, _DWORD, _DWORD); // weak
  // _DWORD *__userpurge sub_804F981@<eax>(_DWORD *a1, int a2);
  const char *__cdecl sub_804FA43(char *msgid, int a2);
  int __cdecl sub_804FB08(_DWORD, _DWORD, _DWORD); // weak
  // int __usercall sub_804FB2D@<eax>(char *a1@<ebx>, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11);
  int sub_8050A8E(); // weak
  void *__cdecl sub_8050BC5(int a1, int a2, _DWORD *a3, int *a4);
  void *__cdecl sub_8050DE1(signed int a1, int a2, int a3, int *a4);
  void *__cdecl sub_8051083(signed int a1, int a2);
  void *__cdecl sub_8051148(signed int a1, int a2, int a3);
  void *__cdecl sub_8051186(signed int a1, int a2, int a3, int a4);
  void *__cdecl sub_8051233(int a1, int a2, char a3);
  _DWORD __cdecl sub_805130D(_DWORD, _DWORD); // weak
  int __cdecl sub_805135B(int a1);
  void *__cdecl sub_8051398(signed int a1, int a2, int a3);
  void __cdecl __noreturn sub_8051459(int a1, int a2, int a3);
  void __cdecl __noreturn sub_80514A9(int a1, int a2, int a3);
  void *__cdecl sub_80515F3(signed int a1, int a2, int a3);
  void *__cdecl sub_805164E(signed int a1, int a2);
  void *__cdecl sub_8051670(int a1);
  void *__cdecl sub_805168B(FILE *stream, int a2);
  void *__cdecl sub_8051980(int a1, int a2, int a3);
  void *__cdecl sub_8051A35(int a1, int a2);
  void __cdecl __noreturn sub_8051A79(char *a1);
  int __cdecl sub_8051E6E(FILE *stream, int, int, int, int, int); // idb
  _DWORD __cdecl sub_805272F(_DWORD, _DWORD, _DWORD, _DWORD, char); // weak
  void *__cdecl sub_8052804(unsigned int a1, unsigned int a2);
  void *__cdecl sub_8052867(void *ptr, int a2, int a3);
  void *__cdecl sub_80528FE(size_t size);
  void *__cdecl sub_8052911(size_t size);
  void *__cdecl sub_805293B(void *ptr, size_t size);
  void *__cdecl sub_8052A13(void *src, size_t n);
  void __noreturn sub_8052A61();
  char *__cdecl sub_8052B3D(char *s, char *fromcode, char *tocode);
  _DWORD __cdecl sub_8052B94(_DWORD, _DWORD); // weak
  int __cdecl sub_8052CDC(int a1, int a2, int a3);
  int __cdecl sub_8052D12(char *nptr, int, int base, int, char *s); // idb
  int __cdecl sub_8053150(FILE *stream); // idb
  int __cdecl sub_805322C(FILE *stream); // idb
  int __cdecl sub_8053265(FILE *fp); // idb
  int __cdecl sub_80532D3(FILE *stream, int, int, int); // idb
  size_t __cdecl sub_80533E2(wchar_t *pwc, char *s, size_t n, mbstate_t *p);
  int __cdecl sub_8053454(unsigned __int8 *a1, unsigned __int8 *a2);
  int __cdecl sub_80534B9(FILE *fp); // idb
  int __cdecl sub_8053581(int category); // idb
  void *sub_80535F8();
  char *sub_8053B40();
  // signed int __usercall sub_8053FB3@<eax>(unsigned int a1@<edx>, int a2@<ecx>, _BYTE *a3, int a4, unsigned int a5, _DWORD *a6);
  _DWORD __cdecl sub_80541F2(_DWORD, _DWORD, _DWORD); // weak
  int __cdecl sub_8054253(int c, size_t n, char); // idb
  // int __usercall __noreturn sub_8054A17@<eax>(int a1@<ebx>, _BYTE *a2, _BYTE *a3);
  int sub_80553B0(); // weak
  int __cdecl sub_80553B9(int a1);
  int __cdecl sub_8055850(char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); // idb
  int __cdecl sub_8055B16(char *s, iconv_t cd); // idb
  char *__cdecl sub_8055EE8(char *s, char *fromcode, char *tocode);
  int __cdecl sub_8055FCD(void *s, size_t n); // idb
  int __cdecl sub_805626F(int a1);
  unsigned int __cdecl sub_80562A5(unsigned int a1);
  void __cdecl sub_805636E(unsigned int a1);
  int __cdecl sub_805647F(int a1, int a2);
  bool __cdecl sub_8056538(unsigned __int8 a1);
  size_t __cdecl sub_805658F(const char *a1);
  int __cdecl sub_8056652(__int64 a1, unsigned int a2, signed int a3);
  int __cdecl sub_80568A5(int a1);
  int __cdecl sub_80568D4(int a1, int a2);
  int __stdcall sub_8056A41(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
  int __fastcall sub_8056AB1(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
  int __stdcall sub_8056B21(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
  int __stdcall sub_8056B8D(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
  int __fastcall sub_8056BFD(_DWORD, _DWORD); // weak
  int __stdcall sub_8056C8E(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
  int __fastcall sub_8056D06(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
  int __fastcall sub_8056D78(_DWORD, _DWORD); // weak
  int __stdcall sub_8056E0B(_DWORD, _DWORD); // weak
  int (**sub_8056E20())();
  void term_proc();
  
  //-------------------------------------------------------------------------
  // Data declarations
  
  _UNKNOWN loc_804A69F; // weak
  _UNKNOWN loc_804A6D8; // weak
  _UNKNOWN loc_804A704; // weak
  _UNKNOWN loc_804A72C; // weak
  _UNKNOWN loc_804A76A; // weak
  _UNKNOWN loc_804A791; // weak
  _UNKNOWN loc_804A796; // weak
  _UNKNOWN loc_804A944; // weak
  _UNKNOWN loc_804A96D; // weak
  _UNKNOWN loc_804A972; // weak
  _UNKNOWN loc_804A99C; // weak
  _UNKNOWN loc_804A9E7; // weak
  _UNKNOWN loc_804AA2C; // weak
  _UNKNOWN loc_804AA45; // weak
  _UNKNOWN loc_804AA68; // weak
  _UNKNOWN loc_804ABAB; // weak
  _UNKNOWN loc_804ABF9; // weak
  _UNKNOWN loc_804AC13; // weak
  _UNKNOWN loc_804AC80; // weak
  _UNKNOWN loc_804ACF6; // weak
  _UNKNOWN locret_804AD32; // weak
  _UNKNOWN loc_804ADD5; // weak
  _UNKNOWN loc_804ADDC; // weak
  _UNKNOWN loc_804AE81; // weak
  _UNKNOWN loc_804AF0A; // weak
  _UNKNOWN loc_804AFC2; // weak
  _UNKNOWN loc_804AFD8; // weak
  _UNKNOWN loc_804B0E1; // weak
  _UNKNOWN loc_804BFD0; // weak
  _UNKNOWN loc_804BFE6; // weak
  _UNKNOWN loc_804C0F0; // weak
  _UNKNOWN loc_804C112; // weak
  _UNKNOWN loc_804C14F; // weak
  _UNKNOWN loc_804C169; // weak
  _UNKNOWN loc_804C2EC; // weak
  _UNKNOWN loc_804DA92; // weak
  _UNKNOWN loc_804DC21; // weak
  _UNKNOWN loc_804E993; // weak
  _UNKNOWN loc_804EBD5; // weak
  _UNKNOWN loc_804ECD9; // weak
  _UNKNOWN loc_804ED05; // weak
  _UNKNOWN loc_804ED23; // weak
  _UNKNOWN loc_804ED98; // weak
  _UNKNOWN loc_804EDC1; // weak
  _UNKNOWN loc_804EDCD; // weak
  _UNKNOWN loc_804F6EC; // weak
  _UNKNOWN loc_804F716; // weak
  _UNKNOWN locret_804FB06; // weak
  _UNKNOWN loc_804FC87; // weak
  _UNKNOWN loc_804FCCA; // weak
  _UNKNOWN loc_804FD54; // weak
  _UNKNOWN loc_804FE4C; // weak
  _UNKNOWN loc_804FE70; // weak
  _UNKNOWN loc_804FEB9; // weak
  _UNKNOWN loc_804FF6E; // weak
  _UNKNOWN loc_804FF78; // weak
  _UNKNOWN loc_80500F4; // weak
  _UNKNOWN loc_80500F9; // weak
  _UNKNOWN loc_8050152; // weak
  _UNKNOWN loc_8050162; // weak
  _UNKNOWN loc_80501E2; // weak
  _UNKNOWN loc_805021E; // weak
  _UNKNOWN loc_8050231; // weak
  _UNKNOWN loc_805027F; // weak
  _UNKNOWN loc_805030B; // weak
  _UNKNOWN loc_805045F; // weak
  _UNKNOWN loc_8050492; // weak
  _UNKNOWN loc_80504CA; // weak
  _UNKNOWN loc_80504CF; // weak
  _UNKNOWN loc_8050678; // weak
  _UNKNOWN loc_805069C; // weak
  _UNKNOWN loc_80506A2; // weak
  _UNKNOWN loc_805074F; // weak
  _UNKNOWN loc_80507A3; // weak
  _UNKNOWN loc_80507BA; // weak
  _UNKNOWN loc_80507D9; // weak
  _UNKNOWN loc_8050816; // weak
  _UNKNOWN loc_8050854; // weak
  _UNKNOWN loc_8050858; // weak
  _UNKNOWN loc_805094D; // weak
  _UNKNOWN loc_8050965; // weak
  _UNKNOWN loc_80509CF; // weak
  _UNKNOWN loc_80509F4; // weak
  _UNKNOWN loc_80509FB; // weak
  _UNKNOWN loc_8050A64; // weak
  _UNKNOWN loc_8050A89; // weak
  _UNKNOWN loc_8050E5B; // weak
  _UNKNOWN loc_8050E62; // weak
  _UNKNOWN loc_80516F2; // weak
  _UNKNOWN loc_8051763; // weak
  _UNKNOWN loc_8051844; // weak
  _UNKNOWN loc_80518CA; // weak
  _UNKNOWN locret_805197E; // weak
  _UNKNOWN loc_8051A0A; // weak
  _UNKNOWN loc_8051A1F; // weak
  _UNKNOWN locret_8051A33; // weak
  _UNKNOWN loc_8051ADE; // weak
  _UNKNOWN loc_8051AE3; // weak
  _UNKNOWN loc_8052B8A; // weak
  _UNKNOWN loc_8052B8F; // weak
  _UNKNOWN loc_80531F8; // weak
  _UNKNOWN loc_8053202; // weak
  _UNKNOWN loc_805328A; // weak
  _UNKNOWN loc_8053299; // weak
  _UNKNOWN locret_80532D1; // weak
  _UNKNOWN locret_80533E0; // weak
  _UNKNOWN loc_80535D7; // weak
  _UNKNOWN loc_80535EE; // weak
  _UNKNOWN loc_8053729; // weak
  _UNKNOWN loc_80537BA; // weak
  _UNKNOWN loc_80537EA; // weak
  _UNKNOWN loc_80537F9; // weak
  _UNKNOWN loc_8053BE8; // weak
  _UNKNOWN loc_805412B; // weak
  _UNKNOWN loc_80541DD; // weak
  _UNKNOWN loc_8054ADC; // weak
  _UNKNOWN loc_8054AE6; // weak
  _UNKNOWN loc_8054B0F; // weak
  _UNKNOWN loc_8054BF9; // weak
  _UNKNOWN loc_8054C15; // weak
  _UNKNOWN loc_8054C1A; // weak
  _UNKNOWN loc_8055123; // weak
  _UNKNOWN loc_8055216; // weak
  _UNKNOWN loc_8055261; // weak
  _UNKNOWN loc_8055362; // weak
  _UNKNOWN loc_8055364; // weak
  _UNKNOWN loc_8055386; // weak
  _UNKNOWN loc_80553AB; // weak
  _UNKNOWN loc_805559E; // weak
  _UNKNOWN loc_80563E6; // weak
  _UNKNOWN locret_8056449; // weak
  _UNKNOWN loc_805652A; // weak
  _UNKNOWN locret_8056536; // weak
  _UNKNOWN loc_80566D9; // weak
  char byte_8057CB8[256] =
  {
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\x04',
    '\0',
    '\x03',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\x06',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\0',
    '\x03',
    '\x02',
    '\x04',
    '\x06',
    '\x05',
    '\b',
    '\x01',
    '\a',
    '\x03',
    '\x02',
    '\x04',
    '\x05',
    '\x03',
    '\x02',
    '\x04',
    '\x05',
    '\0',
    '\x06',
    '\x03',
    '\x02',
    '\x04',
    '\x06',
    '\x05',
    '\0',
    '\t',
    '\x03',
    '\x02',
    '\x04',
    '\x05',
    '\x02',
    '\0',
    '\0',
    '\x03',
    '\x02',
    '\x04',
    '\x06',
    '\x05',
    '\b',
    '\x01',
    '\a',
    '\x03',
    '\x02',
    '\x04',
    '\x05',
    '\x03',
    '\x02',
    '\x04',
    '\x05',
    '\0',
    '\x06',
    '\x03',
    '\x02',
    '\x04',
    '\x06',
    '\x05',
    '\0',
    '\t',
    '\x03',
    '\x02',
    '\x04',
    '\x05',
    '\x02',
    '\0',
    '\0'
  }; // idb
  _UNKNOWN unk_8057F06; // weak
  _UNKNOWN unk_8057F0A; // weak
  _UNKNOWN unk_8057F16; // weak
  _UNKNOWN unk_8057F1A; // weak
  _UNKNOWN unk_8057F1D; // weak
  _UNKNOWN unk_805824C; // weak
  _UNKNOWN unk_80585EB; // weak
  _UNKNOWN unk_8058817; // weak
  int dword_80589D8[8] = { 6656, 4294967279, 4294967294, 2147483646, 0, 0, 0, 0 }; // idb
  _UNKNOWN unk_805A230; // weak
  _UNKNOWN unk_805A233; // weak
  int (*off_805BED8[2])() = { &sub_80495F0, &sub_80495D0 }; // weak
  int (*off_805BEDC)() = &sub_80495D0; // weak
  Elf32_Dyn stru_805BF04 = { 27, { 4u } }; // weak
  Elf32_Dyn stru_805BF0C = { 26, { 134594268u } }; // weak
  int (*dword_805C008)(void) = NULL; // weak
  int dword_805C160 = 0; // weak
  int dword_805C174 = 0; // weak
  int dword_805C188 = 0; // weak
  int dword_805C19C = 0; // weak
  int dword_805C1B0 = 0; // weak
  int dword_805C1C4 = 0; // weak
  int dword_805C1D8 = 0; // weak
  int dword_805C1EC = 0; // weak
  int dword_805C200 = 0; // weak
  int dword_805C230 = 0; // weak
  char byte_805C234 = '\x01'; // weak
  int dword_805C238 = 72; // weak
  int dword_805C23C = 3; // weak
  char *s = "/"; // idb
  char *off_805C244[2] = { "xx", "8.28" }; // weak
  int status = 1; // idb
  int dword_805C26C = 1; // weak
  int dword_805C270 = 256; // weak
  void *off_805C274 = &unk_805CD7C; // weak
  int *off_805C278 = &dword_805C270; // weak
  _UNKNOWN unk_805C28C; // weak
  _UNKNOWN unk_805C2A8; // weak
  _UNKNOWN unk_805C2AB; // weak
  _UNKNOWN unk_805C2BC; // weak
  _UNKNOWN unk_805C2BF; // weak
  int program_invocation_short_name; // weak
  FILE *stderr; // idb
  int program_invocation_name; // weak
  FILE *stdin; // idb
  FILE *stdout; // idb
  char byte_805C30C; // weak
  _UNKNOWN unk_805C3AA; // weak
  char byte_805C6BC; // weak
  char byte_805C6BD; // weak
  char byte_805C6BE; // weak
  int dword_805C6C0; // weak
  char byte_805C6C4; // weak
  char *s1; // idb
  int dword_805C6DC; // weak
  int dword_805C81C; // weak
  char byte_805C95C[256]; // idb
  char byte_805CA7C[9]; // idb
  char byte_805CA85; // weak
  char byte_805CA86; // weak
  char byte_805CA9C; // weak
  int dword_805CB80; // weak
  int dword_805CB9C; // weak
  void *ptr; // idb
  size_t nmemb; // idb
  char byte_805CBDC[12]; // idb
  char byte_805CBE8; // weak
  char byte_805CBFE; // weak
  int dword_805CCDC; // weak
  int dword_805CCE0; // weak
  int dword_805CCE4; // weak
  int dword_805CCE8; // weak
  int dword_805CCEC; // weak
  int dword_805CCF0; // weak
  char byte_805CCF4; // weak
  char *string; // idb
  int dword_805CCFC; // weak
  char byte_805CD00; // weak
  int dword_805CD04; // weak
  int dword_805CD08; // weak
  char byte_805CD0C; // weak
  char *dword_805CD10; // idb
  int dword_805CD14; // weak
  char byte_805CD18; // weak
  int dword_805CD1C; // weak
  int dword_805CD20; // weak
  int dword_805CD24; // weak
  char byte_805CD28; // weak
  int dword_805CD2C; // weak
  int dword_805CD3C; // weak
  int dword_805CD40; // weak
  int dword_805CD44; // weak
  int dword_805CD48; // weak
  int dword_805CD4C; // weak
  int dword_805CD50; // weak
  int dword_805CD54; // weak
  int dword_805CD58; // weak
  int dword_805CD5C; // weak
  int dword_805CD60; // weak
  int dword_805CD64; // weak
  int dword_805CD68; // weak
  _UNKNOWN unk_805CD7C; // weak
  int dword_805CE7C; // weak
  int dword_805CE9C[266]; // idb
  // extern _UNKNOWN __gmon_start__; weak
  
  
  //----- (08048F98) --------------------------------------------------------
  void *init_proc()
  {
    void *result; // eax
  
    result = &__gmon_start__;
    if ( &__gmon_start__ )
      result = (void *)_gmon_start__();
    return result;
  }
  // 80494F0: using guessed type int _gmon_start__(void);
  
  //----- (08048FC0) --------------------------------------------------------
  int sub_8048FC0()
  {
    return dword_805C008();
  }
  // 805C008: using guessed type int (*dword_805C008)(void);
  
  //----- (08049500) --------------------------------------------------------
  #error "8049503: positive sp value has been found (funcsize=2)"
  
  //----- (08049533) --------------------------------------------------------
  void sub_8049533()
  {
    ;
  }
  
  //----- (08049550) --------------------------------------------------------
  void sub_8049550()
  {
    ;
  }
  
  //----- (08049560) --------------------------------------------------------
  int sub_8049560()
  {
    int result; // eax
  
    result = &unk_805C2BF - &unk_805C2BC;
    if ( (unsigned int)(&unk_805C2BF - &unk_805C2BC) > 6 )
      result = 0;
    return result;
  }
  // 8049560: could not find valid save-restore pair for ebp
  
  //----- (080495D0) --------------------------------------------------------
  int sub_80495D0()
  {
    int result; // eax
  
    if ( !byte_805C30C )
    {
      result = sub_8049560();
      byte_805C30C = 1;
    }
    return result;
  }
  // 80495D0: could not find valid save-restore pair for ebp
  // 805C30C: using guessed type char byte_805C30C;
  
  //----- (080495F0) --------------------------------------------------------
  int sub_80495F0()
  {
    return 0;
  }
  // 80495F0: could not find valid save-restore pair for ebp
  
  //----- (0804964F) --------------------------------------------------------
  void sub_804964F()
  {
    ;
  }
  
  //----- (0804966A) --------------------------------------------------------
  void sub_804966A()
  {
    ;
  }
  
  //----- (0804967A) --------------------------------------------------------
  int sub_804967A()
  {
    int result; // eax
  
    result = &unk_805C2AB - &unk_805C2A8;
    if ( (unsigned int)(&unk_805C2AB - &unk_805C2A8) > 6 )
      result = 0;
    return result;
  }
  // 804967A: could not find valid save-restore pair for ebp
  
  //----- (0804975C) --------------------------------------------------------
  void sub_804975C()
  {
    ;
  }
  
  //----- (08049777) --------------------------------------------------------
  void sub_8049777()
  {
    ;
  }
  
  //----- (08049787) --------------------------------------------------------
  int sub_8049787()
  {
    int result; // eax
  
    result = &unk_805C2AB - &unk_805C2A8;
    if ( (unsigned int)(&unk_805C2AB - &unk_805C2A8) > 6 )
      result = 0;
    return result;
  }
  // 8049787: could not find valid save-restore pair for ebp
  
  //----- (08049869) --------------------------------------------------------
  void sub_8049869()
  {
    ;
  }
  
  //----- (08049884) --------------------------------------------------------
  void sub_8049884()
  {
    ;
  }
  
  //----- (08049894) --------------------------------------------------------
  int sub_8049894()
  {
    int result; // eax
  
    result = &unk_805C3AA - (_UNKNOWN *)&program_invocation_short_name;
    if ( (unsigned int)(&unk_805C3AA - (_UNKNOWN *)&program_invocation_short_name) > 6 )
      result = 0;
    return result;
  }
  // 8049894: could not find valid save-restore pair for ebp
  // 805C2C0: using guessed type int program_invocation_short_name;
  
  //----- (08049976) --------------------------------------------------------
  void sub_8049976()
  {
    ;
  }
  
  //----- (08049991) --------------------------------------------------------
  void sub_8049991()
  {
    ;
  }
  
  //----- (080499A1) --------------------------------------------------------
  signed int sub_80499A1()
  {
    return 3;
  }
  // 80499A1: could not find valid save-restore pair for ebp
  
  //----- (08049A53) --------------------------------------------------------
  int __usercall sub_8049A53@<eax>(void (__cdecl *a1)(signed int)@<eax>)
  {
    a1(134590192);
    return 0;
  }
  
  //----- (08049A9F) --------------------------------------------------------
  void sub_8049A9F()
  {
    ;
  }
  
  //----- (08049ABA) --------------------------------------------------------
  void sub_8049ABA()
  {
    ;
  }
  
  //----- (08049ACA) --------------------------------------------------------
  int sub_8049ACA()
  {
    int result; // eax
  
    result = &unk_805C2AB - &unk_805C2A8;
    if ( (unsigned int)(&unk_805C2AB - &unk_805C2A8) > 6 )
      result = 0;
    return result;
  }
  // 8049ACA: could not find valid save-restore pair for ebp
  
  //----- (08049B31) --------------------------------------------------------
  int __usercall sub_8049B31@<eax>(int a1@<eax>, int (__cdecl *a2)(void *, int)@<edx>)
  {
    return a2(&unk_805C2A8, a1);
  }
  
  //----- (08049BC8) --------------------------------------------------------
  void sub_8049BC8()
  {
    ;
  }
  
  //----- (08049BE3) --------------------------------------------------------
  void sub_8049BE3()
  {
    ;
  }
  
  //----- (08049BF3) --------------------------------------------------------
  int sub_8049BF3()
  {
    int result; // eax
  
    result = &unk_805C2AB - &unk_805C2A8;
    if ( (unsigned int)(&unk_805C2AB - &unk_805C2A8) > 6 )
      result = 0;
    return result;
  }
  // 8049BF3: could not find valid save-restore pair for ebp
  
  //----- (08049CFC) --------------------------------------------------------
  void sub_8049CFC()
  {
    ;
  }
  
  //----- (08049D17) --------------------------------------------------------
  void sub_8049D17()
  {
    ;
  }
  
  //----- (08049D27) --------------------------------------------------------
  int sub_8049D27()
  {
    int result; // eax
  
    result = &unk_805A233 - &unk_805A230;
    if ( (unsigned int)(&unk_805A233 - &unk_805A230) > 6 )
      result = 0;
    return result;
  }
  // 8049D27: could not find valid save-restore pair for ebp
  
  //----- (08049E1B) --------------------------------------------------------
  void sub_8049E1B()
  {
    ;
  }
  
  //----- (08049E36) --------------------------------------------------------
  void sub_8049E36()
  {
    ;
  }
  
  //----- (08049E46) --------------------------------------------------------
  int sub_8049E46()
  {
    int result; // eax
  
    result = &unk_805C2AB - &unk_805C2A8;
    if ( (unsigned int)(&unk_805C2AB - &unk_805C2A8) > 6 )
      result = 0;
    return result;
  }
  // 8049E46: could not find valid save-restore pair for ebp
  
  //----- (08049EA4) --------------------------------------------------------
  int sub_8049EA4()
  {
    return nullsub_4();
  }
  // 8049EA4: could not find valid save-restore pair for ebp
  // 8049EA3: using guessed type int nullsub_4(void);
  
  //----- (08049F5D) --------------------------------------------------------
  void sub_8049F5D()
  {
    ;
  }
  
  //----- (08049F78) --------------------------------------------------------
  void sub_8049F78()
  {
    ;
  }
  
  //----- (08049F88) --------------------------------------------------------
  int sub_8049F88()
  {
    int result; // eax
  
    result = &unk_805C2AB - &unk_805C2A8;
    if ( (unsigned int)(&unk_805C2AB - &unk_805C2A8) > 6 )
      result = 0;
    return result;
  }
  // 8049F88: could not find valid save-restore pair for ebp
  
  //----- (08049FEF) --------------------------------------------------------
  int __usercall sub_8049FEF@<eax>(int a1@<eax>, int (__cdecl *a2)(void *, int)@<edx>)
  {
    return a2(&unk_805C2A8, a1);
  }
  
  //----- (0804A09F) --------------------------------------------------------
  void sub_804A09F()
  {
    ;
  }
  
  //----- (0804A0BA) --------------------------------------------------------
  void sub_804A0BA()
  {
    ;
  }
  
  //----- (0804A0CA) --------------------------------------------------------
  #error "804A0F7: call analysis failed (funcsize=23)"
  
  //----- (0804A1E1) --------------------------------------------------------
  void sub_804A1E1()
  {
    ;
  }
  
  //----- (0804A1FC) --------------------------------------------------------
  void sub_804A1FC()
  {
    ;
  }
  
  //----- (0804A20C) --------------------------------------------------------
  int sub_804A20C()
  {
    int result; // eax
  
    result = &unk_80585EB - (_UNKNOWN *)"c";
    if ( (unsigned int)(&unk_80585EB - (_UNKNOWN *)"c") > 6 )
      result = 0;
    return result;
  }
  // 804A20C: could not find valid save-restore pair for ebp
  
  //----- (0804A2BE) --------------------------------------------------------
  int __usercall sub_804A2BE@<eax>(void (__cdecl *a1)(signed int)@<eax>)
  {
    a1(134580028);
    return 0;
  }
  
  //----- (0804A30A) --------------------------------------------------------
  void sub_804A30A()
  {
    ;
  }
  
  //----- (0804A325) --------------------------------------------------------
  void sub_804A325()
  {
    ;
  }
  
  //----- (0804A335) --------------------------------------------------------
  int sub_804A335()
  {
    int result; // eax
  
    result = &unk_80585EB - (_UNKNOWN *)"c";
    if ( (unsigned int)(&unk_80585EB - (_UNKNOWN *)"c") > 6 )
      result = 0;
    return result;
  }
  // 804A335: could not find valid save-restore pair for ebp
  
  //----- (0804A3E5) --------------------------------------------------------
  int __cdecl sub_804A3E5(unsigned __int8 a1)
  {
    return a1;
  }
  
  //----- (0804A3F7) --------------------------------------------------------
  int sub_804A3F7()
  {
    FILE *v0; // ebx
    char *v1; // eax
  
    v0 = stdout;
    v1 = gettext("\nWith no FILE, or when FILE is -, read standard input.\n");
    return fputs_unlocked(v1, v0);
  }
  // 80492B0: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
  
  //----- (0804A422) --------------------------------------------------------
  int sub_804A422()
  {
    FILE *v0; // ebx
    char *v1; // eax
  
    v0 = stdout;
    v1 = gettext("\nMandatory arguments to long options are mandatory for short options too.\n");
    return fputs_unlocked(v1, v0);
  }
  // 80492B0: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
  
  //----- (0804A44D) --------------------------------------------------------
  #error "804A485: call analysis failed (funcsize=17)"
  
  //----- (0804A48A) --------------------------------------------------------
  #error "804A62F: positive sp value has been found (funcsize=97)"
  
  //----- (0804A632) --------------------------------------------------------
  char *__cdecl sub_804A632(char *a1)
  {
    char *v1; // ebx
    int *v2; // eax
  
    v1 = gettext("error in regular expression matcher");
    v2 = __errno_location();
    error(1, *v2, v1);
    return sub_804A662(a1);
  }
  
  //----- (0804A662) --------------------------------------------------------
  #error "804A696: call analysis failed (funcsize=221)"
  
  //----- (0804AA77) --------------------------------------------------------
  int __cdecl sub_804AA77(int *a1)
  {
    char *v1; // eax
    size_t v2; // eax
    void *v3; // ebx
    char *v4; // eax
    char *s; // [esp+0h] [ebp-3Ch]
    size_t length; // [esp+4h] [ebp-38h]
    struct re_pattern_buffer *buffer; // [esp+8h] [ebp-34h]
    int v9; // [esp+Ch] [ebp-30h]
    void *v10; // [esp+10h] [ebp-2Ch]
    int *v11; // [esp+24h] [ebp-18h]
    int v12; // [esp+28h] [ebp-14h]
  
    v11 = a1 + 1;
    v12 = *a1;
    *v11 = 0;
    v11[1] = 0;
    *((_DWORD *)*(&s - 5) + 4) = (char *)buffer + 36;
    if ( byte_805C6C4 )
      v1 = byte_805C95C;
    else
      v1 = 0;
    *((_DWORD *)*(&s - 5) + 5) = v1;
    s = *(&s - 4);
    v2 = strlen(s);
    buffer = (struct re_pattern_buffer *)*(&s - 5);
    length = v2;
    s = *(&s - 4);
    *(&s - 3) = (char *)re_compile_pattern(s, v2, buffer);
    if ( *(&s - 3) )
    {
      s = *(&s - 4);
      v3 = sub_8051670((int)s);
      v4 = gettext("%s (for regexp %s)");
      v10 = v3;
      v9 = (int)*(&s - 3);
      error(1, 0, v4, v9, v3);
    }
    return re_compile_fastmap((struct re_pattern_buffer *)*(&s - 5));
  }
  // 805C6C4: using guessed type char byte_805C6C4;
  
  //----- (0804AB62) --------------------------------------------------------
  #error "804AB88: call analysis failed (funcsize=118)"
  
  //----- (0804AD34) --------------------------------------------------------
  #error "804ADD0: call analysis failed (funcsize=76)"
  
  //----- (0804AE32) --------------------------------------------------------
  #error "804AFBD: call analysis failed (funcsize=90)"
  
  //----- (0804AFE3) --------------------------------------------------------
  int __cdecl compar(const void *a1, const void *a2)
  {
    int v3; // [esp+14h] [ebp-4h]
  
    v3 = sub_804AE32(a1, a2);
    if ( v3 )
      return v3;
    if ( *(_DWORD *)a1 < *(_DWORD *)a2 )
      return -1;
    return *(_DWORD *)a1 > *(_DWORD *)a2;
  }
  
  //----- (0804B032) --------------------------------------------------------
  #error "804B0C0: call analysis failed (funcsize=58)"
  
  //----- (0804B0F4) --------------------------------------------------------
  void sub_804B0F4()
  {
    if ( nmemb )
      qsort(ptr, nmemb, 0x1Cu, compar);
  }
  
  //----- (0804B12D) --------------------------------------------------------
  void __cdecl sub_804B12D(char *s1)
  {
    unsigned __int8 *i; // [esp+14h] [ebp-14h]
    void *ptr; // [esp+18h] [ebp-10h]
    unsigned int v3; // [esp+1Ch] [ebp-Ch]
  
    sub_804AD34(s1, (int)&ptr);
    memset(byte_805CA7C, 1, 0x100u);
    for ( i = (unsigned __int8 *)ptr; v3 > (unsigned int)i; ++i )
      byte_805CA7C[(unsigned __int8)sub_804A3E5(*i)] = 0;
    if ( byte_805C234 != 1 )
    {
      byte_805CA9C = 0;
      byte_805CA85 = 0;
      byte_805CA86 = 0;
    }
    free(ptr);
  }
  // 805C234: using guessed type char byte_805C234;
  // 805CA85: using guessed type char byte_805CA85;
  // 805CA86: using guessed type char byte_805CA86;
  // 805CA9C: using guessed type char byte_805CA9C;
  
  //----- (0804B1C0) --------------------------------------------------------
  void __cdecl sub_804B1C0(char *s1, int a2)
  {
    _BYTE *v2; // [esp+10h] [ebp-18h]
    unsigned int v3; // [esp+14h] [ebp-14h]
    int v4; // [esp+18h] [ebp-10h]
    unsigned int v5; // [esp+1Ch] [ebp-Ch]
  
    sub_804AD34(s1, (int)&v4);
    *(_DWORD *)a2 = 0;
    *(_DWORD *)(a2 + 4) = 0;
    *(_DWORD *)(a2 + 8) = 0;
    v2 = (_BYTE *)v4;
    while ( v5 > (unsigned int)v2 )
    {
      v3 = (unsigned int)v2;
      while ( v5 > (unsigned int)v2 && *v2 != 10 )
        ++v2;
      if ( (unsigned int)v2 > v3 )
      {
        if ( *(_DWORD *)(a2 + 8) == *(_DWORD *)(a2 + 4) )
          *(_DWORD *)a2 = sub_8052867(*(void **)a2, a2 + 4, 8);
        *(_DWORD *)(8 * *(_DWORD *)(a2 + 8) + *(_DWORD *)a2) = v3;
        *(_DWORD *)(*(_DWORD *)a2 + 8 * (*(_DWORD *)(a2 + 8))++ + 4) = &v2[-v3];
      }
      if ( v5 > (unsigned int)v2 )
        ++v2;
    }
    qsort(*(void **)a2, *(_DWORD *)(a2 + 8), 8u, sub_804AE32);
  }
  
  //----- (0804B304) --------------------------------------------------------
  #error "804B821: call analysis failed (funcsize=354)"
  
  //----- (0804BA82) --------------------------------------------------------
  int __cdecl sub_804BA82(int a1)
  {
    int result; // eax
    int i; // [esp+1Ch] [ebp-Ch]
  
    result = a1;
    for ( i = a1; i > 0; --i )
      result = putchar_unlocked(32);
    return result;
  }
  
  //----- (0804BAA8) --------------------------------------------------------
  #error "804BB0E: call analysis failed (funcsize=277)"
  
  //----- (0804BF9B) --------------------------------------------------------
  #error "804C0EB: call analysis failed (funcsize=207)"
  
  //----- (0804C395) --------------------------------------------------------
  #error "804C9C4: call analysis failed (funcsize=400)"
  
  //----- (0804C9C9) --------------------------------------------------------
  #error "804CA39: call analysis failed (funcsize=190)"
  
  //----- (0804CC8F) --------------------------------------------------------
  #error "804D0C5: positive sp value has been found (funcsize=178)"
  
  //----- (0804D0C8) --------------------------------------------------------
  int sub_804D0C8()
  {
    printf(".%s \"", off_805C244[0]);
    sub_804BAA8(dword_805CCEC, dword_805CCF0);
    if ( byte_805CCF4 )
      fputs_unlocked(s, stdout);
    putchar_unlocked(34);
    fwrite_unlocked(" \"", 1u, 2u, stdout);
    if ( byte_805CD00 )
      fputs_unlocked(s, stdout);
    sub_804BAA8(string, dword_805CCFC);
    putchar_unlocked(34);
    fwrite_unlocked(" \"", 1u, 2u, stdout);
    sub_804BAA8(dword_805CD04, dword_805CD08);
    if ( byte_805CD0C )
      fputs_unlocked(s, stdout);
    putchar_unlocked(34);
    fwrite_unlocked(" \"", 1u, 2u, stdout);
    if ( byte_805CD18 )
      fputs_unlocked(s, stdout);
    sub_804BAA8(dword_805CD10, dword_805CD14);
    putchar_unlocked(34);
    if ( byte_805C6BC || byte_805C6BD )
    {
      fwrite_unlocked(" \"", 1u, 2u, stdout);
      sub_804BAA8(dword_805CD1C, dword_805CD20);
      putchar_unlocked(34);
    }
    return putchar_unlocked(10);
  }
  // 80492B0: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
  // 804BAA8: using guessed type _DWORD __cdecl sub_804BAA8(_DWORD, _DWORD);
  // 805C244: using guessed type char *off_805C244[2];
  // 805C6BC: using guessed type char byte_805C6BC;
  // 805C6BD: using guessed type char byte_805C6BD;
  // 805CCEC: using guessed type int dword_805CCEC;
  // 805CCF0: using guessed type int dword_805CCF0;
  // 805CCF4: using guessed type char byte_805CCF4;
  // 805CCFC: using guessed type int dword_805CCFC;
  // 805CD00: using guessed type char byte_805CD00;
  // 805CD04: using guessed type int dword_805CD04;
  // 805CD08: using guessed type int dword_805CD08;
  // 805CD0C: using guessed type char byte_805CD0C;
  // 805CD14: using guessed type int dword_805CD14;
  // 805CD18: using guessed type char byte_805CD18;
  // 805CD1C: using guessed type int dword_805CD1C;
  // 805CD20: using guessed type int dword_805CD20;
  
  //----- (0804D2D2) --------------------------------------------------------
  #error "804D54C: call analysis failed (funcsize=137)"
  
  //----- (0804D599) --------------------------------------------------------
  #error "804D87C: call analysis failed (funcsize=284)"
  
  //----- (0804D9EC) --------------------------------------------------------
  size_t sub_804D9EC()
  {
    int v0; // edx
    int v1; // ecx
    size_t result; // eax
    int i; // [esp+18h] [ebp-10h]
    char *v4; // [esp+1Ch] [ebp-Ch]
  
    dword_805CCEC = 0;
    dword_805CCF0 = 0;
    byte_805CCF4 = 0;
    dword_805CD10 = 0;
    dword_805CD14 = 0;
    byte_805CD18 = 0;
    v4 = (char *)ptr;
    for ( i = 0; ; ++i )
    {
      result = nmemb;
      if ( (signed int)nmemb <= i )
        break;
      sub_804C395(v4);
      if ( dword_805C6C0 == 2 )
      {
        sub_804D0C8();
      }
      else
      {
        if ( (unsigned int)dword_805C6C0 < 2 )
          goto LABEL_6;
        if ( dword_805C6C0 != 3 )
        {
          dword_805C1B0 = (int)&loc_804DA92;
          sub_8056BFD(v1, v0);
  LABEL_6:
          sub_804D599();
          goto LABEL_9;
        }
        sub_804D2D2();
      }
  LABEL_9:
      v4 += 28;
    }
    return result;
  }
  // 804C395: using guessed type _DWORD __cdecl sub_804C395(_DWORD);
  // 804D2D2: using guessed type int sub_804D2D2(void);
  // 804D599: using guessed type int sub_804D599(void);
  // 8056BFD: using guessed type int __fastcall sub_8056BFD(_DWORD, _DWORD);
  // 805C1B0: using guessed type int dword_805C1B0;
  // 805C6C0: using guessed type int dword_805C6C0;
  // 805CCEC: using guessed type int dword_805CCEC;
  // 805CCF0: using guessed type int dword_805CCF0;
  // 805CCF4: using guessed type char byte_805CCF4;
  // 805CD14: using guessed type int dword_805CD14;
  // 805CD18: using guessed type char byte_805CD18;
  
  //----- (0804DAA6) --------------------------------------------------------
  void __cdecl __noreturn sub_804DAA6(int status)
  {
    int v1; // ebx
    char *v2; // eax
    int v3; // edx
    int v4; // ecx
    int v5; // esi
    int v6; // ebx
    char *v7; // eax
    FILE *v8; // ebx
    char *v9; // eax
    FILE *v10; // ebx
    char *v11; // eax
    FILE *v12; // ebx
    char *v13; // eax
    FILE *v14; // ebx
    char *v15; // eax
    FILE *v16; // ebx
    char *v17; // eax
    FILE *v18; // ebx
    char *v19; // eax
    FILE *v20; // ebx
    char *v21; // eax
    FILE *v22; // ebx
    char *v23; // eax
    int v24; // [esp+4h] [ebp-14h]
    int v25; // [esp+8h] [ebp-10h]
  
    if ( status )
    {
      v1 = dword_805CD2C;
      v2 = gettext("Try '%s --help' for more information.\n");
      v25 = v1;
      fprintf(stderr, v2, v1);
      dword_805C174 = (int)&loc_804DC21;
      sub_8056D78(v4, v3);
    }
    v5 = dword_805CD2C;
    v6 = dword_805CD2C;
    v7 = gettext("Usage: %s [OPTION]... [INPUT]...   (without -G)\n  or:  %s -G [OPTION]... [INPUT [OUTPUT]]\n");
    v25 = v5;
    v24 = v6;
    printf(v7, v6, v5);
    v8 = stdout;
    v9 = gettext("Output a permuted index, including context, of the words in the input files.\n");
    fputs_unlocked(v9, v8);
    sub_804A3F7();
    sub_804A422();
    v10 = stdout;
    v11 = gettext(
            "  -A, --auto-reference           output automatically generated references\n"
            "  -G, --traditional              behave more like System V 'ptx'\n");
    fputs_unlocked(v11, v10);
    v12 = stdout;
    v13 = gettext(
            "  -F, --flag-truncation=STRING   use STRING for flagging line truncations.\n"
            "                                 The default is '/'\n");
    fputs_unlocked(v13, v12);
    v14 = stdout;
    v15 = gettext(
            "  -M, --macro-name=STRING        macro name to use instead of 'xx'\n"
            "  -O, --format=roff              generate output as roff directives\n"
            "  -R, --right-side-refs          put references at right, not counted in -w\n"
            "  -S, --sentence-regexp=REGEXP   for end of lines or end of sentences\n"
            "  -T, --format=tex               generate output as TeX directives\n");
    fputs_unlocked(v15, v14);
    v16 = stdout;
    v17 = gettext(
            "  -W, --word-regexp=REGEXP       use REGEXP to match each keyword\n"
            "  -b, --break-file=FILE          word break characters in this FILE\n"
            "  -f, --ignore-case              fold lower case to upper case for sorting\n"
            "  -g, --gap-size=NUMBER          gap size in columns between output fields\n"
            "  -i, --ignore-file=FILE         read ignore word list from FILE\n"
            "  -o, --only-file=FILE           read only word list from this FILE\n");
    fputs_unlocked(v17, v16);
    v18 = stdout;
    v19 = gettext(
            "  -r, --references               first field of each line is a reference\n"
            "  -t, --typeset-mode               - not implemented -\n"
            "  -w, --width=NUMBER             output width in columns, reference excluded\n");
    fputs_unlocked(v19, v18);
    v20 = stdout;
    v21 = gettext("      --help     display this help and exit\n");
    fputs_unlocked(v21, v20);
    v22 = stdout;
    v23 = gettext("      --version  output version information and exit\n");
    fputs_unlocked(v23, v22);
    sub_804A44D("ptx");
    exit(status);
  }
  // 80492B0: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
  // 804A44D: using guessed type int __cdecl sub_804A44D(_DWORD);
  // 8056D78: using guessed type int __fastcall sub_8056D78(_DWORD, _DWORD);
  // 805C174: using guessed type int dword_805C174;
  // 805CD2C: using guessed type int dword_805CD2C;
  
  //----- (0804DC2C) --------------------------------------------------------
  #error "804DC91: call analysis failed (funcsize=511)"
  
  //----- (0804E683) --------------------------------------------------------
  void __noreturn sub_804E683()
  {
    sub_804DAA6(1);
  }
  
  //----- (0804E697) --------------------------------------------------------
  #error "804E752: call analysis failed (funcsize=105)"
  
  //----- (0804E80C) --------------------------------------------------------
  void __cdecl sub_804E80C(int a1, int a2, int a3)
  {
    char *v3; // eax
    char *format; // ST2C_4
    void *v5; // ebx
    void *v6; // eax
  
    if ( a3 == -1 )
      v3 = gettext("invalid argument %s for %s");
    else
      v3 = gettext("ambiguous argument %s for %s");
    format = v3;
    v5 = sub_805164E(1, a1);
    v6 = sub_8051148(0, 8, a2);
    error(0, 0, format, v6, v5);
  }
  
  //----- (0804E88F) --------------------------------------------------------
  int __cdecl sub_804E88F(int a1, int a2, size_t n)
  {
    FILE *v3; // ebx
    char *v4; // eax
    int v5; // ecx
    void *v7; // [esp+8h] [ebp-20h]
    int i; // [esp+18h] [ebp-10h]
    void *s1; // [esp+1Ch] [ebp-Ch]
  
    s1 = 0;
    v3 = stderr;
    v4 = gettext("Valid arguments are:");
    fputs_unlocked(v4, v3);
    for ( i = 0; *(_DWORD *)(4 * i + a1); ++i )
    {
      if ( !i || memcmp(s1, (const void *)(a2 + i * n), n) )
      {
        v7 = sub_8051670(*(_DWORD *)(4 * i + a1));
        fprintf(stderr, "\n  - %s", v7);
        s1 = (void *)(i * n + a2);
        dword_805C1B0 = (int)&loc_804E993;
        sub_8056BFD(v5, i * n);
      }
      v7 = sub_8051670(*(_DWORD *)(4 * i + a1));
      fprintf(stderr, ", %s", v7);
    }
    return putc_unlocked(10, stderr);
  }
  // 80492B0: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
  // 8056BFD: using guessed type int __fastcall sub_8056BFD(_DWORD, _DWORD);
  // 805C1B0: using guessed type int dword_805C1B0;
  
  //----- (0804E9CB) --------------------------------------------------------
  int __cdecl sub_804E9CB(int a1, char *s, int a3, int a4, size_t n, int a6)
  {
    int v7; // [esp+1Ch] [ebp-Ch]
  
    v7 = sub_804E697(s, a3, a4, n);
    if ( v7 >= 0 )
      return v7;
    sub_804E80C(a1, (int)s, v7);
    sub_804E88F(a3, a4, n);
    ((void (*)(void))a6)();
    return -1;
  }
  
  //----- (0804EAEB) --------------------------------------------------------
  #error "804EBD0: call analysis failed (funcsize=64)"
  
  //----- (0804EBE2) --------------------------------------------------------
  #error "804EBE5: positive sp value has been found (funcsize=0)"
  
  //----- (0804EBE8) --------------------------------------------------------
  signed int __cdecl sub_804EBE8(int a1)
  {
    int fd; // [esp+1Ch] [ebp-Ch]
  
    fd = open64("/dev/null", 0);
    if ( fd == a1 )
      return 1;
    if ( fd >= 0 )
    {
      close(fd);
      *__errno_location() = 9;
    }
    return 0;
  }
  // 8049000: using guessed type int __cdecl open64(_DWORD, _DWORD);
  
  //----- (0804EC37) --------------------------------------------------------
  #error "804EDBC: call analysis failed (funcsize=126)"
  
  //----- (0804EE06) --------------------------------------------------------
  char *__cdecl sub_804EE06(char *s)
  {
    char *v1; // eax
    char *result; // eax
    char *v3; // [esp+18h] [ebp-10h]
    char *s1; // [esp+1Ch] [ebp-Ch]
  
    if ( !s )
    {
      fwrite("A NULL argv[0] was passed through an exec system call.\n", 1u, 0x37u, stderr);
      abort();
    }
    v3 = strrchr(s, 47);
    if ( v3 )
      v1 = v3 + 1;
    else
      v1 = s;
    s1 = v1;
    if ( v1 - s > 6 && !strncmp(v1 - 7, "/.libs/", 7u) )
    {
      s = s1;
      if ( !strncmp(s1, "lt-", 3u) )
      {
        s = s1 + 3;
        program_invocation_short_name = (int)(s1 + 3);
      }
    }
    dword_805CD2C = (int)s;
    result = s;
    program_invocation_name = (int)s;
    return result;
  }
  // 805C2C0: using guessed type int program_invocation_short_name;
  // 805C2D0: using guessed type int program_invocation_name;
  // 805CD2C: using guessed type int dword_805CD2C;
  
  //----- (0804EEDF) --------------------------------------------------------
  #error "804EF1F: call analysis failed (funcsize=19)"
  
  //----- (0804EF24) --------------------------------------------------------
  #error "804EF3B: call analysis failed (funcsize=7)"
  
  //----- (0804F512) --------------------------------------------------------
  char *__cdecl sub_804F512(char *msgid, char *a2)
  {
    size_t n; // ST34_4
    char *dest; // ST38_4
    char *v4; // eax
    bool v5; // zf
    void *v6; // eax
    char *result; // eax
    size_t v8; // ebx
    size_t v9; // eax
    int v10; // [esp+0h] [ebp-48h]
    int v11; // [esp+4h] [ebp-44h]
    char *ptr; // [esp+14h] [ebp-34h]
    char *v13; // [esp+18h] [ebp-30h]
    char *v14; // [esp+1Ch] [ebp-2Ch]
    char *v15; // [esp+20h] [ebp-28h]
    const char *s1; // [esp+24h] [ebp-24h]
    char *s; // [esp+28h] [ebp-20h]
    char *v18; // [esp+34h] [ebp-14h]
    char *v19; // [esp+38h] [ebp-10h]
    char *v20; // [esp+3Ch] [ebp-Ch]
  
    s1 = gettext(msgid);
    s = sub_8053B40();
    ptr = 0;
    v13 = 0;
    v15 = 0;
    if ( sub_8053454((unsigned __int8 *)s, "UTF-8") )
    {
      ptr = sub_8052B3D(a2, "UTF-8", s);
      v14 = ptr;
      n = strlen(s);
      dest = (char *)sub_8052911(n + 11);
      memcpy(dest, s, n);
      memcpy(&dest[n], "//TRANSLIT", 0xBu);
      v18 = sub_8052B3D(a2, "UTF-8", dest);
      free(dest);
      if ( v18 )
      {
        if ( strchr(v18, 63) )
        {
          free(v18);
        }
        else
        {
          v13 = v18;
          v15 = v18;
        }
      }
    }
    else
    {
      v14 = a2;
      v15 = a2;
    }
    if ( v14 )
    {
      v4 = v14;
    }
    else if ( v15 )
    {
      v4 = v15;
    }
    else
    {
      v4 = msgid;
    }
    v19 = v4;
    if ( !strcmp(s1, msgid) )
    {
      if ( ptr && ptr != v19 )
        free(ptr);
      if ( v13 && v13 != v19 )
        free(v13);
      result = v19;
    }
    else
    {
      if ( (unsigned __int8)sub_804EEDF(s1, msgid) || v14 && (unsigned __int8)sub_804EEDF(s1, v14) )
      {
  LABEL_21:
        if ( ptr )
          free(ptr);
        if ( v13 )
          free(v13);
        return (char *)s1;
      }
      if ( v15 )
      {
        v5 = (unsigned __int8)sub_804EEDF(s1, v15) == 0;
        v6 = &loc_804F6EC;
        if ( v5 )
          v6 = &loc_804F716;
        dword_805C160 = (int)v6;
        sub_8056E0B(v10, v11);
        goto LABEL_21;
      }
      v8 = strlen(s1);
      v9 = strlen(v19);
      v20 = (char *)sub_8052911(v8 + v9 + 4);
      sprintf(v20, "%s (%s)", s1, v19);
      if ( ptr )
        free(ptr);
      if ( v13 )
        free(v13);
      result = v20;
    }
    return result;
  }
  // 804EEDF: using guessed type _DWORD __cdecl sub_804EEDF(_DWORD, _DWORD);
  // 8056E0B: using guessed type int __stdcall sub_8056E0B(_DWORD, _DWORD);
  // 805C160: using guessed type int dword_805C160;
  
  //----- (0804F84D) --------------------------------------------------------
  int __cdecl sub_804F84D(int *a1, unsigned __int8 a2, char a3)
  {
    int *v3; // eax
    int *v4; // eax
    unsigned int v5; // edx
  
    if ( a1 )
      v3 = a1;
    else
      v3 = &dword_805CD3C;
    v4 = &v3[(a2 >> 5) + 2];
    v5 = (unsigned int)*v4 >> (a2 & 0x1F);
    *v4 ^= (v5 & 1 ^ a3 & 1) << (a2 & 0x1F);
    return v5 & 1;
  }
  // 805CD3C: using guessed type int dword_805CD3C;
  
  //----- (0804F927) --------------------------------------------------------
  #error "804F963: call analysis failed (funcsize=21)"
  
  //----- (0804F96D) --------------------------------------------------------
  #error "804F980: positive sp value has been found (funcsize=0)"
  
  //----- (0804F981) --------------------------------------------------------
  _DWORD *__userpurge sub_804F981@<eax>(_DWORD *a1, int a2)
  {
    int v3; // [esp+4h] [ebp-34h]
    int v4; // [esp+8h] [ebp-30h]
    int v5; // [esp+Ch] [ebp-2Ch]
    int v6; // [esp+10h] [ebp-28h]
    int v7; // [esp+14h] [ebp-24h]
    int v8; // [esp+18h] [ebp-20h]
    int v9; // [esp+1Ch] [ebp-1Ch]
    int v10; // [esp+20h] [ebp-18h]
    int v11; // [esp+24h] [ebp-14h]
    int v12; // [esp+28h] [ebp-10h]
    int v13; // [esp+2Ch] [ebp-Ch]
    int v14; // [esp+30h] [ebp-8h]
  
    memset(&v14 - 14, 0, 0x30u);
    if ( a2 == 10 )
      abort();
    *a1 = a2;
    a1[1] = v3;
    a1[2] = v4;
    a1[3] = v5;
    a1[4] = v6;
    a1[5] = v7;
    a1[6] = v8;
    a1[7] = v9;
    a1[8] = v10;
    a1[9] = v11;
    a1[10] = v12;
    a1[11] = v13;
    return a1;
  }
  
  //----- (0804FA43) --------------------------------------------------------
  const char *__cdecl sub_804FA43(char *msgid, int a2)
  {
    int v2; // edx
    int v3; // ecx
    const char *result; // eax
    int v5; // edx
    int v6; // ecx
    unsigned __int8 *v7; // [esp+1Ch] [ebp-Ch]
  
    if ( gettext(msgid) != msgid )
    {
      dword_805C1B0 = (int)&locret_804FB06;
      sub_8056BFD(v3, v2);
    }
    v7 = (unsigned __int8 *)sub_8053B40();
    if ( sub_8053454(v7, "UTF-8") )
    {
      if ( sub_8053454(v7, "GB18030") )
      {
        if ( a2 == 9 )
        {
          dword_805C174 = (int)&locret_804FB06;
          sub_8056D78(v6, v5);
        }
        result = "'";
      }
      else if ( *msgid == 96 )
      {
        result = (const char *)&unk_8057F16;
      }
      else
      {
        result = (const char *)&unk_8057F1A;
      }
    }
    else if ( *msgid == 96 )
    {
      result = (const char *)&unk_8057F06;
    }
    else
    {
      result = (const char *)&unk_8057F0A;
    }
    return result;
  }
  // 8056BFD: using guessed type int __fastcall sub_8056BFD(_DWORD, _DWORD);
  // 8056D78: using guessed type int __fastcall sub_8056D78(_DWORD, _DWORD);
  // 805C174: using guessed type int dword_805C174;
  // 805C1B0: using guessed type int dword_805C1B0;
  
  //----- (0804FB08) --------------------------------------------------------
  #error "804FB28: call analysis failed (funcsize=13)"
  
  //----- (0804FB2D) --------------------------------------------------------
  #error "804FDE3: call analysis failed (funcsize=1094)"
  
  //----- (08050A8E) --------------------------------------------------------
  #error "8050A91: positive sp value has been found (funcsize=0)"
  
  //----- (08050BC5) --------------------------------------------------------
  void *__cdecl sub_8050BC5(int a1, int a2, _DWORD *a3, int *a4)
  {
    int *v4; // eax
    int *v5; // ST3C_4
    int v6; // ST40_4
    int v7; // ST44_4
    int v8; // edx
    int v9; // eax
    int v10; // ST20_4
    int v11; // ST20_4
    int v12; // ST1C_4
    int v13; // ST10_4
    int size; // [esp+48h] [ebp-10h]
    void *v16; // [esp+4Ch] [ebp-Ch]
  
    if ( a4 )
      v4 = a4;
    else
      v4 = &dword_805CD3C;
    v5 = v4;
    v6 = *__errno_location();
    v7 = v5[1] | (a3 == 0);
    v8 = v5[10];
    v9 = *v5;
    v10 = v5[11];
    size = sub_804FB08(0, 0, a1) + 1;
    v16 = sub_80528FE(size);
    v11 = v5[11];
    v12 = v5[10];
    v13 = *v5;
    sub_804FB08(v16, size, a1);
    *__errno_location() = v6;
    if ( a3 )
      *a3 = size - 1;
    return v16;
  }
  // 804FB08: using guessed type int __cdecl sub_804FB08(_DWORD, _DWORD, _DWORD);
  // 805CD3C: using guessed type int dword_805CD3C;
  
  //----- (08050DE1) --------------------------------------------------------
  void *__cdecl sub_8050DE1(signed int a1, int a2, int a3, int *a4)
  {
    int v4; // ecx
    void *v5; // eax
    size_t v6; // edx
    void *v7; // edx
    size_t v8; // ST4C_4
    int v9; // ST50_4
    int v10; // ST28_4
    int v11; // ST24_4
    int v12; // ST18_4
    int v13; // ST28_4
    int v14; // ST24_4
    int v15; // ST18_4
    bool v17; // [esp+37h] [ebp-21h]
    int *v18; // [esp+38h] [ebp-20h]
    void *ptr; // [esp+3Ch] [ebp-1Ch]
    int v20; // [esp+40h] [ebp-18h]
    int size; // [esp+44h] [ebp-14h]
    unsigned int v22; // [esp+4Ch] [ebp-Ch]
  
    v20 = *__errno_location();
    v18 = off_805C278;
    if ( a1 < 0 )
      abort();
    if ( dword_805C26C <= a1 )
    {
      v17 = off_805C278 == &dword_805C270;
      if ( (unsigned int)a1 > 0xFFFFFFE )
        sub_8052A61();
      v5 = &loc_8050E5B;
      if ( !v17 )
        v5 = &loc_8050E62;
      dword_805C174 = (int)v5;
      sub_8056D78(v4, 8 * (a1 + 1));
      v18 = (int *)sub_805293B(0, v6);
      off_805C278 = v18;
      if ( v17 )
      {
        v7 = off_805C274;
        *v18 = dword_805C270;
        v18[1] = (int)v7;
      }
      memset(&v18[2 * dword_805C26C], 0, 8 * (a1 + 1 - dword_805C26C));
      dword_805C26C = a1 + 1;
    }
    v8 = v18[2 * a1];
    ptr = (void *)v18[2 * a1 + 1];
    v9 = a4[1] | 1;
    v10 = a4[11];
    v11 = a4[10];
    v12 = *a4;
    v22 = sub_804FB08(ptr, v8, a2);
    if ( v8 <= v22 )
    {
      size = v22 + 1;
      v18[2 * a1] = v22 + 1;
      if ( ptr != &unk_805CD7C )
        free(ptr);
      ptr = sub_80528FE(size);
      v18[2 * a1 + 1] = (int)ptr;
      v13 = a4[11];
      v14 = a4[10];
      v15 = *a4;
      sub_804FB08(ptr, size, a2);
    }
    *__errno_location() = v20;
    return ptr;
  }
  // 804FB08: using guessed type int __cdecl sub_804FB08(_DWORD, _DWORD, _DWORD);
  // 8056D78: using guessed type int __fastcall sub_8056D78(_DWORD, _DWORD);
  // 805C174: using guessed type int dword_805C174;
  // 805C26C: using guessed type int dword_805C26C;
  // 805C270: using guessed type int dword_805C270;
  // 805C274: using guessed type void *off_805C274;
  // 805C278: using guessed type int *off_805C278;
  
  //----- (08051083) --------------------------------------------------------
  void *__cdecl sub_8051083(signed int a1, int a2)
  {
    return sub_8050DE1(a1, a2, -1, &dword_805CD3C);
  }
  // 805CD3C: using guessed type int dword_805CD3C;
  
  //----- (080510AD) --------------------------------------------------------
  #error "80510DC: call analysis failed (funcsize=18)"
  
  //----- (080510EF) --------------------------------------------------------
  #error "805110A: positive sp value has been found (funcsize=0)"
  
  //----- (08051148) --------------------------------------------------------
  void *__cdecl sub_8051148(signed int a1, int a2, int a3)
  {
    int v4[14]; // [esp+10h] [ebp-38h]
  
    sub_804F981(v4, a2);
    return sub_8050DE1(a1, a3, -1, v4);
  }
  
  //----- (08051186) --------------------------------------------------------
  void *__cdecl sub_8051186(signed int a1, int a2, int a3, int a4)
  {
    int v5[14]; // [esp+10h] [ebp-38h]
  
    sub_804F981(v5, a2);
    return sub_8050DE1(a1, a3, a4, v5);
  }
  
  //----- (08051233) --------------------------------------------------------
  void *__cdecl sub_8051233(int a1, int a2, char a3)
  {
    int v4; // [esp+0h] [ebp-5Ch]
    char v5; // [esp+1Ch] [ebp-40h]
    int v6; // [esp+20h] [ebp-3Ch]
    int v7; // [esp+24h] [ebp-38h]
    int v8; // [esp+28h] [ebp-34h]
    int v9; // [esp+2Ch] [ebp-30h]
    int v10; // [esp+30h] [ebp-2Ch]
    int v11; // [esp+34h] [ebp-28h]
    int v12; // [esp+38h] [ebp-24h]
    int v13; // [esp+3Ch] [ebp-20h]
    int v14; // [esp+40h] [ebp-1Ch]
  
    v5 = a3;
    v6 = dword_805CD3C;
    v7 = dword_805CD40;
    v8 = dword_805CD44;
    v9 = dword_805CD48;
    v10 = dword_805CD4C;
    v11 = dword_805CD50;
    v12 = dword_805CD54;
    v13 = dword_805CD58;
    v14 = dword_805CD5C;
    *(&v4 - 5) = dword_805CD60;
    *(&v4 - 4) = dword_805CD64;
    *(&v4 - 3) = dword_805CD68;
    sub_804F84D(&v4 - 14, *((_BYTE *)&v4 - 60), 1);
    return sub_8050DE1(0, (int)(&v4 - 14), (int)(&v4 - 14), &v4 - 14);
  }
  // 805CD3C: using guessed type int dword_805CD3C;
  // 805CD40: using guessed type int dword_805CD40;
  // 805CD44: using guessed type int dword_805CD44;
  // 805CD48: using guessed type int dword_805CD48;
  // 805CD4C: using guessed type int dword_805CD4C;
  // 805CD50: using guessed type int dword_805CD50;
  // 805CD54: using guessed type int dword_805CD54;
  // 805CD58: using guessed type int dword_805CD58;
  // 805CD5C: using guessed type int dword_805CD5C;
  // 805CD60: using guessed type int dword_805CD60;
  // 805CD64: using guessed type int dword_805CD64;
  // 805CD68: using guessed type int dword_805CD68;
  
  //----- (0805130D) --------------------------------------------------------
  #error "8051324: call analysis failed (funcsize=14)"
  
  //----- (08051337) --------------------------------------------------------
  #error "805135A: positive sp value has been found (funcsize=0)"
  
  //----- (0805135B) --------------------------------------------------------
  int __cdecl sub_805135B(int a1)
  {
    return sub_805130D(a1, 58);
  }
  // 805130D: using guessed type _DWORD __cdecl sub_805130D(_DWORD, _DWORD);
  
  //----- (08051398) --------------------------------------------------------
  void *__cdecl sub_8051398(signed int a1, int a2, int a3)
  {
    int v4; // [esp+0h] [ebp-78h]
    int v5; // [esp+10h] [ebp-68h]
    int v6; // [esp+14h] [ebp-64h]
    int v7; // [esp+18h] [ebp-60h]
    int v8; // [esp+1Ch] [ebp-5Ch]
    int v9; // [esp+20h] [ebp-58h]
    int v10; // [esp+24h] [ebp-54h]
    int v11; // [esp+28h] [ebp-50h]
    int v12; // [esp+2Ch] [ebp-4Ch]
    int v13; // [esp+30h] [ebp-48h]
    int v14; // [esp+34h] [ebp-44h]
    int v15; // [esp+38h] [ebp-40h]
    int v16; // [esp+3Ch] [ebp-3Ch]
    int v17; // [esp+40h] [ebp-38h]
    int v18; // [esp+44h] [ebp-34h]
    int v19; // [esp+48h] [ebp-30h]
    int v20; // [esp+4Ch] [ebp-2Ch]
    int v21; // [esp+50h] [ebp-28h]
    int v22; // [esp+54h] [ebp-24h]
    int v23; // [esp+58h] [ebp-20h]
    int v24; // [esp+5Ch] [ebp-1Ch]
    int v25; // [esp+60h] [ebp-18h]
    int v26; // [esp+64h] [ebp-14h]
    int v27; // [esp+68h] [ebp-10h]
    int v28; // [esp+6Ch] [ebp-Ch]
  
    sub_804F981(&v5, a2);
    v17 = v5;
    v18 = v6;
    v19 = v7;
    v20 = v8;
    v21 = v9;
    v22 = v10;
    v23 = v11;
    v24 = v12;
    v25 = v13;
    v26 = v14;
    v27 = v15;
    v28 = v16;
    sub_804F84D(&v4 - 14, 0x3Au, 1);
    return sub_8050DE1(a1, a3, -1, &v17);
  }
  
  //----- (08051459) --------------------------------------------------------
  void __cdecl __noreturn sub_8051459(int a1, int a2, int a3)
  {
    sub_80514A9(a1, a2, a3);
  }
  
  //----- (080514A9) --------------------------------------------------------
  void __cdecl __noreturn sub_80514A9(int a1, int a2, int a3)
  {
    int v3; // [esp-10h] [ebp-48h]
    int v4; // [esp+0h] [ebp-38h]
    int v5; // [esp+4h] [ebp-34h]
    int v6; // [esp+8h] [ebp-30h]
    int v7; // [esp+Ch] [ebp-2Ch]
    int v8; // [esp+10h] [ebp-28h]
    int v9; // [esp+14h] [ebp-24h]
    int v10; // [esp+18h] [ebp-20h]
    int v11; // [esp+1Ch] [ebp-1Ch]
    int v12; // [esp+20h] [ebp-18h]
    int v13; // [esp+24h] [ebp-14h]
    int v14; // [esp+28h] [ebp-10h]
    int v15; // [esp+2Ch] [ebp-Ch]
  
    v4 = dword_805CD3C;
    v5 = dword_805CD40;
    v6 = dword_805CD44;
    v7 = dword_805CD48;
    v8 = dword_805CD4C;
    v9 = dword_805CD50;
    v10 = dword_805CD54;
    v11 = dword_805CD58;
    v12 = dword_805CD5C;
    v13 = dword_805CD60;
    v14 = dword_805CD64;
    v15 = dword_805CD68;
    sub_804F927(&v3 - 14, a2, a3);
  }
  // 804F927: using guessed type void __cdecl __noreturn sub_804F927(_DWORD, _DWORD, _DWORD);
  // 805CD3C: using guessed type int dword_805CD3C;
  // 805CD40: using guessed type int dword_805CD40;
  // 805CD44: using guessed type int dword_805CD44;
  // 805CD48: using guessed type int dword_805CD48;
  // 805CD4C: using guessed type int dword_805CD4C;
  // 805CD50: using guessed type int dword_805CD50;
  // 805CD54: using guessed type int dword_805CD54;
  // 805CD58: using guessed type int dword_805CD58;
  // 805CD5C: using guessed type int dword_805CD5C;
  // 805CD60: using guessed type int dword_805CD60;
  // 805CD64: using guessed type int dword_805CD64;
  // 805CD68: using guessed type int dword_805CD68;
  
  //----- (080515F3) --------------------------------------------------------
  void *__cdecl sub_80515F3(signed int a1, int a2, int a3)
  {
    return sub_8050DE1(a1, a2, a3, (int *)&unk_805C28C);
  }
  
  //----- (0805164E) --------------------------------------------------------
  void *__cdecl sub_805164E(signed int a1, int a2)
  {
    return sub_80515F3(a1, a2, -1);
  }
  
  //----- (08051670) --------------------------------------------------------
  void *__cdecl sub_8051670(int a1)
  {
    return sub_805164E(0, a1);
  }
  
  //----- (0805168B) --------------------------------------------------------
  #error "805183F: call analysis failed (funcsize=151)"
  
  //----- (08051980) --------------------------------------------------------
  #error "80519B4: call analysis failed (funcsize=56)"
  
  //----- (08051A35) --------------------------------------------------------
  void *__cdecl sub_8051A35(int a1, int a2)
  {
    return sub_8051980(a1, a2, (int)&unk_805824C);
  }
  
  //----- (08051A79) --------------------------------------------------------
  void __cdecl __noreturn sub_8051A79(char *a1)
  {
    char *v1; // eax
    bool v2; // zf
    void *v3; // eax
    int v4; // [esp-Ch] [ebp-68h]
    int v5; // [esp-8h] [ebp-64h]
    int v6; // [esp-4h] [ebp-60h]
    char *s; // [esp+0h] [ebp-5Ch]
    int v8; // [esp+4h] [ebp-58h]
    int v9; // [esp+8h] [ebp-54h]
    char *v10; // [esp+Ch] [ebp-50h]
    void *dest; // [esp+10h] [ebp-4Ch]
    int v12; // [esp+14h] [ebp-48h]
    int v13; // [esp+18h] [ebp-44h]
    int v14; // [esp+1Ch] [ebp-40h]
    int v15; // [esp+20h] [ebp-3Ch]
    int v16; // [esp+24h] [ebp-38h]
    char *v17; // [esp+28h] [ebp-34h]
    int v18; // [esp+2Ch] [ebp-30h]
    int v19; // [esp+30h] [ebp-2Ch]
    wint_t wc; // [esp+34h] [ebp-28h]
    int v21; // [esp+38h] [ebp-24h]
    int v22; // [esp+3Ch] [ebp-20h]
    int v23; // [esp+40h] [ebp-1Ch]
    int v24; // [esp+44h] [ebp-18h]
    int v25; // [esp+48h] [ebp-14h]
    int v26; // [esp+4Ch] [ebp-10h]
    unsigned int v27; // [esp+50h] [ebp-Ch]
    int v28; // [esp+54h] [ebp-8h]
    int v29; // [esp+58h] [ebp-4h]
  
    s = a1;
    v27 = __readgsdword(0x14u);
    v1 = strdup(a1);
    dest = v1;
    v2 = v1 == 0;
    v3 = &loc_8051ADE;
    if ( !v2 )
      v3 = &loc_8051AE3;
    dword_805C1D8 = (int)v3;
    sub_8056B21(
      v4,
      v5,
      v6,
      s,
      v8,
      v9,
      v10,
      dest,
      v12,
      v13,
      v14,
      v15,
      v16,
      v17,
      v18,
      v19,
      wc,
      v21,
      v22,
      v23,
      v24,
      v25,
      v26,
      v27,
      v28,
      v29);
    sub_8052A61();
  }
  // 8056B21: using guessed type int __stdcall sub_8056B21(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 805C1D8: using guessed type int dword_805C1D8;
  
  //----- (08051E6E) --------------------------------------------------------
  #error "8052518: call analysis failed (funcsize=355)"
  
  //----- (0805267F) --------------------------------------------------------
  #error "805269A: call analysis failed (funcsize=47)"
  
  //----- (08052721) --------------------------------------------------------
  #error "805272E: positive sp value has been found (funcsize=0)"
  
  //----- (0805272F) --------------------------------------------------------
  #error "8052775: call analysis failed (funcsize=26)"
  
  //----- (08052788) --------------------------------------------------------
  #error "8052798: positive sp value has been found (funcsize=0)"
  
  //----- (08052804) --------------------------------------------------------
  void *__cdecl sub_8052804(unsigned int a1, unsigned int a2)
  {
    if ( 0x7FFFFFFF / a2 < a1 )
      sub_8052A61();
    return sub_8052911(a2 * a1);
  }
  
  //----- (08052867) --------------------------------------------------------
  void *__cdecl sub_8052867(void *ptr, int a2, int a3)
  {
    unsigned int v4; // [esp+1Ch] [ebp-Ch]
  
    v4 = *(_DWORD *)a2;
    if ( ptr )
    {
      if ( 0x55555554u / a3 <= v4 )
        sub_8052A61();
      v4 += (v4 >> 1) + 1;
    }
    else
    {
      if ( !v4 )
        v4 = (0x40u / a3 == 0) + 0x40u / a3;
      if ( 0x7FFFFFFFu / a3 < v4 )
        sub_8052A61();
    }
    *(_DWORD *)a2 = v4;
    return sub_805293B(ptr, a3 * v4);
  }
  
  //----- (080528FE) --------------------------------------------------------
  void *__cdecl sub_80528FE(size_t size)
  {
    return sub_8052911(size);
  }
  
  //----- (08052911) --------------------------------------------------------
  void *__cdecl sub_8052911(size_t size)
  {
    void *v2; // [esp+1Ch] [ebp-Ch]
  
    v2 = malloc(size);
    if ( !v2 && size )
      sub_8052A61();
    return v2;
  }
  
  //----- (0805293B) --------------------------------------------------------
  void *__cdecl sub_805293B(void *ptr, size_t size)
  {
    void *result; // eax
    void *ptra; // [esp+20h] [ebp+8h]
  
    if ( size || !ptr )
    {
      ptra = realloc(ptr, size);
      if ( !ptra )
      {
        if ( size )
          sub_8052A61();
      }
      result = ptra;
    }
    else
    {
      free(ptr);
      result = 0;
    }
    return result;
  }
  
  //----- (08052A13) --------------------------------------------------------
  void *__cdecl sub_8052A13(void *src, size_t n)
  {
    void *v2; // eax
  
    v2 = sub_8052911(n);
    return memcpy(v2, src, n);
  }
  
  //----- (08052A61) --------------------------------------------------------
  void __noreturn sub_8052A61()
  {
    char *v0; // eax
  
    v0 = gettext("memory exhausted");
    error(status, 0, "%s", v0);
    abort();
  }
  
  //----- (08052B3D) --------------------------------------------------------
  char *__cdecl sub_8052B3D(char *s, char *fromcode, char *tocode)
  {
    bool v3; // zf
    void *v4; // eax
    int v6; // [esp+0h] [ebp-28h]
    int v7; // [esp+4h] [ebp-24h]
    char *v8; // [esp+1Ch] [ebp-Ch]
  
    v8 = sub_8055EE8(s, fromcode, tocode);
    if ( !v8 )
    {
      v3 = *__errno_location() == 12;
      v4 = &loc_8052B8A;
      if ( !v3 )
        v4 = &loc_8052B8F;
      dword_805C160 = (int)v4;
      sub_8056E0B(v6, v7);
      sub_8052A61();
    }
    return v8;
  }
  // 8056E0B: using guessed type int __stdcall sub_8056E0B(_DWORD, _DWORD);
  // 805C160: using guessed type int dword_805C160;
  
  //----- (08052B94) --------------------------------------------------------
  #error "8052C01: call analysis failed (funcsize=93)"
  
  //----- (08052CDC) --------------------------------------------------------
  int __cdecl sub_8052CDC(int a1, int a2, int a3)
  {
    int v3; // eax
    int i; // [esp+1Ch] [ebp-Ch]
  
    for ( i = 0; ; i |= sub_8052B94(a1, a2) )
    {
      v3 = a3--;
      if ( !v3 )
        break;
    }
    return i;
  }
  // 8052B94: using guessed type _DWORD __cdecl sub_8052B94(_DWORD, _DWORD);
  
  //----- (08052D12) --------------------------------------------------------
  #error "8052D68: call analysis failed (funcsize=291)"
  
  //----- (08053150) --------------------------------------------------------
  #error "80531F3: call analysis failed (funcsize=63)"
  
  //----- (0805322C) --------------------------------------------------------
  int __cdecl sub_805322C(FILE *stream)
  {
    int result; // eax
  
    result = stream->_flags & 0x100;
    if ( result )
      result = sub_80532D3(stream, 0, 0, 1);
    return result;
  }
  
  //----- (08053265) --------------------------------------------------------
  #error "8053285: call analysis failed (funcsize=35)"
  
  //----- (080532D3) --------------------------------------------------------
  #error "80533B7: call analysis failed (funcsize=82)"
  
  //----- (080533E2) --------------------------------------------------------
  size_t __cdecl sub_80533E2(wchar_t *pwc, char *s, size_t n, mbstate_t *p)
  {
    char v5; // [esp+18h] [ebp-10h]
    size_t v6; // [esp+1Ch] [ebp-Ch]
  
    if ( !pwc )
      pwc = (wchar_t *)&v5;
    v6 = mbrtowc(pwc, s, n, p);
    if ( v6 <= 0xFFFFFFFD || !n || !((unsigned __int8)sub_8053581(0) ^ 1) )
      return v6;
    *pwc = (unsigned __int8)*s;
    return 1;
  }
  
  //----- (08053454) --------------------------------------------------------
  int __cdecl sub_8053454(unsigned __int8 *a1, unsigned __int8 *a2)
  {
    unsigned __int8 *v2; // esi
    unsigned __int8 *v3; // ebx
    unsigned __int8 v5; // [esp+1Eh] [ebp-Ah]
    unsigned __int8 v6; // [esp+1Fh] [ebp-9h]
  
    v2 = a1;
    v3 = a2;
    if ( a1 == a2 )
      return 0;
    do
    {
      v5 = sub_805626F(*v2);
      v6 = sub_805626F(*v3);
      if ( !v5 )
        break;
      ++v2;
      ++v3;
    }
    while ( v5 == v6 );
    return v5 - v6;
  }
  
  //----- (080534B9) --------------------------------------------------------
  #error "805354E: call analysis failed (funcsize=63)"
  
  //----- (08053581) --------------------------------------------------------
  int __cdecl sub_8053581(int category)
  {
    bool v1; // zf
    int v2; // edx
    int v3; // ecx
    void *v4; // eax
    unsigned __int8 v6; // [esp+1Bh] [ebp-Dh]
    const char *s1; // [esp+1Ch] [ebp-Ch]
  
    v6 = 1;
    s1 = setlocale(category, 0);
    if ( s1 )
    {
      v1 = strcmp(s1, "C") == 0;
      v4 = &loc_80535D7;
      if ( v1 )
        v4 = &loc_80535EE;
      dword_805C1B0 = (int)v4;
      sub_8056BFD(v3, v2);
      if ( !strcmp(s1, "POSIX") )
        v6 = 0;
    }
    return v6;
  }
  // 8056BFD: using guessed type int __fastcall sub_8056BFD(_DWORD, _DWORD);
  // 805C1B0: using guessed type int dword_805C1B0;
  
  //----- (080535F8) --------------------------------------------------------
  void *sub_80535F8()
  {
    _BOOL4 v0; // eax
    void *v1; // eax
    bool v2; // zf
    void *v3; // eax
    void *v4; // eax
    int v6; // [esp+0h] [ebp-C8h]
    int v7; // [esp+0h] [ebp-C8h]
    int v8; // [esp+4h] [ebp-C4h]
    int v9; // [esp+4h] [ebp-C4h]
    int v10; // [esp+8h] [ebp-C0h]
    int v11; // [esp+8h] [ebp-C0h]
    int v12; // [esp+Ch] [ebp-BCh]
    int v13; // [esp+Ch] [ebp-BCh]
    int v14; // [esp+10h] [ebp-B8h]
    int v15; // [esp+10h] [ebp-B8h]
    void *ptr; // [esp+14h] [ebp-B4h]
    void *v17; // [esp+18h] [ebp-B0h]
    int v18; // [esp+18h] [ebp-B0h]
    const char *s; // [esp+1Ch] [ebp-ACh]
    char *sa; // [esp+1Ch] [ebp-ACh]
    void *v21; // [esp+20h] [ebp-A8h]
    void *v22; // [esp+20h] [ebp-A8h]
    int v23; // [esp+24h] [ebp-A4h]
    int v24; // [esp+24h] [ebp-A4h]
    char *v25; // [esp+28h] [ebp-A0h]
    size_t n; // [esp+2Ch] [ebp-9Ch]
    size_t na; // [esp+2Ch] [ebp-9Ch]
    size_t v28; // [esp+30h] [ebp-98h]
    int v29; // [esp+30h] [ebp-98h]
    _BOOL4 v30; // [esp+34h] [ebp-94h]
    int v31; // [esp+34h] [ebp-94h]
    void *dest; // [esp+38h] [ebp-90h]
    char *desta; // [esp+38h] [ebp-90h]
    int fd; // [esp+3Ch] [ebp-8Ch]
    int fda; // [esp+3Ch] [ebp-8Ch]
    FILE *stream; // [esp+40h] [ebp-88h]
    FILE *streama; // [esp+40h] [ebp-88h]
    int c; // [esp+44h] [ebp-84h]
    int ca; // [esp+44h] [ebp-84h]
    int v40; // [esp+48h] [ebp-80h]
    int v41; // [esp+48h] [ebp-80h]
    int v42; // [esp+4Ch] [ebp-7Ch]
    int v43; // [esp+4Ch] [ebp-7Ch]
    void *v44; // [esp+50h] [ebp-78h]
    void *v45; // [esp+50h] [ebp-78h]
    int v46; // [esp+54h] [ebp-74h]
    int v47; // [esp+54h] [ebp-74h]
    int v48; // [esp+58h] [ebp-70h]
    int v49; // [esp+58h] [ebp-70h]
    int v50; // [esp+5Ch] [ebp-6Ch]
    int v51; // [esp+5Ch] [ebp-6Ch]
    int v52; // [esp+60h] [ebp-68h]
    int v53; // [esp+60h] [ebp-68h]
    int v54; // [esp+64h] [ebp-64h]
    int v55; // [esp+64h] [ebp-64h]
    int v56; // [esp+68h] [ebp-60h]
    int v57; // [esp+6Ch] [ebp-5Ch]
    int v58; // [esp+70h] [ebp-58h]
    int v59; // [esp+74h] [ebp-54h]
    int v60; // [esp+78h] [ebp-50h]
    int v61; // [esp+7Ch] [ebp-4Ch]
    int v62; // [esp+80h] [ebp-48h]
  
    v17 = (void *)dword_805CE7C;
    if ( !dword_805CE7C )
    {
      s = getenv("CHARSETALIASDIR");
      if ( !s || !*s )
        s = "/home/hwangdz/coreutils/coreutils-8.28/install_m32/lib";
      n = strlen(s);
      v28 = strlen("charset.alias");
      v0 = n && s[n - 1] != 47;
      v30 = v0;
      v1 = malloc(n + v0 + v28 + 1);
      dest = v1;
      v2 = v1 == 0;
      v3 = &loc_8053729;
      if ( v2 )
        v3 = &loc_80537BA;
      dword_805C1D8 = (int)v3;
      sub_8056B21(
        v6,
        v8,
        v10,
        v12,
        v14,
        0,
        v17,
        s,
        v21,
        v23,
        "charset.alias",
        n,
        v28,
        v30,
        dest,
        fd,
        stream,
        c,
        v40,
        v42,
        v44,
        v46,
        v48,
        v50,
        v52,
        v54);
      memcpy(desta, sa, na);
      if ( v31 )
        desta[na] = 47;
      memcpy(&desta[na + v31], v25, v29 + 1);
      free(ptr);
      v4 = &loc_80537EA;
      if ( desta )
        v4 = &loc_80537F9;
      dword_805C19C = (int)v4;
      sub_8056C8E(
        v7,
        v9,
        v11,
        v13,
        v15,
        ptr,
        v18,
        sa,
        v22,
        v24,
        v25,
        na,
        v29,
        v31,
        desta,
        fda,
        streama,
        ca,
        v41,
        v43,
        v45,
        v47,
        v49,
        v51,
        v53,
        v55,
        v56,
        v57,
        v58,
        v59,
        v60,
        v61,
        v62);
      v17 = &unk_8058817;
      dword_805CE7C = (int)&unk_8058817;
    }
    return v17;
  }
  // 8056B21: using guessed type int __stdcall sub_8056B21(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 8056C8E: using guessed type int __stdcall sub_8056C8E(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 805C19C: using guessed type int dword_805C19C;
  // 805C1D8: using guessed type int dword_805C1D8;
  // 805CE7C: using guessed type int dword_805CE7C;
  
  //----- (08053B40) --------------------------------------------------------
  char *sub_8053B40()
  {
    int v0; // edx
    int v1; // ecx
    char *v2; // ST1C_4
    const char *s1; // [esp+18h] [ebp-10h]
    char *s2; // [esp+1Ch] [ebp-Ch]
  
    s1 = nl_langinfo(14);
    if ( !s1 )
      s1 = (const char *)&unk_8058817;
    s2 = (char *)sub_80535F8();
    dword_805C1B0 = (int)&loc_8053BE8;
    sub_8056BFD(v1, v0);
    while ( strcmp(s1, s2) && (*s2 != 42 || s2[1]) )
    {
      v2 = &s2[strlen(s2) + 1];
      s2 = &v2[strlen(v2) + 1];
      if ( !*s2 )
        goto LABEL_9;
    }
    s1 = &s2[strlen(s2) + 1];
  LABEL_9:
    if ( !*s1 )
      s1 = "ASCII";
    return (char *)s1;
  }
  // 8056BFD: using guessed type int __fastcall sub_8056BFD(_DWORD, _DWORD);
  // 805C1B0: using guessed type int dword_805C1B0;
  
  //----- (08053C08) --------------------------------------------------------
  #error "8053E91: call analysis failed (funcsize=135)"
  
  //----- (08053FB3) --------------------------------------------------------
  signed int __usercall sub_8053FB3@<eax>(unsigned int a1@<edx>, int a2@<ecx>, _BYTE *a3, int a4, unsigned int a5, _DWORD *a6)
  {
    unsigned int v6; // eax
    void *v7; // esp
    unsigned int v8; // eax
    void *v10; // eax
    char v11; // [esp+13h] [ebp-25h]
    unsigned int i; // [esp+14h] [ebp-24h]
    int v13; // [esp+18h] [ebp-20h]
    int v14; // [esp+1Ch] [ebp-1Ch]
    _BYTE *v15; // [esp+20h] [ebp-18h]
    _BYTE *v16; // [esp+24h] [ebp-14h]
    unsigned int v17; // [esp+28h] [ebp-10h]
    unsigned int v18; // [esp+2Ch] [ebp-Ch]
  
    v17 = a5;
    if ( a5 > 0x1FFFFFFF )
    {
      v8 = 0;
    }
    else if ( 4 * v17 > 0xFB7 )
    {
      v8 = sub_80562A5(4 * v17);
    }
    else
    {
      v6 = 4 * (v17 + 2) + 30;
      a1 = v6 % 0x10;
      v7 = alloca(16 * (v6 / 0x10));
      v8 = 16 * ((unsigned int)&v11 >> 4) + 8;
    }
    v18 = v8;
    if ( !v8 )
      return 0;
    *(_DWORD *)(v18 + 4) = 1;
    v13 = 0;
    for ( i = 2; i < v17; ++i )
    {
      v11 = *(_BYTE *)(i - 1 + a4);
      while ( 1 )
      {
        if ( *(_BYTE *)(a4 + v13) == v11 )
        {
          a2 = i - ++v13;
          a1 = i - v13;
          *(_DWORD *)(4 * i + v18) = i - v13;
          goto LABEL_15;
        }
        if ( !v13 )
          break;
        v13 -= *(_DWORD *)(4 * v13 + v18);
      }
      a1 = v18 + 4 * i;
      *(_DWORD *)a1 = i;
  LABEL_15:
      ;
    }
    *a6 = 0;
    v14 = 0;
    v15 = a3;
    v16 = a3;
    v10 = &loc_80541DD;
    if ( *a3 )
      v10 = &loc_805412B;
    dword_805C1B0 = (int)v10;
    sub_8056BFD(a2, a1);
    sub_805636E(v18);
    return 1;
  }
  // 8056BFD: using guessed type int __fastcall sub_8056BFD(_DWORD, _DWORD);
  // 805C1B0: using guessed type int dword_805C1B0;
  
  //----- (080541F2) --------------------------------------------------------
  #error "805424E: call analysis failed (funcsize=27)"
  
  //----- (08054253) --------------------------------------------------------
  #error "8054262: call analysis failed (funcsize=488)"
  
  //----- (08054A17) --------------------------------------------------------
  int __usercall __noreturn sub_8054A17@<eax>(int a1@<ebx>, _BYTE *a2, _BYTE *a3)
  {
    int v3; // edx
    int v4; // ecx
    int v5; // edx
    int v6; // ecx
    void *v7; // eax
    void *v8; // eax
    int v9; // ebx
    int v10; // edx
    int v11; // ecx
    void *v12; // eax
    bool v30; // zf
    _BYTE *v32; // eax
    _BYTE *v33; // eax
    void *v34; // eax
    unsigned int v35; // eax
    int v36; // edx
    void *v37; // eax
    unsigned int v38; // et1
    int (*v39)(); // eax
    int v41; // [esp-8h] [ebp-180h]
    int v42; // [esp-4h] [ebp-17Ch]
    _BYTE *v43; // [esp+0h] [ebp-178h]
    unsigned int v44; // [esp+4h] [ebp-174h]
    int v45; // [esp+8h] [ebp-170h]
    int v46; // [esp+Ch] [ebp-16Ch]
    int v47; // [esp+10h] [ebp-168h]
    int v48; // [esp+14h] [ebp-164h]
    _BYTE *v49; // [esp+18h] [ebp-160h]
    _BYTE *v50; // [esp+1Ch] [ebp-15Ch]
    int v51; // [esp+20h] [ebp-158h]
    int v52; // [esp+24h] [ebp-154h]
    _BYTE *v53; // [esp+28h] [ebp-150h]
    int v54; // [esp+2Ch] [ebp-14Ch]
    int v55; // [esp+30h] [ebp-148h]
    int v56; // [esp+34h] [ebp-144h]
    int v57; // [esp+38h] [ebp-140h]
    unsigned int v58; // [esp+3Ch] [ebp-13Ch]
    unsigned int v59; // [esp+40h] [ebp-138h]
    unsigned int v60; // [esp+44h] [ebp-134h]
    _BYTE *v61; // [esp+48h] [ebp-130h]
    _BYTE *v62; // [esp+4Ch] [ebp-12Ch]
    _BYTE *v63; // [esp+50h] [ebp-128h]
    char v64; // [esp+54h] [ebp-124h]
    int v65; // [esp+58h] [ebp-120h]
    int v66; // [esp+5Ch] [ebp-11Ch]
    char v67; // [esp+60h] [ebp-118h]
    void *s2; // [esp+64h] [ebp-114h]
    int v69; // [esp+68h] [ebp-110h]
    unsigned __int8 v70; // [esp+6Ch] [ebp-10Ch]
    int v71; // [esp+70h] [ebp-108h]
    int v72; // [esp+74h] [ebp-104h]
    int v73; // [esp+78h] [ebp-100h]
    int v74; // [esp+7Ch] [ebp-FCh]
    int v75; // [esp+80h] [ebp-F8h]
    char v78; // [esp+8Ch] [ebp-ECh]
    char v81; // [esp+98h] [ebp-E0h]
    _BYTE *v82; // [esp+9Ch] [ebp-DCh]
    int v90; // [esp+C4h] [ebp-B4h]
    int v91; // [esp+C8h] [ebp-B0h]
    int v93; // [esp+D0h] [ebp-A8h]
    void *s1; // [esp+D4h] [ebp-A4h]
    int v96; // [esp+DCh] [ebp-9Ch]
    int v97; // [esp+E0h] [ebp-98h]
    unsigned int v124; // [esp+16Ch] [ebp-Ch]
  
    v50 = a2;
    v49 = a3;
    v124 = __readgsdword(0x14u);
    if ( __ctype_get_mb_cur_max() <= 1 )
    {
      if ( *v49 )
      {
        LOBYTE(v52) = 1;
        v58 = 0;
        v59 = 0;
        v60 = 0;
        v61 = v49;
        v33 = v49;
        v3 = (int)(v49++ + 1);
        BYTE2(v52) = *v33;
        while ( 1 )
        {
          if ( !*v50 )
          {
            dword_805C188 = (int)&loc_8055386;
            sub_8056D06(
              v4,
              v3,
              v43,
              v44,
              v45,
              v46,
              v47,
              v48,
              v49,
              v50,
              v51,
              v52,
              v53,
              v54,
              v55,
              v56,
              v57,
              v58,
              v59,
              v60,
              v61,
              v62,
              v63,
              *(_DWORD *)&v64,
              v65,
              v66,
              *(_DWORD *)&v67,
              s2,
              v69);
          }
          if ( (_BYTE)v52 )
          {
            if ( v58 > 9 )
            {
              v3 = v58;
              if ( 5 * v58 <= v59 )
              {
                v42 = 5 * v58;
                v41 = a1;
                v34 = &loc_8055216;
                if ( !v61 )
                  v34 = &loc_8055261;
                dword_805C1C4 = (int)v34;
                a1 = v41;
                sub_8056B8D(
                  v43,
                  v44,
                  v45,
                  v46,
                  v47,
                  v48,
                  v49,
                  v50,
                  v51,
                  v52,
                  v53,
                  v54,
                  v55,
                  v56,
                  v57,
                  v58,
                  v59,
                  v60,
                  v61,
                  v62,
                  v63,
                  *(_DWORD *)&v64,
                  v65,
                  v66,
                  *(_DWORD *)&v67,
                  s2,
                  v69);
                v44 = v59 - v60;
                v43 = v61;
                v61 += strnlen();
                if ( !*v61 )
                  v61 = 0;
                v60 = v59;
                if ( !v61 )
                {
                  v35 = strlen(v49 - 1);
                  HIBYTE(v52) = sub_8053FB3((unsigned int)&v53, (int)(v49 - 1), v50, (int)(v49 - 1), v35, &v53);
                  if ( HIBYTE(v52) )
                  {
                    v32 = v53;
                    goto LABEL_80;
                  }
                  LOBYTE(v52) = 0;
                }
              }
            }
          }
          ++v58;
          ++v59;
          if ( *v50 == BYTE2(v52) )
          {
            v62 = v50 + 1;
            v63 = v49;
            if ( !*v49 )
            {
              v32 = v50;
              goto LABEL_80;
            }
            if ( !*v62 )
            {
              v32 = 0;
              goto LABEL_80;
            }
            ++v59;
            v36 = (unsigned __int8)*v62;
            v30 = (_BYTE)v36 == *v63;
            v42 = (unsigned __int8)*v63;
            v41 = a1;
            v37 = &loc_8055362;
            if ( v30 )
              v37 = &loc_8055364;
            dword_805C1B0 = (int)v37;
            a1 = v41;
            sub_8056BFD(v4, v36);
          }
          ++v50;
        }
      }
      v32 = v50;
    }
    else
    {
      s2 = v49;
      v64 = 0;
      memset(&v65, 0, 8u);
      v67 = 0;
      sub_80553B9((int)&v64);
      v42 = v70 ^ 1;
      v41 = a1;
      v7 = &loc_8054ADC;
      if ( v70 != 1 )
        v7 = &loc_8054AE6;
      dword_805C1B0 = (int)v7;
      sub_8056BFD(v6, v5);
      v42 = v71 != 0;
      v8 = &loc_8054B0F;
      if ( !v71 )
        v8 = &loc_8055123;
      dword_805C19C = (int)v8;
      v9 = v41;
      sub_8056C8E(
        v43,
        v44,
        v45,
        v46,
        v47,
        v48,
        v49,
        v50,
        v51,
        v52,
        v53,
        v54,
        v55,
        v56,
        v57,
        v58,
        v59,
        v60,
        v61,
        v62,
        v63,
        *(_DWORD *)&v64,
        v65,
        v66,
        *(_DWORD *)&v67,
        s2,
        v69,
        *(_DWORD *)&v70,
        v71,
        v72,
        v73,
        v74,
        v75);
      HIBYTE(v51) = 1;
      v54 = 0;
      v55 = 0;
      v56 = 0;
      v82 = v49;
      v78 = 0;
      memset(&v43 - 58, 0, 8u);
      v81 = 0;
      s1 = v50;
      LOBYTE(v90) = 0;
      memset(&v91, 0, 8u);
      LOBYTE(v93) = 0;
      sub_80553B9((int)&v90);
      if ( (_BYTE)v96 == 1 )
      {
        v42 = v97;
        v41 = v9;
        v12 = &loc_8054BF9;
        if ( !v97 )
          v12 = &loc_8054C15;
        dword_805C1D8 = (int)v12;
        sub_8056B21(
          v43,
          v44,
          v45,
          v46,
          v47,
          v48,
          v49,
          v50,
          v51,
          v52,
          v53,
          v54,
          v55,
          v56,
          v57,
          v58,
          v59,
          v60,
          v61,
          v62,
          v63,
          *(_DWORD *)&v64,
          v65,
          v66,
          *(_DWORD *)&v67,
          s2);
      }
      dword_805C188 = (int)&loc_8054C1A;
      sub_8056D06(
        v11,
        v10,
        v43,
        v44,
        v45,
        v46,
        v47,
        v48,
        v49,
        v50,
        v51,
        v52,
        v53,
        v54,
        v55,
        v56,
        v57,
        v58,
        v59,
        v60,
        v61,
        v62,
        v63,
        *(_DWORD *)&v64,
        v65,
        v66,
        *(_DWORD *)&v67,
        s2,
        v69);
      dword_805C1D8 = (int)&loc_8055386;
      sub_8056B21(
        v43,
        v44,
        v45,
        v46,
        v47,
        v48,
        v49,
        v50,
        v51,
        v52,
        v53,
        v54,
        v55,
        v56,
        v57,
        v58,
        v59,
        v60,
        v61,
        v62,
        v63,
        *(_DWORD *)&v64,
        v65,
        v66,
        *(_DWORD *)&v67,
        s2);
      v32 = v50;
    }
  LABEL_80:
    v38 = __readgsdword(0x14u);
    v42 = (int)v32;
    v41 = v38 ^ v124;
    v39 = (int (*)())&loc_80553AB;
    if ( v38 == v124 )
      v39 = sub_80553B0;
    dword_805C1B0 = (int)v39;
    return sub_8056BFD(v4, v3);
  }
  // 80493D0: using guessed type int strnlen(void);
  // 80541F2: using guessed type _DWORD __cdecl sub_80541F2(_DWORD, _DWORD, _DWORD);
  // 80553B0: using guessed type int sub_80553B0();
  // 8056A41: using guessed type int __stdcall sub_8056A41(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 8056AB1: using guessed type int __fastcall sub_8056AB1(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 8056B21: using guessed type int __stdcall sub_8056B21(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 8056B8D: using guessed type int __stdcall sub_8056B8D(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 8056BFD: using guessed type int __fastcall sub_8056BFD(_DWORD, _DWORD);
  // 8056C8E: using guessed type int __stdcall sub_8056C8E(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 8056D06: using guessed type int __fastcall sub_8056D06(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
  // 805C188: using guessed type int dword_805C188;
  // 805C19C: using guessed type int dword_805C19C;
  // 805C1B0: using guessed type int dword_805C1B0;
  // 805C1C4: using guessed type int dword_805C1C4;
  // 805C1D8: using guessed type int dword_805C1D8;
  // 805C1EC: using guessed type int dword_805C1EC;
  // 805C200: using guessed type int dword_805C200;
  
  //----- (080553B0) --------------------------------------------------------
  #error "80553B6: positive sp value has been found (funcsize=0)"
  
  //----- (080553B9) --------------------------------------------------------
  #error "80554D8: call analysis failed (funcsize=136)"
  
  //----- (08055688) --------------------------------------------------------
  #error "805579C: call analysis failed (funcsize=72)"
  
  //----- (08055850) --------------------------------------------------------
  #error "8055B15: positive sp value has been found (funcsize=155)"
  
  //----- (08055B16) --------------------------------------------------------
  #error "8055D10: call analysis failed (funcsize=174)"
  
  //----- (08055EE8) --------------------------------------------------------
  char *__cdecl sub_8055EE8(char *s, char *fromcode, char *tocode)
  {
    char *result; // eax
    int v4; // ST24_4
    int v5; // ST28_4
    iconv_t cd; // [esp+1Ch] [ebp-1Ch]
    void *ptr; // [esp+20h] [ebp-18h]
    char *v8; // [esp+2Ch] [ebp-Ch]
  
    if ( *s && sub_8053454((unsigned __int8 *)fromcode, (unsigned __int8 *)tocode) )
    {
      cd = iconv_open(tocode, fromcode);
      if ( cd == (iconv_t)-1 )
        return 0;
      ptr = (void *)sub_8055B16(s, cd);
      if ( ptr )
      {
        if ( iconv_close(cd) < 0 )
        {
          v5 = *__errno_location();
          free(ptr);
          *__errno_location() = v5;
          return 0;
        }
      }
      else
      {
        v4 = *__errno_location();
        iconv_close(cd);
        *__errno_location() = v4;
      }
      result = (char *)ptr;
    }
    else
    {
      v8 = strdup(s);
      if ( !v8 )
        *__errno_location() = 12;
      result = v8;
    }
    return result;
  }
  
  //----- (08055FCD) --------------------------------------------------------
  #error "805600A: call analysis failed (funcsize=28)"
  
  //----- (0805626F) --------------------------------------------------------
  int __cdecl sub_805626F(int a1)
  {
    int result; // eax
  
    if ( (unsigned int)(a1 - 65) > 0x19 )
      result = a1;
    else
      result = a1 + 32;
    return result;
  }
  
  //----- (080562A5) --------------------------------------------------------
  unsigned int __cdecl sub_80562A5(unsigned int a1)
  {
    _DWORD *v1; // ST18_4
    unsigned int v2; // ST14_4
    _DWORD *v4; // [esp+14h] [ebp-14h]
  
    if ( a1 + 8 < a1 )
      return 0;
    v4 = malloc(a1 + 8);
    if ( !v4 )
      return 0;
    v1 = v4;
    v2 = (unsigned int)(v4 + 2);
    v1[1] = 336984906;
    *v1 = dword_805CE9C[v2 % 0x101];
    dword_805CE9C[v2 % 0x101] = v2;
    return v2;
  }
  
  //----- (0805636E) --------------------------------------------------------
  #error "8056444: call analysis failed (funcsize=49)"
  
  //----- (0805647F) --------------------------------------------------------
  int __cdecl sub_805647F(int a1, int a2)
  {
    int v2; // ecx
    int v3; // edx
    void *v4; // eax
    int result; // eax
  
    if ( *(_DWORD *)a2 == a2 + 16 )
    {
      memcpy((void *)(a1 + 16), (const void *)(a2 + 16), *(_DWORD *)(a2 + 4));
      *(_DWORD *)a1 = a1 + 16;
    }
    else
    {
      *(_DWORD *)a1 = *(_DWORD *)a2;
    }
    *(_DWORD *)(a1 + 4) = *(_DWORD *)(a2 + 4);
    v3 = *(unsigned __int8 *)(a2 + 8);
    *(_BYTE *)(a1 + 8) = v3;
    v4 = &loc_805652A;
    if ( !*(_BYTE *)(a1 + 8) )
      v4 = &locret_8056536;
    dword_805C174 = (int)v4;
    sub_8056D78(v2, v3);
    result = a1;
    *(_DWORD *)(a1 + 12) = *(_DWORD *)(a2 + 12);
    return result;
  }
  // 8056D78: using guessed type int __fastcall sub_8056D78(_DWORD, _DWORD);
  // 805C174: using guessed type int dword_805C174;
  
  //----- (08056538) --------------------------------------------------------
  bool __cdecl sub_8056538(unsigned __int8 a1)
  {
    return (((unsigned int)dword_80589D8[a1 >> 5] >> (a1 & 0x1F)) & 1) != 0;
  }
  
  //----- (0805658F) --------------------------------------------------------
  size_t __cdecl sub_805658F(const char *a1)
  {
    _BOOL4 v1; // eax
    int v3; // [esp+10h] [ebp-48h]
    char v4; // [esp+14h] [ebp-44h]
    int v5; // [esp+18h] [ebp-40h]
    char i; // [esp+20h] [ebp-38h]
    const char *v7; // [esp+24h] [ebp-34h]
    int v8; // [esp+28h] [ebp-30h]
    char v9; // [esp+2Ch] [ebp-2Ch]
    int v10; // [esp+30h] [ebp-28h]
    unsigned int v11; // [esp+4Ch] [ebp-Ch]
  
    v11 = __readgsdword(0x14u);
    if ( __ctype_get_mb_cur_max() <= 1 )
      return strlen(a1);
    v3 = 0;
    v7 = a1;
    v4 = 0;
    memset(&v5, 0, 8u);
    for ( i = 0; ; i = 0 )
    {
      sub_80553B9((int)&v4);
      v1 = v9 != 1 || v10;
      if ( !v1 )
        break;
      ++v3;
      v7 += v8;
    }
    return v3;
  }
  
  //----- (08056652) --------------------------------------------------------
  int __cdecl sub_8056652(__int64 a1, unsigned int a2, signed int a3)
  {
    int v3; // edx
    unsigned int v4; // ecx
    unsigned int v5; // esi
    unsigned int v6; // edi
    unsigned int v7; // ebp
    unsigned int v8; // eax
    int v9; // ecx
    unsigned int v10; // edx
    int v11; // ebp
    signed int v12; // ecx
    signed __int64 v13; // rax
    int v14; // edx
    int v15; // edi
    unsigned int v16; // edx
    unsigned int v17; // esi
    unsigned int v18; // ebp
    signed int v19; // esi
    unsigned __int64 v20; // rax
    unsigned int v21; // ebp
    int v22; // esi
    int v23; // edi
    int v25; // [esp+0h] [ebp-1Ch]
    unsigned int v26; // [esp+4h] [ebp-18h]
    unsigned int v27; // [esp+8h] [ebp-14h]
    unsigned int v28; // [esp+Ch] [ebp-10h]
  
    v3 = a1;
    v25 = 0;
    v26 = a2;
    v4 = HIDWORD(a1);
    if ( a1 < 0 )
    {
      v3 = -(signed int)a1;
      v5 = v26;
      v6 = a3;
      v4 = (unsigned __int64)-a1 >> 32;
      v25 = -1;
      if ( a3 >= 0 )
        goto LABEL_3;
    }
    else
    {
      v5 = v26;
      v6 = a3;
      if ( a3 >= 0 )
        goto LABEL_3;
    }
    v5 = -v5;
    v25 = ~v25;
    v6 = (unsigned __int64)-(signed __int64)__PAIR__(v6, v5) >> 32;
  LABEL_3:
    v7 = v4;
    v27 = v3;
    v8 = v6;
    v9 = v3;
    v26 = v5;
    if ( !v6 )
    {
      if ( v5 <= v7 )
      {
        if ( !v5 )
          v5 = 1 / 0u;
        v14 = v7 % v5;
        v11 = v7 / v5;
        v12 = __PAIR__((unsigned int)v14, v9) / v5;
      }
      else
      {
        v10 = v7;
        v11 = 0;
        v12 = __PAIR__(v10, v9) / v5;
      }
      goto LABEL_8;
    }
    if ( v6 > v7 )
      goto LABEL_7;
    _BitScanReverse(&v6, v6);
    v15 = v6 ^ 0x1F;
    if ( !v15 )
    {
      if ( v26 > v27 && v8 >= v7 )
      {
  LABEL_7:
        v11 = 0;
        v12 = 0;
        goto LABEL_8;
      }
      v11 = 0;
      v12 = 1;
  LABEL_8:
      LODWORD(v13) = v12;
      if ( v25 )
        v13 = -__PAIR__(v11, v12);
      return v13;
    }
    v28 = v26 >> (32 - v15);
    v28 |= v8 << v15;
    v26 <<= v15;
    v16 = (unsigned int)&v25 >> (32 - v15);
    v17 = ((_DWORD)&v25 << v15) | (v27 >> (32 - v15));
    v18 = __PAIR__(v16, v17) % v28;
    v19 = __PAIR__(v16, v17) / v28;
    v20 = v26 * (unsigned __int64)(unsigned int)v19;
    v26 = HIDWORD(v20);
    if ( v18 >= HIDWORD(v20) && (v27 << v15 >= (unsigned int)v20 || v18 != v26) )
    {
      v12 = v19;
      v11 = 0;
      goto LABEL_8;
    }
    dword_805C160 = (int)&loc_80566D9;
    sub_8056E0B(v25, v26);
    v21 = v28;
    init_proc();
    LODWORD(v13) = (char *)&stru_805BF04 + 4;
    v22 = ((char *)&stru_805BF0C - (char *)&stru_805BF04.d_un) >> 2;
    if ( v22 )
    {
      v23 = 0;
      do
        LODWORD(v13) = (*((int (__cdecl **)(unsigned int, unsigned int, unsigned int))&stru_805BF04.d_un.d_val + v23++))(
                         v26,
                         v27,
                         v21);
      while ( v22 != v23 );
    }
    return v13;
  }
  // 8056E0B: using guessed type int __stdcall sub_8056E0B(_DWORD, _DWORD);
  // 805BF04: using guessed type Elf32_Dyn;
  // 805BF0C: using guessed type Elf32_Dyn stru_805BF0C;
  // 805C160: using guessed type int dword_805C160;
  
  //----- (080568A5) --------------------------------------------------------
  int __cdecl sub_80568A5(int a1)
  {
    return __cxa_atexit(a1, 0, dword_805C230);
  }
  // 80491F0: using guessed type int __cdecl __cxa_atexit(_DWORD, _DWORD, _DWORD);
  // 805C230: using guessed type int dword_805C230;
  
  //----- (080568D4) --------------------------------------------------------
  int __cdecl sub_80568D4(int a1, int a2)
  {
    return __fxstat64(3, a1, a2);
  }
  // 8049190: using guessed type int __cdecl __fxstat64(_DWORD, _DWORD, _DWORD);
  
  //----- (08056A41) --------------------------------------------------------
  #error "8056A47: positive sp value has been found (funcsize=0)"
  
  //----- (08056AB1) --------------------------------------------------------
  #error "8056AB7: positive sp value has been found (funcsize=0)"
  
  //----- (08056B21) --------------------------------------------------------
  #error "8056B27: positive sp value has been found (funcsize=0)"
  
  //----- (08056B8D) --------------------------------------------------------
  #error "8056B93: positive sp value has been found (funcsize=0)"
  
  //----- (08056BFD) --------------------------------------------------------
  #error "8056C03: positive sp value has been found (funcsize=0)"
  
  //----- (08056C4D) --------------------------------------------------------
  #error "8056C86: positive sp value has been found (funcsize=18)"
  
  //----- (08056C8E) --------------------------------------------------------
  #error "8056C94: positive sp value has been found (funcsize=0)"
  
  //----- (08056D06) --------------------------------------------------------
  #error "8056D0C: positive sp value has been found (funcsize=0)"
  
  //----- (08056D78) --------------------------------------------------------
  #error "8056D7E: positive sp value has been found (funcsize=0)"
  
  //----- (08056DCA) --------------------------------------------------------
  #error "8056E03: positive sp value has been found (funcsize=18)"
  
  //----- (08056E0B) --------------------------------------------------------
  #error "8056E11: positive sp value has been found (funcsize=0)"
  
  //----- (08056E20) --------------------------------------------------------
  int (**sub_8056E20())()
  {
    int (**result)(); // eax
    int v1; // esi
    int v2; // edi
  
    init_proc();
    result = off_805BED8;
    v1 = &off_805BEDC - off_805BED8;
    if ( v1 )
    {
      v2 = 0;
      do
        result = (int (**)())off_805BED8[v2++]();
      while ( v1 != v2 );
    }
    return result;
  }
  // 805BED8: using guessed type int (*off_805BED8[2])();
  // 805BEDC: using guessed type int (*off_805BEDC)();
  
  //----- (08056E84) --------------------------------------------------------
  void term_proc()
  {
    ;
  }
  
  #error "There were 67 decompilation failure(s) on 180 function(s)"
  