{"type": "func", "start": 6442762656, "end": 6442763146, "name": "sub_18004C1A0", "pseudocode": "// \n// sub_18004C1A0 from 0x18004c1a0 to 0x18004c38a (490 bytes)\n// \n// 5 xrefs:\n// > sub_180053230 @ 0x180053276\n// > sub_180053530 @ 0x180053579\n// > <???> @ 0x180181550\n// > <???> @ 0x180181560\n// > <???> @ 0x1801f85d4\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_18004C1A0(__int64 *a1, __int64 a2)\n{\n  __int64 v2; // rax\n  __int64 v4; // rsi\n  int v6; // r10d\n  unsigned __int8 *v7; // rdi\n  int v8; // r9d\n  int v9; // ecx\n  int v10; // edx\n  unsigned __int8 *v11; // r8\n  int v12; // eax\n  int v13; // eax\n  unsigned int v14; // r8d\n  int v15; // ecx\n  unsigned __int8 *v16; // r9\n  unsigned __int8 *v17; // r11\n  __int64 v18; // rsi\n  __int64 v19; // rcx\n  __int64 v20; // r11\n  __int64 v21; // rcx\n  void *v22; // rax\n  __int64 result; // rax\n  int v24; // edx\n  __int64 v25; // rcx\n\n  v2 = *((int *)a1 + 4);\n  v4 = *a1;\n  v6 = *((_DWORD *)a1 + 3) - v2;\n  v7 = (unsigned __int8 *)(*a1 + v2);\n  if ( *((int *)a1 + 2) < 0 )\n    return 0;\n  v8 = *((_DWORD *)a1 + 6);\n  if ( !v8 )\n  {\n    if ( v6 < 27 )\n      return 0;\n    if ( *(_DWORD *)v7 != 1399285583 )\n    {\nLABEL_19:\n      a1[3] = 0;\n      v22 = memchr(v7 + 1, 79, v6 - 1);\n      if ( !v22 )\n        LODWORD(v22) = v4 + *((_DWORD *)a1 + 3);\n      *((_DWORD *)a1 + 4) = (_DWORD)v22 - v4;\n      return (unsigned int)((_DWORD)v7 - (_DWORD)v22);\n    }\n    v8 = v7[26] + 27;\n    if ( v6 < v8 )\n      return 0;\n    v9 = 0;\n    if ( v7[26] )\n    {\n      v10 = *((_DWORD *)a1 + 7);\n      v11 = v7 + 27;\n      do\n      {\n        v12 = *v11++;\n        v10 += v12;\n        ++v9;\n        *((_DWORD *)a1 + 7) = v10;\n      }\n      while ( v9 < v7[26] );\n    }\n    *((_DWORD *)a1 + 6) = v8;\n  }\n  if ( v8 + *((_DWORD *)a1 + 7) > v6 )\n    return 0;\n  v13 = *(_DWORD *)(v7 + 22);\n  *(_DWORD *)(v7 + 22) = 0;\n  v14 = 0;\n  v15 = *((_DWORD *)a1 + 6);\n  v16 = &v7[v15];\n  if ( v15 > 0 )\n  {\n    v17 = v7;\n    v18 = (unsigned int)v15;\n    do\n    {\n      v19 = *v17++;\n      v14 = dword_1801669D0[v19 ^ ((unsigned __int64)v14 >> 24)] ^ (v14 << 8);\n      --v18;\n    }\n    while ( v18 );\n  }\n  if ( *((int *)a1 + 7) > 0 )\n  {\n    v20 = *((unsigned int *)a1 + 7);\n    do\n    {\n      v21 = *v16++;\n      v14 = dword_1801669D0[v21 ^ ((unsigned __int64)v14 >> 24)] ^ (v14 << 8);\n      --v20;\n    }\n    while ( v20 );\n  }\n  *(_DWORD *)(v7 + 22) = v14;\n  if ( v13 != *(_DWORD *)(v7 + 22) )\n  {\n    *(_DWORD *)(v7 + 22) = v13;\n    v4 = *a1;\n    goto LABEL_19;\n  }\n  v24 = *((_DWORD *)a1 + 4);\n  v25 = *a1 + v24;\n  if ( a2 )\n  {\n    *(_QWORD *)a2 = v25;\n    *(_DWORD *)(a2 + 8) = *((_DWORD *)a1 + 6);\n    *(_QWORD *)(a2 + 16) = v25 + *((int *)a1 + 6);\n    *(_DWORD *)(a2 + 24) = *((_DWORD *)a1 + 7);\n    v24 = *((_DWORD *)a1 + 4);\n  }\n  result = (unsigned int)(*((_DWORD *)a1 + 6) + *((_DWORD *)a1 + 7));\n  *((_DWORD *)a1 + 5) = 0;\n  a1[3] = 0;\n  *((_DWORD *)a1 + 4) = v24 + result;\n  return result;\n}", "assembly": "; \n; sub_18004C1A0 from 0x18004c1a0 to 0x18004c38a (490 bytes)\n; \n; 5 xrefs:\n; > sub_180053230 @ 0x180053276\n; > sub_180053530 @ 0x180053579\n; > <???> @ 0x180181550\n; > <???> @ 0x180181560\n; > <???> @ 0x1801f85d4\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, 0x18004c1a0\nmov     [rsp+arg_10], rsi                                              ; +0x5, 0x18004c1a5\npush    rdi                                                            ; +0xa, 0x18004c1aa\npush    r14                                                            ; +0xb, 0x18004c1ab\npush    r15                                                            ; +0xd, 0x18004c1ad\nsub     rsp, 20h                                                       ; +0xf, 0x18004c1af\nmovsxd  rax, dword ptr [rcx+10h]                                       ; +0x13, 0x18004c1b3\nmov     r14, rdx                                                       ; +0x17, 0x18004c1b7\nmov     rsi, [rcx]                                                     ; +0x1a, 0x18004c1ba\nmov     rbx, rcx                                                       ; +0x1d, 0x18004c1bd\nmov     r10d, [rcx+0Ch]                                                ; +0x20, 0x18004c1c0\nsub     r10d, eax                                                      ; +0x24, 0x18004c1c4\ncmp     dword ptr [rcx+8], 0                                           ; +0x27, 0x18004c1c7\nlea     rdi, [rsi+rax]                                                 ; +0x2b, 0x18004c1cb\njl      loc_18004C374                                                  ; +0x2f, 0x18004c1cf\nmov     r9d, [rcx+18h]                                                 ; +0x35, 0x18004c1d5\nxor     r15d, r15d                                                     ; +0x39, 0x18004c1d9\ntest    r9d, r9d                                                       ; +0x3c, 0x18004c1dc\njnz     short loc_18004C23B                                            ; +0x3f, 0x18004c1df\ncmp     r10d, 1Bh                                                      ; +0x41, 0x18004c1e1\njl      loc_18004C374                                                  ; +0x45, 0x18004c1e5\ncmp     dword ptr [rdi], 5367674Fh                                     ; +0x4b, 0x18004c1eb\njnz     loc_18004C2FE                                                  ; +0x51, 0x18004c1f1\nmovzx   eax, byte ptr [rdi+1Ah]                                        ; +0x57, 0x18004c1f7\nlea     r9d, [rax+1Bh]                                                 ; +0x5b, 0x18004c1fb\ncmp     r10d, r9d                                                      ; +0x5f, 0x18004c1ff\njl      loc_18004C374                                                  ; +0x62, 0x18004c202\nmov     ecx, r15d                                                      ; +0x68, 0x18004c208\ntest    eax, eax                                                       ; +0x6b, 0x18004c20b\njz      short loc_18004C237                                            ; +0x6d, 0x18004c20d\nmov     edx, [rbx+1Ch]                                                 ; +0x6f, 0x18004c20f\nlea     r8, [rdi+1Bh]                                                  ; +0x72, 0x18004c212\nnop     word ptr [rax+rax+00000000h]                                   ; +0x76, 0x18004c216\nmovzx   eax, byte ptr [r8]                                             ; +0x80, 0x18004c220\nlea     r8, [r8+1]                                                     ; +0x84, 0x18004c224\nadd     edx, eax                                                       ; +0x88, 0x18004c228\ninc     ecx                                                            ; +0x8a, 0x18004c22a\nmov     [rbx+1Ch], edx                                                 ; +0x8c, 0x18004c22c\nmovzx   eax, byte ptr [rdi+1Ah]                                        ; +0x8f, 0x18004c22f\ncmp     ecx, eax                                                       ; +0x93, 0x18004c233\njl      short loc_18004C220                                            ; +0x95, 0x18004c235\nmov     [rbx+18h], r9d                                                 ; +0x97, 0x18004c237\nmov     ecx, [rbx+1Ch]                                                 ; +0x9b, 0x18004c23b\nadd     ecx, r9d                                                       ; +0x9e, 0x18004c23e\ncmp     ecx, r10d                                                      ; +0xa1, 0x18004c241\njg      loc_18004C374                                                  ; +0xa4, 0x18004c244\nmov     eax, [rdi+16h]                                                 ; +0xaa, 0x18004c24a\nxor     ecx, ecx                                                       ; +0xad, 0x18004c24d\nmov     [rdi+16h], ecx                                                 ; +0xaf, 0x18004c24f\nmov     r8d, r15d                                                      ; +0xb2, 0x18004c252\nmov     ecx, [rbx+18h]                                                 ; +0xb5, 0x18004c255\nmovsxd  r9, ecx                                                        ; +0xb8, 0x18004c258\nadd     r9, rdi                                                        ; +0xbb, 0x18004c25b\nmov     [rsp+38h+arg_0], r12                                           ; +0xbe, 0x18004c25e\nlea     r12, dword_1801669D0                                           ; +0xc3, 0x18004c263\ntest    ecx, ecx                                                       ; +0xca, 0x18004c26a\njle     short loc_18004C2A0                                            ; +0xcc, 0x18004c26c\nmov     r11, rdi                                                       ; +0xce, 0x18004c26e\nmov     esi, ecx                                                       ; +0xd1, 0x18004c271\nnop     dword ptr [rax+00h]                                            ; +0xd3, 0x18004c273\nnop     word ptr [rax+rax+00000000h]                                   ; +0xd7, 0x18004c277\nmovzx   ecx, byte ptr [r11]                                            ; +0xe0, 0x18004c280\nlea     r11, [r11+1]                                                   ; +0xe4, 0x18004c284\nmov     edx, r8d                                                       ; +0xe8, 0x18004c288\nshr     rdx, 18h                                                       ; +0xeb, 0x18004c28b\nxor     rdx, rcx                                                       ; +0xef, 0x18004c28f\nshl     r8d, 8                                                         ; +0xf2, 0x18004c292\nxor     r8d, [r12+rdx*4]                                               ; +0xf6, 0x18004c296\nsub     rsi, 1                                                         ; +0xfa, 0x18004c29a\njnz     short loc_18004C280                                            ; +0xfe, 0x18004c29e\ncmp     [rbx+1Ch], r15d                                                ; +0x100, 0x18004c2a0\njle     short loc_18004C2D0                                            ; +0x104, 0x18004c2a4\nmov     r11d, [rbx+1Ch]                                                ; +0x106, 0x18004c2a6\nnop     word ptr [rax+rax+00h]                                         ; +0x10a, 0x18004c2aa\nmovzx   ecx, byte ptr [r9]                                             ; +0x110, 0x18004c2b0\nlea     r9, [r9+1]                                                     ; +0x114, 0x18004c2b4\nmov     edx, r8d                                                       ; +0x118, 0x18004c2b8\nshr     rdx, 18h                                                       ; +0x11b, 0x18004c2bb\nxor     rdx, rcx                                                       ; +0x11f, 0x18004c2bf\nshl     r8d, 8                                                         ; +0x122, 0x18004c2c2\nxor     r8d, [r12+rdx*4]                                               ; +0x126, 0x18004c2c6\nsub     r11, 1                                                         ; +0x12a, 0x18004c2ca\njnz     short loc_18004C2B0                                            ; +0x12e, 0x18004c2ce\nmov     r12, [rsp+38h+arg_0]                                           ; +0x130, 0x18004c2d0\nmov     ecx, r8d                                                       ; +0x135, 0x18004c2d5\nmov     [rdi+16h], r8b                                                 ; +0x138, 0x18004c2d8\nshr     ecx, 8                                                         ; +0x13c, 0x18004c2dc\nmov     [rdi+17h], cl                                                  ; +0x13f, 0x18004c2df\nmov     ecx, r8d                                                       ; +0x142, 0x18004c2e2\nshr     ecx, 10h                                                       ; +0x145, 0x18004c2e5\nshr     r8d, 18h                                                       ; +0x148, 0x18004c2e8\nmov     [rdi+18h], cl                                                  ; +0x14c, 0x18004c2ec\nmov     [rdi+19h], r8b                                                 ; +0x14f, 0x18004c2ef\ncmp     eax, [rdi+16h]                                                 ; +0x153, 0x18004c2f3\njz      short loc_18004C330                                            ; +0x156, 0x18004c2f6\nmov     [rdi+16h], eax                                                 ; +0x158, 0x18004c2f8\nmov     rsi, [rbx]                                                     ; +0x15b, 0x18004c2fb\nlea     eax, [r10-1]                                                   ; +0x15e, 0x18004c2fe\nmov     [rbx+18h], r15                                                 ; +0x162, 0x18004c302\nmovsxd  r8, eax; MaxCount                                              ; +0x166, 0x18004c306\nlea     rcx, [rdi+1]; Buf                                              ; +0x169, 0x18004c309\nmov     edx, 4Fh ; 'O'; Val                                            ; +0x16d, 0x18004c30d\ncall    memchr                                                         ; +0x172, 0x18004c312\ntest    rax, rax                                                       ; +0x177, 0x18004c317\njnz     short loc_18004C323                                            ; +0x17a, 0x18004c31a\nmovsxd  rax, dword ptr [rbx+0Ch]                                       ; +0x17c, 0x18004c31c\nadd     rax, rsi                                                       ; +0x180, 0x18004c320\nmov     ecx, eax                                                       ; +0x183, 0x18004c323\nsub     ecx, esi                                                       ; +0x185, 0x18004c325\nsub     edi, eax                                                       ; +0x187, 0x18004c327\nmov     [rbx+10h], ecx                                                 ; +0x189, 0x18004c329\nmov     eax, edi                                                       ; +0x18c, 0x18004c32c\njmp     short loc_18004C376                                            ; +0x18e, 0x18004c32e\nmovsxd  rdx, dword ptr [rbx+10h]                                       ; +0x190, 0x18004c330\nmov     rcx, rdx                                                       ; +0x194, 0x18004c334\nadd     rcx, [rbx]                                                     ; +0x197, 0x18004c337\ntest    r14, r14                                                       ; +0x19a, 0x18004c33a\njz      short loc_18004C35E                                            ; +0x19d, 0x18004c33d\nmov     [r14], rcx                                                     ; +0x19f, 0x18004c33f\nmov     eax, [rbx+18h]                                                 ; +0x1a2, 0x18004c342\nmov     [r14+8], eax                                                   ; +0x1a5, 0x18004c345\nmovsxd  rax, dword ptr [rbx+18h]                                       ; +0x1a9, 0x18004c349\nadd     rax, rcx                                                       ; +0x1ad, 0x18004c34d\nmov     [r14+10h], rax                                                 ; +0x1b0, 0x18004c350\nmov     eax, [rbx+1Ch]                                                 ; +0x1b4, 0x18004c354\nmov     [r14+18h], eax                                                 ; +0x1b7, 0x18004c357\nmov     edx, [rbx+10h]                                                 ; +0x1bb, 0x18004c35b\nmov     eax, [rbx+1Ch]                                                 ; +0x1be, 0x18004c35e\nadd     eax, [rbx+18h]                                                 ; +0x1c1, 0x18004c361\nmov     [rbx+14h], r15d                                                ; +0x1c4, 0x18004c364\nmov     [rbx+18h], r15                                                 ; +0x1c8, 0x18004c368\nlea     ecx, [rdx+rax]                                                 ; +0x1cc, 0x18004c36c\nmov     [rbx+10h], ecx                                                 ; +0x1cf, 0x18004c36f\njmp     short loc_18004C376                                            ; +0x1d2, 0x18004c372\nxor     eax, eax                                                       ; +0x1d4, 0x18004c374\nmov     rbx, [rsp+38h+arg_8]                                           ; +0x1d6, 0x18004c376\nmov     rsi, [rsp+38h+arg_10]                                          ; +0x1db, 0x18004c37b\nadd     rsp, 20h                                                       ; +0x1e0, 0x18004c380\npop     r15                                                            ; +0x1e4, 0x18004c384\npop     r14                                                            ; +0x1e6, 0x18004c386\npop     rdi                                                            ; +0x1e8, 0x18004c388\nretn                                                                   ; +0x1e9, 0x18004c389", "xrefs": ["sub_180053230 @ 0x180053276", "sub_180053530 @ 0x180053579", "<???> @ 0x180181550", "<???> @ 0x180181560", "<???> @ 0x1801f85d4"], "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"}