Function at 0x51b110
Capabilities:
Compress data via zlib inflate or deflate

Disassembly:
push ebx
push ebp
mov ebp, dword [esp + 0xc]
push esi
test ebp, ebp
push edi
je 0x51ba00
mov esi, dword [ebp + 0x1c]
test esi, esi
je 0x51ba00
mov ecx, dword [esp + 0x18]
cmp ecx, 5
jg 0x51ba00
test ecx, ecx
jl 0x51ba00
mov eax, dword [ebp + 0xc]
test eax, eax
je 0x51b9f7
cmp dword [ebp], 0
jne 0x51b15c
mov eax, dword [ebp + 4]
test eax, eax
jne 0x51b9f7
mov eax, dword [esi + 4]
cmp eax, 0x29a
jne 0x51b16f
cmp ecx, 4
jne 0x51b9f7
mov edx, dword [ebp + 0x10]
test edx, edx
jne 0x51b188
mov eax, dword [str.buffer_error]
pop edi
mov dword [ebp + 0x18], eax
pop esi
pop ebp
mov eax, 0xfffffffb
pop ebx
ret
mov edx, dword [esi + 0x28]
cmp eax, 0x2a
mov dword [esi], ebp
mov dword [esp + 0x14], edx
mov dword [esi + 0x28], ecx
mov ebx, 2
jne 0x51b482
cmp dword [esi + 0x18], ebx
jne 0x51b3df
push 0
push 0
push 0
call fcn.0051ab30
mov dword [ebp + 0x30], eax
mov eax, dword [esi + 8]
mov ecx, dword [esi + 0x14]
add esp, 0xc
mov byte [eax + ecx], 0x1f
mov eax, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc eax
mov dword [esi + 0x14], eax
mov byte [edx + eax], 0x8b
mov edi, dword [esi + 0x14]
mov ecx, dword [esi + 8]
inc edi
mov eax, edi
mov dword [esi + 0x14], edi
mov byte [ecx + eax], 8
mov edx, dword [esi + 0x14]
mov eax, dword [esi + 0x1c]
inc edx
test eax, eax
mov dword [esi + 0x14], edx
mov edi, edx
jne 0x51b292
mov edx, dword [esi + 8]
mov byte [edx + edi], al
mov edi, dword [esi + 0x14]
mov ecx, dword [esi + 8]
inc edi
mov eax, edi
mov dword [esi + 0x14], edi
mov byte [ecx + eax], 0
mov edx, dword [esi + 0x14]
inc edx
mov dword [esi + 0x14], edx
mov eax, edx
mov edx, dword [esi + 8]
mov byte [edx + eax], 0
mov ecx, dword [esi + 0x14]
inc ecx
mov dword [esi + 0x14], ecx
mov eax, ecx
mov ecx, dword [esi + 8]
mov byte [ecx + eax], 0
mov eax, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc eax
mov dword [esi + 0x14], eax
mov byte [edx + eax], 0
mov edi, dword [esi + 0x14]
mov eax, dword [esi + 0x84]
inc edi
cmp eax, 9
mov dword [esi + 0x14], edi
mov ecx, edi
jne 0x51b254
mov eax, ebx
jmp 0x51b269
cmp dword [esi + 0x88], ebx
jge 0x51b264
cmp eax, ebx
jl 0x51b264
xor eax, eax
jmp 0x51b269
mov eax, 4
mov edx, dword [esi + 8]
mov byte [edx + ecx], al
mov ecx, dword [esi + 0x14]
inc ecx
mov dword [esi + 0x14], ecx
mov eax, ecx
mov ecx, dword [esi + 8]
mov byte [ecx + eax], 0xb
mov eax, dword [esi + 0x14]
inc eax
mov dword [esi + 4], 0x71
mov dword [esi + 0x14], eax
jmp 0x51b482
mov edx, dword [eax + 0x24]
mov ecx, dword [eax + 0x2c]
neg edx
sbb dl, dl
and edx, 0x10
neg ecx
sbb cl, cl
and ecx, ebx
add dl, cl
mov ecx, dword [eax + 0x1c]
neg ecx
sbb cl, cl
and ecx, 8
add dl, cl
mov ecx, dword [eax + 0x10]
neg ecx
sbb cl, cl
and ecx, 4
add dl, cl
mov ecx, dword [eax]
test ecx, ecx
mov ecx, dword [esi + 8]
setne al
add dl, al
mov byte [ecx + edi], dl
mov edi, dword [esi + 0x14]
mov edx, dword [esi + 0x1c]
mov ecx, dword [esi + 8]
inc edi
mov dword [esi + 0x14], edi
mov dl, byte [edx + 4]
mov eax, edi
mov byte [ecx + eax], dl
mov edx, dword [esi + 0x14]
mov ecx, dword [esi + 0x1c]
inc edx
mov dword [esi + 0x14], edx
mov eax, edx
mov edx, dword [ecx + 4]
mov ecx, dword [esi + 8]
shr edx, 8
mov byte [ecx + eax], dl
mov eax, dword [esi + 0x14]
mov edx, dword [esi + 0x1c]
inc eax
mov dword [esi + 0x14], eax
mov ecx, dword [edx + 4]
mov edx, dword [esi + 8]
shr ecx, 0x10
mov byte [edx + eax], cl
mov edx, dword [esi + 0x14]
mov ecx, dword [esi + 0x1c]
inc edx
mov dword [esi + 0x14], edx
mov eax, edx
mov edx, dword [ecx + 4]
mov ecx, dword [esi + 8]
shr edx, 0x18
mov byte [ecx + eax], dl
mov edi, dword [esi + 0x14]
mov eax, dword [esi + 0x84]
inc edi
cmp eax, 9
mov dword [esi + 0x14], edi
mov ecx, edi
jne 0x51b341
mov eax, ebx
jmp 0x51b356
cmp dword [esi + 0x88], ebx
jge 0x51b351
cmp eax, ebx
jl 0x51b351
xor eax, eax
jmp 0x51b356
mov eax, 4
mov edx, dword [esi + 8]
mov byte [edx + ecx], al
mov ebx, dword [esi + 0x14]
mov ecx, dword [esi + 0x1c]
mov edx, dword [esi + 8]
inc ebx
mov dword [esi + 0x14], ebx
mov cl, byte [ecx + 0xc]
mov eax, ebx
mov byte [edx + eax], cl
mov edi, dword [esi + 0x14]
mov eax, dword [esi + 0x1c]
inc edi
mov dword [esi + 0x14], edi
mov ecx, edi
mov edx, dword [eax + 0x10]
test edx, edx
je 0x51b3ae
mov edx, dword [esi + 8]
mov al, byte [eax + 0x14]
mov byte [edx + ecx], al
mov edx, dword [esi + 0x14]
mov ecx, dword [esi + 0x1c]
inc edx
mov dword [esi + 0x14], edx
mov eax, edx
mov edx, dword [ecx + 0x14]
mov ecx, dword [esi + 8]
shr edx, 8
mov byte [ecx + eax], dl
mov eax, dword [esi + 0x14]
inc eax
mov dword [esi + 0x14], eax
mov ecx, eax
mov edx, dword [esi + 0x1c]
mov eax, dword [edx + 0x2c]
test eax, eax
je 0x51b3cc
mov eax, dword [esi + 8]
push ecx
mov ecx, dword [ebp + 0x30]
push eax
push ecx
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
mov dword [esi + 0x20], 0
mov dword [esi + 4], 0x45
jmp 0x51b482
mov ecx, dword [esi + 0x30]
mov eax, dword [esi + 0x88]
shl ecx, 0xc
sub ecx, 0x7800
cmp eax, ebx
jge 0x51b419
mov eax, dword [esi + 0x84]
cmp eax, ebx
jl 0x51b419
cmp eax, 6
jge 0x51b40b
mov eax, 1
jmp 0x51b41b
xor edx, edx
cmp eax, 6
setne dl
add edx, ebx
mov eax, edx
jmp 0x51b41b
xor eax, eax
shl eax, 6
or ecx, eax
mov eax, dword [esi + 0x6c]
test eax, eax
je 0x51b42a
or ecx, 0x20
mov eax, ecx
xor edx, edx
mov edi, 0x1f
mov dword [esi + 4], 0x71
div edi
sub ecx, edx
add ecx, edi
push ecx
push esi
call fcn.0051ba10
mov eax, dword [esi + 0x6c]
add esp, 8
test eax, eax
je 0x51b471
mov eax, dword [ebp + 0x30]
shr eax, 0x10
push eax
push esi
call fcn.0051ba10
mov ecx, dword [ebp + 0x30]
and ecx, 0xffff
push ecx
push esi
call fcn.0051ba10
add esp, 0x10
push 0
push 0
push 0
call fcn.0051d620
add esp, 0xc
mov dword [ebp + 0x30], eax
cmp dword [esi + 4], 0x45
jne 0x51b560
mov edx, dword [esi + 0x1c]
mov eax, dword [edx + 0x10]
test eax, eax
je 0x51b559
mov eax, dword [edx + 0x14]
mov edi, dword [esi + 0x20]
mov ecx, dword [esi + 0x14]
and eax, 0xffff
cmp edi, eax
jae 0x51b51e
mov eax, dword [esi + 0x14]
mov edi, dword [esi + 0xc]
cmp eax, edi
jne 0x51b4ee
mov edi, dword [edx + 0x2c]
test edi, edi
je 0x51b4d9
cmp eax, ecx
jbe 0x51b4d9
mov edx, dword [esi + 8]
sub eax, ecx
push eax
mov eax, dword [ebp + 0x30]
add edx, ecx
push edx
push eax
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
push ebp
call fcn.0051ba40
mov eax, dword [esi + 0x14]
mov edx, dword [esi + 0xc]
add esp, 4
cmp eax, edx
mov ecx, eax
je 0x51b51e
mov edx, dword [esi + 0x1c]
mov edi, dword [esi + 0x20]
mov ebx, dword [esi + 8]
mov edx, dword [edx + 0x10]
mov dl, byte [edx + edi]
mov byte [ebx + eax], dl
mov edx, dword [esi + 0x14]
mov eax, dword [esi + 0x20]
inc edx
mov dword [esi + 0x14], edx
mov edx, dword [esi + 0x1c]
inc eax
mov dword [esi + 0x20], eax
mov edi, dword [edx + 0x14]
and edi, 0xffff
cmp eax, edi
jb 0x51b4ac
mov eax, dword [esi + 0x1c]
mov edx, dword [eax + 0x2c]
test edx, edx
je 0x51b547
mov eax, dword [esi + 0x14]
cmp eax, ecx
jbe 0x51b547
mov edx, dword [esi + 8]
sub eax, ecx
push eax
mov eax, dword [ebp + 0x30]
add edx, ecx
push edx
push eax
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
mov ecx, dword [esi + 0x1c]
mov edx, dword [esi + 0x20]
cmp edx, dword [ecx + 0x14]
jne 0x51b560
mov dword [esi + 0x20], 0
mov dword [esi + 4], 0x49
cmp dword [esi + 4], 0x49
jne 0x51b622
mov eax, dword [esi + 0x1c]
mov ecx, dword [eax + 0x1c]
test ecx, ecx
je 0x51b61b
mov edx, dword [esi + 0x14]
mov eax, dword [esi + 0x14]
mov ecx, dword [esi + 0xc]
cmp eax, ecx
jne 0x51b5c0
mov ecx, dword [esi + 0x1c]
mov edi, dword [ecx + 0x2c]
test edi, edi
je 0x51b5ab
cmp eax, edx
jbe 0x51b5ab
mov ecx, dword [ebp + 0x30]
sub eax, edx
push eax
mov eax, dword [esi + 8]
add eax, edx
push eax
push ecx
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
push ebp
call fcn.0051ba40
mov eax, dword [esi + 0x14]
mov ecx, dword [esi + 0xc]
add esp, 4
cmp eax, ecx
mov edx, eax
je 0x51b5e6
mov edi, dword [esi + 0x1c]
mov ecx, dword [esi + 0x20]
xor ebx, ebx
inc ecx
mov edi, dword [edi + 0x1c]
mov bl, byte [edi + ecx - 1]
mov dword [esi + 0x20], ecx
mov ecx, dword [esi + 8]
mov byte [ecx + eax], bl
mov ecx, dword [esi + 0x14]
inc ecx
test ebx, ebx
mov dword [esi + 0x14], ecx
je 0x51b5eb
jmp 0x51b57b
mov ebx, 1
mov eax, dword [esi + 0x1c]
mov ecx, dword [eax + 0x2c]
test ecx, ecx
je 0x51b614
mov eax, dword [esi + 0x14]
cmp eax, edx
jbe 0x51b614
mov ecx, dword [esi + 8]
sub eax, edx
add ecx, edx
mov edx, dword [ebp + 0x30]
push eax
push ecx
push edx
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
test ebx, ebx
jne 0x51b622
mov dword [esi + 0x20], ebx
mov dword [esi + 4], 0x5b
cmp dword [esi + 4], 0x5b
jne 0x51b6e1
mov eax, dword [esi + 0x1c]
mov ecx, dword [eax + 0x24]
test ecx, ecx
je 0x51b6da
mov edx, dword [esi + 0x14]
mov eax, dword [esi + 0x14]
mov ecx, dword [esi + 0xc]
cmp eax, ecx
jne 0x51b682
mov ecx, dword [esi + 0x1c]
mov edi, dword [ecx + 0x2c]
test edi, edi
je 0x51b66d
cmp eax, edx
jbe 0x51b66d
mov ecx, dword [ebp + 0x30]
sub eax, edx
push eax
mov eax, dword [esi + 8]
add eax, edx
push eax
push ecx
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
push ebp
call fcn.0051ba40
mov eax, dword [esi + 0x14]
mov ecx, dword [esi + 0xc]
add esp, 4
cmp eax, ecx
mov edx, eax
je 0x51b6a8
mov edi, dword [esi + 0x1c]
mov ecx, dword [esi + 0x20]
xor ebx, ebx
inc ecx
mov edi, dword [edi + 0x24]
mov bl, byte [edi + ecx - 1]
mov dword [esi + 0x20], ecx
mov ecx, dword [esi + 8]
mov byte [ecx + eax], bl
mov ecx, dword [esi + 0x14]
inc ecx
test ebx, ebx
mov dword [esi + 0x14], ecx
je 0x51b6ad
jmp 0x51b63d
mov ebx, 1
mov eax, dword [esi + 0x1c]
mov ecx, dword [eax + 0x2c]
test ecx, ecx
je 0x51b6d6
mov eax, dword [esi + 0x14]
cmp eax, edx
jbe 0x51b6d6
mov ecx, dword [esi + 8]
sub eax, edx
add ecx, edx
mov edx, dword [ebp + 0x30]
push eax
push ecx
push edx
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
test ebx, ebx
jne 0x51b6e1
mov dword [esi + 4], 0x67
cmp dword [esi + 4], 0x67
jne 0x51b751
mov eax, dword [esi + 0x1c]
mov ecx, dword [eax + 0x2c]
test ecx, ecx
je 0x51b74a
mov ecx, dword [esi + 0x14]
mov eax, dword [esi + 0xc]
add ecx, 2
cmp ecx, eax
jbe 0x51b707
push ebp
call fcn.0051ba40
add esp, 4
mov eax, dword [esi + 0x14]
mov ecx, dword [esi + 0xc]
lea edx, [eax + 2]
cmp edx, ecx
ja 0x51b751
mov ecx, dword [esi + 8]
mov dl, byte [ebp + 0x30]
push 0
push 0
mov byte [ecx + eax], dl
mov edi, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc edi
mov dword [esi + 0x14], edi
mov ecx, dword [ebp + 0x30]
mov eax, edi
push 0
shr ecx, 8
mov byte [edx + eax], cl
mov eax, dword [esi + 0x14]
inc eax
mov dword [esi + 0x14], eax
call fcn.0051ab30
add esp, 0xc
mov dword [ebp + 0x30], eax
mov dword [esi + 4], 0x71
mov eax, dword [esi + 0x14]
test eax, eax
je 0x51b776
push ebp
call fcn.0051ba40
mov eax, dword [ebp + 0x10]
add esp, 4
test eax, eax
jne 0x51b7a0
mov dword [esi + 0x28], 0xffffffff
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
mov eax, dword [ebp + 4]
test eax, eax
jne 0x51b7a0
mov ecx, dword [esp + 0x18]
mov eax, dword [esp + 0x14]
cmp ecx, eax
jg 0x51b7a4
cmp ecx, 4
je 0x51b7a4
mov eax, dword [str.buffer_error]
pop edi
mov dword [ebp + 0x18], eax
pop esi
pop ebp
mov eax, 0xfffffffb
pop ebx
ret
mov ecx, dword [esp + 0x18]
mov eax, dword [esi + 4]
mov edx, dword [ebp + 4]
cmp eax, 0x29a
jne 0x51b7c8
test edx, edx
je 0x51b7cc
mov ecx, dword [str.buffer_error]
pop edi
mov dword [ebp + 0x18], ecx
pop esi
pop ebp
mov eax, 0xfffffffb
pop ebx
ret
test edx, edx
jne 0x51b7e6
mov edx, dword [esi + 0x74]
test edx, edx
jne 0x51b7e6
test ecx, ecx
je 0x51b8d5
cmp eax, 0x29a
je 0x51b8d5
mov eax, dword [esi + 0x88]
cmp eax, 2
jne 0x51b7fe
mov edx, dword [esp + 0x18]
push edx
push esi
call fcn.0051cb40
jmp 0x51b826
cmp eax, 3
jne 0x51b810
mov eax, dword [esp + 0x18]
push eax
push esi
call fcn.0051c890
jmp 0x51b826
mov eax, dword [esi + 0x84]
mov edx, dword [esp + 0x18]
push edx
push esi
lea ecx, [eax + eax*2]
call dword [ecx*4 + 0x58db20]
add esp, 8
cmp eax, 2
je 0x51b833
cmp eax, 3
jne 0x51b83a
mov dword [esi + 4], 0x29a
test eax, eax
je 0x51b9e2
cmp eax, 2
je 0x51b9e2
cmp eax, 1
jne 0x51b8d5
mov eax, dword [esp + 0x18]
cmp eax, 1
jne 0x51b868
push esi
call fcn.0051da10
add esp, 4
jmp 0x51b8b7
cmp eax, 5
je 0x51b8b7
push 0
push 0
push 0
push esi
call fcn.0051d970
mov eax, dword [esp + 0x28]
add esp, 0x10
cmp eax, 3
jne 0x51b8b7
mov eax, dword [esi + 0x4c]
mov ecx, dword [esi + 0x44]
xor edx, edx
mov word [ecx + eax*2 - 2], dx
mov eax, dword [esi + 0x4c]
mov edi, dword [esi + 0x44]
lea ecx, [eax + eax - 2]
xor eax, eax
mov ebx, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, ebx
and ecx, 3
rep stosb byte es:[edi], al
cmp dword [esi + 0x74], edx
jne 0x51b8b7
mov dword [esi + 0x6c], edx
mov dword [esi + 0x5c], edx
push ebp
call fcn.0051ba40
mov eax, dword [ebp + 0x10]
add esp, 4
test eax, eax
jne 0x51b8d5
mov dword [esi + 0x28], 0xffffffff
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
cmp dword [esp + 0x18], 4
je 0x51b8e3
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
mov eax, dword [esi + 0x18]
test eax, eax
jg 0x51b8f4
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
ret
cmp eax, 2
jne 0x51b99e
mov ecx, dword [esi + 8]
mov edx, dword [esi + 0x14]
mov al, byte [ebp + 0x30]
mov byte [ecx + edx], al
mov edi, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc edi
mov dword [esi + 0x14], edi
mov ecx, dword [ebp + 0x30]
mov eax, edi
shr ecx, 8
mov byte [edx + eax], cl
mov eax, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc eax
mov dword [esi + 0x14], eax
mov ecx, dword [ebp + 0x30]
shr ecx, 0x10
mov byte [edx + eax], cl
mov edi, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc edi
mov dword [esi + 0x14], edi
mov ecx, dword [ebp + 0x30]
mov eax, edi
shr ecx, 0x18
mov byte [edx + eax], cl
mov ebx, dword [esi + 0x14]
mov ecx, dword [esi + 8]
inc ebx
mov dword [esi + 0x14], ebx
mov dl, byte [ebp + 8]
mov eax, ebx
mov byte [ecx + eax], dl
mov edi, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc edi
mov dword [esi + 0x14], edi
mov ecx, dword [ebp + 8]
mov eax, edi
shr ecx, 8
mov byte [edx + eax], cl
mov eax, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc eax
mov dword [esi + 0x14], eax
mov ecx, dword [ebp + 8]
shr ecx, 0x10
mov byte [edx + eax], cl
mov edi, dword [esi + 0x14]
mov edx, dword [esi + 8]
inc edi
mov dword [esi + 0x14], edi
mov ecx, dword [ebp + 8]
mov eax, edi
shr ecx, 0x18
mov byte [edx + eax], cl
mov eax, dword [esi + 0x14]
inc eax
mov dword [esi + 0x14], eax
jmp 0x51b9be
mov eax, dword [ebp + 0x30]
shr eax, 0x10
push eax
push esi
call fcn.0051ba10
mov ecx, dword [ebp + 0x30]
and ecx, 0xffff
push ecx
push esi
call fcn.0051ba10
add esp, 0x10
push ebp
call fcn.0051ba40
mov eax, dword [esi + 0x18]
add esp, 4
test eax, eax
jle 0x51b9d3
neg eax
mov dword [esi + 0x18], eax
mov ecx, dword [esi + 0x14]
xor eax, eax
pop edi
pop esi
test ecx, ecx
pop ebp
pop ebx
sete al
ret
mov eax, dword [ebp + 0x10]
test eax, eax
jne 0x51b9f0
mov dword [esi + 0x28], 0xffffffff
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
mov edx, dword [str.stream_error]
mov dword [ebp + 0x18], edx
pop edi
pop esi
pop ebp
mov eax, 0xfffffffe
pop ebx
ret