Function at 0x40c788
Capabilities:
Decompress data using aplib

Disassembly:
pushal
mov esi, dword [esp + 0x24]
mov eax, dword [esp + 0x28]
mov edi, dword [esp + 0x2c]
mov ecx, dword [esp + 0x30]
push eax
push ecx
test esi, esi
je 0x40ca4e
test edi, edi
je 0x40ca4e
cld
xor edx, edx
sub dword [esp + 4], 1
jb 0x40ca4e
mov al, byte [esi]
add esi, 1
sub dword [esp], 1
jb 0x40ca4e
mov byte [edi], al
add edi, 1
mov ebx, 2
add dl, dl
jne 0x40c7e8
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
jae 0x40c7ae
add dl, dl
jne 0x40c800
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
jae 0x40c8b6
xor eax, eax
add dl, dl
jne 0x40c81e
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
jae 0x40ca03
add dl, dl
jne 0x40c83a
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
adc eax, eax
add dl, dl
jne 0x40c852
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
adc eax, eax
add dl, dl
jne 0x40c86a
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
adc eax, eax
add dl, dl
jne 0x40c882
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
adc eax, eax
je 0x40c89f
mov ebx, dword [esp + 0x38]
sub ebx, dword [esp]
cmp eax, ebx
ja 0x40ca4e
push edi
sub edi, eax
mov al, byte [edi]
pop edi
sub dword [esp], 1
jb 0x40ca4e
mov byte [edi], al
inc edi
mov ebx, 2
jmp 0x40c7d2
mov eax, 1
add dl, dl
jne 0x40c8d1
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
adc eax, eax
jb 0x40ca4e
add dl, dl
jne 0x40c8ef
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
jb 0x40c8bb
sub eax, ebx
mov ebx, 1
jne 0x40c961
mov ecx, 1
add dl, dl
jne 0x40c919
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
adc ecx, ecx
jb 0x40ca4e
add dl, dl
jne 0x40c937
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
jb 0x40c903
push ecx
mov ecx, dword [esp + 0x3c]
sub ecx, dword [esp + 4]
cmp ebp, ecx
pop ecx
ja 0x40ca4e
sub dword [esp], ecx
jb 0x40ca4e
push esi
mov esi, edi
sub esi, ebp
rep movsb byte es:[edi], byte [esi]
pop esi
jmp 0x40c7d2
dec eax
test eax, 0xff000000
jne 0x40ca4e
shl eax, 8
sub dword [esp + 4], 1
jb 0x40ca4e
mov al, byte [esi]
inc esi
mov ebp, eax
mov ecx, 1
add dl, dl
jne 0x40c99b
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
adc ecx, ecx
jb 0x40ca4e
add dl, dl
jne 0x40c9b9
sub dword [esp + 4], 1
jb 0x40ca4e
mov dl, byte [esi]
inc esi
add dl, dl
inc dl
jb 0x40c985
cmp eax, 0x7d00
sbb ecx, 0xffffffff
cmp eax, 0x500
sbb ecx, 0xffffffff
cmp eax, 0x80
adc ecx, 0
cmp eax, 0x80
adc ecx, 0
push ecx
mov ecx, dword [esp + 0x3c]
sub ecx, dword [esp + 4]
cmp eax, ecx
pop ecx
ja 0x40ca4e
sub dword [esp], ecx
jb 0x40ca4e
push esi
mov esi, edi
sub esi, eax
rep movsb byte es:[edi], byte [esi]
pop esi
jmp 0x40c7d2
sub dword [esp + 4], 1
jb 0x40ca4e
mov al, byte [esi]
inc esi
xor ecx, ecx
shr al, 1
je 0x40ca56
adc ecx, 2
mov ebp, eax
push ecx
mov ecx, dword [esp + 0x3c]
sub ecx, dword [esp + 4]
cmp eax, ecx
pop ecx
ja 0x40ca4e
sub dword [esp], ecx
jb 0x40ca4e
push esi
mov esi, edi
sub esi, eax
rep movsb byte es:[edi], byte [esi]
pop esi
mov ebx, 1
jmp 0x40c7d2
add esp, 8
popal
or eax, 0xffffffff
ret
add esp, 8
sub edi, dword [esp + 0x2c]
mov dword [esp + 0x1c], edi
popal
ret