{"type": "func", "start": 6442716688, "end": 6442716903, "name": "sub_180040E10", "pseudocode": "// \n// sub_180040E10 from 0x180040e10 to 0x180040ee7 (215 bytes)\n// \n// 5 xrefs:\n// > sub_18003DC70 @ 0x18003dd95\n// > sub_18003DC70 @ 0x18003dda5\n// > sub_18003E5C0 @ 0x18003e6e5\n// > sub_18003E5C0 @ 0x18003e6f5\n// > <???> @ 0x1801bb4a0\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:21:38 +0000\n// \n\nchar *__fastcall sub_180040E10(__int64 *a1, const void *a2, size_t a3, unsigned int *a4)\n{\n  size_t v4; // rax\n  __int64 v6; // r14\n  unsigned int v10; // edx\n  char *v11; // rbx\n  int v12; // ecx\n  __int64 v13; // rax\n\n  v4 = *a4;\n  v6 = *a1;\n  if ( v4 <= a3 )\n  {\n    sub_180044BB0(a1, v6 + a3);\n    v11 = (char *)(v6 + a1[2]);\n  }\n  else\n  {\n    sub_180044BB0(a1, v6 + v4);\n    v10 = a4[2];\n    v11 = (char *)(v6 + a1[2]);\n    v12 = *((unsigned __int8 *)a4 + 4);\n    v13 = *a4;\n    if ( v10 == 2 )\n    {\n      if ( (unsigned int)v13 != a3 )\n        memset(v11, v12, (unsigned int)v13 - a3);\n      v11 += *a4 - a3;\n    }\n    else if ( v10 == 3 )\n    {\n      v11 = (char *)fmt::BasicWriter<char>::FillPadding(v11, (unsigned int)v13, a3, (unsigned int)(char)v12);\n    }\n    else if ( v13 != a3 )\n    {\n      memset(&v11[a3], v12, v13 - a3);\n    }\n  }\n  memmove(v11, a2, a3);\n  return v11;\n}", "assembly": "; \n; sub_180040E10 from 0x180040e10 to 0x180040ee7 (215 bytes)\n; \n; 5 xrefs:\n; > sub_18003DC70 @ 0x18003dd95\n; > sub_18003DC70 @ 0x18003dda5\n; > sub_18003E5C0 @ 0x18003e6e5\n; > sub_18003E5C0 @ 0x18003e6f5\n; > <???> @ 0x1801bb4a0\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:21:38 +0000\n; \nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x180040e10\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x180040e15\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x180040e1a\nmov     [rsp+arg_18], rdi                                              ; +0xf, 0x180040e1f\npush    r14                                                            ; +0x14, 0x180040e24\nsub     rsp, 20h                                                       ; +0x16, 0x180040e26\nmov     eax, [r9]                                                      ; +0x1a, 0x180040e2a\nmov     rsi, r9                                                        ; +0x1d, 0x180040e2d\nmov     r14, [rcx]                                                     ; +0x20, 0x180040e30\nmov     rdi, r8                                                        ; +0x23, 0x180040e33\nmov     rbp, rdx                                                       ; +0x26, 0x180040e36\nmov     rbx, rcx                                                       ; +0x29, 0x180040e39\ncmp     rax, r8                                                        ; +0x2c, 0x180040e3c\njbe     short loc_180040EAB                                            ; +0x2f, 0x180040e3f\nlea     rdx, [r14+rax]                                                 ; +0x31, 0x180040e41\ncall    sub_180044BB0                                                  ; +0x35, 0x180040e45\nmov     rbx, [rbx+10h]                                                 ; +0x3a, 0x180040e4a\nmov     edx, [rsi+8]                                                   ; +0x3e, 0x180040e4e\nadd     rbx, r14                                                       ; +0x41, 0x180040e51\nmovzx   ecx, byte ptr [rsi+4]                                          ; +0x44, 0x180040e54\nmov     eax, [rsi]                                                     ; +0x48, 0x180040e58\ncmp     edx, 2                                                         ; +0x4a, 0x180040e5a\njnz     short loc_180040E7B                                            ; +0x4d, 0x180040e5d\nmov     r8d, eax                                                       ; +0x4f, 0x180040e5f\nsub     r8, rdi; Size                                                  ; +0x52, 0x180040e62\njz      short loc_180040E71                                            ; +0x55, 0x180040e65\nmov     edx, ecx; Val                                                  ; +0x57, 0x180040e67\nmov     rcx, rbx; void *                                               ; +0x59, 0x180040e69\ncall    memset                                                         ; +0x5c, 0x180040e6c\nmov     eax, [rsi]                                                     ; +0x61, 0x180040e71\nsub     rax, rdi                                                       ; +0x63, 0x180040e73\nadd     rbx, rax                                                       ; +0x66, 0x180040e76\njmp     short loc_180040EBB                                            ; +0x69, 0x180040e79\ncmp     edx, 3                                                         ; +0x6b, 0x180040e7b\njnz     short loc_180040E96                                            ; +0x6e, 0x180040e7e\nmovsx   r9d, cl                                                        ; +0x70, 0x180040e80\nmov     r8, rdi                                                        ; +0x74, 0x180040e84\nmov     rcx, rbx                                                       ; +0x77, 0x180040e87\nmov     edx, eax                                                       ; +0x7a, 0x180040e8a\ncall    ?FillPadding@?$BasicWriter@D@fmt@@CAPEADPEADI_K_W@Z; fmt::BasicWriter<char>::FillPadding(char *,uint,unsigned __int64,wchar_t) ; +0x7c, 0x180040e8c\nmov     rbx, rax                                                       ; +0x81, 0x180040e91\njmp     short loc_180040EBB                                            ; +0x84, 0x180040e94\nmov     r8, rax                                                        ; +0x86, 0x180040e96\nsub     r8, rdi; Size                                                  ; +0x89, 0x180040e99\njz      short loc_180040EBB                                            ; +0x8c, 0x180040e9c\nmov     edx, ecx; Val                                                  ; +0x8e, 0x180040e9e\nlea     rcx, [rbx+rdi]; void *                                         ; +0x90, 0x180040ea0\ncall    memset                                                         ; +0x94, 0x180040ea4\njmp     short loc_180040EBB                                            ; +0x99, 0x180040ea9\nlea     rdx, [r14+r8]                                                  ; +0x9b, 0x180040eab\ncall    sub_180044BB0                                                  ; +0x9f, 0x180040eaf\nmov     rbx, [rbx+10h]                                                 ; +0xa4, 0x180040eb4\nadd     rbx, r14                                                       ; +0xa8, 0x180040eb8\nmov     r8, rdi; Size                                                  ; +0xab, 0x180040ebb\nmov     rdx, rbp; Src                                                  ; +0xae, 0x180040ebe\nmov     rcx, rbx; void *                                               ; +0xb1, 0x180040ec1\ncall    memmove                                                        ; +0xb4, 0x180040ec4\nmov     rbp, [rsp+28h+arg_8]                                           ; +0xb9, 0x180040ec9\nmov     rax, rbx                                                       ; +0xbe, 0x180040ece\nmov     rbx, [rsp+28h+arg_0]                                           ; +0xc1, 0x180040ed1\nmov     rsi, [rsp+28h+arg_10]                                          ; +0xc6, 0x180040ed6\nmov     rdi, [rsp+28h+arg_18]                                          ; +0xcb, 0x180040edb\nadd     rsp, 20h                                                       ; +0xd0, 0x180040ee0\npop     r14                                                            ; +0xd4, 0x180040ee4\nretn                                                                   ; +0xd6, 0x180040ee6", "xrefs": ["sub_18003DC70 @ 0x18003dd95", "sub_18003DC70 @ 0x18003dda5", "sub_18003E5C0 @ 0x18003e6e5", "sub_18003E5C0 @ 0x18003e6f5", "<???> @ 0x1801bb4a0"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}