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

Disassembly:
push ebp
push edi
xor eax, eax
push esi
push ebx
sub esp, 0x1cc
mov ecx, dword [esp + 0x1ec]
cmp ecx, 0x64
ja 0x501894
mov ebx, dword [esp + 0x1e0]
mov esi, dword [esp + 0x1e4]
mov edi, dword [esp + 0x1e8]
test ebx, ebx
sete dl
test esi, esi
setle bl
or edx, ebx
test edi, edi
setle bl
or dl, bl
jne 0x501894
mov eax, ecx
mov edx, 0x51eb851f
sar ecx, 0x1f
imul edx
mov eax, 1
sar edx, 3
sub edx, ecx
mov esi, edx
mov dword [esp + 0x3c], edx
je 0x501894
lea edx, [esp + 0x78]
xor ebp, ebp
mov ecx, 0x12
mov eax, ebp
mov edi, edx
rep stosd dword es:[edi], eax
lea eax, [esi + esi]
mov edi, esi
mov dword [esp], 1
mov dword [esp + 4], 0
lea ebx, [eax + 1]
add eax, 2
imul eax, dword [esp + 0x1e4]
lea esi, [eax + eax]
mov eax, dword [esp + 0x1e4]
add eax, eax
mov dword [esp + 0x2c], eax
lea eax, [esi + eax + 0xffe]
mov dword [esp + 8], eax
call fcn.004ff1a0
mov ecx, eax
xor eax, eax
test ecx, ecx
je 0x501894
mov eax, dword [esp + 0x1e4]
mov edx, dword [esp + 0x2c]
mov dword [esp + 4], 0
mov dword [esp + 0x94], ecx
mov dword [esp + 0x98], ecx
mov dword [esp + 0x9c], ecx
imul eax, ebx
mov dword [esp + 8], edx
mov dword [esp + 0x30], ecx
imul ebx, ebx
lea eax, [ecx + eax*2]
mov dword [esp + 0x1c], eax
mov dword [esp + 0xa0], eax
sub eax, edx
mov dword [esp], eax
mov dword [esp + 0x5c], eax
mov dword [esp + 0xa4], eax
call sub.msvcrt.dll_memset
mov eax, dword [esp + 0x1e4]
mov dword [esp + 0x8c], edi
mov ecx, 0x40
add esi, dword [esp + 0x30]
mov dword [esp + 0xb0], 0xff
mov byte [esp + 0x38], 0
mov dword [esp + 0x78], eax
mov eax, dword [esp + 0x1e8]
mov dword [esp + 0x34], esi
mov dword [esp + 0xa8], esi
mov esi, 0xff
mov dword [esp + 0x7c], eax
mov eax, dword [esp + 0x1e0]
mov dword [esp + 0x84], eax
mov dword [esp + 0x88], eax
mov eax, 0x40000
cdq
idiv ebx
lea ebx, [esp + 0xc0]
mov edx, edi
neg edx
mov edi, ebx
mov dword [esp + 0x24], edx
mov dword [esp + 0x80], edx
mov edx, dword [esp + 0x1e0]
mov dword [esp + 0x40], eax
mov dword [esp + 0x90], eax
mov eax, ebp
rep stosd dword es:[edi], eax
mov ecx, dword [esp + 0x1e4]
mov ebp, dword [esp + 0xb4]
xor edi, edi
imul ecx, dword [esp + 0x1e8]
mov eax, edi
xor edi, edi
mov dword [esp + 0x20], ebp
mov byte [esp + 0x18], al
mov ebp, 0xff
add ecx, edx
movzx eax, byte [edx]
cmp eax, ebp
jge 0x501700
mov esi, eax
mov ebp, eax
mov byte [esp + 0x38], 1
cmp eax, edi
jle 0x50170f
mov dword [esp + 0x20], eax
mov edi, eax
mov byte [esp + 0x18], 1
add edx, 1
mov byte [esp + eax + 0xc0], 1
cmp ecx, edx
jne 0x5016f0
mov dword [esp + 0x44], edi
movzx edi, byte [esp + 0x18]
mov dword [esp + 0x28], ebp
mov ebp, dword [esp + 0x20]
mov eax, edi
test al, al
jne 0x501b55
cmp byte [esp + 0x38], 0
jne 0x501b8d
mov ecx, dword [esp + 0x44]
sub ecx, dword [esp + 0x28]
xor edi, edi
mov esi, dword [esp + 0xac]
mov byte [esp + 0x18], 0
xor ebp, ebp
mov edx, 0xffffffff
xor eax, eax
mov dword [esp + 0xb8], ecx
mov dword [esp + 0x20], ecx
jmp 0x50178c
mov dword [esp + 0x20], edi
mov ecx, edi
mov edx, eax
mov edi, 1
mov byte [esp + 0x18], 1
add eax, 1
cmp eax, 0x100
je 0x5017b9
cmp byte [ebx + eax], 0
je 0x501782
add ebp, 1
cmp edx, 0xffffffff
je 0x5018a0
mov edi, eax
mov esi, ebp
sub edi, edx
cmp edi, ecx
jl 0x501770
mov edx, eax
mov edi, 1
add eax, 1
cmp eax, 0x100
jne 0x50178c
cmp byte [esp + 0x18], 0
jne 0x501b7d
mov eax, edi
test al, al
jne 0x501b71
mov edi, dword [esp + 0x2c]
mov eax, dword [esp + 0x34]
mov dword [esp + 0x48], ebp
lea eax, [eax + edi + 0x7fe]
mov edx, eax
mov dword [esp + 0x38], eax
mov dword [esp + 0xbc], eax
lea eax, [ecx*4]
lea ebx, [edx - 2]
mov ebp, edx
lea edi, [eax + ecx*8]
mov esi, eax
mov dword [esp + 0x18], eax
mov ecx, 1
sar edi, 2
sub esi, edi
mov dword [esp + 0x20], esi
mov esi, eax
sub esi, 1
imul esi, edi
jmp 0x501841
mov eax, ecx
sar eax, 2
mov edx, eax
neg eax
mov word [ebp + ecx*2], dx
add ecx, 1
mov word [ebx], ax
sub esi, edi
sub ebx, 2
cmp ecx, 0x400
je 0x5018c0
cmp edi, ecx
jge 0x501820
cmp dword [esp + 0x18], ecx
jle 0x5018b0
mov eax, esi
cdq
idiv dword [esp + 0x20]
sar eax, 2
mov edx, eax
neg eax
jmp 0x501829
cmp byte [esp + 0x58], 0
jne 0x501b61
mov edi, dword [esp + 0x24]
mov dword [esp + 0xa4], eax
mov eax, dword [esp + 0x18]
mov dword [esp + 0x80], edi
mov dword [esp + 0x9c], eax
mov eax, dword [esp + 0x30]
mov dword [esp], eax
call fcn.004ff2a0
mov eax, 1
add esp, 0x1cc
pop ebx
pop esi
pop edi
pop ebp
ret
mov esi, ebp
mov edx, eax
mov edi, 1
jmp 0x5017af
xor eax, eax
xor edx, edx
jmp 0x501829
mov ebp, dword [esp + 0x48]
mov eax, dword [esp + 0x38]
xor edx, edx
cmp ebp, 2
mov word [eax], dx
jle 0x501883
mov eax, dword [esp + 0x2c]
mov ebp, dword [esp + 0x1c]
mov byte [esp + 0x58], 0
lea edi, [eax - 2]
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x18], edi
add edi, ebp
lea esi, [eax + 1]
mov dword [esp + 0x6c], edi
lea edi, [ebp + eax*2]
mov ebx, esi
mov dword [esp + 0x4c], esi
mov esi, dword [esp + 0x1e4]
mov edx, edi
mov dword [esp + 0x50], edi
mov edi, dword [esp + 0x5c]
sub esi, eax
mov ecx, esi
mov dword [esp + 0x60], esi
mov esi, eax
shl eax, 2
sub edx, eax
cmp ecx, ebx
mov eax, ebx
mov dword [esp + 0x54], edx
mov edx, dword [esp + 0x18]
cmovge eax, ecx
mov ebx, eax
mov dword [esp + 0x64], eax
sub edx, esi
mov esi, dword [esp + 0x1e8]
mov eax, edx
sub eax, ebx
lea eax, [ebp + eax*2]
sub esi, 1
mov dword [esp + 0x20], esi
mov dword [esp + 0x68], eax
mov eax, dword [esp + 0x1e0]
mov ebp, eax
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x30]
nop
xor ecx, ecx
xor edx, edx
mov dword [esp + 0x18], edi
nop
lea esi, [esi]
movzx ebx, byte [ebp + edx]
mov esi, dword [esp + 0x18]
mov edi, dword [esp + 0x1c]
add ecx, ebx
mov ebx, ecx
add bx, word [esi + edx*2]
mov esi, ebx
sub si, word [eax + edx*2]
mov word [edi + edx*2], si
mov word [eax + edx*2], bx
add edx, 1
cmp dword [esp + 0x1e4], edx
jne 0x501970
mov esi, dword [esp + 0x2c]
add esi, eax
cmp edi, esi
mov edi, dword [esp + 0x24]
cmove esi, dword [esp + 0x30]
test edi, edi
mov dword [esp + 0x18], esi
js 0x5019ce
mov edx, dword [esp + 0x1e4]
add edx, ebp
cmp dword [esp + 0x20], edi
cmovg ebp, edx
cmp dword [esp + 0x3c], edi
jle 0x5019f0
add dword [esp + 0x24], 1
mov edi, eax
mov esi, dword [esp + 0x24]
cmp dword [esp + 0x1e8], esi
je 0x50185b
mov eax, dword [esp + 0x18]
jmp 0x501960
mov edi, dword [esp + 0x50]
mov dword [esp + 0x58], ebp
xor ecx, ecx
mov edx, dword [esp + 0x34]
mov esi, dword [esp + 0x4c]
mov ebp, dword [esp + 0x40]
mov dword [esp + 0x5c], eax
mov ebx, edi
lea esi, [esi]
movzx eax, word [ebx]
sub ebx, 2
add ax, word [edi + ecx*2 - 2]
movzx eax, ax
imul eax, ebp
shr eax, 0x10
mov word [edx + ecx*2], ax
add ecx, 1
cmp ecx, esi
jne 0x501a10
mov edi, dword [esp + 0x60]
mov esi, dword [esp + 0x4c]
mov ebp, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
cmp edi, esi
jle 0x501a85
mov ecx, esi
mov edx, edi
mov ebx, dword [esp + 0x34]
mov esi, dword [esp + 0x54]
mov edi, dword [esp + 0x50]
mov ebp, dword [esp + 0x40]
mov esi, esi
lea edi, [edi]
movzx eax, word [edi + ecx*2]
sub ax, word [esi + ecx*2 - 2]
movzx eax, ax
imul eax, ebp
shr eax, 0x10
mov word [ebx + ecx*2], ax
add ecx, 1
cmp edx, ecx
jne 0x501a60
mov ebp, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
mov edi, dword [esp + 0x64]
cmp dword [esp + 0x1e4], edi
jle 0x501ae2
mov ecx, edi
mov dword [esp + 0x58], ebp
mov ebx, dword [esp + 0x68]
mov edx, dword [esp + 0x34]
mov esi, dword [esp + 0x54]
mov edi, dword [esp + 0x6c]
mov ebp, dword [esp + 0x40]
mov dword [esp + 0x5c], eax
movzx eax, word [edi]
sub ebx, 2
add eax, eax
sub ax, word [ebx + 2]
sub ax, word [esi + ecx*2 - 2]
movzx eax, ax
imul eax, ebp
shr eax, 0x10
mov word [edx + ecx*2], ax
add ecx, 1
cmp dword [esp + 0x1e4], ecx
jne 0x501ab0
mov ebp, dword [esp + 0x58]
mov eax, dword [esp + 0x5c]
mov ecx, dword [esp + 0x48]
mov edi, dword [esp + 0x1e4]
mov ebx, dword [esp + 0x34]
mov edx, dword [esp + 0x44]
mov dword [esp + 0x48], ebp
mov dword [esp + 0x58], eax
add edi, ecx
nop
movzx eax, byte [ecx]
cmp eax, edx
jge 0x501b35
cmp eax, dword [esp + 0x28]
jle 0x501b35
movzx esi, word [ebx]
lea ebp, [eax*4]
sub esi, ebp
mov ebp, dword [esp + 0x38]
movsx esi, word [ebp + esi*2]
add eax, esi
mov esi, eax
not esi
sar esi, 0x1f
test eax, 0xffffff00
cmovne eax, esi
mov byte [ecx], al
add ecx, 1
add ebx, 2
cmp edi, ecx
jne 0x501b00
mov ebp, dword [esp + 0x48]
mov eax, dword [esp + 0x58]
mov dword [esp + 0x48], edi
mov byte [esp + 0x58], 1
jmp 0x5019ce
mov dword [esp + 0xb4], ebp
jmp 0x501739
mov edi, dword [esp + 0x48]
mov dword [esp + 0x88], edi
jmp 0x501866
mov dword [esp + 0xac], esi
jmp 0x5017ce
mov eax, dword [esp + 0x20]
mov dword [esp + 0xb8], eax
jmp 0x5017c4
mov dword [esp + 0xb0], esi
jmp 0x501744