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

Disassembly:
sub esp, 0x34
push ebx
push ebp
mov ebp, dword [esp + 0x50]
push esi
mov esi, ecx
movsx ecx, ax
mov ebx, edx
mov edx, dword [0x3368dc]
cmp ecx, edx
push edi
jle 0x51369
movsx edi, word [esp + 0x4c]
cmp edi, edx
jle 0x51369
movsx edi, word [esp + 0x54]
cmp edi, edx
jle 0x51369
movsx edi, bx
cmp edi, edx
jg 0x51a3a
movsx edi, word [esp + 0x48]
mov edx, dword [0x3368e0]
cmp edi, edx
jle 0x51393
movsx edi, word [esp + 0x50]
cmp edi, edx
jle 0x51393
movsx edi, bp
cmp edi, edx
jle 0x51393
movsx edi, si
cmp edi, edx
jg 0x51a3a
mov edx, dword [0x3368d4]
cmp ecx, edx
jge 0x513ba
movsx ecx, word [esp + 0x4c]
cmp ecx, edx
jge 0x513ba
movsx ecx, word [esp + 0x54]
cmp ecx, edx
jge 0x513ba
movsx ecx, bx
cmp ecx, edx
jl 0x51a3a
movsx ecx, word [esp + 0x48]
mov edi, dword [0x3368d8]
cmp ecx, edi
jge 0x513e4
movsx ecx, word [esp + 0x50]
cmp ecx, edi
jge 0x513e4
movsx ecx, bp
cmp ecx, edi
jge 0x513e4
movsx ecx, si
cmp ecx, edi
jl 0x51a3a
cmp edi, dword [0x3368e0]
jge 0x51a3a
cmp edx, dword [0x3368dc]
jge 0x51a3a
mov edx, dword [esp + 0x78]
mov ecx, dword [esp + 0x74]
push edx
mov edx, dword [esp + 0x74]
push ecx
mov ecx, dword [esp + 0x74]
push edx
mov edx, dword [esp + 0x74]
push ecx
mov ecx, dword [esp + 0x74]
push edx
mov edx, dword [esp + 0x68]
push ecx
mov ecx, dword [esp + 0x68]
push esi
push ebx
push ebp
push edx
mov edx, dword [esp + 0x74]
push ecx
mov ecx, dword [esp + 0x74]
push edx
mov edx, dword [esp + 0x90]
push ecx
mov ecx, dword [esp + 0x90]
call fcn.0004e670
add esp, 0x34
test ax, ax
je 0x51a3a
movsx esi, word [0x4530e0]
cmp esi, edi
jge 0x51473
jmp 0x51460
call fcn.0004e560
test ax, ax
jne 0x51a3a
inc esi
cmp esi, edi
jl 0x51460
movsx eax, word [0x453104]
mov ecx, dword [0x4530e4]
movsx ebp, word [esp + 0x80]
movsx edx, word [esp + 0x7c]
mov edi, dword [0x4530dc]
add eax, ecx
movsx ecx, word [0x453100]
shl eax, 0xa
shl ebp, 0xa
add eax, edi
sar ecx, 1
add ebp, edx
cmp word [0x33679c], 0
lea ebx, [ecx + eax*2]
mov dword [esp + 0x24], ebx
jne 0x5178a
cmp word [0x3368f8], 0
jne 0x5178a
movsx eax, word [0x4530fa]
cmp esi, eax
mov dword [esp + 0x1c], esi
jg 0x51a3a
shl esi, 0xa
mov dword [esp + 0x20], esi
jmp 0x514f0
movsx esi, word [0x2a8e12]
movsx ecx, word [0x2a8e36]
cmp esi, ecx
mov dword [esp + 0x18], esi
jl 0x5174e
sub esi, ecx
mov edx, dword [0x2a8e38]
mov edi, dword [0x2a8e14]
mov dword [esp + 0x10], edx
jne 0x51523
mov esi, 1
mov eax, dword [0x2a8e44]
sub eax, edi
cdq
idiv esi
mov edx, dword [0x2a8e38]
mov dword [esp + 0x14], eax
mov eax, dword [0x2a8e78]
sub eax, edx
cdq
idiv esi
mov edx, dword [esp + 0x14]
mov esi, dword [0x3368d4]
add edx, edx
cmp ecx, esi
mov dword [esp + 0x38], edx
lea edx, [eax + eax]
mov dword [esp + 0x3c], edx
jge 0x5157c
mov edx, esi
sub edx, ecx
mov edi, edx
imul edx, eax
imul edi, dword [esp + 0x14]
mov ecx, esi
add edi, dword [0x2a8e14]
add edx, dword [0x2a8e38]
mov dword [esp + 0x10], edx
mov edx, dword [esp + 0x18]
mov esi, dword [0x3368dc]
dec edx
cmp esi, edx
mov dword [esp + 0x18], edx
jge 0x51595
mov edx, esi
mov dword [esp + 0x18], edx
cmp ecx, edx
mov esi, ecx
jge 0x516ea
mov esi, dword [esp + 0x10]
add eax, esi
mov esi, dword [0x653190]
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x14]
add eax, edi
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x20]
add eax, ecx
lea eax, [esi + eax*2]
mov esi, edx
sub esi, ecx
dec esi
shr esi, 1
inc esi
lea ecx, [ecx + esi*2]
mov dword [esp + 0x30], eax
mov dword [esp + 0x40], ecx
jmp 0x515e0
movsx ecx, word [0x453102]
mov eax, edi
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x10]
movsx ecx, word [0x453106]
sar eax, 0x10
mov dword [esp + 0x14], edx
cdq
idiv ecx
mov ecx, dword [0x6533b4]
mov eax, dword [esp + 0x14]
sar eax, 1
shl edx, 0xb
add edx, ecx
mov cl, byte [esp + 0x14]
add eax, edx
mov dl, byte [eax + ebx]
and cl, 1
shl cl, 2
shr dl, cl
movsx ecx, word [0x453102]
and dl, 0xf
movzx ax, dl
mov word [esp + 0x34], ax
mov eax, dword [esp + 0x28]
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x2c]
movsx ecx, word [0x453106]
sar eax, 0x10
mov dword [esp + 0x14], edx
cdq
idiv ecx
mov eax, dword [0x6533b4]
mov ecx, dword [esp + 0x14]
sar ecx, 1
shl edx, 0xb
add edx, eax
add ecx, edx
movzx edx, byte [ecx + ebx]
xor ecx, ecx
mov cl, byte [esp + 0x14]
mov ebx, dword [esp + 0x30]
and cl, 1
shl cl, 2
shr edx, cl
mov ecx, dword [0x653190]
and edx, 0xf
add edx, ebp
movzx eax, word [ecx + edx*2]
movsx edx, word [esp + 0x34]
add edx, ebp
movzx ecx, word [ecx + edx*2]
shl eax, 0x10
or eax, ecx
call fcn.0004c040
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x28]
mov ebx, dword [esp + 0x10]
mov edx, dword [esp + 0x2c]
add ecx, eax
add edi, eax
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x28], ecx
mov ecx, dword [esp + 0x30]
add ebx, eax
add edx, eax
add ecx, 4
dec esi
mov dword [esp + 0x10], ebx
mov ebx, dword [esp + 0x24]
mov dword [esp + 0x2c], edx
mov dword [esp + 0x30], ecx
jne 0x515e0
mov edx, dword [esp + 0x18]
mov esi, dword [esp + 0x40]
cmp esi, edx
jne 0x5174e
movsx ecx, word [0x453102]
mov eax, edi
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x10]
movsx edi, word [0x453106]
sar eax, 0x10
mov ecx, edx
cdq
idiv edi
mov edi, dword [0x6533b4]
mov eax, ecx
sar eax, 1
and cl, 1
shl cl, 2
shl edx, 0xb
add edx, edi
add eax, edx
movzx edx, byte [eax + ebx]
mov eax, dword [esp + 0x20]
shr edx, cl
lea ecx, [eax + esi]
mov eax, dword [0x653190]
lea ecx, [eax + ecx*2]
and edx, 0xf
add edx, ebp
mov ax, word [eax + edx*2]
push ecx
call fcn.0004ba90
add esp, 4
call fcn.0004e560
test ax, ax
jne 0x51a3a
mov ecx, dword [esp + 0x1c]
mov esi, dword [esp + 0x20]
movsx eax, word [0x4530fa]
inc ecx
add esi, 0x400
cmp ecx, eax
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x20], esi
jle 0x514f0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x34
ret
movsx eax, word [0x4530fa]
cmp esi, eax
mov dword [esp + 0x1c], esi
jg 0x51a3a
shl esi, 0xa
mov dword [esp + 0x20], esi
jmp 0x517b0
movsx esi, word [0x2a8e12]
movsx ecx, word [0x2a8e36]
cmp esi, ecx
mov dword [esp + 0x18], esi
jl 0x51a0a
sub esi, ecx
mov edx, dword [0x2a8e38]
mov edi, dword [0x2a8e14]
mov dword [esp + 0x10], edx
jne 0x517e3
mov esi, 1
mov eax, dword [0x2a8e44]
sub eax, edi
cdq
idiv esi
mov edx, dword [0x2a8e38]
mov dword [esp + 0x14], eax
mov eax, dword [0x2a8e78]
sub eax, edx
cdq
idiv esi
mov edx, dword [esp + 0x14]
mov esi, dword [0x3368d4]
add edx, edx
cmp ecx, esi
mov dword [esp + 0x38], edx
lea edx, [eax + eax]
mov dword [esp + 0x3c], edx
jge 0x5183c
mov edx, esi
sub edx, ecx
mov edi, edx
imul edx, eax
imul edi, dword [esp + 0x14]
mov ecx, esi
add edi, dword [0x2a8e14]
add edx, dword [0x2a8e38]
mov dword [esp + 0x10], edx
mov edx, dword [esp + 0x18]
mov esi, dword [0x3368dc]
dec edx
cmp esi, edx
mov dword [esp + 0x18], edx
jge 0x51855
mov edx, esi
mov dword [esp + 0x18], edx
cmp ecx, edx
mov esi, ecx
jge 0x519aa
mov esi, dword [esp + 0x10]
add eax, esi
mov esi, dword [0x653190]
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x14]
add eax, edi
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x20]
add eax, ecx
lea eax, [esi + eax*2]
mov esi, edx
sub esi, ecx
dec esi
shr esi, 1
inc esi
lea ecx, [ecx + esi*2]
mov dword [esp + 0x28], eax
mov dword [esp + 0x40], ecx
jmp 0x518a0
movsx ecx, word [0x453102]
mov eax, edi
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x10]
movsx ecx, word [0x453106]
sar eax, 0x10
mov dword [esp + 0x14], edx
cdq
idiv ecx
mov ecx, dword [0x6533b4]
mov eax, dword [esp + 0x14]
sar eax, 1
shl edx, 0xb
add edx, ecx
mov cl, byte [esp + 0x14]
add eax, edx
mov dl, byte [eax + ebx]
and cl, 1
shl cl, 2
shr dl, cl
movsx ecx, word [0x453102]
and dl, 0xf
movzx ax, dl
mov word [esp + 0x34], ax
mov eax, dword [esp + 0x30]
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x2c]
movsx ecx, word [0x453106]
sar eax, 0x10
mov dword [esp + 0x14], edx
cdq
idiv ecx
mov eax, dword [0x6533b4]
mov ecx, dword [esp + 0x14]
sar ecx, 1
shl edx, 0xb
add edx, eax
add ecx, edx
movzx edx, byte [ecx + ebx]
xor ecx, ecx
mov cl, byte [esp + 0x14]
mov ebx, dword [esp + 0x28]
and cl, 1
shl cl, 2
shr edx, cl
mov ecx, dword [0x653190]
and edx, 0xf
add edx, ebp
movzx eax, word [ecx + edx*2]
movsx edx, word [esp + 0x34]
add edx, ebp
movzx ecx, word [ecx + edx*2]
shl eax, 0x10
or eax, ecx
call fcn.0004c1a0
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x30]
mov ebx, dword [esp + 0x10]
mov edx, dword [esp + 0x2c]
add ecx, eax
add edi, eax
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x30], ecx
mov ecx, dword [esp + 0x28]
add ebx, eax
add edx, eax
add ecx, 4
dec esi
mov dword [esp + 0x10], ebx
mov ebx, dword [esp + 0x24]
mov dword [esp + 0x2c], edx
mov dword [esp + 0x28], ecx
jne 0x518a0
mov edx, dword [esp + 0x18]
mov esi, dword [esp + 0x40]
cmp esi, edx
jne 0x51a0a
movsx ecx, word [0x453102]
mov eax, edi
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x10]
movsx edi, word [0x453106]
sar eax, 0x10
mov ecx, edx
cdq
idiv edi
mov edi, dword [0x6533b4]
mov eax, ecx
sar eax, 1
and cl, 1
shl cl, 2
shl edx, 0xb
add edx, edi
add eax, edx
movzx edx, byte [eax + ebx]
mov eax, dword [esp + 0x20]
shr edx, cl
lea ecx, [eax + esi]
mov eax, dword [0x653190]
lea edi, [eax + ecx*2]
and edx, 0xf
add edx, ebp
mov ax, word [eax + edx*2]
call fcn.0004b820
call fcn.0004e560
test ax, ax
jne 0x51a3a
mov ecx, dword [esp + 0x1c]
mov esi, dword [esp + 0x20]
movsx eax, word [0x4530fa]
inc ecx
add esi, 0x400
cmp ecx, eax
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x20], esi
jle 0x517b0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x34
ret