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

Disassembly:
sub esp, 0x30
push ebx
push ebp
mov ebp, dword [esp + 0x4c]
push esi
mov esi, ecx
movsx ecx, ax
mov ebx, edx
mov edx, dword [0x3368dc]
cmp ecx, edx
push edi
jle 0x50c89
movsx edi, word [esp + 0x48]
cmp edi, edx
jle 0x50c89
movsx edi, word [esp + 0x50]
cmp edi, edx
jle 0x50c89
movsx edi, bx
cmp edi, edx
jg 0x51321
movsx edi, word [esp + 0x44]
mov edx, dword [0x3368e0]
cmp edi, edx
jle 0x50cb3
movsx edi, word [esp + 0x4c]
cmp edi, edx
jle 0x50cb3
movsx edi, bp
cmp edi, edx
jle 0x50cb3
movsx edi, si
cmp edi, edx
jg 0x51321
mov edx, dword [0x3368d4]
cmp ecx, edx
jge 0x50cda
movsx ecx, word [esp + 0x48]
cmp ecx, edx
jge 0x50cda
movsx ecx, word [esp + 0x50]
cmp ecx, edx
jge 0x50cda
movsx ecx, bx
cmp ecx, edx
jl 0x51321
movsx ecx, word [esp + 0x44]
mov edi, dword [0x3368d8]
cmp ecx, edi
jge 0x50d04
movsx ecx, word [esp + 0x4c]
cmp ecx, edi
jge 0x50d04
movsx ecx, bp
cmp ecx, edi
jge 0x50d04
movsx ecx, si
cmp ecx, edi
jl 0x51321
cmp edi, dword [0x3368e0]
jge 0x51321
cmp edx, dword [0x3368dc]
jge 0x51321
mov edx, dword [esp + 0x74]
mov ecx, dword [esp + 0x70]
push edx
mov edx, dword [esp + 0x70]
push ecx
mov ecx, dword [esp + 0x70]
push edx
mov edx, dword [esp + 0x70]
push ecx
mov ecx, dword [esp + 0x70]
push edx
mov edx, dword [esp + 0x64]
push ecx
mov ecx, dword [esp + 0x64]
push esi
push ebx
push ebp
push edx
mov edx, dword [esp + 0x70]
push ecx
mov ecx, dword [esp + 0x70]
push edx
mov edx, dword [esp + 0x8c]
push ecx
mov ecx, dword [esp + 0x8c]
call fcn.0004e670
add esp, 0x34
test ax, ax
je 0x51321
movsx esi, word [0x4530e0]
cmp esi, edi
jge 0x50d93
jmp 0x50d80
call fcn.0004e560
test ax, ax
jne 0x51321
inc esi
cmp esi, edi
jl 0x50d80
movsx eax, word [0x453104]
mov ecx, dword [0x4530e4]
movsx ebp, word [esp + 0x7c]
movsx edx, word [esp + 0x78]
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 edx, [ecx + eax*2]
mov dword [esp + 0x18], edx
jne 0x51091
cmp word [0x3368f8], 0
jne 0x51091
movsx eax, word [0x4530fa]
cmp esi, eax
mov dword [esp + 0x20], esi
jg 0x51321
shl esi, 0xa
mov dword [esp + 0x24], esi
jmp 0x50e10
movsx ebx, word [0x2a8e12]
movsx ecx, word [0x2a8e36]
cmp ebx, ecx
mov dword [esp + 0x14], ebx
jl 0x51055
sub ebx, ecx
mov eax, dword [0x2a8e38]
mov edi, dword [0x2a8e14]
mov dword [esp + 0x10], eax
jne 0x50e42
mov ebx, 1
mov eax, dword [0x2a8e44]
sub eax, edi
cdq
idiv ebx
mov edx, dword [0x2a8e38]
mov esi, eax
mov eax, dword [0x2a8e78]
sub eax, edx
cdq
idiv ebx
mov ebx, dword [0x3368d4]
cmp ecx, ebx
lea edx, [esi + esi]
mov dword [esp + 0x34], edx
lea edx, [eax + eax]
mov dword [esp + 0x38], edx
jge 0x50e94
mov edx, ebx
sub edx, ecx
mov edi, edx
imul edx, eax
imul edi, esi
mov ecx, ebx
add edi, dword [0x2a8e14]
add edx, dword [0x2a8e38]
mov dword [esp + 0x10], edx
mov edx, dword [esp + 0x14]
mov ebx, dword [0x3368dc]
dec edx
cmp ebx, edx
mov dword [esp + 0x14], edx
jge 0x50ead
mov dword [esp + 0x14], ebx
mov edx, ebx
cmp ecx, edx
mov ebx, ecx
jge 0x50fed
mov ebx, dword [esp + 0x10]
add eax, ebx
add esi, edi
mov dword [esp + 0x28], esi
mov esi, dword [0x653190]
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x24]
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 + 0x3c], ecx
lea esp, [esp]
movsx ebx, word [0x453102]
mov eax, edi
sar eax, 0x10
cdq
idiv ebx
mov eax, dword [esp + 0x10]
movsx ecx, word [0x453106]
sar eax, 0x10
mov dword [esp + 0x1c], edx
cdq
idiv ecx
mov ecx, dword [0x6533b4]
mov eax, dword [esp + 0x1c]
sar eax, 1
shl edx, 0xb
add edx, ecx
mov cl, byte [esp + 0x1c]
add eax, edx
mov edx, dword [esp + 0x18]
mov al, byte [eax + edx]
and cl, 1
shl cl, 2
shr al, cl
and al, 0xf
movzx cx, al
mov eax, dword [esp + 0x28]
sar eax, 0x10
cdq
idiv ebx
mov eax, dword [esp + 0x2c]
movsx ebx, word [0x453106]
sar eax, 0x10
mov word [esp + 0x1c], cx
mov ecx, edx
cdq
idiv ebx
mov ebx, dword [0x6533b4]
mov eax, ecx
sar eax, 1
and cl, 1
shl cl, 2
shl edx, 0xb
add edx, ebx
add eax, edx
mov edx, dword [esp + 0x18]
movzx eax, byte [eax + edx]
movsx edx, word [esp + 0x1c]
mov ebx, dword [esp + 0x30]
shr eax, cl
mov ecx, dword [0x653190]
add edx, ebp
and eax, 0xf
add eax, ebp
movzx eax, word [ecx + eax*2]
movzx ecx, word [ecx + edx*2]
shl eax, 0x10
or eax, ecx
call fcn.0004c040
mov eax, dword [esp + 0x34]
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 + 0x38]
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 dword [esp + 0x2c], edx
mov dword [esp + 0x30], ecx
jne 0x50ef0
mov ebx, dword [esp + 0x3c]
mov edx, dword [esp + 0x14]
cmp ebx, edx
jne 0x51055
movsx ecx, word [0x453102]
mov eax, edi
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x10]
movsx esi, word [0x453106]
sar eax, 0x10
mov edi, dword [0x6533b4]
mov ecx, edx
cdq
idiv esi
mov eax, ecx
sar eax, 1
and cl, 1
shl cl, 2
shl edx, 0xb
add edx, edi
add eax, edx
mov edx, dword [esp + 0x18]
movzx edx, byte [eax + edx]
mov eax, dword [esp + 0x24]
shr edx, cl
lea ecx, [eax + ebx]
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 0x51321
mov ecx, dword [esp + 0x20]
mov esi, dword [esp + 0x24]
movsx eax, word [0x4530fa]
inc ecx
add esi, 0x400
cmp ecx, eax
mov dword [esp + 0x20], ecx
mov dword [esp + 0x24], esi
jle 0x50e10
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x30
ret
movsx eax, word [0x4530fa]
cmp esi, eax
mov dword [esp + 0x20], esi
jg 0x51321
shl esi, 0xa
mov dword [esp + 0x24], esi
jmp 0x510b0
movsx edi, word [0x2a8e12]
movsx ecx, word [0x2a8e36]
cmp edi, ecx
mov dword [esp + 0x14], edi
jl 0x512f1
sub edi, ecx
mov edx, dword [0x2a8e38]
mov ebx, dword [0x2a8e14]
mov dword [esp + 0x10], edx
jne 0x510e3
mov edi, 1
mov eax, dword [0x2a8e44]
sub eax, ebx
cdq
idiv edi
mov edx, dword [0x2a8e38]
mov esi, eax
mov eax, dword [0x2a8e78]
sub eax, edx
cdq
idiv edi
mov edi, dword [0x3368d4]
cmp ecx, edi
lea edx, [esi + esi]
mov dword [esp + 0x34], edx
lea edx, [eax + eax]
mov dword [esp + 0x38], edx
jge 0x51135
mov edx, edi
sub edx, ecx
mov ebx, edx
imul edx, eax
imul ebx, esi
mov ecx, edi
add ebx, dword [0x2a8e14]
add edx, dword [0x2a8e38]
mov dword [esp + 0x10], edx
mov edx, dword [esp + 0x14]
mov edi, dword [0x3368dc]
dec edx
cmp edi, edx
mov dword [esp + 0x14], edx
jge 0x5114e
mov dword [esp + 0x14], edi
mov edx, edi
cmp ecx, edx
mov edi, ecx
jge 0x5128d
mov edi, dword [esp + 0x10]
add eax, edi
add esi, ebx
mov dword [esp + 0x30], esi
mov esi, dword [0x653190]
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x24]
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 + 0x3c], ecx
lea ebx, [ebx]
movsx edi, word [0x453102]
mov eax, ebx
sar eax, 0x10
cdq
idiv edi
mov eax, dword [esp + 0x10]
movsx ecx, word [0x453106]
sar eax, 0x10
mov dword [esp + 0x1c], edx
cdq
idiv ecx
mov ecx, dword [0x6533b4]
mov eax, dword [esp + 0x1c]
sar eax, 1
shl edx, 0xb
add edx, ecx
mov cl, byte [esp + 0x1c]
add eax, edx
mov edx, dword [esp + 0x18]
mov al, byte [eax + edx]
and cl, 1
shl cl, 2
shr al, cl
and al, 0xf
movzx cx, al
mov eax, dword [esp + 0x30]
sar eax, 0x10
cdq
idiv edi
mov eax, dword [esp + 0x2c]
movsx edi, word [0x453106]
sar eax, 0x10
mov word [esp + 0x1c], cx
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
mov edx, dword [esp + 0x18]
movzx eax, byte [eax + edx]
movsx edx, word [esp + 0x1c]
mov edi, dword [esp + 0x28]
shr eax, cl
mov ecx, dword [0x653190]
add edx, ebp
and eax, 0xf
add eax, ebp
movzx eax, word [ecx + eax*2]
movzx ecx, word [ecx + edx*2]
shl eax, 0x10
or eax, ecx
call fcn.0004bb30
mov eax, dword [esp + 0x34]
mov ecx, dword [esp + 0x30]
mov edi, dword [esp + 0x10]
mov edx, dword [esp + 0x2c]
add ecx, eax
add ebx, eax
mov eax, dword [esp + 0x38]
mov dword [esp + 0x30], ecx
mov ecx, dword [esp + 0x28]
add edi, eax
add edx, eax
add ecx, 4
dec esi
mov dword [esp + 0x10], edi
mov dword [esp + 0x2c], edx
mov dword [esp + 0x28], ecx
jne 0x51190
mov edi, dword [esp + 0x3c]
mov edx, dword [esp + 0x14]
cmp edi, edx
jne 0x512f1
movsx ecx, word [0x453102]
mov eax, ebx
sar eax, 0x10
cdq
idiv ecx
mov eax, dword [esp + 0x10]
movsx esi, word [0x453106]
sar eax, 0x10
mov ebx, dword [0x6533b4]
mov ecx, edx
cdq
idiv esi
mov eax, ecx
sar eax, 1
and cl, 1
shl cl, 2
shl edx, 0xb
add edx, ebx
add eax, edx
mov edx, dword [esp + 0x18]
movzx edx, byte [eax + edx]
mov eax, dword [esp + 0x24]
shr edx, cl
lea ecx, [eax + edi]
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 0x51321
mov ecx, dword [esp + 0x20]
mov esi, dword [esp + 0x24]
movsx eax, word [0x4530fa]
inc ecx
add esi, 0x400
cmp ecx, eax
mov dword [esp + 0x20], ecx
mov dword [esp + 0x24], esi
jle 0x510b0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x30
ret