{"type": "func", "start": 6443728864, "end": 6443729691, "name": "sub_180137FE0", "pseudocode": "// \n// sub_180137FE0 from 0x180137fe0 to 0x18013831b (827 bytes)\n// \n// 4 xrefs:\n// > unknown_libname_44 @ 0x18012deab\n// > unknown_libname_45 @ 0x18012e07b\n// > unknown_libname_46 @ 0x18012e25b\n// > <???> @ 0x180203638\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 10:55:01 +0000\n// \n\nint __fastcall sub_180137FE0(\n        __int64 *a1,\n        char *a2,\n        unsigned __int64 a3,\n        char *a4,\n        rsize_t SizeInBytes,\n        int a6,\n        int a7,\n        unsigned __int64 a8,\n        struct __crt_locale_pointers *a9,\n        int a10)\n{\n  unsigned __int64 v10; // rdi\n  char *v11; // rbx\n  int result; // eax\n  bool v13; // r11\n  __int64 v14; // rdx\n  int v15; // r8d\n  unsigned __int64 v16; // rcx\n  unsigned __int64 v17; // rdx\n  unsigned __int64 v18; // r10\n  unsigned int v19; // edx\n  unsigned int v20; // esi\n  __int64 v21; // rcx\n  int v22; // eax\n  int v23[4]; // [rsp+50h] [rbp-18h] BYREF\n\n  v10 = a3;\n  v11 = a2;\n  if ( !a2 || !a3 || !a4 || !SizeInBytes )\n  {\n    *errno() = 22;\n    invalid_parameter_noinfo();\n    return 22;\n  }\n  v13 = a6 == 65 || (unsigned int)(a6 - 69) <= 2;\n  if ( (a8 & 8) != 0 || (v14 = *a1, (((unsigned __int64)*a1 >> 52) & 0x7FF) != 0x7FF) )\n  {\n    v19 = (a8 >> 4) & 1 | 2;\n    v20 = (a8 & 0x20) != 0 ? a10 : 0;\n    if ( a6 != 65 )\n    {\n      switch ( a6 )\n      {\n        case 'E':\n          return sub_180137954(a1, v11, a3, a4, SizeInBytes, a7, v13, v19, a9, v20);\n        case 'F':\n          goto LABEL_35;\n        case 'G':\n          return sub_180137D7C(a1, v11, a3, a4, SizeInBytes, a7, v13, v19, v20, a9);\n      }\n      if ( a6 != 97 )\n      {\n        if ( a6 != 101 )\n        {\n          if ( a6 != 102 )\n            return sub_180137D7C(a1, v11, a3, a4, SizeInBytes, a7, v13, v19, v20, a9);\nLABEL_35:\n          v21 = *a1;\n          *(_OWORD *)v23 = 0;\n          v22 = _acrt_fltout(v21, a7, 0, (int)v23, a4, SizeInBytes);\n          result = sub_18013DC24(&v11[v23[0] == 45], v22, v20);\n          if ( !result )\n            return fp_format_f_internal(v11, v10, a7, (struct _strflt *const)v23, 0, a9);\n          *v11 = 0;\n          return result;\n        }\n        return sub_180137954(a1, v11, a3, a4, SizeInBytes, a7, v13, v19, a9, v20);\n      }\n    }\n    return fp_format_a(a1, v11, a3, (__int64)a4, SizeInBytes, a7, v13, v19, a9, v20);\n  }\n  v15 = 12;\n  if ( (v14 & 0xFFFFFFFFFFFFFLL) != 0 )\n  {\n    if ( v14 < 0 && (v14 & 0xFFFFFFFFFFFFFLL) == 0x8000000000000LL )\n      v16 = 12;\n    else\n      v16 = (-(__int64)((v14 & 0x8000000000000LL) != 0) & 0xFFFFFFFFFFFFFFFCuLL) + 8;\n  }\n  else\n  {\n    v16 = 0;\n  }\n  v17 = (unsigned __int64)v14 >> 63;\n  if ( v10 >= v17 + 4 )\n  {\n    v18 = -1;\n    if ( (_BYTE)v17 )\n    {\n      *v11++ = 45;\n      *v11 = 0;\n      if ( v10 != -1 )\n        --v10;\n    }\n    do\n      ++v18;\n    while ( *((_BYTE *)*(&off_180176180 + 2 * !v13 + v16) + v18) );\n    if ( strcpy_s(v11, v10, (const char *)*(&off_180176180 + 2 * !v13 + v16 + (v10 <= v18))) )\n      invoke_watson(nullptr, nullptr, nullptr, 0, 0);\n    return 0;\n  }\n  else\n  {\n    *v11 = 0;\n  }\n  return v15;\n}", "assembly": "; \n; sub_180137FE0 from 0x180137fe0 to 0x18013831b (827 bytes)\n; \n; 4 xrefs:\n; > unknown_libname_44 @ 0x18012deab\n; > unknown_libname_45 @ 0x18012e07b\n; > unknown_libname_46 @ 0x18012e25b\n; > <???> @ 0x180203638\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 10:55:01 +0000\n; \nmov     rax, rsp                                                       ; +0x0, 0x180137fe0\nmov     [rax+8], rbx                                                   ; +0x3, 0x180137fe3\nmov     [rax+10h], rbp                                                 ; +0x7, 0x180137fe7\nmov     [rax+18h], rsi                                                 ; +0xb, 0x180137feb\nmov     [rax+20h], rdi                                                 ; +0xf, 0x180137fef\npush    r14                                                            ; +0x13, 0x180137ff3\nsub     rsp, 60h                                                       ; +0x15, 0x180137ff5\nmov     r10, r9                                                        ; +0x19, 0x180137ff9\nmov     rdi, r8                                                        ; +0x1c, 0x180137ffc\nmov     rbx, rdx                                                       ; +0x1f, 0x180137fff\nmov     r14, rcx                                                       ; +0x22, 0x180138002\ntest    rdx, rdx                                                       ; +0x25, 0x180138005\njnz     short loc_180138022                                            ; +0x28, 0x180138008\ncall    _errno                                                         ; +0x2a, 0x18013800a\nmov     ebx, 16h                                                       ; +0x2f, 0x18013800f\nmov     [rax], ebx                                                     ; +0x34, 0x180138014\ncall    _invalid_parameter_noinfo                                      ; +0x36, 0x180138016\nmov     eax, ebx                                                       ; +0x3b, 0x18013801b\njmp     loc_1801382EB                                                  ; +0x3d, 0x18013801d\ntest    rdi, rdi                                                       ; +0x42, 0x180138022\njz      short loc_18013800A                                            ; +0x45, 0x180138025\ntest    r10, r10                                                       ; +0x47, 0x180138027\njz      short loc_18013800A                                            ; +0x4a, 0x18013802a\nmov     r9, [rsp+68h+arg_20]                                           ; +0x4c, 0x18013802c\ntest    r9, r9                                                         ; +0x54, 0x180138034\njz      short loc_18013800A                                            ; +0x57, 0x180138037\nmov     ecx, [rsp+68h+arg_28]                                          ; +0x59, 0x180138039\ncmp     ecx, 41h ; 'A'                                                 ; +0x60, 0x180138040\njz      short loc_180138052                                            ; +0x63, 0x180138043\nlea     eax, [rcx-45h]                                                 ; +0x65, 0x180138045\ncmp     eax, 2                                                         ; +0x68, 0x180138048\njbe     short loc_180138052                                            ; +0x6b, 0x18013804b\nxor     r11b, r11b                                                     ; +0x6d, 0x18013804d\njmp     short loc_180138055                                            ; +0x70, 0x180138050\nmov     r11b, 1                                                        ; +0x72, 0x180138052\nmov     r8, [rsp+68h+arg_38]                                           ; +0x75, 0x180138055\ntest    r8b, 8                                                         ; +0x7d, 0x18013805d\njnz     loc_18013814A                                                  ; +0x81, 0x180138061\nmov     rdx, [r14]                                                     ; +0x87, 0x180138067\nmov     esi, 7FFh                                                      ; +0x8a, 0x18013806a\nmov     rax, rdx                                                       ; +0x8f, 0x18013806f\nshr     rax, 34h                                                       ; +0x92, 0x180138072\nand     rax, rsi                                                       ; +0x96, 0x180138076\ncmp     rax, rsi                                                       ; +0x99, 0x180138079\njnz     loc_18013814A                                                  ; +0x9c, 0x18013807c\nmov     rcx, 0FFFFFFFFFFFFFh                                           ; +0xa2, 0x180138082\nmov     rax, rdx                                                       ; +0xac, 0x18013808c\nmov     r8d, 0Ch                                                       ; +0xaf, 0x18013808f\nand     rax, rcx                                                       ; +0xb5, 0x180138095\njnz     short loc_18013809E                                            ; +0xb8, 0x180138098\nxor     ecx, ecx                                                       ; +0xba, 0x18013809a\njmp     short loc_1801380CB                                            ; +0xbc, 0x18013809c\nmov     rcx, 8000000000000h                                            ; +0xbe, 0x18013809e\ntest    rdx, rdx                                                       ; +0xc8, 0x1801380a8\njns     short loc_1801380B7                                            ; +0xcb, 0x1801380ab\ncmp     rax, rcx                                                       ; +0xcd, 0x1801380ad\njnz     short loc_1801380B7                                            ; +0xd0, 0x1801380b0\nmov     rcx, r8                                                        ; +0xd2, 0x1801380b2\njmp     short loc_1801380CB                                            ; +0xd5, 0x1801380b5\nmov     rax, rdx                                                       ; +0xd7, 0x1801380b7\nand     rax, rcx                                                       ; +0xda, 0x1801380ba\nneg     rax                                                            ; +0xdd, 0x1801380bd\nsbb     rcx, rcx                                                       ; +0xe0, 0x1801380c0\nand     rcx, 0FFFFFFFFFFFFFFFCh                                        ; +0xe3, 0x1801380c3\nadd     rcx, 8                                                         ; +0xe7, 0x1801380c7\nshr     rdx, 3Fh                                                       ; +0xeb, 0x1801380cb\nlea     rax, [rdx+4]                                                   ; +0xef, 0x1801380cf\ncmp     rdi, rax                                                       ; +0xf3, 0x1801380d3\njnb     short loc_1801380DD                                            ; +0xf6, 0x1801380d6\nmov     byte ptr [rbx], 0                                              ; +0xf8, 0x1801380d8\njmp     short loc_180138142                                            ; +0xfb, 0x1801380db\nor      r10, 0FFFFFFFFFFFFFFFFh                                        ; +0xfd, 0x1801380dd\ntest    dl, dl                                                         ; +0x101, 0x1801380e1\njz      short loc_1801380F6                                            ; +0x103, 0x1801380e3\nmov     byte ptr [rbx], 2Dh ; '-'                                      ; +0x105, 0x1801380e5\ninc     rbx                                                            ; +0x108, 0x1801380e8\nmov     byte ptr [rbx], 0                                              ; +0x10b, 0x1801380eb\ncmp     rdi, r10                                                       ; +0x10e, 0x1801380ee\njz      short loc_1801380F6                                            ; +0x111, 0x1801380f1\ndec     rdi                                                            ; +0x113, 0x1801380f3\nmovzx   edx, r11b                                                      ; +0x116, 0x1801380f6\nlea     r9, off_180176180                                              ; +0x11a, 0x1801380fa\nxor     edx, 1                                                         ; +0x121, 0x180138101\nadd     edx, edx                                                       ; +0x124, 0x180138104\nmov     eax, edx                                                       ; +0x126, 0x180138106\nadd     rax, rcx                                                       ; +0x128, 0x180138108\nmov     r8, [r9+rax*8]                                                 ; +0x12b, 0x18013810b\ninc     r10                                                            ; +0x12f, 0x18013810f\ncmp     byte ptr [r8+r10], 0                                           ; +0x132, 0x180138112\njnz     short loc_18013810F                                            ; +0x137, 0x180138117\nxor     eax, eax                                                       ; +0x139, 0x180138119\ncmp     rdi, r10                                                       ; +0x13b, 0x18013811b\nsetbe   al                                                             ; +0x13e, 0x18013811e\nlea     r8d, [rdx+rax]                                                 ; +0x141, 0x180138121\nmov     rdx, rdi; SizeInBytes                                          ; +0x145, 0x180138125\nadd     r8, rcx                                                        ; +0x148, 0x180138128\nmov     rcx, rbx; Destination                                          ; +0x14b, 0x18013812b\nmov     r8, [r9+r8*8]; Source                                          ; +0x14e, 0x18013812e\ncall    strcpy_s                                                       ; +0x152, 0x180138132\ntest    eax, eax                                                       ; +0x157, 0x180138137\njnz     loc_180138306                                                  ; +0x159, 0x180138139\nxor     r8d, r8d                                                       ; +0x15f, 0x18013813f\nmov     eax, r8d                                                       ; +0x162, 0x180138142\njmp     loc_1801382EB                                                  ; +0x165, 0x180138145\nmov     rdx, r8                                                        ; +0x16a, 0x18013814a\nand     r8b, 20h                                                       ; +0x16d, 0x18013814d\nshr     rdx, 4                                                         ; +0x171, 0x180138151\nand     edx, 1                                                         ; +0x175, 0x180138155\nor      edx, 2                                                         ; +0x178, 0x180138158\nneg     r8b                                                            ; +0x17b, 0x18013815b\nsbb     esi, esi                                                       ; +0x17e, 0x18013815e\nand     esi, [rsp+68h+arg_48]                                          ; +0x180, 0x180138160\nsub     ecx, 41h ; 'A'                                                 ; +0x187, 0x180138167\njz      loc_1801382B0                                                  ; +0x18a, 0x18013816a\nsub     ecx, 4                                                         ; +0x190, 0x180138170\njz      loc_180138273                                                  ; +0x193, 0x180138173\nsub     ecx, 1                                                         ; +0x199, 0x180138179\njz      short loc_1801381DA                                            ; +0x19c, 0x18013817c\nsub     ecx, 1                                                         ; +0x19e, 0x18013817e\njz      short loc_18013819A                                            ; +0x1a1, 0x180138181\nsub     ecx, 1Ah                                                       ; +0x1a3, 0x180138183\njz      loc_1801382B0                                                  ; +0x1a6, 0x180138186\nsub     ecx, 4                                                         ; +0x1ac, 0x18013818c\njz      loc_180138273                                                  ; +0x1af, 0x18013818f\ncmp     ecx, 1                                                         ; +0x1b5, 0x180138195\njz      short loc_1801381DA                                            ; +0x1b8, 0x180138198\nmov     rax, [rsp+68h+arg_40]                                          ; +0x1ba, 0x18013819a\nmov     r8, rdi                                                        ; +0x1c2, 0x1801381a2\nmov     [rsp+68h+var_20], rax                                          ; +0x1c5, 0x1801381a5\nmov     rcx, r14                                                       ; +0x1ca, 0x1801381aa\nmov     eax, [rsp+68h+arg_30]                                          ; +0x1cd, 0x1801381ad\nmov     dword ptr [rsp+68h+var_28], esi                                ; +0x1d4, 0x1801381b4\nmov     [rsp+68h+var_30], edx                                          ; +0x1d8, 0x1801381b8\nmov     rdx, rbx                                                       ; +0x1dc, 0x1801381bc\nmov     [rsp+68h+var_38], r11b                                         ; +0x1df, 0x1801381bf\nmov     dword ptr [rsp+68h+SizeInBytes], eax                           ; +0x1e4, 0x1801381c4\nmov     [rsp+68h+var_48], r9                                           ; +0x1e8, 0x1801381c8\nmov     r9, r10                                                        ; +0x1ed, 0x1801381cd\ncall    sub_180137D7C                                                  ; +0x1f0, 0x1801381d0\njmp     loc_1801382EB                                                  ; +0x1f5, 0x1801381d5\nmov     ebp, [rsp+68h+arg_30]                                          ; +0x1fa, 0x1801381da\nxorps   xmm0, xmm0                                                     ; +0x201, 0x1801381e1\nmov     rcx, [r14]; int                                                ; +0x204, 0x1801381e4\nmov     edx, ebp; int                                                  ; +0x207, 0x1801381e7\nmov     [rsp+68h+SizeInBytes], r9; SizeInBytes                         ; +0x209, 0x1801381e9\nxor     r8d, r8d; int                                                  ; +0x20e, 0x1801381ee\nlea     r9, [rsp+68h+var_18]; int                                      ; +0x211, 0x1801381f1\nmov     [rsp+68h+var_48], r10; char *                                  ; +0x216, 0x1801381f6\nmovups  xmmword ptr [rsp+68h+var_18], xmm0                             ; +0x21b, 0x1801381fb\ncall    __acrt_fltout                                                  ; +0x220, 0x180138200\nmov     r8d, [rsp+68h+var_18+4]                                        ; +0x225, 0x180138205\nxor     r9d, r9d                                                       ; +0x22a, 0x18013820a\ncmp     [rsp+68h+var_18], 2Dh ; '-'                                    ; +0x22d, 0x18013820d\nmov     rdx, rdi                                                       ; +0x232, 0x180138212\nmov     dword ptr [rsp+68h+SizeInBytes], esi; int                      ; +0x235, 0x180138215\nsetz    r9b                                                            ; +0x239, 0x180138219\nmov     dword ptr [rsp+68h+var_48], eax; int                           ; +0x23d, 0x18013821d\nsub     rdx, r9                                                        ; +0x241, 0x180138221\nadd     r8d, ebp                                                       ; +0x244, 0x180138224\nor      r10, 0FFFFFFFFFFFFFFFFh                                        ; +0x247, 0x180138227\ncmp     rdi, r10                                                       ; +0x24b, 0x18013822b\nlea     rcx, [r9+rbx]; void *                                          ; +0x24e, 0x18013822e\ncmovz   rdx, rdi                                                       ; +0x252, 0x180138232\nlea     r9, [rsp+68h+var_18]                                           ; +0x256, 0x180138236\ncall    sub_18013DC24                                                  ; +0x25b, 0x18013823b\ntest    eax, eax                                                       ; +0x260, 0x180138240\njz      short loc_18013824C                                            ; +0x262, 0x180138242\nmov     byte ptr [rbx], 0                                              ; +0x264, 0x180138244\njmp     loc_1801382EB                                                  ; +0x267, 0x180138247\nmov     rax, [rsp+68h+arg_40]                                          ; +0x26c, 0x18013824c\nlea     r9, [rsp+68h+var_18]; struct _strflt *                         ; +0x274, 0x180138254\nmov     [rsp+68h+SizeInBytes], rax; struct __crt_locale_pointers *     ; +0x279, 0x180138259\nmov     r8d, ebp; int                                                  ; +0x27e, 0x18013825e\nmov     rdx, rdi; unsigned __int64                                     ; +0x281, 0x180138261\nmov     byte ptr [rsp+68h+var_48], 0; bool                             ; +0x284, 0x180138264\nmov     rcx, rbx; Src                                                  ; +0x289, 0x180138269\ncall    ?fp_format_f_internal@@YAHQEAD_KHQEAU_strflt@@_NQEAU__crt_locale_pointers@@@Z; fp_format_f_internal(char * const,unsigned __int64,int,_strflt * const,bool,__crt_locale_pointers * const) ; +0x28c, 0x18013826c\njmp     short loc_1801382EB                                            ; +0x291, 0x180138271\nmov     rax, [rsp+68h+arg_40]                                          ; +0x293, 0x180138273\nmov     r8, rdi                                                        ; +0x29b, 0x18013827b\nmov     dword ptr [rsp+68h+var_20], esi                                ; +0x29e, 0x18013827e\nmov     rcx, r14                                                       ; +0x2a2, 0x180138282\nmov     [rsp+68h+var_28], rax                                          ; +0x2a5, 0x180138285\nmov     eax, [rsp+68h+arg_30]                                          ; +0x2aa, 0x18013828a\nmov     [rsp+68h+var_30], edx                                          ; +0x2b1, 0x180138291\nmov     rdx, rbx                                                       ; +0x2b5, 0x180138295\nmov     [rsp+68h+var_38], r11b                                         ; +0x2b8, 0x180138298\nmov     dword ptr [rsp+68h+SizeInBytes], eax                           ; +0x2bd, 0x18013829d\nmov     [rsp+68h+var_48], r9                                           ; +0x2c1, 0x1801382a1\nmov     r9, r10                                                        ; +0x2c6, 0x1801382a6\ncall    sub_180137954                                                  ; +0x2c9, 0x1801382a9\njmp     short loc_1801382EB                                            ; +0x2ce, 0x1801382ae\nmov     rax, [rsp+68h+arg_40]                                          ; +0x2d0, 0x1801382b0\nmov     r8, rdi                                                        ; +0x2d8, 0x1801382b8\nmov     dword ptr [rsp+68h+var_20], esi                                ; +0x2db, 0x1801382bb\nmov     rcx, r14                                                       ; +0x2df, 0x1801382bf\nmov     [rsp+68h+var_28], rax                                          ; +0x2e2, 0x1801382c2\nmov     eax, [rsp+68h+arg_30]                                          ; +0x2e7, 0x1801382c7\nmov     [rsp+68h+var_30], edx                                          ; +0x2ee, 0x1801382ce\nmov     rdx, rbx                                                       ; +0x2f2, 0x1801382d2\nmov     [rsp+68h+var_38], r11b                                         ; +0x2f5, 0x1801382d5\nmov     dword ptr [rsp+68h+SizeInBytes], eax                           ; +0x2fa, 0x1801382da\nmov     [rsp+68h+var_48], r9                                           ; +0x2fe, 0x1801382de\nmov     r9, r10                                                        ; +0x303, 0x1801382e3\ncall    ?fp_format_a@@YAHQEBNPEAD_KQEAD2H_NIQEAU__crt_locale_pointers@@W4__acrt_rounding_mode@@@Z; fp_format_a(double const * const,char *,unsigned __int64,char * const,unsigned __int64,int,bool,uint,__crt_locale_pointers * const,__acrt_rounding_mode) ; +0x306, 0x1801382e6\nlea     r11, [rsp+68h+var_8]                                           ; +0x30b, 0x1801382eb\nmov     rbx, [r11+10h]                                                 ; +0x310, 0x1801382f0\nmov     rbp, [r11+18h]                                                 ; +0x314, 0x1801382f4\nmov     rsi, [r11+20h]                                                 ; +0x318, 0x1801382f8\nmov     rdi, [r11+28h]                                                 ; +0x31c, 0x1801382fc\nmov     rsp, r11                                                       ; +0x320, 0x180138300\npop     r14                                                            ; +0x323, 0x180138303\nretn                                                                   ; +0x325, 0x180138305\nand     [rsp+68h+var_48], 0                                            ; +0x326, 0x180138306\nxor     r9d, r9d; LineNo                                               ; +0x32c, 0x18013830c\nxor     r8d, r8d; FileName                                             ; +0x32f, 0x18013830f\nxor     edx, edx; FunctionName                                         ; +0x332, 0x180138312\nxor     ecx, ecx; Expression                                           ; +0x334, 0x180138314\ncall    _invoke_watson                                                 ; +0x336, 0x180138316", "xrefs": ["unknown_libname_44 @ 0x18012deab", "unknown_libname_45 @ 0x18012e07b", "unknown_libname_46 @ 0x18012e25b", "<???> @ 0x180203638"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}