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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x5fc1c4
mov eax, dword fs:[0]
push eax
sub esp, 0xa0
push ebx
push esi
push edi
mov eax, dword [0x70b744]
xor eax, esp
push eax
lea eax, [esp + 0xb0]
mov dword fs:[0], eax
mov esi, dword [ebp + 0x14]
push 1
push esi
lea ecx, [esp + 0x34]
call fcn.0040b9ba
and dword [esp + 0xb8], 0
mov eax, dword [esp + 0x34]
mov eax, dword [eax + 4]
push dword [ebp + 0x18]
mov edi, dword [ebp + 0xc]
lea eax, [esp + eax + 0x38]
lea ecx, [edi + 0x3c]
push eax
call fcn.0040ba9c
mov eax, dword [esp + 0x34]
mov eax, dword [eax + 4]
mov ecx, dword [esp + eax + 0x44]
mov ebx, dword [esp + eax + 0x4c]
mov dword [esp + 0x1c], ecx
shr ecx, 8
and cl, 1
mov dword [esp + 0x28], ebx
je 0x40a9ff
test ebx, ebx
mov byte [esp + 0x17], 1
jne 0x40aa04
mov byte [esp + 0x17], 0
mov ecx, dword [ebp + 0x10]
push 0
push 0
call fcn.00408971
cmp byte [esp + 0x17], 0
jne 0x40ab0d
test ebx, ebx
jle 0x40aa2e
mov eax, dword [esp + 0x34]
mov eax, dword [eax + 4]
lea eax, [esp + eax + 0x34]
and dword [eax + 0x18], 0
push dword [ebp + 8]
lea eax, [esp + 0x38]
push eax
call fcn.0040c512
mov eax, dword [esi + 0x14]
and dword [esp + 0x20], 0
test byte [edi + 0x60], 2
mov ebx, dword [eax]
pop ecx
pop ecx
je 0x40aaa2
mov eax, dword [esi + 0x24]
mov eax, dword [eax]
sub eax, ebx
test eax, 0xfffffffe
je 0x40aa89
mov eax, dword [esp + 0x34]
mov ecx, dword [eax + 4]
push 0x2b
lea ecx, [esp + ecx + 0x38]
call fcn.004014e3
cmp word [ebx], ax
je 0x40aaa2
mov eax, dword [esp + 0x34]
mov ecx, dword [eax + 4]
push 0x2d
lea ecx, [esp + ecx + 0x38]
call fcn.004014e3
cmp word [ebx], ax
je 0x40aaa2
mov eax, dword [esp + 0x34]
mov ecx, dword [eax + 4]
push 0x20
lea ecx, [esp + ecx + 0x38]
call fcn.004014e3
movzx eax, ax
mov dword [esp + 0x18], eax
mov eax, dword [esi + 0x24]
mov eax, dword [eax]
mov ecx, dword [esi + 0x14]
sub eax, dword [ecx]
xor ecx, ecx
sar eax, 1
cmp word [esp + 0x18], cx
mov dword [esp + 0x24], eax
mov eax, dword [edi + 0x5c]
setne cl
sub eax, ecx
cmp dword [esp + 0x24], eax
mov dword [esp + 0x20], eax
lea eax, [esp + 0x24]
jb 0x40aad3
lea eax, [esp + 0x20]
mov edx, dword [edi + 0x60]
mov ecx, dword [esp + 0x34]
mov ecx, dword [ecx + 4]
movzx ecx, word [esp + ecx + 0x64]
mov eax, dword [eax]
shr edx, 2
and edx, 0xffffff01
push edx
push dword [esp + 0x1c]
push dword [esp + 0x24]
push ecx
push dword [esp + 0x38]
push eax
push ebx
push dword [ebp + 0x10]
call fcn.0040bbbd
add esp, 0x20
jmp 0x40ad3d
push dword [ebp + 8]
lea eax, [esp + 0x38]
push eax
call fcn.0040c512
mov eax, dword [esi + 0x14]
pop ecx
pop ecx
mov ecx, dword [eax]
mov eax, dword [esi + 0x24]
mov eax, dword [eax]
mov ebx, eax
sub ebx, ecx
sar ebx, 1
test byte [edi + 0x60], 2
mov dword [esp + 0x18], ecx
mov byte [esp + 0x17], 0
je 0x40ab82
mov ecx, dword [esi + 0x14]
sub eax, dword [ecx]
test eax, 0xfffffffe
je 0x40ab7d
mov eax, dword [esp + 0x34]
mov ecx, dword [eax + 4]
push 0x2b
lea ecx, [esp + ecx + 0x38]
call fcn.004014e3
mov ecx, dword [esp + 0x18]
cmp word [ecx], ax
je 0x40ab82
mov eax, dword [esp + 0x34]
mov ecx, dword [eax + 4]
push 0x2d
lea ecx, [esp + ecx + 0x38]
call fcn.004014e3
mov ecx, dword [esp + 0x18]
cmp word [ecx], ax
je 0x40ab82
mov byte [esp + 0x17], 1
mov eax, dword [esp + 0x28]
cmp ebx, eax
jne 0x40aba8
cmp eax, dword [edi + 0x5c]
jg 0x40aba8
cmp byte [esp + 0x17], 0
jne 0x40aba8
mov ecx, dword [ebp + 0x10]
push ebx
push dword [esp + 0x1c]
call fcn.0040fd27
jmp 0x40ad3d
mov ecx, dword [ebp + 0x10]
push ebx
push dword [esp + 0x1c]
call fcn.0040fd27
mov ecx, esi
call fcn.0040bb4f
push 1
push esi
lea ecx, [esp + 0x74]
call fcn.0040b9ba
push dword [ebp + 0x18]
mov byte [esp + 0xbc], 1
mov eax, dword [esp + 0x78]
mov eax, dword [eax + 4]
lea eax, [esp + eax + 0x78]
push eax
lea ecx, [edi + 0x3c]
call fcn.0040ba9c
mov eax, dword [esp + 0x74]
mov eax, dword [eax + 4]
lea eax, [esp + eax + 0x74]
and dword [eax + 0x18], 0
cmp byte [esp + 0x17], 0
je 0x40ac0b
lea eax, [esp + 0x74]
push 0x20
push eax
call fcn.00403c48
pop ecx
pop ecx
push dword [ebp + 8]
lea eax, [esp + 0x78]
push eax
call fcn.0040c512
mov eax, dword [esi + 0x24]
mov eax, dword [eax]
pop ecx
pop ecx
mov ecx, dword [esi + 0x14]
sub eax, dword [ecx]
test eax, 0xfffffffe
jne 0x40ac44
test byte [edi + 0x60], 2
je 0x40ac44
lea eax, [esp + 0x74]
push 0x20
push eax
mov byte [esp + 0x1f], 1
call fcn.00403c48
pop ecx
pop ecx
mov eax, dword [esi + 0x14]
mov ecx, dword [eax]
mov eax, dword [esi + 0x24]
mov eax, dword [eax]
mov edi, dword [edi + 0x5c]
sub eax, ecx
sar eax, 1
mov dword [esp + 0x1c], eax
cmp eax, edi
mov dword [esp + 0x24], ecx
mov dword [esp + 0x20], edi
lea eax, [esp + 0x1c]
jb 0x40ac6d
lea eax, [esp + 0x20]
mov edi, dword [eax]
cmp dword [esp + 0x28], edi
mov dword [esp + 0x1c], edi
ja 0x40ac88
push edi
push ecx
mov ecx, dword [ebp + 0x10]
call fcn.0040fd27
jmp 0x40ad2c
xor ecx, ecx
cmp byte [esp + 0x17], cl
lea eax, [esp + 0x1c]
setne cl
add ebx, ecx
cmp edi, ebx
mov dword [esp + 0x20], ebx
jb 0x40aca3
lea eax, [esp + 0x20]
movzx ebx, byte [esp + 0x17]
mov eax, dword [eax]
cmp ebx, eax
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], ebx
jae 0x40ace5
mov eax, ebx
sub eax, ecx
mov dword [esp + 0x18], eax
jmp 0x40acc4
mov eax, dword [esp + 0x18]
mov ecx, dword [ebp + 0x10]
push eax
call fcn.00404d58
mov ecx, dword [esp + 0x24]
mov cx, word [ecx + ebx*2]
cmp cx, word [eax]
jne 0x40ace5
inc ebx
inc dword [esp + 0x18]
cmp ebx, dword [esp + 0x1c]
jb 0x40acc0
cmp ebx, edi
jb 0x40aced
mov ebx, dword [esp + 0x20]
mov ecx, dword [ebp + 0x10]
push ebx
push dword [esp + 0x28]
call fcn.0040fd27
mov ecx, dword [esp + 0x74]
mov ecx, dword [ecx + 4]
movzx ecx, word [esp + ecx + 0xa4]
mov eax, dword [esp + 0x28]
push ecx
mov ecx, dword [ebp + 0x10]
sub eax, edi
push eax
call fcn.00401561
mov eax, dword [esp + 0x24]
mov ecx, dword [ebp + 0x10]
sub edi, ebx
push edi
lea eax, [eax + ebx*2]
push eax
call fcn.00401fd5
lea ecx, [esp + 0x6c]
mov byte [esp + 0xb8], 0
call fcn.0040b678
mov ecx, esi
call fcn.0040bb4f
or dword [esp + 0xb8], 0xffffffff
lea ecx, [esp + 0x2c]
call fcn.0040b678
mov ecx, dword [esp + 0xb0]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret