Function at 0x40cf10
Capabilities:
Parse pe header

Disassembly:
push ebp
mov ebp, esp
pop ebp
jmp 0x40d5a9
sub esp, 0x10
push ebx
mov ebx, dword [esp + 0x18]
test ebx, ebx
jne 0x40d5be
xor eax, eax
pop ebx
add esp, 0x10
ret 0x10
push esi
mov esi, dword [esp + 0x20]
cmp esi, 0x40
jb 0x40d5df
mov eax, 0x5a4d
cmp word [ebx], ax
jne 0x40d5df
mov ecx, dword [ebx + 0x3c]
lea eax, [ecx + 0xf8]
cmp esi, eax
jae 0x40d5e9
pop esi
xor eax, eax
pop ebx
add esp, 0x10
ret 0x10
cmp dword [ecx + ebx], 0x4550
push ebp
lea ebp, [ecx + ebx]
mov dword [esp + 0x18], ebp
jne 0x40d619
mov eax, 0x14c
cmp word [ebp + 4], ax
jne 0x40d619
test byte [ebp + 0x16], 2
je 0x40d619
movzx eax, word [ebp + 0x14]
mov edx, 0xe0
cmp ax, dx
jae 0x40d624
pop ebp
pop esi
xor eax, eax
pop ebx
add esp, 0x10
ret 0x10
add eax, 0xffffff20
movzx eax, ax
push edi
movzx edi, word [ebp + 6]
mov dword [esp + 0x28], eax
add eax, ecx
lea ecx, [ebx + 0xf8]
add ecx, eax
xor edx, edx
mov dword [esp + 0x10], ecx
mov dword [esp + 0x18], edi
test edi, edi
jle 0x40d680
xor eax, eax
jmp 0x40d659
mov ebx, dword [esp + 0x10]
lea eax, [eax + eax*4]
mov ecx, dword [ecx + eax*8 + 0x14]
add ecx, dword [ebx + eax*8 + 0x10]
mov ebx, dword [esp + 0x24]
cmp ecx, esi
ja 0x40d7ea
mov ecx, dword [esp + 0x10]
inc edx
movzx eax, dx
cmp eax, edi
jl 0x40d659
mov edx, dword [ebp + 0x50]
xor esi, esi
test edi, edi
jle 0x40d70f
mov ecx, dword [ebp + 0x38]
xor eax, eax
mov dword [esp + 0x10], ecx
mov ebp, edx
nop
mov ecx, dword [ebx + 0x3c]
lea eax, [eax + eax*4]
lea ecx, [ecx + eax*8]
add ecx, dword [esp + 0x28]
mov edx, dword [ecx + ebx + 0x108]
mov edi, dword [ecx + ebx + 0x100]
mov ecx, dword [ecx + ebx + 0x104]
cmp edx, edi
mov eax, edi
cmova eax, edx
add eax, ecx
dec eax
mov dword [esp + 0x14], ecx
mov ecx, dword [esp + 0x10]
mov dword [esp + 0x24], edx
add eax, ecx
xor edx, edx
div ecx
imul eax, ecx
cmp ebp, eax
ja 0x40d6f9
cmp dword [esp + 0x24], edi
mov eax, dword [esp + 0x14]
cmova edi, dword [esp + 0x24]
dec eax
add eax, edi
add eax, ecx
xor edx, edx
div ecx
mov ebp, eax
imul ebp, ecx
inc esi
movzx eax, si
cmp eax, dword [esp + 0x18]
jl 0x40d699
mov dword [esp + 0x24], ebp
mov ebp, dword [esp + 0x1c]
mov edx, dword [esp + 0x24]
test edx, edx
je 0x40d7ea
mov ecx, dword [ebp + 0x34]
call fcn.0040d149
mov edi, eax
test edi, edi
je 0x40d7ea
movzx eax, word [ebp + 6]
mov edx, ebx
lea ecx, [eax + eax*4]
mov eax, dword [ebx + 0x3c]
lea eax, [eax + ecx*8]
mov ecx, dword [esp + 0x28]
add ecx, 0xf8
add eax, ecx
push eax
mov ecx, edi
call fcn.0040cf19
xor eax, eax
add esp, 4
xor esi, esi
cmp ax, word [ebp + 6]
jae 0x40d79a
movzx eax, si
lea ecx, [eax + eax*4]
mov eax, dword [ebx + 0x3c]
lea eax, [eax + ecx*8]
add eax, dword [esp + 0x28]
mov edx, dword [eax + ebx + 0x108]
test edx, edx
je 0x40d793
mov ecx, dword [eax + ebx + 0x104]
test ecx, ecx
je 0x40d793
push edx
mov edx, dword [eax + ebx + 0x10c]
add edx, ebx
add ecx, edi
call fcn.0040cf19
add esp, 4
inc esi
cmp si, word [ebp + 6]
jb 0x40d759
mov ecx, edi
call fcn.0040d209
push dword [esp + 0x30]
mov edx, dword [esp + 0x30]
mov ecx, edi
call fcn.0040d2a9
add esp, 4
test eax, eax
je 0x40d7e3
mov eax, 0x2000
test word [ebp + 0x16], ax
je 0x40d7f6
mov eax, dword [ebp + 0x28]
test eax, eax
je 0x40d7f6
push 0
push 1
lea esi, [eax + edi]
push edi
call esi
test eax, eax
jne 0x40d7f6
push eax
push eax
push edi
call esi
mov ecx, edi
call fcn.0040d4d9
mov ecx, edi
call fcn.0040d1b9
pop edi
pop ebp
pop esi
xor eax, eax
pop ebx
add esp, 0x10
ret 0x10
mov eax, edi
pop edi
pop ebp
pop esi
pop ebx
add esp, 0x10
ret 0x10