{"type": "func", "start": 6442968496, "end": 6442968835, "name": "sub_18007E5B0", "pseudocode": "// \n// sub_18007E5B0 from 0x18007e5b0 to 0x18007e703 (339 bytes)\n// \n// 2 xrefs:\n// > sub_18007FBB0 @ 0x18007fd70\n// > <???> @ 0x1801b4f08\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\nchar __fastcall sub_18007E5B0(_QWORD *a1, _QWORD *a2, unsigned int *a3, unsigned __int64 a4)\n{\n  __int64 v4; // r10\n  unsigned int *v5; // rbx\n  unsigned int *i; // rdi\n  unsigned int v9; // eax\n  __int64 v10; // rax\n  __int64 v11; // rbp\n  _BYTE *v12; // rax\n  _BYTE *v13; // rsi\n  _BYTE *j; // rdx\n  unsigned int v15; // eax\n  _BYTE *v16; // r11\n  unsigned int v17; // ecx\n  char v18; // r8\n\n  v4 = 0;\n  v5 = a3;\n  for ( i = &a3[a4 >> 2]; a3 < i; v4 += v10 )\n  {\n    v9 = *a3;\n    if ( *a3 >= 0x10000 )\n    {\n      v10 = 4;\n    }\n    else if ( v9 >= 0x80 )\n    {\n      v10 = 3LL - (v9 < 0x800);\n    }\n    else\n    {\n      v10 = 1;\n    }\n    ++a3;\n  }\n  v11 = v4 + 1;\n  v12 = off_1801A2FA0(v4 + 1);\n  v13 = v12;\n  if ( v12 )\n  {\n    for ( j = v12; v5 < i; ++v5 )\n    {\n      v15 = *v5;\n      v16 = j;\n      if ( *v5 >= 0x10000 )\n      {\n        *j = (v15 >> 18) | 0xF0;\n        j[1] = (v15 >> 12) & 0x3F | 0x80;\n        j[3] = v15 & 0x3F | 0x80;\n        j[2] = (v15 >> 6) & 0x3F | 0x80;\n        j += 4;\n      }\n      else if ( v15 >= 0x80 )\n      {\n        v17 = v15 >> 6;\n        v18 = v15 & 0x3F | 0x80;\n        if ( v15 >= 0x800 )\n        {\n          j[2] = v18;\n          j[1] = v17 & 0x3F | 0x80;\n          j += 3;\n          *v16 = (v15 >> 12) | 0xE0;\n        }\n        else\n        {\n          j[1] = v18;\n          j += 2;\n          *v16 = v17 | 0xC0;\n        }\n      }\n      else\n      {\n        ++j;\n        *v16 = v15;\n      }\n    }\n    *j = 0;\n    *a1 = v13;\n    *a2 = v11;\n    LOBYTE(v12) = 1;\n  }\n  return (char)v12;\n}", "assembly": "; \n; sub_18007E5B0 from 0x18007e5b0 to 0x18007e703 (339 bytes)\n; \n; 2 xrefs:\n; > sub_18007FBB0 @ 0x18007fd70\n; > <???> @ 0x1801b4f08\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, 0x18007e5b0\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x18007e5b5\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x18007e5ba\npush    rdi                                                            ; +0xf, 0x18007e5bf\npush    r14                                                            ; +0x10, 0x18007e5c0\npush    r15                                                            ; +0x12, 0x18007e5c2\nsub     rsp, 20h                                                       ; +0x14, 0x18007e5c4\nshr     r9, 2                                                          ; +0x18, 0x18007e5c8\nxor     r10d, r10d                                                     ; +0x1c, 0x18007e5cc\nmov     rbx, r8                                                        ; +0x1f, 0x18007e5cf\nmov     r14, rdx                                                       ; +0x22, 0x18007e5d2\nmov     r15, rcx                                                       ; +0x25, 0x18007e5d5\nlea     rdi, [r8+r9*4]                                                 ; +0x28, 0x18007e5d8\ncmp     r8, rdi                                                        ; +0x2c, 0x18007e5dc\njnb     short loc_18007E618                                            ; +0x2f, 0x18007e5df\nmov     eax, [r8]                                                      ; +0x31, 0x18007e5e1\ncmp     eax, 10000h                                                    ; +0x34, 0x18007e5e4\njnb     short loc_18007E607                                            ; +0x39, 0x18007e5e9\ncmp     eax, 80h                                                       ; +0x3b, 0x18007e5eb\njnb     short loc_18007E5F9                                            ; +0x40, 0x18007e5f0\nmov     eax, 1                                                         ; +0x42, 0x18007e5f2\njmp     short loc_18007E60C                                            ; +0x47, 0x18007e5f7\ncmp     eax, 800h                                                      ; +0x49, 0x18007e5f9\nsbb     rax, rax                                                       ; +0x4e, 0x18007e5fe\nadd     rax, 3                                                         ; +0x51, 0x18007e601\njmp     short loc_18007E60C                                            ; +0x55, 0x18007e605\nmov     eax, 4                                                         ; +0x57, 0x18007e607\nadd     r8, 4                                                          ; +0x5c, 0x18007e60c\nadd     r10, rax                                                       ; +0x60, 0x18007e610\ncmp     r8, rdi                                                        ; +0x63, 0x18007e613\njb      short loc_18007E5E1                                            ; +0x66, 0x18007e616\nlea     rbp, [r10+1]                                                   ; +0x68, 0x18007e618\nmov     rcx, rbp; Size                                                 ; +0x6c, 0x18007e61c\ncall    cs:off_1801A2FA0                                               ; +0x6f, 0x18007e61f\nmov     rsi, rax                                                       ; +0x75, 0x18007e625\ntest    rax, rax                                                       ; +0x78, 0x18007e628\njz      loc_18007E6EA                                                  ; +0x7b, 0x18007e62b\nmov     rdx, rsi                                                       ; +0x81, 0x18007e631\ncmp     rbx, rdi                                                       ; +0x84, 0x18007e634\njnb     loc_18007E6DF                                                  ; +0x87, 0x18007e637\nnop     dword ptr [rax]                                                ; +0x8d, 0x18007e63d\nmov     eax, [rbx]                                                     ; +0x90, 0x18007e640\nmov     r11, rdx                                                       ; +0x92, 0x18007e642\ncmp     eax, 10000h                                                    ; +0x95, 0x18007e645\njnb     short loc_18007E6A1                                            ; +0x9a, 0x18007e64a\ncmp     eax, 80h                                                       ; +0x9c, 0x18007e64c\njnb     short loc_18007E65B                                            ; +0xa1, 0x18007e651\ninc     rdx                                                            ; +0xa3, 0x18007e653\nmov     [r11], al                                                      ; +0xa6, 0x18007e656\njmp     short loc_18007E6D2                                            ; +0xa9, 0x18007e659\nmovzx   r8d, al                                                        ; +0xab, 0x18007e65b\nmov     ecx, eax                                                       ; +0xaf, 0x18007e65f\nand     r8b, 3Fh                                                       ; +0xb1, 0x18007e661\nshr     ecx, 6                                                         ; +0xb5, 0x18007e665\nor      r8b, 80h                                                       ; +0xb8, 0x18007e668\ncmp     eax, 800h                                                      ; +0xbc, 0x18007e66c\njnb     short loc_18007E686                                            ; +0xc1, 0x18007e671\nmov     [rdx+1], r8b                                                   ; +0xc3, 0x18007e673\nadd     rdx, 2                                                         ; +0xc7, 0x18007e677\nor      cl, 0C0h                                                       ; +0xcb, 0x18007e67b\nmovzx   eax, cl                                                        ; +0xce, 0x18007e67e\nmov     [r11], cl                                                      ; +0xd1, 0x18007e681\njmp     short loc_18007E6D2                                            ; +0xd4, 0x18007e684\nand     cl, 3Fh                                                        ; +0xd6, 0x18007e686\nmov     [rdx+2], r8b                                                   ; +0xd9, 0x18007e689\nor      cl, 80h                                                        ; +0xdd, 0x18007e68d\nshr     eax, 0Ch                                                       ; +0xe0, 0x18007e690\nmov     [rdx+1], cl                                                    ; +0xe3, 0x18007e693\nadd     rdx, 3                                                         ; +0xe6, 0x18007e696\nor      al, 0E0h                                                       ; +0xea, 0x18007e69a\nmov     [r11], al                                                      ; +0xec, 0x18007e69c\njmp     short loc_18007E6D2                                            ; +0xef, 0x18007e69f\nmov     ecx, eax                                                       ; +0xf1, 0x18007e6a1\nshr     ecx, 12h                                                       ; +0xf3, 0x18007e6a3\nor      cl, 0F0h                                                       ; +0xf6, 0x18007e6a6\nmov     [rdx], cl                                                      ; +0xf9, 0x18007e6a9\nmov     ecx, eax                                                       ; +0xfb, 0x18007e6ab\nshr     ecx, 0Ch                                                       ; +0xfd, 0x18007e6ad\nand     cl, 3Fh                                                        ; +0x100, 0x18007e6b0\nor      cl, 80h                                                        ; +0x103, 0x18007e6b3\nmov     [rdx+1], cl                                                    ; +0x106, 0x18007e6b6\nmov     ecx, eax                                                       ; +0x109, 0x18007e6b9\nshr     ecx, 6                                                         ; +0x10b, 0x18007e6bb\nand     al, 3Fh                                                        ; +0x10e, 0x18007e6be\nand     cl, 3Fh                                                        ; +0x110, 0x18007e6c0\nor      al, 80h                                                        ; +0x113, 0x18007e6c3\nor      cl, 80h                                                        ; +0x115, 0x18007e6c5\nmov     [rdx+3], al                                                    ; +0x118, 0x18007e6c8\nmov     [rdx+2], cl                                                    ; +0x11b, 0x18007e6cb\nadd     rdx, 4                                                         ; +0x11e, 0x18007e6ce\nadd     rbx, 4                                                         ; +0x122, 0x18007e6d2\ncmp     rbx, rdi                                                       ; +0x126, 0x18007e6d6\njb      loc_18007E640                                                  ; +0x129, 0x18007e6d9\nmov     byte ptr [rdx], 0                                              ; +0x12f, 0x18007e6df\nmov     al, 1                                                          ; +0x132, 0x18007e6e2\nmov     [r15], rsi                                                     ; +0x134, 0x18007e6e4\nmov     [r14], rbp                                                     ; +0x137, 0x18007e6e7\nmov     rbx, [rsp+38h+arg_0]                                           ; +0x13a, 0x18007e6ea\nmov     rbp, [rsp+38h+arg_8]                                           ; +0x13f, 0x18007e6ef\nmov     rsi, [rsp+38h+arg_10]                                          ; +0x144, 0x18007e6f4\nadd     rsp, 20h                                                       ; +0x149, 0x18007e6f9\npop     r15                                                            ; +0x14d, 0x18007e6fd\npop     r14                                                            ; +0x14f, 0x18007e6ff\npop     rdi                                                            ; +0x151, 0x18007e701\nretn                                                                   ; +0x152, 0x18007e702", "xrefs": ["sub_18007FBB0 @ 0x18007fd70", "<???> @ 0x1801b4f08"], "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"}