{"type": "func", "start": 6442566960, "end": 6442567393, "name": "sub_18001C530", "pseudocode": "// \n// sub_18001C530 from 0x18001c530 to 0x18001c6e1 (433 bytes)\n// \n// 2 xrefs:\n// > <???> @ 0x1800e6b90\n// > <???> @ 0x1801aeb00\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\n__int64 __fastcall sub_18001C530(__int64 a1, unsigned int a2)\n{\n  unsigned __int64 v5; // rdi\n  unsigned __int64 v6; // rax\n  unsigned __int64 v7; // r14\n  __int64 v8; // rax\n  size_t v9; // r14\n  _QWORD *v10; // rsi\n  void *v11; // r15\n  unsigned __int64 v12; // rdi\n  size_t v13; // rcx\n  void *v14; // rax\n  __int64 v15; // rcx\n  _QWORD *v16; // r9\n  _QWORD *v17; // r8\n  __int64 v18; // rax\n\n  if ( (*(_BYTE *)(a1 + 112) & 2) != 0 )\n    return 0xFFFFFFFFLL;\n  if ( a2 == -1 )\n    return 0;\n  v5 = std::streambuf::pptr(a1);\n  v6 = std::streambuf::epptr(a1);\n  v7 = v6;\n  if ( v5 && v5 < v6 )\n  {\n    *(_BYTE *)std::streambuf::_Pninc(a1) = a2;\n    *(_QWORD *)(a1 + 104) = v5 + 1;\n    return a2;\n  }\n  v8 = std::streambuf::eback(a1);\n  v9 = v7 - v8;\n  v10 = nullptr;\n  v11 = (void *)v8;\n  if ( !v5 )\n    v9 = 0;\n  if ( v9 >= 0x20 )\n  {\n    if ( v9 < 0x3FFFFFFF )\n    {\n      v12 = 2 * v9;\n      if ( 2 * v9 < 0x1000 )\n      {\n        if ( 2 * v9 )\n          v10 = operator new(2 * v9);\n        goto LABEL_21;\n      }\n      v13 = v12 + 39;\n      if ( v12 + 39 < v12 )\n        Concurrency::cancel_current_task();\n      goto LABEL_19;\n    }\n    v12 = 0x7FFFFFFF;\n    if ( v9 < 0x7FFFFFFF )\n    {\n      v13 = 2147483686LL;\nLABEL_19:\n      v14 = operator new(v13);\n      if ( !v14 )\n        invalid_parameter_noinfo_noreturn();\n      v10 = (_QWORD *)(((unsigned __int64)v14 + 39) & 0xFFFFFFFFFFFFFFE0uLL);\n      *(v10 - 1) = v14;\n      goto LABEL_21;\n    }\n    return 0xFFFFFFFFLL;\n  }\n  v12 = 32;\n  v10 = operator new(0x20u);\nLABEL_21:\n  memcpy(v10, v11, v9);\n  *(_QWORD *)(a1 + 104) = (char *)v10 + v9 + 1;\n  std::streambuf::setp(a1, v10, (char *)v10 + v9, (char *)v10 + v12);\n  v15 = a1;\n  if ( (*(_BYTE *)(a1 + 112) & 4) != 0 )\n  {\n    v16 = v10;\n    v17 = v10;\n  }\n  else\n  {\n    v18 = std::streambuf::gptr(a1);\n    v16 = *(_QWORD **)(a1 + 104);\n    v15 = a1;\n    v17 = (_QWORD *)(v18 + (char *)v10 - (_BYTE *)v11);\n  }\n  std::streambuf::setg(v15, v10, v17, v16);\n  if ( (*(_BYTE *)(a1 + 112) & 1) != 0 )\n    std::allocator<char>::deallocate(a1 + 116, v11, v9);\n  *(_DWORD *)(a1 + 112) |= 1u;\n  *(_BYTE *)std::streambuf::_Pninc(a1) = a2;\n  return a2;\n}", "assembly": "; \n; sub_18001C530 from 0x18001c530 to 0x18001c6e1 (433 bytes)\n; \n; 2 xrefs:\n; > <???> @ 0x1800e6b90\n; > <???> @ 0x1801aeb00\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x18001c530\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x18001c535\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x18001c53a\npush    rdi                                                            ; +0xf, 0x18001c53f\npush    r14                                                            ; +0x10, 0x18001c540\npush    r15                                                            ; +0x12, 0x18001c542\nsub     rsp, 20h                                                       ; +0x14, 0x18001c544\ntest    byte ptr [rcx+70h], 2                                          ; +0x18, 0x18001c548\nmov     ebp, edx                                                       ; +0x1c, 0x18001c54c\nmov     rbx, rcx                                                       ; +0x1e, 0x18001c54e\njnz     loc_18001C6BD                                                  ; +0x21, 0x18001c551\ncmp     edx, 0FFFFFFFFh                                                ; +0x27, 0x18001c557\njnz     short loc_18001C563                                            ; +0x2a, 0x18001c55a\nxor     eax, eax                                                       ; +0x2c, 0x18001c55c\njmp     loc_18001C6C2                                                  ; +0x2e, 0x18001c55e\ncall    cs:?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ; std::streambuf::pptr(void) ; +0x33, 0x18001c563\nmov     rcx, rbx                                                       ; +0x39, 0x18001c569\nmov     rdi, rax                                                       ; +0x3c, 0x18001c56c\ncall    cs:?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ; std::streambuf::epptr(void) ; +0x3f, 0x18001c56f\nmov     r14, rax                                                       ; +0x45, 0x18001c575\ntest    rdi, rdi                                                       ; +0x48, 0x18001c578\njz      short loc_18001C59D                                            ; +0x4b, 0x18001c57b\ncmp     rdi, rax                                                       ; +0x4d, 0x18001c57d\njnb     short loc_18001C59D                                            ; +0x50, 0x18001c580\nmov     rcx, rbx                                                       ; +0x52, 0x18001c582\ncall    cs:?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ; std::streambuf::_Pninc(void) ; +0x55, 0x18001c585\nmov     [rax], bpl                                                     ; +0x5b, 0x18001c58b\nlea     rax, [rdi+1]                                                   ; +0x5e, 0x18001c58e\nmov     [rbx+68h], rax                                                 ; +0x62, 0x18001c592\nmov     eax, ebp                                                       ; +0x66, 0x18001c596\njmp     loc_18001C6C2                                                  ; +0x68, 0x18001c598\nmov     rcx, rbx                                                       ; +0x6d, 0x18001c59d\ncall    cs:?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ; std::streambuf::eback(void) ; +0x70, 0x18001c5a0\nsub     r14, rax                                                       ; +0x76, 0x18001c5a6\nxor     esi, esi                                                       ; +0x79, 0x18001c5a9\ntest    rdi, rdi                                                       ; +0x7b, 0x18001c5ab\nmov     r15, rax                                                       ; +0x7e, 0x18001c5ae\ncmovz   r14, rsi                                                       ; +0x81, 0x18001c5b1\ncmp     r14, 20h ; ' '                                                 ; +0x85, 0x18001c5b5\njnb     short loc_18001C5CC                                            ; +0x89, 0x18001c5b9\nmov     edi, 20h ; ' '                                                 ; +0x8b, 0x18001c5bb\nmov     ecx, edi; Size                                                 ; +0x90, 0x18001c5c0\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x92, 0x18001c5c2\nmov     rsi, rax                                                       ; +0x97, 0x18001c5c7\njmp     short loc_18001C633                                            ; +0x9a, 0x18001c5ca\ncmp     r14, 3FFFFFFFh                                                 ; +0x9c, 0x18001c5cc\njnb     short loc_18001C606                                            ; +0xa3, 0x18001c5d3\nlea     rdi, [r14+r14]                                                 ; +0xa5, 0x18001c5d5\nmov     rax, rdi                                                       ; +0xa9, 0x18001c5d9\ncmp     rdi, 1000h                                                     ; +0xac, 0x18001c5dc\njb      short loc_18001C5F4                                            ; +0xb3, 0x18001c5e3\nlea     rcx, [rdi+27h]                                                 ; +0xb5, 0x18001c5e5\ncmp     rcx, rdi                                                       ; +0xb9, 0x18001c5e9\njbe     loc_18001C6DB                                                  ; +0xbc, 0x18001c5ec\njmp     short loc_18001C619                                            ; +0xc2, 0x18001c5f2\ntest    rax, rax                                                       ; +0xc4, 0x18001c5f4\njz      short loc_18001C633                                            ; +0xc7, 0x18001c5f7\nmov     rcx, rdi; Size                                                 ; +0xc9, 0x18001c5f9\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0xcc, 0x18001c5fc\nmov     rsi, rax                                                       ; +0xd1, 0x18001c601\njmp     short loc_18001C633                                            ; +0xd4, 0x18001c604\nmov     edi, 7FFFFFFFh                                                 ; +0xd6, 0x18001c606\ncmp     r14, rdi                                                       ; +0xdb, 0x18001c60b\njnb     loc_18001C6BD                                                  ; +0xde, 0x18001c60e\nmov     ecx, 80000026h; Size                                           ; +0xe4, 0x18001c614\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0xe9, 0x18001c619\ntest    rax, rax                                                       ; +0xee, 0x18001c61e\njz      loc_18001C6B6                                                  ; +0xf1, 0x18001c621\nlea     rsi, [rax+27h]                                                 ; +0xf7, 0x18001c627\nand     rsi, 0FFFFFFFFFFFFFFE0h                                        ; +0xfb, 0x18001c62b\nmov     [rsi-8], rax                                                   ; +0xff, 0x18001c62f\nmov     r8, r14; Size                                                  ; +0x103, 0x18001c633\nmov     rdx, r15; Src                                                  ; +0x106, 0x18001c636\nmov     rcx, rsi; void *                                               ; +0x109, 0x18001c639\ncall    memcpy                                                         ; +0x10c, 0x18001c63c\nlea     r8, [r14+rsi]                                                  ; +0x111, 0x18001c641\nmov     rdx, rsi                                                       ; +0x115, 0x18001c645\nlea     rax, [r8+1]                                                    ; +0x118, 0x18001c648\nmov     rcx, rbx                                                       ; +0x11c, 0x18001c64c\nlea     r9, [rsi+rdi]                                                  ; +0x11f, 0x18001c64f\nmov     [rbx+68h], rax                                                 ; +0x123, 0x18001c653\ncall    cs:?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z; std::streambuf::setp(char *,char *,char *) ; +0x127, 0x18001c657\ntest    byte ptr [rbx+70h], 4                                          ; +0x12d, 0x18001c65d\nmov     rcx, rbx                                                       ; +0x131, 0x18001c661\njz      short loc_18001C66E                                            ; +0x134, 0x18001c664\nmov     r9, rsi                                                        ; +0x136, 0x18001c666\nmov     r8, rsi                                                        ; +0x139, 0x18001c669\njmp     short loc_18001C684                                            ; +0x13c, 0x18001c66c\ncall    cs:?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ; std::streambuf::gptr(void) ; +0x13e, 0x18001c66e\nmov     r9, [rbx+68h]                                                  ; +0x144, 0x18001c674\nmov     r8, rsi                                                        ; +0x148, 0x18001c678\nsub     r8, r15                                                        ; +0x14b, 0x18001c67b\nmov     rcx, rbx                                                       ; +0x14e, 0x18001c67e\nadd     r8, rax                                                        ; +0x151, 0x18001c681\nmov     rdx, rsi                                                       ; +0x154, 0x18001c684\ncall    cs:?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z; std::streambuf::setg(char *,char *,char *) ; +0x157, 0x18001c687\ntest    byte ptr [rbx+70h], 1                                          ; +0x15d, 0x18001c68d\njz      short loc_18001C6A2                                            ; +0x161, 0x18001c691\nlea     rcx, [rbx+74h]                                                 ; +0x163, 0x18001c693\nmov     r8, r14                                                        ; +0x167, 0x18001c697\nmov     rdx, r15                                                       ; +0x16a, 0x18001c69a\ncall    ?deallocate@?$allocator@D@std@@QEAAXQEAD_K@Z; std::allocator<char>::deallocate(char * const,unsigned __int64) ; +0x16d, 0x18001c69d\nor      dword ptr [rbx+70h], 1                                         ; +0x172, 0x18001c6a2\nmov     rcx, rbx                                                       ; +0x176, 0x18001c6a6\ncall    cs:?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ; std::streambuf::_Pninc(void) ; +0x179, 0x18001c6a9\nmov     [rax], bpl                                                     ; +0x17f, 0x18001c6af\nmov     eax, ebp                                                       ; +0x182, 0x18001c6b2\njmp     short loc_18001C6C2                                            ; +0x184, 0x18001c6b4\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x186, 0x18001c6b6\ndb 0CCh                                                                ; +0x18c, 0x18001c6bc\nmov     eax, 0FFFFFFFFh                                                ; +0x18d, 0x18001c6bd\nmov     rbx, [rsp+38h+arg_0]                                           ; +0x192, 0x18001c6c2\nmov     rbp, [rsp+38h+arg_8]                                           ; +0x197, 0x18001c6c7\nmov     rsi, [rsp+38h+arg_10]                                          ; +0x19c, 0x18001c6cc\nadd     rsp, 20h                                                       ; +0x1a1, 0x18001c6d1\npop     r15                                                            ; +0x1a5, 0x18001c6d5\npop     r14                                                            ; +0x1a7, 0x18001c6d7\npop     rdi                                                            ; +0x1a9, 0x18001c6d9\nretn                                                                   ; +0x1aa, 0x18001c6da\ncall    ?cancel_current_task@Concurrency@@YAXXZ; Concurrency::cancel_current_task(void) ; +0x1ab, 0x18001c6db\ndb 0CCh                                                                ; +0x1b0, 0x18001c6e0", "xrefs": ["<???> @ 0x1800e6b90", "<???> @ 0x1801aeb00"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}