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

Disassembly:
sub esp, 0x68
push ebx
push ebp
push esi
mov esi, dword [esp + 0x78]
push edi
mov edi, eax
mov eax, 0xff
cmp word [esi + 0x10], ax
jne 0x40f533
mov ecx, eax
cmp word [esi + 0x14], cx
jne 0x40f533
mov edx, eax
cmp word [esi + 0x12], dx
jne 0x40f533
cmp dword [esi + 0x5c], 0
mov byte [esp + 0x13], 1
jne 0x40f538
mov byte [esp + 0x13], 0
mov eax, dword [esi + 0x54]
mov eax, dword [eax + 0xe098]
test eax, eax
je 0x40f559
cmp dword [esi + 0x50], eax
je 0x40f559
mov eax, esi
call fcn.0040e180
test eax, eax
je 0x40f950
mov ecx, dword [esi + 0x30]
mov ebp, dword [edi + 4]
xor edx, edx
mov eax, ebp
div ecx
mov ebx, dword [edi + 0xc]
mov eax, ebx
sub ebp, edx
xor edx, edx
div ecx
mov dword [edi + 4], ebp
sub ebx, edx
xor edx, edx
lea ebx, [ebx + ecx - 1]
mov dword [esp + 0x40], ebx
mov dword [edi + 0xc], ebx
mov ebx, dword [edi]
mov eax, ebx
div ecx
mov eax, dword [edi + 8]
sub ebx, edx
xor edx, edx
div ecx
mov eax, dword [edi + 8]
mov dword [edi], ebx
sub eax, edx
lea eax, [eax + ecx - 1]
mov dword [edi + 8], eax
mov dword [esp + 0x44], eax
xor edx, edx
mov eax, ebp
div ecx
xor edx, edx
movzx edi, byte [esi + 0xc]
mov dword [esp + 0x6c], eax
mov eax, dword [esp + 0x40]
div ecx
xor edx, edx
mov dword [esp + 0x74], eax
mov eax, ebx
div ecx
xor edx, edx
mov dword [esp + 0x68], eax
mov eax, dword [esp + 0x44]
div ecx
mov ecx, dword [esi + 4]
mov dword [esp + 0x70], eax
mov eax, edi
imul eax, ebx
cdq
and edx, 7
add eax, edx
mov ebx, eax
mov edx, ecx
imul edx, ebp
mov eax, edi
imul eax, dword [esp + 0x68]
sar ebx, 3
add ebx, edx
add ebx, dword [esi + 0x50]
cdq
and edx, 7
add eax, edx
mov edx, dword [esp + 0x6c]
imul ecx, edx
mov ebp, eax
sar ebp, 3
add ebp, ecx
add ebp, dword [esi + 0x34]
cmp byte [esi + 0xf], 0
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x40], ebp
je 0x40f8df
movzx edi, byte [esi + 0xc]
mov eax, dword [esp + 0x74]
shr edi, 3
cmp edx, eax
mov dword [esp + 0x48], edi
jge 0x40f950
mov ecx, dword [esp + 0x70]
sub ecx, dword [esp + 0x68]
sub eax, edx
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x44], eax
xor edx, edx
cmp dword [esp + 0x3c], edx
mov dword [esp + 0x18], edx
jle 0x40f8b5
mov dword [esp + 0x38], ebp
jmp 0x40f662
xor edx, edx
mov ebx, dword [esi + 0x30]
mov dword [esp + 0x2c], edx
mov dword [esp + 0x30], edx
mov dword [esp + 0x34], edx
mov dword [esp + 0x14], edx
mov dword [esp + 0x4c], ebx
cmp ebx, edx
jbe 0x40f7af
xor eax, eax
cmp ebx, edx
jbe 0x40f79e
movzx ecx, byte [esi + 0x16]
mov dword [esp + 0x50], ecx
movzx ecx, word [esi + 0x10]
mov dword [esp + 0x54], ecx
movzx ecx, byte [esi + 0x17]
mov dword [esp + 0x58], ecx
movzx ecx, word [esi + 0x12]
mov dword [esp + 0x5c], ecx
movzx ecx, byte [esi + 0x18]
mov dword [esp + 0x60], ecx
movzx ecx, word [esi + 0x14]
mov dword [esp + 0x64], ecx
jmp 0x40f6c0
cmp edi, 2
mov dword [esp + 0x24], edx
mov dword [esp + 0x28], edx
mov dword [esp + 0x20], edx
jl 0x40f727
imul ebx, dword [esp + 0x18]
mov esi, dword [esi + 4]
imul esi, dword [esp + 0x14]
add ebx, eax
imul ebx, edi
add ebx, dword [esp + 0x1c]
add edi, 0xfffffffe
shr edi, 1
xor ebp, ebp
add esi, ebx
inc edi
lea ecx, [edi + edi]
mov dword [esp + 0x20], ecx
movzx ebx, byte [esi]
mov ecx, ebp
shl ebx, cl
lea ecx, [ebp + 8]
add esi, 2
add ebp, 0x10
add dword [esp + 0x24], ebx
movzx ebx, byte [esi - 1]
shl ebx, cl
add dword [esp + 0x28], ebx
sub edi, 1
jne 0x40f6f8
mov edi, dword [esp + 0x48]
mov esi, dword [esp + 0x7c]
mov ebx, dword [esp + 0x4c]
cmp dword [esp + 0x20], edi
jae 0x40f759
mov ebp, dword [esi + 4]
imul ebp, dword [esp + 0x14]
mov ecx, dword [esp + 0x20]
mov edx, ebx
imul edx, dword [esp + 0x18]
add edx, eax
imul edx, edi
add edx, ecx
add ebp, edx
mov edx, dword [esp + 0x1c]
movzx edx, byte [edx + ebp]
add ecx, ecx
add ecx, ecx
add ecx, ecx
shl edx, cl
mov ebp, dword [esp + 0x28]
mov ecx, dword [esp + 0x24]
add ecx, ebp
add edx, ecx
mov ecx, dword [esp + 0x50]
mov ebp, edx
shr ebp, cl
mov ecx, dword [esp + 0x58]
inc eax
and ebp, dword [esp + 0x54]
add dword [esp + 0x2c], ebp
mov ebp, edx
shr ebp, cl
mov ecx, dword [esp + 0x60]
shr edx, cl
and ebp, dword [esp + 0x5c]
and edx, dword [esp + 0x64]
add dword [esp + 0x30], ebp
add dword [esp + 0x34], edx
xor edx, edx
cmp eax, ebx
jb 0x40f6c0
mov eax, dword [esp + 0x14]
inc eax
mov dword [esp + 0x14], eax
cmp eax, ebx
jb 0x40f681
mov ecx, dword [esi + 0x30]
mov eax, dword [esp + 0x2c]
imul ecx, ecx
xor edx, edx
div ecx
xor edx, edx
mov ebx, eax
mov eax, dword [esp + 0x30]
div ecx
xor edx, edx
mov ebp, eax
mov eax, dword [esp + 0x34]
div ecx
cmp byte [esp + 0x13], 0
je 0x40f85b
imul ebx, ebx, 0xb
lea eax, [eax + eax*4]
shl ebp, 4
add eax, ebp
add eax, ebx
cdq
and edx, 0x1f
add eax, edx
sar eax, 5
cmp eax, 0x20
jg 0x40f7fe
mov eax, 0x101010
jmp 0x40f871
cmp eax, 0x40
jg 0x40f80a
mov eax, 0x303030
jmp 0x40f871
cmp eax, 0x60
jg 0x40f816
mov eax, 0x505050
jmp 0x40f871
cmp eax, 0x80
jg 0x40f824
mov eax, 0x707070
jmp 0x40f871
cmp eax, 0xa0
jg 0x40f832
mov eax, 0x909090
jmp 0x40f871
cmp eax, 0xc0
jg 0x40f840
mov eax, 0xb0b0b0
jmp 0x40f871
xor edx, edx
cmp eax, 0xe0
setg dl
dec edx
and edx, 0xffdfdfe0
add edx, 0xf0f0f0
mov eax, edx
jmp 0x40f871
movzx ecx, byte [esi + 0x18]
shl eax, cl
movzx ecx, byte [esi + 0x17]
shl ebp, cl
movzx ecx, byte [esi + 0x16]
shl ebx, cl
add eax, ebp
add eax, ebx
xor edx, edx
test edi, edi
jbe 0x40f896
xor ebp, ebp
lea esp, [esp]
mov ecx, ebp
mov ebx, eax
shr ebx, cl
mov ecx, dword [esp + 0x38]
inc edx
add ebp, 8
mov byte [ecx + edx - 1], bl
cmp edx, edi
jb 0x40f880
mov eax, dword [esp + 0x18]
add dword [esp + 0x38], edi
inc eax
cmp eax, dword [esp + 0x3c]
mov dword [esp + 0x18], eax
jl 0x40f660
mov ebp, dword [esp + 0x40]
mov ebx, dword [esp + 0x1c]
mov eax, dword [esi + 4]
mov edx, dword [esi + 0x30]
imul edx, eax
add ebx, edx
add ebp, eax
sub dword [esp + 0x44], 1
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x40], ebp
jne 0x40f649
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x68
ret 4
movzx eax, byte [esi + 0xc]
mov ecx, dword [esp + 0x74]
shr eax, 3
cmp edx, ecx
mov dword [esp + 0x38], eax
jge 0x40f950
mov edi, dword [esp + 0x70]
sub edi, dword [esp + 0x68]
sub ecx, edx
mov dword [esp + 0x44], edi
mov dword [esp + 0x40], ecx
xor edi, edi
cmp dword [esp + 0x44], edi
jle 0x40f93c
mov dword [esp + 0x7c], ebp
mov edx, dword [esp + 0x7c]
mov ecx, edi
imul ecx, eax
imul ecx, dword [esi + 0x30]
push eax
add ecx, ebx
push ecx
push edx
call fcn.00462180
mov eax, dword [esp + 0x44]
add dword [esp + 0x88], eax
inc edi
add esp, 0xc
cmp edi, dword [esp + 0x44]
jl 0x40f910
mov ecx, dword [esi + 4]
mov edx, dword [esi + 0x30]
imul edx, ecx
add ebx, edx
add ebp, ecx
sub dword [esp + 0x40], 1
jne 0x40f904
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x68
ret 4