// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/zlib-1.3.0.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 0x9c4be
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
jne 0x9caed
cmpl $-0x1, %ebp
movl $0x6, %r12d
cmovnel %ebp, %r12d
cmpl $0xa, %r12d
setae %cl
cmpl $0x5, %ebx
setae %dl
orb %cl, %dl
jne 0x9caed
movq 0x38(%r15), %r14
cmpl %ebx, 0xc8(%r14)
jne 0x9c9f7
movslq 0xc4(%r14), %rax
shlq $0x4, %rax
leaq 0xb34dc(%rip), %rcx     # 0x14fec0
movq 0x8(%rax,%rcx), %rax
movl %r12d, %edx
shlq $0x4, %rdx
cmpq 0x8(%rdx,%rcx), %rax
je 0x9ca2d
cmpl $-0x2, 0x4c(%r14)
je 0x9ca2d
movq %r15, %rdi
movl $0x5, %esi
callq 0x9caf6
cmpl $-0x2, %eax
jne 0x9ca17
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x9ca23
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
cmpl $0x0, 0x8(%r15)
je 0x9ca5b
xorl %ecx, %ecx
testb %cl, %cl
je 0x9caed
movl 0xc4(%r14), %eax
cmpl %r12d, %eax
je 0x9cae4
testl %eax, %eax
jne 0x9caa0
movl 0x1728(%r14), %eax
testl %eax, %eax
je 0x9caa0
cmpl $0x1, %eax
jne 0x9ca78
movq %r14, %rdi
callq 0x9d5fd
jmp 0x9ca95
movl 0xac(%r14), %ecx
movl 0xb4(%r14), %edx
subq 0x98(%r14), %rcx
addq %rcx, %rdx
sete %cl
jmp 0x9ca25
movq 0x78(%r14), %rdi
movl 0x84(%r14), %edx
decl %edx
movw $0x0, (%rdi,%rdx,2)
addq %rdx, %rdx
xorl %esi, %esi
callq 0xb2f0
movl $0x0, 0x1728(%r14)
movl %r12d, 0xc4(%r14)
movl %r12d, %eax
shlq $0x4, %rax
leaq 0xb340b(%rip), %rcx     # 0x14fec0
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