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

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x5c
mov ecx, dword [esp + 0x74]
mov edx, dword [esp + 0x88]
lea eax, [esp + 0x4c]
test ecx, ecx
cmove ecx, eax
mov eax, dword [edx + 4]
test eax, eax
je 0x402eda
mov esi, dword [edx + 8]
mov edx, dword [esp + 0x7c]
lea ebx, [edx*8]
cdq
mov dword [esp + 0x24], esi
sub ebx, dword [esp + 0x84]
xor eax, edx
sub eax, edx
lea edx, [eax + 0x3fffffff]
shl eax, 5
lea edi, [edx*4]
bsr edx, dword [esi + edx*4]
lea esi, [ebx + eax - 1]
xor edx, 0x1f
sub esi, edx
xor edx, edx
mov eax, esi
div ebx
mov dword [esp + 0x2c], eax
mov dword [ecx], eax
mov eax, dword [esp + 0x70]
mov dword [esp + 0x3c], eax
test eax, eax
je 0x402f3d
mov eax, dword [esp + 0x80]
test eax, eax
jne 0x402cc3
mov eax, dword [esp + 0x84]
test eax, eax
jne 0x402f03
mov dword [esp + 0x80], 0xffffffff
test byte [esp + 0x3c], 3
jne 0x402cd2
cmp dword [esp + 0x7c], 4
jne 0x402cd2
cmp dword [esp + 0x80], 0xffffffff
mov eax, dword [esp + 0x78]
sete dl
and eax, dword [esp + 0x80]
cmp eax, 0xffffffff
je 0x402fe7
cmp dword [esp + 0x78], 1
sete al
test dl, dl
je 0x402f67
test al, al
je 0x402f67
mov eax, dword [esp + 0x24]
mov esi, dword [esp + 0x2c]
lea edx, [eax + esi*4 - 4]
test esi, esi
jle 0x402cb7
mov ebx, dword [esp + 0x3c]
xor eax, eax
lea esi, [esi]
mov ecx, dword [edx]
sub edx, 4
mov dword [ebx + eax*4], ecx
add eax, 1
cmp esi, eax
jne 0x402ca8
mov eax, dword [esp + 0x3c]
add esp, 0x5c
pop ebx
pop esi
pop edi
pop ebp
ret
mov ebp, dword [esp + 0x84]
test ebp, ebp
je 0x402c46
mov eax, ebx
shr eax, 3
mov dword [esp + 0x10], eax
mov eax, ebx
and eax, 7
mov edx, eax
mov dword [esp + 0x28], eax
mov eax, 1
mov ecx, edx
shl eax, cl
mov ecx, dword [esp + 0x80]
sub eax, 1
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x7c]
test ecx, ecx
js 0x402f32
mov edx, dword [esp + 0x78]
test edx, edx
js 0x402ef4
sub eax, dword [esp + 0x7c]
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x2c]
sub eax, 1
imul eax, dword [esp + 0x7c]
mov edx, dword [esp + 0x7c]
mov ebp, dword [esp + 0x80]
lea edx, [eax + edx - 1]
test ebp, ebp
cmovns eax, edx
add eax, dword [esp + 0x3c]
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x24]
lea eax, [eax + edi + 4]
mov dword [esp + 0x1c], eax
cmp esi, ebx
jb 0x402cb7
mov edi, dword [esp + 0x80]
mov eax, dword [esp + 0x10]
mov dword [esp + 0x20], 0
xor edx, edx
neg edi
imul eax, edi
mov dword [esp + 0x34], eax
xor eax, eax
lea esi, [esi]
mov ecx, dword [esp + 0x10]
mov esi, dword [esp + 0x18]
xor ebx, ebx
test ecx, ecx
je 0x402e06
mov dword [esp + 0x14], edi
mov ebp, dword [esp + 0x24]
mov ecx, eax
jmp 0x402db5
mov byte [esi], cl
sub edx, 8
shr ecx, 8
add esi, dword [esp + 0x14]
add ebx, 1
cmp ebx, dword [esp + 0x10]
je 0x402df0
mov eax, ecx
cmp edx, 7
jg 0x402da0
xor ecx, ecx
cmp dword [esp + 0x1c], ebp
je 0x402dde
mov edi, dword [ebp]
mov ecx, edx
add ebp, 4
shl edi, cl
mov ecx, 8
or eax, edi
mov edi, dword [ebp - 4]
sub ecx, edx
shr edi, cl
mov ecx, edi
mov byte [esi], al
add edx, 0x18
add esi, dword [esp + 0x14]
add ebx, 1
cmp ebx, dword [esp + 0x10]
jne 0x402db5
mov ebx, dword [esp + 0x34]
mov edi, dword [esp + 0x14]
mov dword [esp + 0x24], ebp
mov eax, ecx
add dword [esp + 0x18], ebx
mov ebx, dword [esp + 0x10]
mov esi, dword [esp + 0x28]
test esi, esi
je 0x402e33
mov byte [esp + 0x14], al
movzx ebp, byte [esp + 0x38]
cmp edx, esi
jl 0x402e90
mov ecx, ebp
mov ebp, dword [esp + 0x18]
sub edx, esi
and ecx, eax
mov byte [ebp], cl
mov ecx, esi
shr eax, cl
add dword [esp + 0x18], edi
add ebx, 1
mov ecx, dword [esp + 0x18]
mov ebp, dword [esp + 0x7c]
mov esi, ebx
cmp dword [esp + 0x7c], ebx
jbe 0x402e64
lea esi, [esi]
nop
add ebx, 1
mov byte [ecx], 0
add ecx, edi
cmp ebp, ebx
jne 0x402e48
sub esi, dword [esp + 0x7c]
imul esi, dword [esp + 0x80]
add dword [esp + 0x18], esi
add dword [esp + 0x20], 1
mov ebx, dword [esp + 0x30]
mov esi, dword [esp + 0x20]
add dword [esp + 0x18], ebx
cmp dword [esp + 0x2c], esi
ja 0x402d80
mov eax, dword [esp + 0x3c]
add esp, 0x5c
pop ebx
pop esi
pop edi
pop ebp
ret
mov ecx, dword [esp + 0x24]
xor eax, eax
cmp dword [esp + 0x1c], ecx
je 0x402ebf
mov eax, dword [ecx]
mov ecx, edx
mov esi, eax
shl esi, cl
mov ecx, esi
mov esi, dword [esp + 0x28]
or byte [esp + 0x14], cl
sub esi, edx
mov ecx, esi
shr eax, cl
mov ecx, dword [esp + 0x24]
lea esi, [ecx + 4]
mov dword [esp + 0x24], esi
movzx esi, byte [esp + 0x14]
sub edx, dword [esp + 0x28]
add edx, 0x20
and esi, ebp
mov ecx, esi
mov esi, dword [esp + 0x18]
mov byte [esi], cl
jmp 0x402e2c
mov eax, dword [esp + 0x70]
mov dword [ecx], 0
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x3c]
add esp, 0x5c
pop ebx
pop esi
pop edi
pop ebp
ret
add eax, dword [esp + 0x7c]
mov dword [esp + 0x30], eax
xor eax, eax
jmp 0x402d29
mov dword [esp + 0x80], 0xffffffff
mov eax, ebx
shr eax, 3
mov dword [esp + 0x10], eax
mov eax, ebx
and eax, 7
mov edx, eax
mov dword [esp + 0x28], eax
mov eax, 1
mov ecx, edx
shl eax, cl
sub eax, 1
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x7c]
neg eax
jmp 0x402d09
mov eax, dword [esp + 0x2c]
imul eax, dword [esp + 0x7c]
mov dword [esp], eax
call dword [0x431448]
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x80]
test eax, eax
je 0x402c2c
jmp 0x402cc3
cmp dword [esp + 0x80], 1
sete dl
cmp dword [esp + 0x78], 0xffffffff
jne 0x402fa7
test dl, dl
je 0x402fa7
mov esi, dword [esp + 0x2c]
test esi, esi
jle 0x402cb7
mov ecx, dword [esp + 0x24]
mov ebx, dword [esp + 0x3c]
xor edx, edx
mov eax, dword [ecx + edx*4]
bswap eax
mov dword [ebx + edx*4], eax
add edx, 1
cmp esi, edx
jne 0x402f93
jmp 0x402cb7
test al, al
je 0x402cd2
test dl, dl
je 0x402cd2
mov eax, dword [esp + 0x24]
mov esi, dword [esp + 0x2c]
lea ecx, [eax + esi*4 - 4]
test esi, esi
jle 0x402cb7
mov ebx, dword [esp + 0x3c]
xor edx, edx
mov eax, dword [ecx]
sub ecx, 4
bswap eax
mov dword [ebx + edx*4], eax
add edx, 1
cmp esi, edx
jne 0x402fd1
jmp 0x402cb7
mov eax, dword [esp + 0x2c]
mov dword [esp + 8], eax
mov eax, dword [esp + 0x24]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x3c]
mov dword [esp], eax
call fcn.00418440
jmp 0x402cb7