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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff0
sub esp, 0xc58
mov eax, dword [0x40a004]
xor eax, esp
mov dword [esp + 0xc54], eax
movups xmm0, xmmword [ebp + 8]
push esi
push edi
mov edi, ecx
movups xmmword [esp + 0x40], xmm0
test edi, edi
je 0x4056e1
mov esi, dword [edi + 0x20]
cmp esi, 1
je 0x405375
cmp esi, 2
jne 0x40536a
cmp dword [esp + 0x40], 0
jne 0x40536a
cmp byte [esp + 0x48], 2
jb 0x405375
xor ecx, ecx
mov dword [esp + 0x38], ecx
jmp 0x40540d
push 0x400
lea eax, [esp + 0x85c]
mov dword [esp + 0x3c], 1
push 0
push eax
call sub.VCRUNTIME140.dll_memset
add esp, 0xc
lea eax, [esp + 0x88]
push 0x3d0
push 0
push eax
call sub.VCRUNTIME140.dll_memset
mov eax, dword [esp + 0x4c]
add esp, 0xc
mov ecx, dword [edi + 0xc]
mov dword [esp + 0x58], eax
mov eax, dword [esp + 0x44]
mov dword [esp + 0x60], eax
movzx eax, byte [esp + 0x48]
cdq
mov dword [esp + 0x68], eax
mov eax, esi
mov dword [esp + 0x70], ecx
mov ecx, dword [edi + 8]
mov dword [esp + 0x6c], edx
cdq
mov dword [esp + 0x78], ecx
mov ecx, 1
mov dword [esp + 0x5c], 0
mov dword [esp + 0x64], 0
mov dword [esp + 0x74], 0
mov dword [esp + 0x7c], 0
mov dword [esp + 0x80], eax
mov dword [esp + 0x84], edx
mov al, byte [esp + 0x48]
xor esi, esi
mov dword [esp + 0x18], esi
cmp dword [esp + 0x40], esi
jne 0x405477
test al, al
jne 0x405477
mov esi, 2
mov dword [esp + 0x18], esi
test ecx, ecx
je 0x405477
add dword [esp + 0x88], 1
lea eax, [esp + 0x458]
push 0
adc dword [esp + 0x90], 0
lea edx, [esp + 0x5c]
push eax
lea ecx, [esp + 0x860]
call fcn.00403db0
lea eax, [esp + 0x460]
push 0
push eax
mov edx, eax
lea ecx, [esp + 0x868]
call fcn.00403db0
mov al, byte [esp + 0x58]
add esp, 0x10
mov ecx, dword [edi + 0x10]
movzx edx, al
mov eax, dword [edi + 0x14]
imul eax, dword [esp + 0x44]
imul ecx, edx
mov dword [esp + 0x3c], edx
xor edx, edx
add eax, esi
add ecx, eax
mov dword [esp + 0x1c], ecx
mov eax, ecx
mov ecx, dword [edi + 0x14]
div ecx
mov eax, dword [esp + 0x1c]
test edx, edx
lea edx, [eax - 1]
jne 0x4054aa
add edx, ecx
mov dword [esp + 0x28], edx
cmp esi, dword [edi + 0x10]
jae 0x4056e1
shl edx, 0xa
mov ecx, eax
shl ecx, 0xa
mov dword [esp + 0x20], edx
mov dword [esp + 0x24], ecx
mov ecx, dword [edi + 0x14]
xor edx, edx
div ecx
mov dword [esp + 0x10], ecx
cmp edx, 1
jne 0x4054f4
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x24]
dec eax
add edx, 0xfffffc00
mov dword [esp + 0x28], eax
mov dword [esp + 0x20], edx
mov dword [esp + 0x10], ecx
jmp 0x4054f8
mov edx, dword [esp + 0x20]
cmp dword [esp + 0x38], 0
je 0x40556e
mov eax, esi
and eax, 0x7f
mov dword [esp + 0x14], eax
jne 0x40555a
add dword [esp + 0x88], 1
lea eax, [esp + 0x458]
push 0
adc dword [esp + 0x90], 0
lea edx, [esp + 0x5c]
push eax
lea ecx, [esp + 0x860]
call fcn.00403db0
lea eax, [esp + 0x460]
push 0
push eax
mov edx, eax
lea ecx, [esp + 0x868]
call fcn.00403db0
mov eax, dword [edi + 0x14]
add esp, 0x10
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x14]
mov ecx, dword [esp + eax*8 + 0x458]
mov eax, dword [esp + eax*8 + 0x45c]
mov dword [esp + 0x2c], ecx
jmp 0x405583
mov eax, dword [edi]
mov dword [esp + 0x10], ecx
mov esi, dword [edx + eax]
mov eax, dword [edx + eax + 4]
mov dword [esp + 0x2c], esi
mov esi, dword [esp + 0x18]
push 0
push dword [edi + 0x18]
push 0
push eax
call fcn.00407180
cmp dword [esp + 0x40], 0
mov cl, byte [esp + 0x48]
mov dword [esp + 0x14], eax
jne 0x4055ba
test cl, cl
jne 0x4055ba
mov eax, dword [esp + 0x44]
mov edx, 1
mov dword [esp + 0x14], eax
mov dword [esp + 0x34], 0
jmp 0x4055cd
cmp eax, dword [esp + 0x44]
jne 0x4055cb
test edx, edx
jne 0x4055cb
mov edx, 1
jmp 0x4055cd
xor edx, edx
cmp dword [esp + 0x40], 0
jne 0x405601
mov eax, dword [edi + 0x10]
mov dword [esp + 0x30], eax
test cl, cl
jne 0x4055e2
dec esi
jmp 0x405632
mov ecx, eax
imul ecx, dword [esp + 0x3c]
test edx, edx
je 0x4055f2
dec esi
add esi, ecx
jmp 0x405632
neg esi
mov dword [esp + 0x30], eax
sbb esi, esi
neg esi
dec esi
add esi, ecx
jmp 0x405632
mov ecx, dword [edi + 0x10]
mov dword [esp + 0x30], ecx
test edx, edx
je 0x405618
mov eax, dword [edi + 0x14]
mov dword [esp + 0x10], eax
sub eax, ecx
dec eax
jmp 0x405630
mov esi, ecx
mov eax, ecx
neg esi
not eax
cmp dword [esp + 0x18], 0
cmove esi, eax
mov eax, dword [esp + 0x10]
mov dword [esp + 0x10], eax
add esi, eax
mov eax, dword [esp + 0x2c]
push 0
push eax
push 0
push eax
call fcn.00407120
mov eax, edx
mul esi
dec esi
xor eax, eax
sub esi, edx
sbb eax, eax
xor ecx, ecx
mov dword [esp + 0x2c], eax
cmp dword [esp + 0x40], ecx
je 0x405669
cmp byte [esp + 0x48], 3
je 0x405669
mov ecx, dword [esp + 0x3c]
inc ecx
imul ecx, dword [esp + 0x30]
xor eax, eax
add ecx, esi
mov esi, dword [esp + 0x10]
adc eax, dword [esp + 0x2c]
push 0
push esi
push eax
push ecx
call fcn.00407180
imul esi, dword [esp + 0x14]
mov ecx, dword [edi]
mov edx, dword [esp + 0x24]
add edx, ecx
add esi, eax
xor eax, eax
shl esi, 0xa
add esi, ecx
cmp dword [edi + 4], 0x10
je 0x4056a2
cmp dword [esp + 0x40], eax
setne al
add ecx, dword [esp + 0x20]
push eax
push edx
mov edx, esi
call fcn.00403db0
mov esi, dword [esp + 0x20]
add esp, 8
mov eax, dword [esp + 0x1c]
inc esi
add dword [esp + 0x24], 0x400
inc eax
inc dword [esp + 0x28]
add dword [esp + 0x20], 0x400
mov dword [esp + 0x18], esi
mov dword [esp + 0x1c], eax
cmp esi, dword [edi + 0x10]
jb 0x4054c7
mov ecx, dword [esp + 0xc5c]
pop edi
pop esi
xor ecx, esp
call fcn.00406480
mov esp, ebp
pop ebp
ret