{"type": "func", "start": 6442791472, "end": 6442791762, "name": "sub_180053230", "pseudocode": "// \n// sub_180053230 from 0x180053230 to 0x180053352 (290 bytes)\n// \n// 14 xrefs:\n// > sub_1800510D0 @ 0x180051279\n// > sub_180051410 @ 0x180051602\n// > sub_180051410 @ 0x180051777\n// > sub_180051410 @ 0x1800518fe\n// > sub_180051410 @ 0x180051962\n// > sub_180051B90 @ 0x180051db9\n// > sub_1800523F0 @ 0x18005268e\n// > sub_1800523F0 @ 0x1800527d1\n// > sub_180052A90 @ 0x180052b81\n// > sub_180052E90 @ 0x180052edc\n// > sub_180052E90 @ 0x180053072\n// > sub_180052E90 @ 0x1800531cf\n// > sub_180053360 @ 0x180053416\n// > <???> @ 0x1801f8b38\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_180053230(__int64 a1, _QWORD *a2, __int64 a3, __int64 a4)\n{\n  __int64 v4; // rdi\n  int v8; // eax\n  __int64 v9; // rcx\n  __int64 v10; // rax\n  int v11; // eax\n  __int64 result; // rax\n\n  v4 = a4;\n  if ( a4 > 0 )\n    v4 = a2[2] + a4;\n  while ( 1 )\n  {\n    while ( 1 )\n    {\n      if ( v4 > 0 && a2[2] >= v4 )\n        return -1;\n      v8 = sub_18004C1A0(a2 + 4, a3);\n      v9 = v8;\n      if ( v8 >= 0 )\n        break;\n      a2[2] -= v8;\n    }\n    if ( v8 )\n    {\n      result = a2[2];\n      a2[2] = result + v9;\n      return result;\n    }\n    if ( !v4 )\n      return -1;\n    *errno() = 0;\n    if ( !a2[98] )\n      return -128;\n    if ( !*a2 )\n      return -2;\n    v10 = sub_18004C090(a1, (__int64)(a2 + 4), 8500);\n    if ( !v10 )\n      return -139;\n    v11 = ((__int64 (__fastcall *)(__int64, __int64, __int64, _QWORD))a2[98])(v10, 1, 8500, *a2);\n    if ( v11 <= 0 )\n      break;\n    sub_18004C3B0((__int64)(a2 + 4), v11);\n  }\n  if ( v11 )\n  {\n    if ( v11 != -139 )\n      return -128;\n    return -139;\n  }\n  else\n  {\n    if ( *errno() )\n      return -128;\n    return -2;\n  }\n}", "assembly": "; \n; sub_180053230 from 0x180053230 to 0x180053352 (290 bytes)\n; \n; 14 xrefs:\n; > sub_1800510D0 @ 0x180051279\n; > sub_180051410 @ 0x180051602\n; > sub_180051410 @ 0x180051777\n; > sub_180051410 @ 0x1800518fe\n; > sub_180051410 @ 0x180051962\n; > sub_180051B90 @ 0x180051db9\n; > sub_1800523F0 @ 0x18005268e\n; > sub_1800523F0 @ 0x1800527d1\n; > sub_180052A90 @ 0x180052b81\n; > sub_180052E90 @ 0x180052edc\n; > sub_180052E90 @ 0x180053072\n; > sub_180052E90 @ 0x1800531cf\n; > sub_180053360 @ 0x180053416\n; > <???> @ 0x1801f8b38\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_8], rbx                                               ; +0x0, 0x180053230\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x180053235\npush    rdi                                                            ; +0xa, 0x18005323a\npush    r14                                                            ; +0xb, 0x18005323b\npush    r15                                                            ; +0xd, 0x18005323d\nsub     rsp, 20h                                                       ; +0xf, 0x18005323f\nmov     rdi, r9                                                        ; +0x13, 0x180053243\nmov     rbp, r8                                                        ; +0x16, 0x180053246\nmov     rbx, rdx                                                       ; +0x19, 0x180053249\nmov     r14, rcx                                                       ; +0x1c, 0x18005324c\ntest    r9, r9                                                         ; +0x1f, 0x18005324f\njle     short loc_180053258                                            ; +0x22, 0x180053252\nadd     rdi, [rdx+10h]                                                 ; +0x24, 0x180053254\nxor     r15d, r15d                                                     ; +0x28, 0x180053258\nmov     [rsp+38h+arg_0], rsi                                           ; +0x2b, 0x18005325b\ntest    rdi, rdi                                                       ; +0x30, 0x180053260\njle     short loc_18005326F                                            ; +0x33, 0x180053263\ncmp     [rbx+10h], rdi                                                 ; +0x35, 0x180053265\njge     loc_180053325                                                  ; +0x39, 0x180053269\nmov     rdx, rbp                                                       ; +0x3f, 0x18005326f\nlea     rcx, [rbx+20h]                                                 ; +0x42, 0x180053272\ncall    sub_18004C1A0                                                  ; +0x46, 0x180053276\nmovsxd  rcx, eax                                                       ; +0x4b, 0x18005327b\ntest    eax, eax                                                       ; +0x4e, 0x18005327e\njns     short loc_180053288                                            ; +0x50, 0x180053280\nsub     [rbx+10h], rcx                                                 ; +0x52, 0x180053282\njmp     short loc_180053260                                            ; +0x56, 0x180053286\njnz     loc_18005332E                                                  ; +0x58, 0x180053288\ntest    rdi, rdi                                                       ; +0x5e, 0x18005328e\njz      loc_180053325                                                  ; +0x61, 0x180053291\ncall    _errno                                                         ; +0x67, 0x180053297\nmov     [rax], r15d                                                    ; +0x6c, 0x18005329c\ncmp     [rbx+310h], r15                                                ; +0x6f, 0x18005329f\njz      short loc_180053300                                            ; +0x76, 0x1800532a6\ncmp     [rbx], r15                                                     ; +0x78, 0x1800532a8\njz      short loc_180053313                                            ; +0x7b, 0x1800532ab\nmov     r8d, 2134h                                                     ; +0x7d, 0x1800532ad\nlea     rdx, [rbx+20h]                                                 ; +0x83, 0x1800532b3\nmov     rcx, r14                                                       ; +0x87, 0x1800532b7\ncall    sub_18004C090                                                  ; +0x8a, 0x1800532ba\ntest    rax, rax                                                       ; +0x8f, 0x1800532bf\njz      short loc_18005331C                                            ; +0x92, 0x1800532c2\nmov     r9, [rbx]                                                      ; +0x94, 0x1800532c4\nmov     edx, 1                                                         ; +0x97, 0x1800532c7\nmov     r8d, 2134h                                                     ; +0x9c, 0x1800532cc\nmov     rcx, rax                                                       ; +0xa2, 0x1800532d2\ncall    qword ptr [rbx+310h]                                           ; +0xa5, 0x1800532d5\ntest    eax, eax                                                       ; +0xab, 0x1800532db\njle     short loc_1800532EF                                            ; +0xad, 0x1800532dd\nmov     edx, eax                                                       ; +0xaf, 0x1800532df\nlea     rcx, [rbx+20h]                                                 ; +0xb1, 0x1800532e1\ncall    sub_18004C3B0                                                  ; +0xb5, 0x1800532e5\njmp     loc_180053260                                                  ; +0xba, 0x1800532ea\njz      short loc_180053309                                            ; +0xbf, 0x1800532ef\ncmp     eax, 0FFFFFF75h                                                ; +0xc1, 0x1800532f1\njz      short loc_18005331C                                            ; +0xc6, 0x1800532f6\ntest    eax, eax                                                       ; +0xc8, 0x1800532f8\njns     loc_180053260                                                  ; +0xca, 0x1800532fa\nmov     rax, 0FFFFFFFFFFFFFF80h                                        ; +0xd0, 0x180053300\njmp     short loc_180053339                                            ; +0xd7, 0x180053307\ncall    _errno                                                         ; +0xd9, 0x180053309\ncmp     [rax], r15d                                                    ; +0xde, 0x18005330e\njnz     short loc_180053300                                            ; +0xe1, 0x180053311\nmov     rax, 0FFFFFFFFFFFFFFFEh                                        ; +0xe3, 0x180053313\njmp     short loc_180053339                                            ; +0xea, 0x18005331a\nmov     rax, 0FFFFFFFFFFFFFF75h                                        ; +0xec, 0x18005331c\njmp     short loc_180053339                                            ; +0xf3, 0x180053323\nmov     rax, 0FFFFFFFFFFFFFFFFh                                        ; +0xf5, 0x180053325\njmp     short loc_180053339                                            ; +0xfc, 0x18005332c\nmov     rax, [rbx+10h]                                                 ; +0xfe, 0x18005332e\nadd     rcx, rax                                                       ; +0x102, 0x180053332\nmov     [rbx+10h], rcx                                                 ; +0x105, 0x180053335\nmov     rsi, [rsp+38h+arg_0]                                           ; +0x109, 0x180053339\nmov     rbx, [rsp+38h+arg_8]                                           ; +0x10e, 0x18005333e\nmov     rbp, [rsp+38h+arg_10]                                          ; +0x113, 0x180053343\nadd     rsp, 20h                                                       ; +0x118, 0x180053348\npop     r15                                                            ; +0x11c, 0x18005334c\npop     r14                                                            ; +0x11e, 0x18005334e\npop     rdi                                                            ; +0x120, 0x180053350\nretn                                                                   ; +0x121, 0x180053351", "xrefs": ["sub_1800510D0 @ 0x180051279", "sub_180051410 @ 0x180051602", "sub_180051410 @ 0x180051777", "sub_180051410 @ 0x1800518fe", "sub_180051410 @ 0x180051962", "sub_180051B90 @ 0x180051db9", "sub_1800523F0 @ 0x18005268e", "sub_1800523F0 @ 0x1800527d1", "sub_180052A90 @ 0x180052b81", "sub_180052E90 @ 0x180052edc", "sub_180052E90 @ 0x180053072", "sub_180052E90 @ 0x1800531cf", "sub_180053360 @ 0x180053416", "<???> @ 0x1801f8b38"], "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"}