// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/zlib1.3.1/deflate.c
// Function: deflateParams
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) {
    deflate_state *s;
    compress_func func;

    if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
    s = strm->state;

#ifdef FASTEST
    if (level != 0) level = 1;
#else
    if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif
    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
        return Z_STREAM_ERROR;
    }
    func = configuration_table[s->level].func;

    if ((strategy != s->strategy || func != configuration_table[level].func) &&
        s->last_flush != -2) {
        /* Flush the last buffer: */
        int err = deflate(strm, Z_BLOCK);
        if (err == Z_STREAM_ERROR)
            return err;
        if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
            return Z_BUF_ERROR;
    }
    if (s->level != level) {
        if (s->level == 0 && s->matches != 0) {
            if (s->matches == 1)
                slide_hash(s);
            else
                CLEAR_HASH(s);
            s->matches = 0;
        }
        s->level = level;
        s->max_lazy_match   = configuration_table[level].max_lazy;
        s->good_match       = configuration_table[level].good_length;
        s->nice_match       = configuration_table[level].nice_length;
        s->max_chain_length = configuration_table[level].max_chain;
    }
    s->strategy = strategy;
    return Z_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r15
callq 0x4b13a
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
jne 0x4b754
cmpl $-0x1, %ebp
movl $0x6, %r12d
cmovnel %ebp, %r12d
cmpl $0xa, %r12d
setae %cl
cmpl $0x5, %ebx
setae %dl
orb %cl, %dl
jne 0x4b754
movq 0x38(%r15), %r14
cmpl %ebx, 0xc8(%r14)
jne 0x4b65e
movslq 0xc4(%r14), %rax
shlq $0x4, %rax
leaq 0x305f5(%rip), %rcx     # 0x7bc40
movq 0x8(%rax,%rcx), %rax
movl %r12d, %edx
shlq $0x4, %rdx
cmpq 0x8(%rdx,%rcx), %rax
je 0x4b694
cmpl $-0x2, 0x4c(%r14)
je 0x4b694
movq %r15, %rdi
movl $0x5, %esi
callq 0x4b75d
cmpl $-0x2, %eax
jne 0x4b67e
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x4b68a
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
cmpl $0x0, 0x8(%r15)
je 0x4b6c2
xorl %ecx, %ecx
testb %cl, %cl
je 0x4b754
movl 0xc4(%r14), %eax
cmpl %r12d, %eax
je 0x4b74b
testl %eax, %eax
jne 0x4b707
movl 0x1728(%r14), %eax
testl %eax, %eax
je 0x4b707
cmpl $0x1, %eax
jne 0x4b6df
movq %r14, %rdi
callq 0x4c264
jmp 0x4b6fc
movl 0xac(%r14), %ecx
movl 0xb4(%r14), %edx
subq 0x98(%r14), %rcx
addq %rcx, %rdx
sete %cl
jmp 0x4b68c
movq 0x78(%r14), %rdi
movl 0x84(%r14), %edx
decl %edx
movw $0x0, (%rdi,%rdx,2)
addq %rdx, %rdx
xorl %esi, %esi
callq 0x41c0
movl $0x0, 0x1728(%r14)
movl %r12d, 0xc4(%r14)
movl %r12d, %eax
shlq $0x4, %rax
leaq 0x30524(%rip), %rcx     # 0x7bc40
movzwl 0x2(%rax,%rcx), %edx
movl %edx, 0xc0(%r14)
movzwl (%rax,%rcx), %edx
movl %edx, 0xcc(%r14)
movzwl 0x4(%rax,%rcx), %edx
movl %edx, 0xd0(%r14)
movzwl 0x6(%rax,%rcx), %eax
movl %eax, 0xbc(%r14)
movl %ebx, 0xc8(%r14)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq