Function at 0x5178e2
Capabilities:
Decompress data using aplib

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov edx, dword [ebp + 8]
sub esp, 0x2c
push ebx
push esi
mov esi, dword [ebp + 0xc]
push edi
jmp 0x5178fc
xor edi, edi
cmp eax, edi
je 0x517c28
cmp edx, edi
je 0x517c28
lea ebx, [ecx - 1]
mov dword [esp + 0x20], eax
mov dword [esp + 0x28], edx
mov dword [esp + 0x2c], esi
mov dword [esp + 0x34], edi
mov dword [esp + 0x1c], edi
mov dword [esp + 0x24], ebx
test ecx, ecx
je 0x517c28
lea ecx, [esi - 1]
mov dword [esp + 0x2c], ecx
test esi, esi
je 0x517c28
mov cl, byte [eax]
mov ebx, dword [esp + 0x1c]
mov byte [edx], cl
inc edx
inc eax
mov dword [esp + 0x28], edx
mov dword [esp + 0x20], eax
jmp 0x517957
mov esi, dword [ebp + 0xc]
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x24]
call fcn.00517834
pop ecx
test eax, eax
je 0x517c28
cmp dword [esp + 0x14], 0
je 0x517bde
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x24]
call fcn.00517834
pop ecx
test eax, eax
je 0x517c28
cmp dword [esp + 0x14], 0
je 0x517aae
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x24]
call fcn.00517834
pop ecx
test eax, eax
je 0x517c28
cmp dword [esp + 0x14], 0
je 0x517a36
push 4
xor edi, edi
pop esi
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x24]
call fcn.00517834
pop ecx
test eax, eax
je 0x517c28
dec esi
mov eax, dword [esp + 0x14]
lea edi, [eax + edi*2]
mov dword [esp + 0x18], edi
jne 0x5179be
test edi, edi
je 0x517a16
mov eax, dword [ebp + 0xc]
sub eax, dword [esp + 0x2c]
cmp edi, eax
ja 0x517c28
mov eax, dword [esp + 0x2c]
dec dword [esp + 0x2c]
test eax, eax
je 0x517c28
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x28]
sub eax, edi
mov al, byte [eax]
mov byte [ecx], al
jmp 0x517a2d
mov eax, dword [esp + 0x2c]
dec dword [esp + 0x2c]
test eax, eax
je 0x517c28
mov eax, dword [esp + 0x28]
mov byte [eax], 0
inc dword [esp + 0x28]
jmp 0x517c0a
mov eax, dword [esp + 0x24]
dec dword [esp + 0x24]
test eax, eax
je 0x517c28
mov eax, dword [esp + 0x20]
movzx esi, byte [eax]
inc dword [esp + 0x20]
xor edi, edi
inc edi
mov eax, esi
and eax, edi
inc eax
inc eax
shr esi, 1
mov dword [esp + 0x10], eax
mov dword [esp + 0x18], esi
je 0x517aa3
mov ecx, dword [ebp + 0xc]
sub ecx, dword [esp + 0x2c]
cmp esi, ecx
ja 0x517c28
cmp eax, dword [esp + 0x2c]
ja 0x517c28
sub dword [esp + 0x2c], eax
test eax, eax
je 0x517aa7
mov ecx, dword [esp + 0x28]
sub ecx, esi
mov ebx, dword [esp + 0x28]
mov dl, byte [ecx]
inc dword [esp + 0x28]
inc ecx
dec eax
mov byte [ebx], dl
jne 0x517a8d
mov dword [esp + 0x10], eax
jmp 0x517aa7
mov dword [esp + 0x1c], edi
mov ebx, esi
jmp 0x517c0c
lea eax, [esp + 0x18]
push eax
lea eax, [esp + 0x24]
push eax
call fcn.0051788d
pop ecx
pop ecx
test eax, eax
je 0x517c28
mov eax, dword [esp + 0x18]
test edi, edi
jne 0x517b3a
cmp eax, 2
jne 0x517b35
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x24]
push eax
mov dword [esp + 0x20], ebx
call fcn.0051788d
pop ecx
pop ecx
test eax, eax
je 0x517c28
sub esi, dword [esp + 0x2c]
cmp ebx, esi
ja 0x517c28
mov eax, dword [esp + 0x10]
cmp eax, dword [esp + 0x2c]
ja 0x517c28
sub dword [esp + 0x2c], eax
test eax, eax
je 0x517bd9
mov eax, dword [esp + 0x28]
sub eax, ebx
mov edx, dword [esp + 0x28]
mov cl, byte [eax]
inc dword [esp + 0x28]
inc eax
dec dword [esp + 0x10]
mov byte [edx], cl
jne 0x517b1d
jmp 0x517bd9
sub eax, 3
jmp 0x517b3c
dec eax
dec eax
mov ecx, dword [esp + 0x24]
dec dword [esp + 0x24]
test ecx, ecx
je 0x517c28
mov ecx, dword [esp + 0x20]
movzx ecx, byte [ecx]
shl eax, 8
add eax, ecx
inc dword [esp + 0x20]
mov esi, eax
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x24]
push eax
mov dword [esp + 0x20], esi
call fcn.0051788d
pop ecx
pop ecx
test eax, eax
je 0x517c28
cmp esi, 0x7d00
jb 0x517b87
inc dword [esp + 0x10]
cmp esi, 0x500
jb 0x517b93
inc dword [esp + 0x10]
cmp esi, 0x80
jae 0x517ba0
add dword [esp + 0x10], 2
mov eax, dword [ebp + 0xc]
sub eax, dword [esp + 0x2c]
cmp esi, eax
ja 0x517c28
mov ecx, dword [esp + 0x10]
cmp ecx, dword [esp + 0x2c]
ja 0x517c28
sub dword [esp + 0x2c], ecx
test ecx, ecx
je 0x517bd7
mov eax, dword [esp + 0x28]
sub eax, esi
mov edi, dword [esp + 0x28]
mov dl, byte [eax]
inc dword [esp + 0x28]
inc eax
dec ecx
mov byte [edi], dl
jne 0x517bc3
mov dword [esp + 0x10], ecx
mov ebx, esi
xor edi, edi
inc edi
jmp 0x517c0c
mov eax, dword [esp + 0x24]
dec dword [esp + 0x24]
test eax, eax
je 0x517c28
mov eax, dword [esp + 0x2c]
dec dword [esp + 0x2c]
test eax, eax
je 0x517c28
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x28]
mov al, byte [eax]
inc dword [esp + 0x28]
inc dword [esp + 0x20]
mov byte [ecx], al
xor edi, edi
cmp dword [esp + 0x1c], 0
je 0x517954
jmp 0x517c1f
mov eax, dword [esp + 0x28]
sub eax, dword [ebp + 8]
jmp 0x517c2b
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret