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

Disassembly:
push rdi
push r12
sub rsp, 0x28
mov r12d, edx
mov rdi, rcx
call fcn.18016c740
test eax, eax
jne 0x18016c310
cmp r12d, 5
ja 0x18016c310
cmp qword [rdi + 0x10], 0
mov qword [rsp + 0x40], rbx
mov rbx, qword [rdi + 0x28]
je 0x18016c2f3
cmp dword [rdi + 8], eax
je 0x18016ba48
cmp qword [rdi], 0
je 0x18016c2f3
mov r9d, dword [rbx + 8]
cmp r9d, 0x29a
jne 0x18016ba5f
cmp r12d, 4
jne 0x18016c2f3
cmp dword [rdi + 0x18], 0
mov qword [rsp + 0x48], rbp
mov qword [rsp + 0x50], rsi
mov qword [rsp + 0x58], r14
mov qword [rsp + 0x20], r15
je 0x18016bae5
mov edx, dword [rbx + 0x40]
xor esi, esi
mov dword [rbx + 0x40], r12d
cmp dword [rbx + 0x28], esi
je 0x18016ba9e
mov rcx, rdi
call fcn.18016ceb0
cmp dword [rdi + 0x18], esi
je 0x18016c2e5
mov r8d, dword [rbx + 8]
jmp 0x18016bad3
mov r8d, r9d
cmp dword [rdi + 8], esi
jne 0x18016bad3
cmp edx, 4
mov r10d, 9
mov eax, esi
mov ecx, esi
cmovg eax, r10d
add edx, edx
sub edx, eax
lea eax, [r12 + r12]
cmp r12d, 4
cmovg ecx, r10d
sub eax, ecx
cmp eax, edx
jg 0x18016bad3
cmp r12d, 4
jne 0x18016bae5
cmp r8d, 0x29a
jne 0x18016bb16
cmp dword [rdi + 8], esi
je 0x18016bbd3
mov rax, qword [str.buffer_error]
mov qword [rdi + 0x20], rax
mov eax, 0xfffffffb
mov r14, qword [rsp + 0x58]
mov rsi, qword [rsp + 0x50]
mov rbp, qword [rsp + 0x48]
mov r15, qword [rsp + 0x20]
mov rbx, qword [rsp + 0x40]
add rsp, 0x28
pop r12
pop rdi
ret
cmp r8d, 0x2a
jne 0x18016bbd3
mov eax, dword [rbx + 0x48]
shl eax, 0xc
sub eax, 0x7800
cmp dword [rbx + 0xb0], 2
jge 0x18016bb63
mov ecx, dword [rbx + 0xac]
cmp ecx, 2
jl 0x18016bb63
cmp ecx, 6
jge 0x18016bb4d
lea edx, [r8 + 0x16]
lea ecx, [rdx + 0x20]
jmp 0x18016bb6a
jne 0x18016bb59
mov edx, 0x80
lea ecx, [rdx + 0x20]
jmp 0x18016bb6a
mov edx, 0xc0
lea ecx, [rdx + 0x20]
jmp 0x18016bb6a
mov edx, esi
mov ecx, 0x20
cmp dword [rbx + 0x94], esi
cmove ecx, edx
or ecx, eax
mov eax, 0x8421085
mul ecx
sub ecx, edx
shr ecx, 1
add ecx, edx
shr ecx, 4
inc ecx
imul edx, ecx, 0x1f
mov rcx, rbx
call fcn.18016d1a0
cmp dword [rbx + 0x94], esi
je 0x18016bbac
movzx edx, word [rdi + 0x4e]
call fcn.18016d1a0
movzx edx, word [rdi + 0x4c]
call fcn.18016d1a0
xor r8d, r8d
xor edx, edx
xor ecx, ecx
call fcn.18016d310
mov dword [rdi + 0x4c], eax
mov rcx, rdi
mov dword [rbx + 8], 0x71
call fcn.18016ceb0
cmp dword [rbx + 0x28], esi
jne 0x18016c2e5
mov eax, dword [rbx + 8]
cmp eax, 0x39
jne 0x18016be0c
xor r8d, r8d
xor edx, edx
xor ecx, ecx
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], 0x1f
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], 0x8b
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], 8
inc dword [rbx + 0x28]
mov r8, qword [rbx + 0x30]
mov r9d, dword [rbx + 0x28]
test r8, r8
jne 0x18016bccc
mov rax, qword [rbx + 0x10]
mov byte [r9 + rax], sil
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], sil
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], sil
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], sil
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], sil
mov ecx, dword [rbx + 0x28]
mov eax, dword [rbx + 0xac]
inc ecx
mov dword [rbx + 0x28], ecx
cmp eax, 9
jne 0x18016bc80
mov dl, 2
jmp 0x18016bc94
cmp dword [rbx + 0xb0], 2
jge 0x18016bc92
cmp eax, 2
jl 0x18016bc92
xor dl, dl
jmp 0x18016bc94
mov dl, 4
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], dl
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], 0xb
mov rcx, rdi
inc dword [rbx + 0x28]
mov dword [rbx + 8], 0x71
call fcn.18016ceb0
cmp dword [rbx + 0x28], esi
jne 0x18016c2e5
mov eax, dword [rbx + 8]
jmp 0x18016be0c
mov rax, qword [r8 + 0x30]
neg rax
mov eax, dword [r8 + 0x3c]
sbb dl, dl
and dl, 0x10
neg eax
mov rax, qword [r8 + 0x20]
sbb cl, cl
and cl, 2
add dl, cl
neg rax
mov rax, qword [r8 + 0x10]
sbb cl, cl
and cl, 8
add dl, cl
neg rax
sbb cl, cl
and cl, 4
add dl, cl
cmp dword [r8], esi
setne al
add dl, al
mov rax, qword [rbx + 0x10]
mov byte [r9 + rax], dl
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
mov rcx, qword [rbx + 0x10]
movzx eax, byte [rax + 4]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
mov rcx, qword [rbx + 0x10]
movzx eax, byte [rax + 5]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
mov rcx, qword [rbx + 0x10]
movzx eax, byte [rax + 6]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
mov edx, dword [rbx + 0x28]
mov rcx, qword [rbx + 0x10]
movzx eax, byte [rax + 7]
mov byte [rdx + rcx], al
mov ecx, dword [rbx + 0x28]
mov eax, dword [rbx + 0xac]
inc ecx
mov dword [rbx + 0x28], ecx
cmp eax, 9
jne 0x18016bd7c
mov dl, 2
jmp 0x18016bd90
cmp dword [rbx + 0xb0], 2
jge 0x18016bd8e
cmp eax, 2
jl 0x18016bd8e
xor dl, dl
jmp 0x18016bd90
mov dl, 4
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], dl
inc dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
mov edx, dword [rbx + 0x28]
mov rcx, qword [rbx + 0x10]
movzx eax, byte [rax + 0xc]
mov byte [rdx + rcx], al
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
inc ecx
mov dword [rbx + 0x28], ecx
cmp qword [rax + 0x10], rsi
je 0x18016bdea
movzx eax, byte [rax + 0x18]
mov edx, ecx
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
mov edx, dword [rbx + 0x28]
mov rcx, qword [rbx + 0x10]
movzx eax, byte [rax + 0x19]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov ecx, dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
cmp dword [rax + 0x3c], esi
je 0x18016be01
mov rdx, qword [rbx + 0x10]
mov r8d, ecx
mov ecx, dword [rdi + 0x4c]
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov eax, 0x45
mov dword [rbx + 0x38], esi
mov dword [rbx + 8], eax
cmp eax, 0x45
jne 0x18016befe
mov rcx, qword [rbx + 0x30]
cmp qword [rcx + 0x10], rsi
je 0x18016bef6
mov edx, dword [rbx + 0x38]
movzx r15d, word [rcx + 0x18]
mov r14d, dword [rbx + 0x28]
sub r15d, edx
mov ebp, dword [rbx + 0x18]
lea eax, [r14 + r15]
cmp eax, ebp
jbe 0x18016beaf
mov ecx, r14d
mov rax, qword [rbx + 0x30]
sub ebp, ecx
mov edx, dword [rbx + 0x38]
add rcx, qword [rbx + 0x10]
mov r8d, ebp
add rdx, qword [rax + 0x10]
call fcn.18013cf70
mov rax, qword [rbx + 0x30]
mov r8d, dword [rbx + 0x18]
mov dword [rbx + 0x28], r8d
cmp dword [rax + 0x3c], esi
je 0x18016be84
cmp r8d, r14d
jbe 0x18016be84
mov ecx, dword [rdi + 0x4c]
sub r8d, r14d
mov edx, r14d
add rdx, qword [rbx + 0x10]
call fcn.18016d600
mov dword [rdi + 0x4c], eax
add dword [rbx + 0x38], ebp
mov rcx, rdi
call fcn.18016ceb0
cmp dword [rbx + 0x28], esi
jne 0x18016c2e5
sub r15d, ebp
mov ecx, esi
mov ebp, dword [rbx + 0x18]
mov r14d, esi
cmp r15d, ebp
ja 0x18016be40
mov rcx, qword [rbx + 0x30]
mov edx, dword [rbx + 0x38]
add rdx, qword [rcx + 0x10]
mov rcx, qword [rbx + 0x10]
mov ebp, r14d
add rcx, rbp
mov r8d, r15d
call fcn.18013cf70
mov r8d, dword [rbx + 0x28]
mov rax, qword [rbx + 0x30]
add r8d, r15d
mov dword [rbx + 0x28], r8d
cmp dword [rax + 0x3c], esi
je 0x18016bef3
cmp r8d, r14d
jbe 0x18016bef3
mov rdx, qword [rbx + 0x10]
sub r8d, r14d
mov ecx, dword [rdi + 0x4c]
add rdx, rbp
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov dword [rbx + 0x38], esi
mov eax, 0x49
mov dword [rbx + 8], eax
cmp eax, 0x49
jne 0x18016bfbc
mov rax, qword [rbx + 0x30]
cmp qword [rax + 0x20], rsi
je 0x18016bfb4
mov r9d, dword [rbx + 0x28]
mov r8d, r9d
nop dword [rax]
cmp r8d, dword [rbx + 0x18]
jne 0x18016bf60
mov rax, qword [rbx + 0x30]
cmp dword [rax + 0x3c], esi
je 0x18016bf49
cmp r8d, r9d
jbe 0x18016bf49
mov ecx, dword [rdi + 0x4c]
sub r8d, r9d
mov edx, r9d
add rdx, qword [rbx + 0x10]
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov rcx, rdi
call fcn.18016ceb0
cmp dword [rbx + 0x28], esi
jne 0x18016c2e5
mov r9d, esi
mov r8d, esi
mov ecx, dword [rbx + 0x38]
mov rax, qword [rbx + 0x30]
mov rax, qword [rax + 0x20]
movzx edx, byte [rcx + rax]
lea eax, [rcx + 1]
mov ecx, r8d
mov dword [rbx + 0x38], eax
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], dl
mov r8d, dword [rbx + 0x28]
inc r8d
mov dword [rbx + 0x28], r8d
test dl, dl
jne 0x18016bf20
mov rax, qword [rbx + 0x30]
cmp dword [rax + 0x3c], esi
je 0x18016bfb1
cmp r8d, r9d
jbe 0x18016bfb1
mov ecx, dword [rdi + 0x4c]
sub r8d, r9d
mov edx, r9d
add rdx, qword [rbx + 0x10]
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov dword [rbx + 0x38], esi
mov eax, 0x5b
mov dword [rbx + 8], eax
cmp eax, 0x5b
jne 0x18016c07a
mov rax, qword [rbx + 0x30]
cmp qword [rax + 0x30], rsi
je 0x18016c071
mov r9d, dword [rbx + 0x28]
mov r8d, r9d
nop word [rax + rax]
cmp r8d, dword [rbx + 0x18]
jne 0x18016c020
mov rax, qword [rbx + 0x30]
cmp dword [rax + 0x3c], esi
je 0x18016c009
cmp r8d, r9d
jbe 0x18016c009
mov ecx, dword [rdi + 0x4c]
sub r8d, r9d
mov edx, r9d
add rdx, qword [rbx + 0x10]
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov rcx, rdi
call fcn.18016ceb0
cmp dword [rbx + 0x28], esi
jne 0x18016c2e5
mov r9d, esi
mov r8d, esi
mov ecx, dword [rbx + 0x38]
mov rax, qword [rbx + 0x30]
mov rax, qword [rax + 0x30]
movzx edx, byte [rcx + rax]
lea eax, [rcx + 1]
mov ecx, r8d
mov dword [rbx + 0x38], eax
mov rax, qword [rbx + 0x10]
mov byte [rcx + rax], dl
mov r8d, dword [rbx + 0x28]
inc r8d
mov dword [rbx + 0x28], r8d
test dl, dl
jne 0x18016bfe0
mov rax, qword [rbx + 0x30]
cmp dword [rax + 0x3c], esi
je 0x18016c071
cmp r8d, r9d
jbe 0x18016c071
mov ecx, dword [rdi + 0x4c]
sub r8d, r9d
mov edx, r9d
add rdx, qword [rbx + 0x10]
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov dword [rbx + 8], 0x67
jmp 0x18016c07f
cmp eax, 0x67
jne 0x18016c0ee
mov rax, qword [rbx + 0x30]
cmp dword [rax + 0x3c], esi
je 0x18016c0d6
mov ecx, dword [rbx + 0x28]
lea eax, [rcx + 2]
cmp eax, dword [rbx + 0x18]
jbe 0x18016c0a6
mov rcx, rdi
call fcn.18016ceb0
mov ecx, dword [rbx + 0x28]
test ecx, ecx
jne 0x18016c2e5
movzx eax, byte [rdi + 0x4c]
xor r8d, r8d
mov edx, ecx
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
mov rcx, qword [rbx + 0x10]
movzx eax, byte [rdi + 0x4d]
mov byte [rdx + rcx], al
xor edx, edx
inc dword [rbx + 0x28]
xor ecx, ecx
call fcn.18016d600
mov dword [rdi + 0x4c], eax
mov rcx, rdi
mov dword [rbx + 8], 0x71
call fcn.18016ceb0
cmp dword [rbx + 0x28], esi
jne 0x18016c2e5
cmp dword [rdi + 8], esi
jne 0x18016c111
cmp dword [rbx + 0x9c], esi
jne 0x18016c111
test r12d, r12d
je 0x18016c1fb
cmp dword [rbx + 8], 0x29a
je 0x18016c1fb
movsxd rcx, dword [rbx + 0xac]
mov edx, r12d
test ecx, ecx
jne 0x18016c129
mov rcx, rbx
call fcn.18016acf0
jmp 0x18016c161
mov eax, dword [rbx + 0xb0]
cmp eax, 2
jne 0x18016c13e
mov rcx, rbx
call fcn.18016c7a0
jmp 0x18016c161
cmp eax, 3
jne 0x18016c14d
mov rcx, rbx
call fcn.18016c970
jmp 0x18016c161
mov rax, rcx
lea r8, fcn.18016acf0
add rax, rax
mov rcx, rbx
call qword [r8 + rax*8]
mov ecx, eax
lea eax, [rax - 2]
cmp eax, 1
ja 0x18016c172
mov dword [rbx + 8], 0x29a
test ecx, 0xfffffffd
je 0x18016c2e0
cmp ecx, 1
jne 0x18016c1fb
cmp r12d, ecx
jne 0x18016c192
mov rcx, rbx
call fcn.18016e300
jmp 0x18016c1ea
cmp r12d, 5
je 0x18016c1ea
xor r9d, r9d
xor r8d, r8d
xor edx, edx
mov rcx, rbx
call fcn.18016e6b0
cmp r12d, 3
jne 0x18016c1ea
mov ecx, dword [rbx + 0x74]
xor edx, edx
mov rax, qword [rbx + 0x68]
dec ecx
mov word [rax + rcx*2], si
mov r8d, dword [rbx + 0x74]
mov rcx, qword [rbx + 0x68]
dec r8d
add r8, r8
call fcn.18013d3d0
cmp dword [rbx + 0x9c], esi
jne 0x18016c1ea
mov dword [rbx + 0x94], esi
mov dword [rbx + 0x84], esi
mov dword [rbx + 0x170c], esi
mov rcx, rdi
call fcn.18016ceb0
cmp dword [rdi + 0x18], esi
je 0x18016c2e5
cmp r12d, 4
jne 0x18016c2ec
mov eax, dword [rbx + 0x2c]
test eax, eax
jg 0x18016c216
lea eax, [r12 - 3]
jmp 0x18016baf5
cmp eax, 2
jne 0x18016c2a9
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0x4c]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0x4d]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0x4e]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0x4f]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0xc]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0xd]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0xe]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
mov edx, dword [rbx + 0x28]
movzx eax, byte [rdi + 0xf]
mov rcx, qword [rbx + 0x10]
mov byte [rdx + rcx], al
inc dword [rbx + 0x28]
jmp 0x18016c2be
movzx edx, word [rdi + 0x4e]
mov rcx, rbx
call fcn.18016d1a0
movzx edx, word [rdi + 0x4c]
call fcn.18016d1a0
mov rcx, rdi
call fcn.18016ceb0
mov eax, dword [rbx + 0x2c]
test eax, eax
jle 0x18016c2d2
neg eax
mov dword [rbx + 0x2c], eax
cmp dword [rbx + 0x28], esi
sete sil
mov eax, esi
jmp 0x18016baf5
cmp dword [rdi + 0x18], esi
jne 0x18016c2ec
mov dword [rbx + 0x40], 0xffffffff
xor eax, eax
jmp 0x18016baf5
mov rax, qword [str.stream_error]
mov rbx, qword [rsp + 0x40]
mov qword [rdi + 0x20], rax
mov eax, 0xfffffffe
add rsp, 0x28
pop r12
pop rdi
ret
mov eax, 0xfffffffe
add rsp, 0x28
pop r12
pop rdi
ret