Function at 0x40a320
Capabilities:
Parse pe header

Disassembly:
push ebp
mov ebp, esp
pop ebp
jmp 0x40aaf9
sub esp, 0xc
push esi
mov esi, dword [esp + 0x14]
test esi, esi
jne 0x40ab0e
xor eax, eax
pop esi
add esp, 0xc
ret 0x10
mov eax, dword [esp + 0x18]
cmp eax, 0x40
jb 0x40ab05
mov ecx, 0x5a4d
cmp word [esi], cx
jne 0x40ab05
push ebp
mov ebp, dword [esi + 0x3c]
lea edx, [ebp + 0xf8]
cmp eax, edx
jb 0x40ab5a
cmp dword [esi + ebp], 0x4550
jne 0x40ab5a
mov eax, 0x14c
cmp word [esi + ebp + 4], ax
jne 0x40ab5a
test byte [esi + ebp + 0x16], 2
je 0x40ab5a
movzx eax, word [esi + ebp + 0x14]
mov ecx, 0xe0
cmp ax, cx
jae 0x40ab64
pop ebp
xor eax, eax
pop esi
add esp, 0xc
ret 0x10
push ebx
movzx ebx, ax
movzx eax, word [esi + ebp + 6]
sub ebx, ecx
lea edx, [ebx + ebp]
add edx, esi
xor ecx, ecx
push edi
mov dword [esp + 0x14], ebx
mov dword [esp + 0x10], edx
test eax, eax
jbe 0x40abb0
add edx, 0x108
mov dword [esp + 0x20], edx
mov edi, dword [edx + 4]
add edi, dword [edx]
cmp edi, dword [esp + 0x24]
ja 0x40acfd
mov edx, dword [esp + 0x20]
inc ecx
add edx, 0x28
mov dword [esp + 0x20], edx
cmp ecx, eax
jb 0x40ab8d
mov edx, dword [esp + 0x10]
mov edi, dword [esi + ebp + 0x50]
test eax, eax
jbe 0x40ac13
mov ecx, dword [esi + ebp + 0x38]
lea ebx, [edx + 0x100]
mov dword [esp + 0x24], eax
lea ecx, [ecx]
mov eax, dword [ebx + 8]
mov edx, dword [ebx]
cmp eax, edx
ja 0x40abd4
mov eax, edx
mov ebp, dword [ebx + 4]
add eax, ebp
lea eax, [eax + ecx - 1]
xor edx, edx
div ecx
imul eax, ecx
cmp edi, eax
ja 0x40ac02
mov edx, dword [ebx]
mov eax, dword [ebx + 8]
cmp eax, edx
ja 0x40abf3
mov eax, edx
add ebp, eax
xor edx, edx
lea eax, [ecx + ebp - 1]
div ecx
mov edi, eax
imul edi, ecx
add ebx, 0x28
sub dword [esp + 0x24], 1
jne 0x40abc9
mov ebx, dword [esp + 0x14]
mov ebp, dword [esi + 0x3c]
test edi, edi
je 0x40acfd
mov ecx, dword [esi + ebp + 0x34]
push ecx
call fcn.0040a549
mov edi, eax
add esp, 4
test edi, edi
je 0x40acfd
movzx eax, word [esi + ebp + 6]
mov ecx, dword [esi + 0x3c]
lea edx, [eax + eax*4]
lea eax, [ebx + edx*8]
lea ecx, [eax + ecx + 0xf8]
mov eax, esi
mov edx, edi
call fcn.0040a329
xor eax, eax
xor edx, edx
mov dword [esp + 0x20], eax
cmp dx, word [esi + ebp + 6]
jae 0x40acac
mov dword [esp + 0x24], eax
lea ebx, [ebx]
mov eax, dword [esp + 0x24]
mov ecx, dword [esi + 0x3c]
add eax, ebx
add eax, esi
lea eax, [eax + ecx + 0xf8]
mov ecx, dword [eax + 0x10]
test ecx, ecx
je 0x40ac95
mov edx, dword [eax + 0xc]
test edx, edx
je 0x40ac95
mov eax, dword [eax + 0x14]
add eax, esi
add edx, edi
call fcn.0040a329
mov eax, dword [esp + 0x20]
movzx edx, word [esi + ebp + 6]
add dword [esp + 0x24], 0x28
inc eax
mov dword [esp + 0x20], eax
cmp eax, edx
jb 0x40ac69
call fcn.0040a669
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x28]
push eax
push ecx
call fcn.0040a6f9
add esp, 8
test eax, eax
je 0x40acf4
mov edx, 0x2000
test word [esi + ebp + 0x16], dx
je 0x40ad09
mov esi, dword [esi + ebp + 0x28]
test esi, esi
je 0x40ad09
push 0
push 1
add esi, edi
push edi
call esi
test eax, eax
jne 0x40ad09
push eax
push eax
push edi
call esi
mov ebx, edi
call fcn.0040a9e9
push edi
call fcn.0040a5e9
add esp, 4
pop edi
pop ebx
pop ebp
xor eax, eax
pop esi
add esp, 0xc
ret 0x10
mov eax, edi
pop edi
pop ebx
pop ebp
pop esi
add esp, 0xc
ret 0x10