Function at 0x515e80
Capabilities:
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x34
push ebx
push esi
mov esi, dword [ebp + 8]
mov dl, byte [ebp + 0xc]
and dl, 2
mov dword [ebp - 0x14], 0
push edi
mov eax, dword [esi]
movzx ecx, word [esi + 0x46]
mov dword [ebp - 0xc], eax
mov dword [ebp - 8], ecx
mov eax, dword [eax + 4]
mov dword [ebp - 4], eax
movsx eax, byte [esi + 0x44]
mov dword [ebp - 0x10], eax
mov byte [ebp + 0xc], dl
mov ebx, dword [esi + eax*4 + 0x74]
mov eax, dword [ebx + 0x40]
mov ax, word [eax + ecx*2]
mov ch, al
mov cl, ah
movzx eax, word [ebx + 0x18]
movzx ecx, cx
and ecx, eax
add ecx, dword [ebx + 0x38]
mov dword [ebp - 0x18], ecx
test dl, dl
je 0x515f22
cmp byte [ebx + 8], 0
je 0x515f11
push ecx
push ebx
call fcn.004f5be0
movzx edi, word [ebx + 0x14]
add esp, 8
movzx ecx, ax
add edi, 2
add edi, ecx
mov eax, 0xaaaaaaab
mov ecx, dword [ebp - 4]
mov ecx, dword [ecx + 0x24]
add ecx, ecx
mul ecx
shr edx, 1
cmp edi, edx
jg 0x515f11
mov dword [ebp - 0x14], 1
jmp 0x515f22
push esi
call fcn.00510230
add esp, 4
test eax, eax
jne 0x51615e
cmp byte [ebx + 8], 0
jne 0x515f74
and byte [esi + 0x40], 0xf1
xor eax, eax
cmp byte [esi + 0x42], 1
mov dword [ebp + 8], 0
mov word [esi + 0x22], ax
jne 0x515f5f
movzx ecx, word [esi + 0x46]
test cx, cx
je 0x515f5f
movsx eax, byte [esi + 0x44]
mov eax, dword [esi + eax*4 + 0x74]
cmp byte [eax + 8], 0
je 0x515f5f
lea eax, [ecx - 1]
mov word [esi + 0x46], ax
jmp 0x515f74
lea eax, [ebp + 8]
push eax
push esi
call fcn.004f5790
add esp, 8
test eax, eax
jne 0x51615e
test byte [esi + 0x40], 0x20
je 0x515f91
push esi
push dword [esi + 0x34]
push dword [ebp - 4]
call fcn.005101e0
add esp, 0xc
test eax, eax
jne 0x51615e
cmp dword [esi + 0x70], 0
jne 0x515fad
push 0
push dword [esi + 0x14]
push dword [esi + 0x10]
push dword [esi + 0x34]
push dword [ebp - 0xc]
call fcn.00504a40
add esp, 0x14
push dword [ebx + 0x48]
call fcn.0052bb50
add esp, 4
test eax, eax
jne 0x51615e
lea eax, [ebp - 0x34]
push eax
push dword [ebp - 0x18]
push ebx
call fcn.004f67d0
mov dword [ebp + 8], eax
lea eax, [ebp + 8]
push eax
movzx eax, word [ebp - 0x22]
push eax
push dword [ebp - 8]
push ebx
call fcn.004fc1b0
mov eax, dword [ebp + 8]
add esp, 0x1c
test eax, eax
jne 0x51615e
cmp byte [ebx + 8], al
jne 0x5160b7
movsx eax, byte [esi + 0x44]
mov edi, dword [esi + eax*4 + 0x74]
mov eax, dword [ebp - 0x10]
movzx ecx, word [edi + 0x16]
mov eax, dword [esi + eax*4 + 0x78]
mov edx, dword [edi + 0x38]
mov eax, dword [eax + 4]
mov dword [ebp - 0x18], eax
mov eax, dword [edi + 0x40]
mov ax, word [eax + ecx*2 - 2]
mov ch, al
mov cl, ah
movzx eax, word [edi + 0x18]
movzx ecx, cx
and ecx, eax
lea eax, [edx + 4]
add ecx, edx
mov dword [ebp - 0x1c], ecx
cmp ecx, eax
jae 0x51604a
push 0x1074f
call fcn.00519d30
add esp, 4
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [edi + 0x4c]
push ecx
push edi
call eax
push dword [edi + 0x48]
movzx eax, ax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x50]
mov dword [ebp - 4], eax
call fcn.0052bb50
add esp, 0xc
mov dword [ebp + 8], eax
test eax, eax
jne 0x516096
lea eax, [ebp + 8]
push eax
push dword [ebp - 0x18]
mov eax, dword [ebp - 0xc]
push dword [ebp - 4]
add eax, 4
push eax
mov eax, dword [ebp - 0x1c]
add eax, 0xfffffffc
push eax
push dword [ebp - 8]
push ebx
call fcn.00504760
add esp, 0x1c
lea eax, [ebp + 8]
push eax
movzx eax, word [edi + 0x16]
push dword [ebp - 0xc]
dec eax
push eax
push edi
call fcn.004fc1b0
mov eax, dword [ebp + 8]
add esp, 0x10
test eax, eax
jne 0x51615e
push esi
call fcn.004f2790
mov edx, eax
add esp, 4
test edx, edx
jne 0x51615c
movsx ecx, byte [esi + 0x44]
mov edi, dword [ebp - 0x10]
cmp ecx, edi
jle 0x51610a
mov cl, byte [esi + 0x44]
movsx eax, cl
dec cl
mov eax, dword [esi + eax*4 + 0x74]
mov byte [esi + 0x44], cl
test eax, eax
je 0x5160f3
push dword [eax + 0x48]
call fcn.0052baa0
add esp, 4
movsx eax, byte [esi + 0x44]
cmp eax, edi
jg 0x5160d5
push esi
call fcn.004f2790
mov edx, eax
add esp, 4
test edx, edx
jne 0x51615c
cmp dword [ebp - 0x14], 0
je 0x516147
mov byte [esi + 0x42], 2
movzx eax, word [ebx + 0x16]
cmp dword [ebp - 8], eax
jb 0x516137
mov dword [esi + 0x3c], 0xffffffff
mov ax, word [ebx + 0x16]
dec ax
pop edi
mov word [esi + 0x46], ax
mov eax, edx
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
mov dword [esi + 0x3c], 1
mov eax, edx
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push esi
call fcn.00506970
add esp, 4
mov edx, eax
cmp byte [ebp + 0xc], 0
je 0x51615c
mov byte [esi + 0x42], 3
mov eax, edx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret