Function at 0x51f500
Capabilities:
Access peb ldr_data

Disassembly:
push 0xffffffffffffffff
push 0x5db021
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x10
push ebp
push esi
mov dword [esp + 0xc], 0
call fcn.005afeed
mov edx, dword [eax]
mov ecx, eax
call dword [edx + 0xc]
add eax, 0x10
mov dword [esp + 8], eax
mov dword [esp + 0x20], 2
mov ebp, dword [esp + 0x30]
test ebp, ebp
je 0x51f821
mov esi, dword [esp + 0x2c]
mov eax, dword [esi]
cmp word [eax], 0
je 0x51f821
push edi
mov edi, dword [esp + 0xc]
mov eax, dword [edi - 4]
mov ecx, 1
sub ecx, eax
mov eax, dword [edi - 8]
lea edx, [ebp + 4]
sub eax, edx
or eax, ecx
jge 0x51f582
push edx
lea ecx, [esp + 0x10]
call fcn.00402690
mov edi, dword [esp + 0xc]
mov ecx, dword [esi]
mov dx, word [ecx + ebp*2]
lea ebp, [ecx + ebp*2]
mov word [ebp], 0
mov eax, dword [esi]
cmp word [eax], 0
mov dword [esp + 0x34], edi
mov word [esp + 0x18], dx
je 0x51f7cc
mov eax, dword [esi]
cmp eax, ebp
jae 0x51f7cc
xor ecx, ecx
mov cx, word [eax]
push ecx
call fcn.0057aab1
add esp, 4
test eax, eax
je 0x51f615
cmp dword [esp + 0x34], edi
je 0x51f5d0
mov word [edi], 0x20
add edi, 2
mov edx, dword [esi]
add edx, 2
mov eax, edx
mov dword [esi], edx
cmp word [eax], 0
je 0x51f601
nop
xor edx, edx
mov dx, word [eax]
push edx
call fcn.0057aab1
add esp, 4
test eax, eax
je 0x51f601
mov eax, dword [esi]
add eax, 2
mov ecx, eax
mov dword [esi], eax
cmp word [ecx], 0
jne 0x51f5e0
mov eax, dword [esi]
cmp word [eax], 0
je 0x51f7cc
cmp eax, ebp
jae 0x51f7cc
mov eax, dword [esi]
mov cx, word [eax]
cmp cx, 0x26
jne 0x51f7b3
add eax, 2
mov dword [esi], eax
cmp word [eax], 0
je 0x51f7cc
cmp eax, ebp
jae 0x51f7cc
push 4
push 0x604f8c
push eax
call fcn.0057ab90
add esp, 0xc
test eax, eax
jne 0x51f661
mov word [edi], 0x26
mov eax, dword [esi]
add edi, 2
add eax, 8
jmp 0x51f7be
mov edx, dword [esi]
push 3
push 0x604f84
push edx
call fcn.0057ab90
add esp, 0xc
test eax, eax
jne 0x51f689
mov word [edi], 0x3c
mov eax, dword [esi]
add edi, 2
add eax, 6
jmp 0x51f7be
mov eax, dword [esi]
push 3
push 0x604f7c
push eax
call fcn.0057ab90
add esp, 0xc
test eax, eax
jne 0x51f6b1
mov word [edi], 0x3e
mov eax, dword [esi]
add edi, 2
add eax, 6
jmp 0x51f7be
mov ecx, dword [esi]
push 5
push 0x604f70
push ecx
call fcn.0057ab90
add esp, 0xc
test eax, eax
jne 0x51f6d9
mov word [edi], 0x22
mov eax, dword [esi]
add edi, 2
add eax, 0xa
jmp 0x51f7be
mov edx, dword [esi]
push 5
push 0x604f64
push edx
call fcn.0057ab90
add esp, 0xc
test eax, eax
jne 0x51f701
mov word [edi], 0x27
mov eax, dword [esi]
add edi, 2
add eax, 0xa
jmp 0x51f7be
mov eax, dword [esi]
push 5
push str.nbsp_
push eax
call fcn.0057ab90
add esp, 0xc
test eax, eax
jne 0x51f729
mov word [edi], 0x20
mov eax, dword [esi]
add edi, 2
add eax, 0xa
jmp 0x51f7be
mov eax, dword [esi]
cmp word [eax], 0x23
jne 0x51f7a9
add eax, 2
xor ecx, ecx
mov dword [esi], eax
mov cx, word [eax]
test cx, cx
je 0x51f7cc
cmp eax, ebp
jae 0x51f7cc
push ecx
call fcn.0057aaa3
add esp, 4
test eax, eax
je 0x51f7cc
mov edx, dword [esi]
lea ecx, [esp + 0x14]
push ecx
push 0x604f4c
push edx
call fcn.0057a511
add esp, 0xc
cmp eax, 1
jne 0x51f7c0
mov ax, word [esp + 0x14]
mov word [edi], ax
mov ecx, dword [esi]
add edi, 2
cmp word [ecx], 0
je 0x51f79b
mov eax, dword [esi]
cmp word [eax], 0x3b
je 0x51f79b
add eax, 2
mov edx, eax
mov dword [esi], eax
cmp word [edx], 0
jne 0x51f786
mov eax, dword [esi]
cmp word [eax], 0
je 0x51f7cc
cmp eax, ebp
jae 0x51f7cc
jmp 0x51f7bb
mov word [edi], 0x26
add edi, 2
jmp 0x51f7c0
mov word [edi], cx
mov eax, dword [esi]
add edi, 2
add eax, 2
mov dword [esi], eax
mov eax, dword [esi]
cmp word [eax], 0
jne 0x51f5a6
mov esi, dword [esp + 0x34]
mov cx, word [esp + 0x18]
sub edi, esi
mov word [ebp], cx
sar edi, 1
push edi
lea ecx, [esp + 0x10]
call fcn.00404fa0
mov esi, dword [esp + 0x2c]
lea edx, [esp + 0xc]
push edx
mov ecx, esi
call fcn.00402dc0
mov dword [esp + 0x10], 1
mov byte [esp + 0x24], 0
lea ecx, [esp + 0xc]
call fcn.00401b70
pop edi
mov eax, esi
pop esi
pop ebp
mov ecx, dword [esp + 0x10]
mov dword fs:[0], ecx
add esp, 0x1c
ret
mov esi, dword [esp + 0x28]
lea eax, [esp + 8]
push eax
mov ecx, esi
call fcn.00402dc0
mov dword [esp + 0xc], 1
mov dword [esp + 0x20], 0
mov eax, dword [esp + 8]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x51f85f
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
call dword [edx + 4]
mov ecx, dword [esp + 0x18]
mov eax, esi
pop esi
pop ebp
mov dword fs:[0], ecx
add esp, 0x1c
ret