{"type": "func", "start": 6442755760, "end": 6442756153, "name": "sub_18004A6B0", "pseudocode": "// \n// sub_18004A6B0 from 0x18004a6b0 to 0x18004a839 (393 bytes)\n// \n// 2 xrefs:\n// > sub_180049840 @ 0x18004984f\n// > <???> @ 0x1801f8484\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_18004A6B0(__int64 a1, __int64 a2)\n{\n  int v2; // ebx\n  int v5; // eax\n  __int64 v6; // rcx\n  int v7; // edi\n  int v8; // esi\n  unsigned int v9; // ebx\n  int v11; // edx\n  unsigned int v12; // edx\n  unsigned int v13; // edx\n  unsigned int v14; // edx\n  unsigned int v15; // ecx\n  unsigned int v16; // r9d\n  unsigned int v17; // eax\n  __int64 v18; // r10\n  unsigned int v19; // eax\n  __int64 v20; // rdx\n  unsigned int v21; // ecx\n  unsigned int v22; // ecx\n  int v23; // edx\n\n  v2 = *(_DWORD *)(a1 + 68);\n  v5 = sub_180048130(a2, *(_DWORD *)(a1 + 64));\n  if ( v5 < 0 )\n  {\n    v8 = *(_DWORD *)(a1 + 8);\n    v7 = 0;\n  }\n  else\n  {\n    v6 = *(int *)(*(_QWORD *)(a1 + 56) + 4LL * v5);\n    if ( (int)v6 >= 0 )\n    {\n      v9 = v6 - 1;\n      sub_1800480B0(a2, *(char *)(*(_QWORD *)(a1 + 48) + v6 - 1));\n      return v9;\n    }\n    v7 = ((int)v6 >> 15) & 0x7FFF;\n    v8 = *(_DWORD *)(a1 + 8) - (*(_DWORD *)(*(_QWORD *)(a1 + 56) + 4LL * v5) & 0x7FFF);\n  }\n  v11 = sub_180048130(a2, v2);\n  if ( v11 >= 0 )\n  {\nLABEL_9:\n    v12 = __ROL4__(v11, 16);\n    v13 = (v12 << 8) ^ ((v12 << 8) ^ (v12 >> 8)) & 0xFF00FF;\n    v14 = (16 * v13) ^ ((16 * v13) ^ (v13 >> 4)) & 0xF0F0F0F;\n    v15 = (4 * v14) ^ ((4 * v14) ^ (v14 >> 2)) & 0x33333333;\n    v16 = (2 * v15) ^ ((2 * v15) ^ (v15 >> 1)) & 0x55555555;\n    v17 = v8 - v7;\n    if ( v8 - v7 > 1 )\n    {\n      v18 = *(_QWORD *)(a1 + 32);\n      do\n      {\n        v19 = v17 >> 1;\n        v20 = (int)(v19 + v7);\n        v21 = v19;\n        if ( *(_DWORD *)(v18 + 4 * v20) > v16 )\n          v21 = 0;\n        v7 += v21;\n        v22 = 0;\n        if ( *(_DWORD *)(v18 + 4 * v20) > v16 )\n          v22 = v19;\n        v8 -= v22;\n        v17 = v8 - v7;\n      }\n      while ( v8 - v7 > 1 );\n    }\n    v23 = *(char *)(*(_QWORD *)(a1 + 48) + v7);\n    if ( v23 <= v2 )\n    {\n      sub_1800480B0(a2, v23);\n      return (unsigned int)v7;\n    }\n    sub_1800480B0(a2, v2);\n  }\n  else\n  {\n    while ( v2 > 1 )\n    {\n      v11 = sub_180048130(a2, --v2);\n      if ( v11 >= 0 )\n        goto LABEL_9;\n    }\n  }\n  return 0xFFFFFFFFLL;\n}", "assembly": "; \n; sub_18004A6B0 from 0x18004a6b0 to 0x18004a839 (393 bytes)\n; \n; 2 xrefs:\n; > sub_180049840 @ 0x18004984f\n; > <???> @ 0x1801f8484\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, 0x18004a6b0\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x18004a6b5\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x18004a6ba\npush    rdi                                                            ; +0xf, 0x18004a6bf\npush    r14                                                            ; +0x10, 0x18004a6c0\npush    r15                                                            ; +0x12, 0x18004a6c2\nsub     rsp, 20h                                                       ; +0x14, 0x18004a6c4\nmov     ebx, [rcx+44h]                                                 ; +0x18, 0x18004a6c8\nmov     rbp, rdx                                                       ; +0x1b, 0x18004a6cb\nmov     edx, [rcx+40h]                                                 ; +0x1e, 0x18004a6ce\nmov     r14, rcx                                                       ; +0x21, 0x18004a6d1\nmov     rcx, rbp                                                       ; +0x24, 0x18004a6d4\ncall    sub_180048130                                                  ; +0x27, 0x18004a6d7\nxor     r15d, r15d                                                     ; +0x2c, 0x18004a6dc\ntest    eax, eax                                                       ; +0x2f, 0x18004a6df\njs      short loc_18004A729                                            ; +0x31, 0x18004a6e1\nmovsxd  r8, eax                                                        ; +0x33, 0x18004a6e3\nmov     rax, [r14+38h]                                                 ; +0x36, 0x18004a6e6\nmovsxd  rcx, dword ptr [rax+r8*4]                                      ; +0x3a, 0x18004a6ea\ntest    ecx, ecx                                                       ; +0x3e, 0x18004a6ee\njns     short loc_18004A70B                                            ; +0x40, 0x18004a6f0\nmov     esi, [r14+8]                                                   ; +0x42, 0x18004a6f2\nmov     edi, ecx                                                       ; +0x46, 0x18004a6f6\nsar     edi, 0Fh                                                       ; +0x48, 0x18004a6f8\nand     ecx, 7FFFh                                                     ; +0x4b, 0x18004a6fb\nand     edi, 7FFFh                                                     ; +0x51, 0x18004a701\nsub     esi, ecx                                                       ; +0x57, 0x18004a707\njmp     short loc_18004A730                                            ; +0x59, 0x18004a709\nmov     rdx, rcx                                                       ; +0x5b, 0x18004a70b\nlea     ebx, [rcx-1]                                                   ; +0x5e, 0x18004a70e\nmov     rcx, [r14+30h]                                                 ; +0x61, 0x18004a711\nmovsx   edx, byte ptr [rcx+rdx-1]                                      ; +0x65, 0x18004a715\nmov     rcx, rbp                                                       ; +0x6a, 0x18004a71a\ncall    sub_1800480B0                                                  ; +0x6d, 0x18004a71d\nmov     eax, ebx                                                       ; +0x72, 0x18004a722\njmp     loc_18004A820                                                  ; +0x74, 0x18004a724\nmov     esi, [r14+8]                                                   ; +0x79, 0x18004a729\nmov     edi, r15d                                                      ; +0x7d, 0x18004a72d\nmov     edx, ebx                                                       ; +0x80, 0x18004a730\nmov     rcx, rbp                                                       ; +0x82, 0x18004a732\ncall    sub_180048130                                                  ; +0x85, 0x18004a735\nmov     edx, eax                                                       ; +0x8a, 0x18004a73a\ntest    eax, eax                                                       ; +0x8c, 0x18004a73c\njns     short loc_18004A75B                                            ; +0x8e, 0x18004a73e\ncmp     ebx, 1                                                         ; +0x90, 0x18004a740\njle     loc_18004A81B                                                  ; +0x93, 0x18004a743\ndec     ebx                                                            ; +0x99, 0x18004a749\nmov     rcx, rbp                                                       ; +0x9b, 0x18004a74b\nmov     edx, ebx                                                       ; +0x9e, 0x18004a74e\ncall    sub_180048130                                                  ; +0xa0, 0x18004a750\nmov     edx, eax                                                       ; +0xa5, 0x18004a755\ntest    eax, eax                                                       ; +0xa7, 0x18004a757\njs      short loc_18004A740                                            ; +0xa9, 0x18004a759\nrol     edx, 10h                                                       ; +0xab, 0x18004a75b\nmov     ecx, edx                                                       ; +0xae, 0x18004a75e\nmov     eax, edx                                                       ; +0xb0, 0x18004a760\nshr     ecx, 8                                                         ; +0xb2, 0x18004a762\nshl     eax, 8                                                         ; +0xb5, 0x18004a765\nxor     ecx, eax                                                       ; +0xb8, 0x18004a768\nshl     edx, 8                                                         ; +0xba, 0x18004a76a\nand     ecx, 0FF00FFh                                                  ; +0xbd, 0x18004a76d\nxor     ecx, edx                                                       ; +0xc3, 0x18004a773\nmov     edx, ecx                                                       ; +0xc5, 0x18004a775\nmov     eax, ecx                                                       ; +0xc7, 0x18004a777\nshl     eax, 4                                                         ; +0xc9, 0x18004a779\nshl     ecx, 4                                                         ; +0xcc, 0x18004a77c\nshr     edx, 4                                                         ; +0xcf, 0x18004a77f\nxor     edx, eax                                                       ; +0xd2, 0x18004a782\nand     edx, 0F0F0F0Fh                                                 ; +0xd4, 0x18004a784\nxor     edx, ecx                                                       ; +0xda, 0x18004a78a\nmov     ecx, edx                                                       ; +0xdc, 0x18004a78c\nshr     ecx, 2                                                         ; +0xde, 0x18004a78e\nlea     eax, ds:0[rdx*4]                                               ; +0xe1, 0x18004a791\nxor     ecx, eax                                                       ; +0xe8, 0x18004a798\nlea     eax, ds:0[rdx*4]                                               ; +0xea, 0x18004a79a\nand     ecx, 33333333h                                                 ; +0xf1, 0x18004a7a1\nxor     ecx, eax                                                       ; +0xf7, 0x18004a7a7\nmov     r9d, ecx                                                       ; +0xf9, 0x18004a7a9\nshr     r9d, 1                                                         ; +0xfc, 0x18004a7ac\nlea     eax, [rcx+rcx]                                                 ; +0xff, 0x18004a7af\nxor     r9d, eax                                                       ; +0x102, 0x18004a7b2\nlea     eax, [rcx+rcx]                                                 ; +0x105, 0x18004a7b5\nand     r9d, 55555555h                                                 ; +0x108, 0x18004a7b8\nxor     r9d, eax                                                       ; +0x10f, 0x18004a7bf\nmov     eax, esi                                                       ; +0x112, 0x18004a7c2\nsub     eax, edi                                                       ; +0x114, 0x18004a7c4\ncmp     eax, 1                                                         ; +0x116, 0x18004a7c6\njle     short loc_18004A7F9                                            ; +0x119, 0x18004a7c9\nmov     r10, [r14+20h]                                                 ; +0x11b, 0x18004a7cb\nnop                                                                    ; +0x11f, 0x18004a7cf\nshr     eax, 1                                                         ; +0x120, 0x18004a7d0\nlea     ecx, [rax+rdi]                                                 ; +0x122, 0x18004a7d2\nmovsxd  rdx, ecx                                                       ; +0x125, 0x18004a7d5\nmov     ecx, eax                                                       ; +0x128, 0x18004a7d8\ncmp     [r10+rdx*4], r9d                                               ; +0x12a, 0x18004a7da\ncmova   ecx, r15d                                                      ; +0x12e, 0x18004a7de\nadd     edi, ecx                                                       ; +0x132, 0x18004a7e2\nmov     ecx, r15d                                                      ; +0x134, 0x18004a7e4\ncmp     [r10+rdx*4], r9d                                               ; +0x137, 0x18004a7e7\ncmova   ecx, eax                                                       ; +0x13b, 0x18004a7eb\nsub     esi, ecx                                                       ; +0x13e, 0x18004a7ee\nmov     eax, esi                                                       ; +0x140, 0x18004a7f0\nsub     eax, edi                                                       ; +0x142, 0x18004a7f2\ncmp     eax, 1                                                         ; +0x144, 0x18004a7f4\njg      short loc_18004A7D0                                            ; +0x147, 0x18004a7f7\nmov     rcx, [r14+30h]                                                 ; +0x149, 0x18004a7f9\nmovsxd  rdx, edi                                                       ; +0x14d, 0x18004a7fd\nmovsx   edx, byte ptr [rcx+rdx]                                        ; +0x150, 0x18004a800\nmov     rcx, rbp                                                       ; +0x154, 0x18004a804\ncmp     edx, ebx                                                       ; +0x157, 0x18004a807\njg      short loc_18004A814                                            ; +0x159, 0x18004a809\ncall    sub_1800480B0                                                  ; +0x15b, 0x18004a80b\nmov     eax, edi                                                       ; +0x160, 0x18004a810\njmp     short loc_18004A820                                            ; +0x162, 0x18004a812\nmov     edx, ebx                                                       ; +0x164, 0x18004a814\ncall    sub_1800480B0                                                  ; +0x166, 0x18004a816\nmov     eax, 0FFFFFFFFh                                                ; +0x16b, 0x18004a81b\nmov     rbx, [rsp+38h+arg_0]                                           ; +0x170, 0x18004a820\nmov     rbp, [rsp+38h+arg_8]                                           ; +0x175, 0x18004a825\nmov     rsi, [rsp+38h+arg_10]                                          ; +0x17a, 0x18004a82a\nadd     rsp, 20h                                                       ; +0x17f, 0x18004a82f\npop     r15                                                            ; +0x183, 0x18004a833\npop     r14                                                            ; +0x185, 0x18004a835\npop     rdi                                                            ; +0x187, 0x18004a837\nretn                                                                   ; +0x188, 0x18004a838", "xrefs": ["sub_180049840 @ 0x18004984f", "<???> @ 0x1801f8484"], "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"}