Function at 0x509dd8
Capabilities:
Access peb ldr_data

Disassembly:
push ebp
mov ebp, esp
mov ecx, 6
push 0
push 0
dec ecx
jne 0x509de0
push ecx
push ebx
push esi
push edi
xor eax, eax
push ebp
push 0x50a075
push dword fs:[eax]
mov dword fs:[eax], esp
lea eax, [ebp - 0x28]
call fcn.00406f9c
push eax
mov eax, dword [ebp + 8]
mov eax, dword [eax - 4]
call fcn.0050ab68
mov edx, dword [eax + 0x30]
lea eax, [ebp - 0x2c]
mov ecx, 0x50a084
call fcn.00406fe0
mov eax, dword [ebp - 0x2c]
push eax
mov eax, dword [eax]
call dword [eax + 0xc]
call fcn.004070a8
mov edx, dword [ebp - 0x28]
lea eax, [ebp - 0x18]
mov ecx, 0x50a094
call fcn.00406fe0
lea eax, [ebp - 0x1c]
call fcn.00406f9c
push eax
push 0x50a0a4
mov eax, dword [ebp - 0x18]
push eax
mov eax, dword [eax]
call dword [eax]
push 0
push 0
push 0
mov eax, dword [ebp - 0x1c]
push eax
mov eax, dword [eax]
call dword [eax + 0x14]
cmp dword [ebp - 0x1c], 0
je 0x50a022
xor eax, eax
mov dword [ebp - 8], eax
xor eax, eax
mov dword [ebp - 0xc], eax
xor eax, eax
push ebp
push 0x50a01b
push dword fs:[eax]
mov dword fs:[eax], esp
lea eax, [ebp - 0x20]
call fcn.00406f9c
push eax
push 0x50a0b4
mov eax, dword [ebp - 0x18]
push eax
mov eax, dword [eax]
call dword [eax]
cmp dword [ebp - 0x20], 0
je 0x509ea9
push 0
mov eax, dword [ebp - 0x20]
push eax
mov eax, dword [eax]
call dword [eax + 0xc]
lea eax, [ebp - 0xc]
push eax
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 4]
push eax
mov eax, dword [ebp - 0x1c]
push eax
mov eax, dword [eax]
call dword [eax + 0xc]
test eax, eax
jne 0x509fe3
mov eax, dword [ebp - 4]
dec eax
test eax, eax
jl 0x509fe3
inc eax
mov dword [ebp - 0x24], eax
xor esi, esi
lea eax, [esi + esi*2]
mov edx, dword [ebp - 8]
lea ebx, [edx + eax*8]
mov edi, dword [ebx + 8]
test edi, edi
jne 0x509f10
lea edx, [ebp - 0x34]
lea eax, [esi + 1]
call fcn.0040a390
mov ecx, dword [ebp - 0x34]
lea eax, [ebp - 0x30]
mov edx, 0x50a0cc
call fcn.00404f74
mov edx, dword [ebp - 0x30]
lea eax, [ebp - 0x10]
call fcn.00405538
jmp 0x509f1a
lea eax, [ebp - 0x10]
mov edx, edi
call fcn.004054fc
cmp word [ebx + 0x14], 0x80
jne 0x509f28
mov word [ebx + 0x14], 0xcc
cmp word [ebx + 0x14], 0x81
jne 0x509f36
mov word [ebx + 0x14], 0xc8
mov edi, dword [ebx]
and edi, 0xf
test edi, edi
jne 0x509f44
mov edi, 1
lea eax, [ebp - 0x14]
call fcn.00406f9c
push eax
mov eax, dword [0x752d24]
push dword [eax + 0xc]
push dword [eax + 8]
push dword [eax + 4]
push dword [eax]
mov eax, dword [ebx + 0x10]
push eax
push edi
movzx eax, word [ebx + 0x14]
push eax
mov eax, dword [ebp - 0x10]
push eax
mov eax, dword [ebp + 8]
mov eax, dword [eax - 4]
call fcn.0050ab68
mov eax, dword [eax + 0x30]
push eax
mov eax, dword [eax]
call dword [eax + 0x48]
call fcn.004070a8
mov al, byte [ebx + 0x16]
push eax
mov eax, dword [ebp - 0x14]
push eax
mov eax, dword [eax]
call dword [eax + 0x40]
call fcn.004070a8
lea eax, [esi + esi*2]
mov edx, dword [ebp - 8]
mov al, byte [edx + eax*8 + 0x17]
push eax
mov eax, dword [ebp - 0x14]
push eax
mov eax, dword [eax]
call dword [eax + 0x48]
call fcn.004070a8
mov eax, dword [ebx]
and eax, 0xfffffff0
push eax
mov eax, dword [ebp - 0x14]
push eax
mov eax, dword [eax]
call dword [eax + 0x60]
call fcn.004070a8
mov eax, dword [ebp + 8]
mov eax, dword [eax - 4]
call fcn.0050a3c0
add eax, 0xc
mov edx, dword [ebp - 0x14]
call fcn.00406fb4
inc esi
dec dword [ebp - 0x24]
jne 0x509ed8
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x50a022
cmp dword [ebp - 8], 0
je 0x50a005
mov eax, dword [ebp - 8]
push eax
mov eax, dword [0x754edc]
push eax
mov eax, dword [eax]
call dword [eax + 0x14]
cmp dword [ebp - 0xc], 0
je 0x50a01a
mov eax, dword [ebp - 0xc]
push eax
mov eax, dword [0x754edc]
push eax
mov eax, dword [eax]
call dword [eax + 0x14]
ret
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x50a07c
lea eax, [ebp - 0x34]
mov edx, 2
call fcn.00404c84
lea eax, [ebp - 0x2c]
call fcn.00406f9c
lea eax, [ebp - 0x28]
call fcn.00406f9c
lea eax, [ebp - 0x20]
call fcn.00406f9c
lea eax, [ebp - 0x1c]
call fcn.00406f9c
lea eax, [ebp - 0x18]
call fcn.00406f9c
lea eax, [ebp - 0x14]
call fcn.00406f9c
lea eax, [ebp - 0x10]
call fcn.00405394
ret