Function at 0x40f010
Capabilities:
Inspect section memory permissions
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x48
push ebx
push ebp
push esi
push edi
mov dword [esp + 0x48], 0
mov edi, 0x4701e0
test byte [edi + 0x14], 2
jne 0x40f8eb
cmp dword [edi], 4
jne 0x40f8eb
test byte [edi + 0x15e], 0x10
jne 0x40f8eb
mov dword [esp + 0x3c], 0
mov eax, dword [esp + 0x3c]
mov eax, dword [edi + eax*4 + 0x89]
test eax, eax
mov dword [esp + 0x14], eax
je 0x40f8d9
mov al, byte [edi + 0x5c]
mov esi, dword [esp + 0x14]
test al, 1
mov eax, dword [edi + 8]
movsx ecx, word [esi + 1]
cdq
je 0x40f089
and edx, 0xffff
add eax, edx
sar eax, 0x10
sub eax, ecx
mov dword [esp + 0x24], eax
jmp 0x40f09a
and edx, 0xffff
add eax, edx
sar eax, 0x10
add ecx, eax
mov dword [esp + 0x24], ecx
mov eax, dword [edi + 0xc]
mov dword [esp + 0x44], 0
movsx ecx, word [esi + 3]
cdq
and edx, 0xffff
mov ebp, 0x4701e0
add eax, edx
movsx edx, word [esi + 5]
sar eax, 0x10
add ecx, eax
mov dword [esp + 0x30], edx
movsx eax, word [esi + 7]
mov dword [esp + 0x40], ecx
mov dword [esp + 0x2c], eax
cmp dword [ebp], 4
jne 0x40f8bf
mov edx, dword [ebp + 0x14]
mov esi, dword [edi + 0x14]
mov ecx, edx
xor ecx, esi
test cl, 1
jne 0x40f8bf
mov eax, dword [edi + 0x60]
mov ecx, dword [ebp + 0x60]
cmp eax, ecx
je 0x40f8bf
mov eax, dword [edi + 0x156]
mov ecx, dword [ebp + 0x156]
imul eax, eax, 0xe03f
mov esi, 1
mov dword [esp + 0x18], eax
shl esi, cl
test dword [eax + 0x4dfd37], esi
je 0x40f8bf
test dl, 2
jne 0x40f8bf
mov eax, dword [ebp + 0x15a]
test eax, eax
jne 0x40f194
mov ecx, dword [ebp + 0xc]
mov eax, dword [ebp + 0x58]
cmp ecx, eax
jne 0x40f159
mov eax, dword [ebp + 0x1c]
test eax, eax
jne 0x40f159
mov edx, dword [esp + 0x14]
mov al, byte [edx + 0xa]
test al, 0x10
jne 0x40f8bf
jmp 0x40f168
mov eax, dword [esp + 0x14]
mov al, byte [eax + 0xa]
test al, 0x20
jne 0x40f8bf
test al, 8
je 0x40f17e
mov ecx, dword [ebp + 0x15e]
and ecx, 0xc
cmp cl, 0xc
je 0x40f8bf
test al, 0x80
je 0x40f194
mov edx, dword [ebp + 0x15e]
and edx, 0xc
cmp dl, 8
je 0x40f8bf
lea eax, [ebp + 0xd9]
mov dword [esp + 0x1c], 0
mov dword [esp + 0x20], eax
mov ecx, dword [esp + 0x20]
mov ecx, dword [ecx]
test ecx, ecx
mov dword [esp + 0x34], ecx
je 0x40f25f
test byte [ecx + 0xa], 6
je 0x40f25f
test byte [ebp + 0x5c], 1
je 0x40f1e1
mov eax, dword [ebp + 8]
movsx esi, word [ecx + 1]
cdq
and edx, 0xffff
add eax, edx
mov ebx, eax
sar ebx, 0x10
sub ebx, esi
jmp 0x40f1f6
mov eax, dword [ebp + 8]
movsx ebx, word [ecx + 1]
cdq
and edx, 0xffff
add eax, edx
sar eax, 0x10
add ebx, eax
mov eax, dword [ebp + 0xc]
mov dword [esp + 0x28], ebx
movsx esi, word [ecx + 3]
cdq
and edx, 0xffff
add eax, edx
movsx edx, word [ecx + 7]
sar eax, 0x10
add esi, eax
movsx eax, word [ecx + 5]
mov ecx, dword [esp + 0x30]
mov dword [esp + 0x38], esi
mov esi, dword [esp + 0x24]
sub ebx, eax
add ecx, esi
cmp ecx, ebx
jle 0x40f25f
mov ecx, dword [esp + 0x28]
mov ebx, dword [esp + 0x30]
add eax, ecx
mov ecx, esi
sub ecx, ebx
cmp ecx, eax
jge 0x40f25f
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x40]
mov ebx, dword [esp + 0x2c]
mov esi, eax
sub esi, edx
add ebx, ecx
cmp ebx, esi
jle 0x40f25f
mov esi, dword [esp + 0x2c]
add edx, eax
sub ecx, esi
cmp ecx, edx
jl 0x40f281
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x20]
inc eax
add edx, 4
cmp eax, 0x14
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], edx
jl 0x40f1a6
jmp 0x40f8bf
mov edx, dword [esp + 0x14]
mov ecx, dword [ebp + 0x156]
mov ebx, dword [0x447ee0]
mov dword [esp + 0x10], 0
mov al, byte [edx + 0xc]
mov esi, eax
mov eax, ecx
shl eax, 0xa
add eax, ebx
and esi, 0xff
mov dword [esp + 0x4c], esi
mov edx, dword [eax*4 + 0x4280e0]
mov eax, ecx
imul eax, eax, 0xe03f
mov dword [esp + 0x1c], edx
mov edx, dword [edi + 0x15a]
lea ebx, [eax + 0x4d1d80]
test edx, edx
mov edx, dword [esp + 0x18]
mov dword [esp + 0x20], ebx
jne 0x40f2e6
mov dword [edx + 0x4dfc79], ebp
mov dword [ebx + 0xdef9], edi
cmp dword [edi + 0x156], 0
jne 0x40f2ff
mov dword [0x4701c4], ecx
mov dword [0x4701c8], 0x3e8
mov ecx, dword [eax + 0x4dfd7f]
test ecx, ecx
je 0x40f313
mov eax, dword [eax + 0x4dfd83]
mov dword [esp + 0x1c], eax
mov ecx, dword [edi + 0x15e]
or ecx, 0x10
mov dword [edi + 0x15e], ecx
mov eax, dword [edi + 0x15a]
test eax, eax
jne 0x40f33d
mov ecx, dword [edi + 0x14]
and ecx, 1
mov eax, dword [ecx*4 + 0x41f130]
inc eax
mov dword [edi + 4], eax
mov eax, dword [ebp + 0x15a]
test eax, eax
jne 0x40f358
mov ecx, dword [edi + 0x14]
and ecx, 1
mov eax, dword [ecx*4 + 0x41f130]
dec eax
mov dword [ebp + 4], eax
mov eax, dword [ebp + 0x15a]
sub eax, 0
je 0x40f384
dec eax
jne 0x40f8bf
mov eax, dword [edi + 0x6c]
test eax, eax
je 0x40f8bf
mov dword [edi + 0x38], eax
mov dword [edi + 0x6c], 0
jmp 0x40f8bf
mov eax, dword [edx + 0x4dfd05]
test eax, eax
je 0x40f398
mov dword [edx + 0x4dfd05], 2
mov eax, dword [ebx + 0xdf51]
test eax, eax
je 0x40f3bd
test byte [ebx + 0x7cb6], 8
je 0x40f3bd
mov ecx, dword [edi + 8]
mov eax, dword [ebp + 8]
xor edx, edx
cmp ecx, eax
setle dl
inc edx
mov ecx, edx
jmp 0x40f3c2
mov ecx, 1
test byte [ebp + 0x15e], 0xc
jne 0x40f449
mov eax, dword [ebx + 0xdf5d]
test eax, eax
je 0x40f3ec
call fcn.00417a22
cdq
mov ecx, 0x64
idiv ecx
cmp edx, dword [ebx + 0xdf61]
jge 0x40f449
jmp 0x40f441
mov eax, dword [ebx + 0x7cb6]
test al, 8
je 0x40f42c
mov cl, byte [ebx + 0x7ca9]
mov edx, 1
add ecx, 4
shl edx, cl
mov ecx, dword [ebp + 0x156]
shl ecx, 0xa
add ecx, dword [0x447ee0]
test dword [ecx*4 + 0x4280e0], edx
jne 0x40f441
test al, 1
je 0x40f449
mov eax, dword [esp + 0x1c]
test eax, eax
jne 0x40f449
jmp 0x40f441
mov edx, dword [esp + 0x1c]
test edx, ecx
jne 0x40f441
test al, 1
je 0x40f449
mov eax, edx
test eax, 0xfffffff7
jne 0x40f449
mov dword [esp + 0x10], 1
mov eax, dword [ebp + 0x15e]
and eax, 0xc
cmp al, 0xc
jne 0x40f461
mov eax, 1
mov dword [esp + 0x10], eax
jmp 0x40f465
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x14]
test byte [ecx + 0xa], 0x40
je 0x40f475
xor eax, eax
mov dword [esp + 0x10], eax
test byte [ebx + 0x7cb6], 2
jne 0x40f48e
mov edx, dword [ebp + 0xc]
mov ecx, dword [ebp + 0x58]
cmp edx, ecx
jge 0x40f48e
xor eax, eax
mov dword [esp + 0x10], eax
mov ecx, dword [edi + 0x129]
test ecx, ecx
je 0x40f657
mov edx, dword [edi + 0xc]
cmp edx, dword [edi + 0x58]
mov edx, dword [ebp + 0xc]
cmp edx, dword [ebp + 0x58]
jge 0x40f4be
test eax, eax
je 0x40f4b6
xor eax, eax
mov ax, word [ecx + 0xb]
jmp 0x40f525
xor eax, eax
mov ax, word [ecx + 5]
jmp 0x40f525
test byte [esp + 0x1c], 8
je 0x40f4f6
test eax, eax
je 0x40f4ee
mov edx, dword [ebx + 0xdf5d]
xor eax, eax
mov ax, word [ecx + 9]
test edx, edx
je 0x40f525
lea edx, [eax + eax*8]
test byte [edx*4 + 0x438694], 1
je 0x40f525
xor eax, eax
mov ax, word [ecx + 7]
jmp 0x40f525
xor eax, eax
mov ax, word [ecx + 3]
jmp 0x40f525
test eax, eax
je 0x40f51f
mov edx, dword [ebx + 0xdf5d]
xor eax, eax
mov ax, word [ecx + 7]
test edx, edx
je 0x40f525
lea edx, [eax + eax*8]
test byte [edx*4 + 0x438694], 1
je 0x40f525
xor eax, eax
mov ax, word [ecx + 9]
jmp 0x40f525
xor eax, eax
mov ax, word [ecx + 1]
test eax, eax
je 0x40f657
lea ecx, [eax*4]
xor edx, edx
lea eax, [eax + eax*8]
mov dx, word [ecx + ebx + 0x6daa]
mov dword [ebp + 0x38], edx
mov dl, byte [eax*4 + 0x438694]
test dl, 1
je 0x40f558
mov dword [esp + 0x10], 0
mov edx, dword [esp + 0x14]
mov al, byte [edx + 0xc]
test al, al
je 0x40f635
mov eax, dword [esp + 0x18]
cmp word [ecx + eax + 0x4d8b2c], 0
lea ebx, [ecx + eax + 0x4d8b2c]
je 0x40f631
mov ecx, dword [esp + 0x34]
mov esi, dword [edi + 0x156]
mov edx, dword [esp + 0x28]
imul esi, esi, 0xe03f
movsx eax, word [ecx + 7]
push eax
add esi, 0x4d1d80
movsx eax, word [ecx + 5]
mov ecx, dword [esp + 0x3c]
push eax
mov eax, dword [esp + 0x34]
push ecx
mov ecx, dword [esp + 0x3c]
push edx
mov edx, dword [esp + 0x50]
push eax
mov eax, dword [esp + 0x38]
push ecx
push edx
lea ecx, [esp + 0x6c]
push eax
push ecx
call fcn.0040eab0
mov edx, dword [esp + 0x78]
mov eax, dword [esp + 0x74]
push edx
push eax
push 0x5d
push 4
call fcn.00406570
mov ecx, dword [edi + 0x156]
mov edx, dword [edi + 0x5c]
mov dword [eax + 0x156], ecx
mov ecx, dword [edi + 0x14]
mov dword [eax + 0x14], ecx
xor ecx, ecx
mov cx, word [ebx]
mov dword [eax + 0x5c], edx
mov dword [eax + 0x30], ecx
mov dword [eax + 0x15a], 1
lea edx, [ecx + ecx*4]
add esp, 0x34
shl edx, 3
sub edx, ecx
mov ecx, dword [esi + 0x110]
xor esi, esi
mov si, word [edx + ecx + 0x20]
mov ecx, dword [eax + 0x28]
or ecx, 0x40000000
mov dword [eax + 0x2c], esi
mov esi, dword [esp + 0x4c]
mov dword [eax + 0x28], ecx
mov ebx, dword [esp + 0x20]
mov eax, dword [ebp + 0x38]
test eax, eax
jne 0x40f672
test esi, esi
je 0x40f672
push 0xff
push str.reaction_error_1
call fcn.00415190
add esp, 8
jmp 0x40f8bf
test esi, esi
je 0x40f672
push 0xff
push str.reaction_error_2
call fcn.00415190
add esp, 8
jmp 0x40f8bf
mov eax, dword [esp + 0x10]
test eax, eax
je 0x40f700
mov edx, dword [edi + 0x5c]
xor edx, 1
test esi, esi
mov dword [ebp + 0x5c], edx
je 0x40f6e6
xor eax, eax
mov al, byte [0x43a29a]
mov dword [ebp + 0x40], eax
mov dword [edi + 0x40], eax
mov eax, dword [esp + 0x14]
mov edx, dword [ebp + 0x15e]
or edx, 0xc
mov cl, byte [eax + 0xa]
mov dword [ebp + 0x15e], edx
test cl, 4
je 0x40f6e6
mov edx, dword [esp + 0x18]
xor ecx, ecx
mov eax, 0x51eb851f
mov cl, byte [edx + 0x4d9a25]
imul ecx, esi
imul ecx
sar edx, 5
mov eax, edx
shr eax, 0x1f
add edx, eax
jne 0x40f6da
mov edx, 1
neg edx
push edx
push ebx
call fcn.0040e7c0
add esp, 8
mov eax, dword [edi + 0x68]
test eax, eax
je 0x40f896
mov dword [edi + 0x38], eax
mov dword [edi + 0x68], 0
jmp 0x40f896
mov ecx, dword [esp + 0x34]
test byte [ecx + 0xa], 4
je 0x40f73c
mov eax, dword [esp + 0x18]
push 0x8fffff
push 0x41f1f8
mov ecx, dword [eax + 0x4dfcad]
or ecx, 3
mov dword [eax + 0x4dfcad], ecx
mov eax, dword [ebx + 0xdf31]
inc eax
mov dword [ebx + 0xdf31], eax
call fcn.00415190
add esp, 8
mov edx, dword [edi + 0x5c]
xor edx, 1
test esi, esi
mov dword [ebp + 0x5c], edx
je 0x40f80e
xor eax, eax
mov al, byte [0x43a299]
mov dword [ebp + 0x40], eax
mov dword [edi + 0x40], eax
mov eax, dword [esp + 0x18]
mov edx, dword [edi + 0x156]
movsx ecx, word [eax + 0x4d9a3e]
push ecx
push edx
call fcn.0040e6f0
movsx eax, word [ebx + 0x7cc0]
mov ecx, dword [ebp + 0x156]
push eax
push ecx
call fcn.0040e6f0
mov eax, dword [esp + 0x28]
xor ecx, ecx
mov edx, dword [ebp + 0x15e]
add esp, 0x10
mov cl, byte [eax + 0x4d9a28]
and edx, 0xfffffffb
imul ecx, dword [ebx + 0xdf01]
imul ecx, esi
or edx, 8
mov eax, 0xae147ae1
mov dword [ebp + 0x15e], edx
imul ecx
sar edx, 5
mov ecx, edx
shr ecx, 0x1f
add edx, ecx
add esi, edx
cmp esi, 1
jge 0x40f7ce
mov esi, 1
mov edx, dword [esp + 0x34]
xor ecx, ecx
mov eax, 0x51eb851f
mov cl, byte [edx + 0xb]
imul ecx, esi
imul ecx
sar edx, 5
mov eax, edx
shr eax, 0x1f
add edx, eax
cmp edx, 1
jge 0x40f7f5
mov edx, 1
neg edx
push edx
push ebx
call fcn.0040e7c0
mov eax, dword [ebx + 0xdf01]
add esp, 8
inc eax
mov dword [ebx + 0xdf01], eax
mov esi, dword [esp + 0x20]
mov eax, dword [esi + 0xdf01]
lea ebx, [esi + 0xdf01]
cmp eax, 1
jle 0x40f859
mov eax, dword [esp + 0x38]
shl eax, 0x10
push eax
mov eax, dword [esp + 0x2c]
shl eax, 0x10
push eax
push 0x5e
push 7
call fcn.00406570
mov ecx, dword [ebx]
add esp, 0x10
mov dword [eax + 0x156], ecx
mov ecx, dword [eax + 0x28]
or ecx, 0x40000000
mov dword [eax + 0x15e], ebx
mov dword [eax + 0x28], ecx
mov eax, dword [edi + 0x15a]
test eax, eax
jne 0x40f885
mov eax, dword [esp + 0x18]
mov ecx, dword [eax + 0x4dfcad]
or ecx, 1
mov dword [eax + 0x4dfcad], ecx
mov eax, dword [esi + 0xdf31]
inc eax
mov dword [esi + 0xdf31], eax
jmp 0x40f896
mov eax, dword [edi + 0x6c]
test eax, eax
je 0x40f896
mov dword [edi + 0x38], eax
mov dword [edi + 0x6c], 0
mov eax, dword [edi + 0x15a]
test eax, eax
jne 0x40f8ac
mov edx, dword [esp + 0x20]
mov dword [edx + 0xdefd], edi
jmp 0x40f8bf
test dword [edi + 0x28], 0x20000000
je 0x40f8bf
mov eax, dword [esp + 0x20]
mov dword [eax + 0xdefd], edi
mov eax, dword [esp + 0x44]
add ebp, 0x17e
inc eax
cmp eax, 0x400
mov dword [esp + 0x44], eax
jl 0x40f0d0
mov eax, dword [esp + 0x3c]
inc eax
cmp eax, 0x14
mov dword [esp + 0x3c], eax
jl 0x40f04c
mov eax, dword [esp + 0x48]
add edi, 0x17e
inc eax
cmp eax, 0x400
mov dword [esp + 0x48], eax
jl 0x40f024
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x48
ret