; ; sub_180051B90 from 0x180051b90 to 0x180051fa9 (1049 bytes) ; ; 7 xrefs: ; > sub_180050E70 @ 0x180050ffa ; > sub_180051410 @ 0x180051aa5 ; > @ 0x180181cb0 ; > @ 0x180181cf0 ; > @ 0x180181d14 ; > @ 0x180181d24 ; > @ 0x1801f8a84 ; ; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True! ; ; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA ; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings ; Generated at Fri, 27 Nov 2026 10:53:17 +0000 ; push rbx ; +0x0, 0x180051b90 push rdi ; +0x2, 0x180051b92 push r14 ; +0x3, 0x180051b93 sub rsp, 220h ; +0x5, 0x180051b95 mov rax, cs:__security_cookie ; +0xc, 0x180051b9c xor rax, rsp ; +0x13, 0x180051ba3 mov [rsp+238h+var_48], rax ; +0x16, 0x180051ba6 cmp dword ptr [rdx+80h], 2 ; +0x1e, 0x180051bae mov rdi, r8 ; +0x25, 0x180051bb5 mov rbx, rdx ; +0x28, 0x180051bb8 mov r14, rcx ; +0x2b, 0x180051bbb jl loc_180051F9F ; +0x2e, 0x180051bbe cmp dword ptr [rdx+8], 0 ; +0x34, 0x180051bc4 jnz short loc_180051BD4 ; +0x38, 0x180051bc8 mov eax, 0FFFFFF76h ; +0x3a, 0x180051bca jmp loc_180051CBE ; +0x3f, 0x180051bcf test rdi, rdi ; +0x44, 0x180051bd4 js loc_180051F9F ; +0x47, 0x180051bd7 cmp rdi, [rdx+18h] ; +0x4d, 0x180051bdd jg loc_180051F9F ; +0x51, 0x180051be1 mov qword ptr [rdx+78h], 0FFFFFFFFFFFFFFFFh ; +0x57, 0x180051be7 mov [rsp+238h+var_38], r15 ; +0x5f, 0x180051bef lea r15, [rdx+98h] ; +0x67, 0x180051bf7 mov edx, [rdx+84h] ; +0x6e, 0x180051bfe mov rcx, r15 ; +0x74, 0x180051c04 call sub_18004C040 ; +0x77, 0x180051c07 lea rcx, [rbx+210h] ; +0x7c, 0x180051c0c call sub_180049270 ; +0x83, 0x180051c13 mov rdx, rdi ; +0x88, 0x180051c18 mov rcx, rbx ; +0x8b, 0x180051c1b call sub_1800537E0 ; +0x8e, 0x180051c1e lea rdx, [rsp+238h+var_1C8] ; +0x93, 0x180051c23 mov rcx, r14 ; +0x98, 0x180051c28 test eax, eax ; +0x9b, 0x180051c2b jz short loc_180051C4E ; +0x9d, 0x180051c2d mov qword ptr [rbx+78h], 0FFFFFFFFFFFFFFFFh ; +0x9f, 0x180051c2f call sub_18004B940 ; +0xa7, 0x180051c37 mov rdx, rbx ; +0xac, 0x180051c3c mov rcx, r14 ; +0xaf, 0x180051c3f call sub_180052A50 ; +0xb2, 0x180051c42 mov eax, 0FFFFFF77h ; +0xb7, 0x180051c47 jmp short loc_180051CB6 ; +0xbc, 0x180051c4c mov r8d, [rbx+84h] ; +0xbe, 0x180051c4e mov [rsp+238h+arg_18], rbp ; +0xc5, 0x180051c55 xor ebp, ebp ; +0xcd, 0x180051c5d mov [rsp+238h+var_20], rsi ; +0xcf, 0x180051c5f xor esi, esi ; +0xd7, 0x180051c67 mov [rsp+238h+var_28], r12 ; +0xd9, 0x180051c69 xor r12d, r12d ; +0xe1, 0x180051c71 mov [rsp+238h+var_30], r13 ; +0xe4, 0x180051c74 xor r13d, r13d ; +0xec, 0x180051c7c mov [rsp+238h+var_218], r12d ; +0xef, 0x180051c7f mov [rsp+238h+var_214], esi ; +0xf4, 0x180051c84 call sub_18004B9B0 ; +0xf8, 0x180051c88 test eax, eax ; +0xfd, 0x180051c8d jns short loc_180051CDA ; +0xff, 0x180051c8f mov eax, 0FFFFFF75h ; +0x101, 0x180051c91 mov r13, [rsp+238h+var_30] ; +0x106, 0x180051c96 mov r12, [rsp+238h+var_28] ; +0x10e, 0x180051c9e mov rsi, [rsp+238h+var_20] ; +0x116, 0x180051ca6 mov rbp, [rsp+238h+arg_18] ; +0x11e, 0x180051cae mov r15, [rsp+238h+var_38] ; +0x126, 0x180051cb6 mov rcx, [rsp+238h+var_48] ; +0x12e, 0x180051cbe xor rcx, rsp; StackCookie ; +0x136, 0x180051cc6 call __security_check_cookie ; +0x139, 0x180051cc9 add rsp, 220h ; +0x13e, 0x180051cce pop r14 ; +0x145, 0x180051cd5 pop rdi ; +0x147, 0x180051cd7 pop rbx ; +0x148, 0x180051cd8 retn ; +0x149, 0x180051cd9 lea rcx, [rsp+238h+var_1C8] ; +0x14a, 0x180051cda call sub_18004BFF0 ; +0x14f, 0x180051cdf jmp short loc_180051D00 ; +0x154, 0x180051ce4 align 10h ; +0x156, 0x180051ce6 mov esi, [rsp+238h+var_214] ; +0x160, 0x180051cf0 mov r12d, [rsp+238h+var_218] ; +0x164, 0x180051cf4 nop dword ptr [rax+00000000h] ; +0x169, 0x180051cf9 cmp dword ptr [rbx+80h], 3 ; +0x170, 0x180051d00 jl loc_180051D9F ; +0x177, 0x180051d07 lea rdx, [rsp+238h+var_1F0] ; +0x17d, 0x180051d0d lea rcx, [rsp+238h+var_1C8] ; +0x182, 0x180051d12 call sub_18004BAA0 ; +0x187, 0x180051d17 test eax, eax ; +0x18c, 0x180051d1c jle short loc_180051D9F ; +0x18e, 0x180051d1e movsxd rax, dword ptr [rbx+88h] ; +0x190, 0x180051d20 lea rcx, [rax+rax*4] ; +0x197, 0x180051d27 mov rax, [rbx+68h] ; +0x19b, 0x180051d2b cmp qword ptr [rax+rcx*8+20h], 0 ; +0x19f, 0x180051d2f lea rcx, [rax+rcx*8] ; +0x1a5, 0x180051d35 jz short loc_180051D95 ; +0x1a9, 0x180051d39 lea rdx, [rsp+238h+var_1F0] ; +0x1ab, 0x180051d3b call sub_180050710 ; +0x1b0, 0x180051d40 mov edi, eax ; +0x1b5, 0x180051d45 test eax, eax ; +0x1b7, 0x180051d47 jns short loc_180051D59 ; +0x1b9, 0x180051d49 xor edx, edx ; +0x1bb, 0x180051d4b mov rcx, r15 ; +0x1bd, 0x180051d4d call sub_18004BAA0 ; +0x1c0, 0x180051d50 xor edi, edi ; +0x1c5, 0x180051d55 jmp short loc_180051D7F ; +0x1c7, 0x180051d57 test r13d, r13d ; +0x1c9, 0x180051d59 jz short loc_180051D6E ; +0x1cc, 0x180051d5c test esi, esi ; +0x1ce, 0x180051d5e jnz short loc_180051D6E ; +0x1d0, 0x180051d60 xor edx, edx ; +0x1d2, 0x180051d62 mov rcx, r15 ; +0x1d4, 0x180051d64 call sub_18004BAA0 ; +0x1d7, 0x180051d67 jmp short loc_180051D7F ; +0x1dc, 0x180051d6c test ebp, ebp ; +0x1de, 0x180051d6e jz short loc_180051D7F ; +0x1e0, 0x180051d70 add eax, ebp ; +0x1e2, 0x180051d72 sar eax, 2 ; +0x1e4, 0x180051d74 add r12d, eax ; +0x1e7, 0x180051d77 mov [rsp+238h+var_218], r12d ; +0x1ea, 0x180051d7a mov r8, [rsp+238h+var_1D8] ; +0x1ef, 0x180051d7f cmp r8, 0FFFFFFFFFFFFFFFFh ; +0x1f4, 0x180051d84 jnz loc_180051EDD ; +0x1f8, 0x180051d88 mov ebp, edi ; +0x1fe, 0x180051d8e jmp loc_180051D00 ; +0x200, 0x180051d90 xor edx, edx ; +0x205, 0x180051d95 mov rcx, r15 ; +0x207, 0x180051d97 call sub_18004BAA0 ; +0x20a, 0x180051d9a test ebp, ebp ; +0x20f, 0x180051d9f jnz loc_180051F78 ; +0x211, 0x180051da1 mov r9, 0FFFFFFFFFFFFFFFFh ; +0x217, 0x180051da7 lea r8, [rsp+238h+var_210] ; +0x21e, 0x180051dae mov rdx, rbx ; +0x223, 0x180051db3 mov rcx, r14 ; +0x226, 0x180051db6 call sub_180053230 ; +0x229, 0x180051db9 mov r12, rax ; +0x22e, 0x180051dbe test rax, rax ; +0x231, 0x180051dc1 js loc_180051F65 ; +0x234, 0x180051dc4 cmp dword ptr [rbx+80h], 3 ; +0x23a, 0x180051dca jl short loc_180051E31 ; +0x241, 0x180051dd1 lea rcx, [rsp+238h+var_210] ; +0x243, 0x180051dd3 call sub_18004B910 ; +0x248, 0x180051dd8 cmp [rbx+84h], eax ; +0x24d, 0x180051ddd jz short loc_180051E28 ; +0x253, 0x180051de3 lea rcx, [rsp+238h+var_210] ; +0x255, 0x180051de5 call sub_18004B880 ; +0x25a, 0x180051dea test eax, eax ; +0x25f, 0x180051def jz short loc_180051E28 ; +0x261, 0x180051df1 lea rdx, [rbx+210h] ; +0x263, 0x180051df3 mov rcx, r14 ; +0x26a, 0x180051dfa call sub_1800484A0 ; +0x26d, 0x180051dfd lea rdx, [rbx+288h] ; +0x272, 0x180051e02 mov rcx, r14 ; +0x279, 0x180051e09 call sub_180048360 ; +0x27c, 0x180051e0c lea rdx, [rsp+238h+var_1C8] ; +0x281, 0x180051e11 mov dword ptr [rbx+80h], 2 ; +0x286, 0x180051e16 mov rcx, r14 ; +0x290, 0x180051e20 call sub_18004B940 ; +0x293, 0x180051e23 cmp dword ptr [rbx+80h], 3 ; +0x298, 0x180051e28 jge short loc_180051EA9 ; +0x29f, 0x180051e2f lea rcx, [rsp+238h+var_210] ; +0x2a1, 0x180051e31 call sub_18004B910 ; +0x2a6, 0x180051e36 mov r8d, [rbx+40h] ; +0x2ab, 0x180051e3b xor edx, edx ; +0x2af, 0x180051e3f xor edi, edi ; +0x2b1, 0x180051e41 mov esi, eax ; +0x2b3, 0x180051e43 test r8d, r8d ; +0x2b5, 0x180051e45 jle short loc_180051E62 ; +0x2b8, 0x180051e48 mov rcx, [rbx+58h] ; +0x2ba, 0x180051e4a xchg ax, ax ; +0x2be, 0x180051e4e cmp [rcx], esi ; +0x2c0, 0x180051e50 jz short loc_180051E62 ; +0x2c2, 0x180051e52 inc edx ; +0x2c4, 0x180051e54 inc rdi ; +0x2c6, 0x180051e56 add rcx, 4 ; +0x2c9, 0x180051e59 cmp edx, r8d ; +0x2cd, 0x180051e5d jl short loc_180051E50 ; +0x2d0, 0x180051e60 cmp edx, r8d ; +0x2d2, 0x180051e62 jz loc_180051CF0 ; +0x2d5, 0x180051e65 mov [rbx+88h], edx ; +0x2db, 0x180051e6b mov rcx, r15 ; +0x2e1, 0x180051e71 mov edx, esi ; +0x2e4, 0x180051e74 mov [rbx+84h], esi ; +0x2e6, 0x180051e76 call sub_18004C040 ; +0x2ec, 0x180051e7c mov edx, esi ; +0x2f1, 0x180051e81 lea rcx, [rsp+238h+var_1C8] ; +0x2f3, 0x180051e83 call sub_18004C040 ; +0x2f8, 0x180051e88 mov rax, [rbx+50h] ; +0x2fd, 0x180051e8d xor esi, esi ; +0x301, 0x180051e91 mov dword ptr [rbx+80h], 3 ; +0x303, 0x180051e93 cmp r12, [rax+rdi*8] ; +0x30d, 0x180051e9d setle sil ; +0x311, 0x180051ea1 mov [rsp+238h+var_214], esi ; +0x315, 0x180051ea5 lea r8, [rsp+238h+var_210] ; +0x319, 0x180051ea9 mov rdx, r15 ; +0x31e, 0x180051eae mov rcx, r14 ; +0x321, 0x180051eb1 call sub_18004BBC0 ; +0x324, 0x180051eb4 lea r8, [rsp+238h+var_210] ; +0x329, 0x180051eb9 mov rcx, r14 ; +0x32e, 0x180051ebe lea rdx, [rsp+238h+var_1C8] ; +0x331, 0x180051ec1 call sub_18004BBC0 ; +0x336, 0x180051ec6 lea rcx, [rsp+238h+var_210] ; +0x33b, 0x180051ecb call sub_18004B8A0 ; +0x340, 0x180051ed0 mov r13d, eax ; +0x345, 0x180051ed5 jmp loc_180051CF4 ; +0x348, 0x180051ed8 movsxd rdx, dword ptr [rbx+88h] ; +0x34d, 0x180051edd mov r10d, 0 ; +0x354, 0x180051ee4 mov rdi, [rbx+60h] ; +0x35a, 0x180051eea mov r11, rdx ; +0x35e, 0x180051eee lea eax, [rdx+rdx] ; +0x361, 0x180051ef1 movsxd rcx, eax ; +0x364, 0x180051ef4 sub r8, [rdi+rcx*8] ; +0x367, 0x180051ef7 cmovns r10, r8 ; +0x36b, 0x180051efb xor r8d, r8d ; +0x36f, 0x180051eff xor ecx, ecx ; +0x372, 0x180051f02 xor r9d, r9d ; +0x374, 0x180051f04 cmp rdx, 2 ; +0x377, 0x180051f07 jl short loc_180051F36 ; +0x37b, 0x180051f0b add rdx, 0FFFFFFFFFFFFFFFEh ; +0x37d, 0x180051f0d lea rax, [rdi+18h] ; +0x381, 0x180051f11 shr rdx, 1 ; +0x385, 0x180051f15 inc rdx ; +0x388, 0x180051f18 lea r9, [rdx+rdx] ; +0x38b, 0x180051f1b nop ; +0x38f, 0x180051f1f add r8, [rax-10h] ; +0x390, 0x180051f20 add rcx, [rax] ; +0x394, 0x180051f24 lea rax, [rax+20h] ; +0x397, 0x180051f27 sub rdx, 1 ; +0x39b, 0x180051f2b jnz short loc_180051F20 ; +0x39f, 0x180051f2f cmp r9, r11 ; +0x3a1, 0x180051f31 jl short loc_180051F40 ; +0x3a4, 0x180051f34 cmp r9, r11 ; +0x3a6, 0x180051f36 jge short loc_180051F48 ; +0x3a9, 0x180051f39 nop dword ptr [rax+rax+00h] ; +0x3ab, 0x180051f3b add r9, r9 ; +0x3b0, 0x180051f40 add r10, [rdi+r9*8+8] ; +0x3b3, 0x180051f43 movsxd rax, r12d ; +0x3b8, 0x180051f48 sub rcx, rax ; +0x3bb, 0x180051f4b lea rax, [r8+rcx] ; +0x3be, 0x180051f4e add rax, r10 ; +0x3c2, 0x180051f52 mov [rbx+78h], rax ; +0x3c5, 0x180051f55 jns short loc_180051F80 ; +0x3c9, 0x180051f59 mov qword ptr [rbx+78h], 0 ; +0x3cb, 0x180051f5b jmp short loc_180051F80 ; +0x3d3, 0x180051f63 mov edx, 0FFFFFFFFh ; +0x3d5, 0x180051f65 mov rcx, rbx ; +0x3da, 0x180051f6a call sub_180051B10 ; +0x3dd, 0x180051f6d mov [rbx+78h], rax ; +0x3e2, 0x180051f72 jmp short loc_180051F80 ; +0x3e6, 0x180051f76 mov qword ptr [rbx+78h], 0FFFFFFFFFFFFFFFFh ; +0x3e8, 0x180051f78 lea rdx, [rsp+238h+var_1C8] ; +0x3f0, 0x180051f80 mov rcx, r14 ; +0x3f5, 0x180051f85 call sub_18004B940 ; +0x3f8, 0x180051f88 xor eax, eax ; +0x3fd, 0x180051f8d mov qword ptr [rbx+8Ch], 0 ; +0x3ff, 0x180051f8f jmp loc_180051C96 ; +0x40a, 0x180051f9a mov eax, 0FFFFFF7Dh ; +0x40f, 0x180051f9f jmp loc_180051CBE ; +0x414, 0x180051fa4