Function at 0x50e20
Capabilities:
Access peb ldr_data

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffd8
push ebx
push esi
push edi
mov byte [ebp - 5], cl
mov ebx, edx
mov dword [ebp - 4], eax
lea esi, [ebx + 1]
cmp esi, 2
jge 0x50e84
dec esi
jge 0x50e44
mov eax, dword [0x4fd58]
call dword [eax + 4]
mov eax, dword [ebp - 4]
mov eax, dword [eax]
mov edx, dword [ebp + 8]
mov ecx, dword [eax]
call dword [ecx + 0x30]
mov byte [ebp - 6], al
cmp byte [ebp - 6], 0
jne 0x510f8
cmp dword [ebp + 0x10], 0
je 0x50e6b
mov eax, dword [ebp + 0x10]
xor edx, edx
mov dword [eax], edx
cmp dword [ebp + 0xc], 0
je 0x510f8
mov eax, dword [ebp - 4]
mov eax, dword [eax]
mov edx, dword [ebp + 0xc]
mov dword [edx], eax
jmp 0x510f8
mov eax, dword [0x220c70]
call dword [eax + 8]
mov dword [ebp - 0x20], eax
mov dl, 1
mov eax, dword [0x4fb90]
call fcn.0005136c
mov dword [ebp - 0x18], eax
xor edx, edx
push ebp
push 0x510bf
push dword fs:[edx]
mov dword fs:[edx], esp
mov dword [ebp - 0x14], 0xffffffff
mov eax, dword [ebp - 0x18]
or byte [eax + 0xc], 1
cmp byte [ebp - 5], 0
je 0x50ec7
mov eax, dword [ebp - 0x18]
or byte [eax + 0xc], 2
mov eax, dword [ebp - 0x18]
mov dword [eax + 8], 1
cmp byte [ebp - 5], 0
je 0x50edc
mov dword [eax + 0x10], esi
jmp 0x50ee3
mov dword [eax + 0x10], 0xffffffff
call fcn.000481fc
mov eax, dword [ebp - 0x18]
call fcn.000485cc
or edx, 0xffffffff
call fcn.00048364
xor edx, edx
push ebp
push 0x510ae
push dword fs:[edx]
mov dword fs:[edx], esp
mov byte [ebp - 0x19], 0
mov dword [ebp - 0x10], 0xffffffff
test ebx, ebx
jl 0x50fd7
inc ebx
mov dword [ebp - 0x24], ebx
mov dword [ebp - 0xc], 0
mov eax, dword [ebp - 4]
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x28]
mov eax, dword [eax]
mov edx, dword [eax]
call dword [edx + 0xc]
xor eax, eax
push ebp
push 0x50fba
push dword fs:[eax]
mov dword fs:[eax], esp
mov eax, dword [ebp - 0x28]
mov eax, dword [eax]
call fcn.00051108
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x50fc1
mov eax, dword [ebp - 0x28]
mov eax, dword [eax]
xor edx, edx
mov ecx, dword [eax]
call dword [ecx + 0x30]
test al, al
jne 0x50f9c
mov eax, dword [ebp - 0x28]
mov eax, dword [eax]
mov edx, dword [eax]
call dword [edx + 0x10]
cmp byte [ebp - 5], 0
je 0x50f87
mov eax, dword [ebp - 0x18]
dec dword [eax + 0x10]
jmp 0x50fb9
mov eax, dword [ebp - 0x18]
mov edx, dword [ebp - 0xc]
mov dword [eax + 0x10], edx
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x10], eax
mov byte [ebp - 0x19], 1
jmp 0x50fb9
lea edx, [ebp - 0x18]
mov eax, dword [ebp - 0x28]
mov eax, dword [eax]
mov ecx, dword [eax]
call dword [ecx + 0x20]
mov eax, dword [ebp - 0x18]
inc dword [eax + 8]
mov eax, dword [ebp - 0x28]
mov eax, dword [eax]
mov edx, dword [eax]
call dword [edx + 0x10]
ret
cmp byte [ebp - 0x19], 0
jne 0x50fed
cmp dword [ebp + 8], 0
jne 0x50fed
mov byte [ebp - 0x19], 1
mov byte [ebp - 6], 1
jmp 0x5106a
mov byte [ebp - 6], 0
jmp 0x5106a
cmp byte [ebp - 5], 0
je 0x51002
mov eax, dword [ebp - 0x18]
cmp dword [eax + 0x10], 0
je 0x51015
cmp byte [ebp - 5], 0
jne 0x51011
mov eax, dword [ebp - 0x18]
cmp dword [eax + 0x10], 0xffffffff
jne 0x51015
xor eax, eax
jmp 0x51017
mov al, 1
mov byte [ebp - 0x19], al
cmp byte [ebp - 0x19], 0
jne 0x5106a
cmp dword [ebp + 8], 0xffffffff
je 0x51046
mov eax, dword [0x4fd58]
call dword [eax + 8]
mov ebx, eax
mov edi, ebx
sub edi, dword [ebp - 0x20]
cmp edi, dword [ebp + 8]
jb 0x51040
mov byte [ebp - 6], 1
jmp 0x51070
sub dword [ebp + 8], edi
mov dword [ebp - 0x20], ebx
mov esi, dword [ebp - 0x18]
mov eax, dword [esi + 4]
mov ecx, dword [ebp + 8]
mov edx, esi
call fcn.000488d8
test al, al
je 0x51060
mov byte [ebp - 6], 0
jmp 0x51064
mov byte [ebp - 6], 1
cmp byte [ebp - 6], 0
jne 0x51070
cmp byte [ebp - 0x19], 0
je 0x50ff3
mov ebx, dword [ebp - 0x18]
mov eax, dword [ebx + 0x10]
mov dword [ebp - 0x10], eax
and byte [ebx + 0xc], 0xfe
mov eax, dword [ebp - 0x18]
dec dword [eax + 8]
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x510b5
mov eax, dword [ebp - 0x18]
cmp dword [eax + 8], 0
jne 0x510a8
call fcn.00048544
lea eax, [ebp - 0x18]
call fcn.00050dc8
jmp 0x510ad
call fcn.00048544
ret
movzx eax, byte [ebp - 6]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0xc