// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/zlib-1.3.0.1/deflate.c
// Function: deflate_slow
local block_state deflate_slow(deflate_state *s, int flush) {
    IPos hash_head;          /* head of hash chain */
    int bflush;              /* set if current block must be flushed */

    /* Process the input block. */
    for (;;) {
        /* Make sure that we always have enough lookahead, except
         * at the end of the input file. We need MAX_MATCH bytes
         * for the next match, plus MIN_MATCH bytes to insert the
         * string following the next match.
         */
        if (s->lookahead < MIN_LOOKAHEAD) {
            fill_window(s);
            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
                return need_more;
            }
            if (s->lookahead == 0) break; /* flush the current block */
        }

        /* Insert the string window[strstart .. strstart + 2] in the
         * dictionary, and set hash_head to the head of the hash chain:
         */
        hash_head = NIL;
        if (s->lookahead >= MIN_MATCH) {
            INSERT_STRING(s, s->strstart, hash_head);
        }

        /* Find the longest match, discarding those <= prev_length.
         */
        s->prev_length = s->match_length, s->prev_match = s->match_start;
        s->match_length = MIN_MATCH-1;

        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
            s->strstart - hash_head <= MAX_DIST(s)) {
            /* To simplify the code, we prevent matches with the string
             * of window index 0 (in particular we have to avoid a match
             * of the string with itself at the start of the input file).
             */
            s->match_length = longest_match (s, hash_head);
            /* longest_match() sets match_start */

            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
#if TOO_FAR <= 32767
                || (s->match_length == MIN_MATCH &&
                    s->strstart - s->match_start > TOO_FAR)
#endif
                )) {

                /* If prev_match is also MIN_MATCH, match_start is garbage
                 * but we will ignore the current match anyway.
                 */
                s->match_length = MIN_MATCH-1;
            }
        }
        /* If there was a match at the previous step and the current
         * match is not better, output the previous match:
         */
        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
            /* Do not insert strings in hash table beyond this. */

            check_match(s, s->strstart - 1, s->prev_match, s->prev_length);

            _tr_tally_dist(s, s->strstart - 1 - s->prev_match,
                           s->prev_length - MIN_MATCH, bflush);

            /* Insert in hash table all strings up to the end of the match.
             * strstart - 1 and strstart are already inserted. If there is not
             * enough lookahead, the last two strings are not inserted in
             * the hash table.
             */
            s->lookahead -= s->prev_length - 1;
            s->prev_length -= 2;
            do {
                if (++s->strstart <= max_insert) {
                    INSERT_STRING(s, s->strstart, hash_head);
                }
            } while (--s->prev_length != 0);
            s->match_available = 0;
            s->match_length = MIN_MATCH-1;
            s->strstart++;

            if (bflush) FLUSH_BLOCK(s, 0);

        } else if (s->match_available) {
            /* If there was no match at the previous position, output a
             * single literal. If there was a match but the current match
             * is longer, truncate the previous match to a single literal.
             */
            Tracevv((stderr,"%c", s->window[s->strstart - 1]));
            _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
            if (bflush) {
                FLUSH_BLOCK_ONLY(s, 0);
            }
            s->strstart++;
            s->lookahead--;
            if (s->strm->avail_out == 0) return need_more;
        } else {
            /* There is no previous match to compare with, wait for
             * the next step to decide.
             */
            s->match_available = 1;
            s->strstart++;
            s->lookahead--;
        }
    }
    Assert (flush != Z_NO_FLUSH, "no flush?");
    if (s->match_available) {
        Tracevv((stderr,"%c", s->window[s->strstart - 1]));
        _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
        s->match_available = 0;
    }
    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
    if (flush == Z_FINISH) {
        FLUSH_BLOCK(s, 1);
        return finish_done;
    }
    if (s->sym_next)
        FLUSH_BLOCK(s, 0);
    return block_done;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r12d
movq %rdi, %rbx
movl $0x100, %r13d           # imm = 0x100
xorl %r15d, %r15d
cmpl $0x105, 0xb4(%rbx)      # imm = 0x105
ja 0x9e913
testl %r12d, %r12d
sete %r14b
movq %rbx, %rdi
callq 0x9c512
movl 0xb4(%rbx), %eax
cmpl $0x106, %eax            # imm = 0x106
setb %cl
testb %cl, %r14b
jne 0x9eccc
testl %eax, %eax
je 0x9ecd4
xorl %esi, %esi
cmpl $0x3, 0xb4(%rbx)
jb 0x9e967
movl 0x80(%rbx), %eax
movb 0x90(%rbx), %cl
shll %cl, %eax
movl 0xac(%rbx), %ecx
leal 0x2(%rcx), %edx
movq 0x60(%rbx), %rsi
movzbl (%rsi,%rdx), %edx
xorl %eax, %edx
andl 0x8c(%rbx), %edx
movq 0x70(%rbx), %rax
movl %edx, 0x80(%rbx)
movq 0x78(%rbx), %rdi
movzwl (%rdi,%rdx,2), %esi
movl 0x58(%rbx), %r8d
andl %ecx, %r8d
movw %si, (%rax,%r8,2)
movw %cx, (%rdi,%rdx,2)
movl 0xa0(%rbx), %eax
movl 0xb0(%rbx), %ecx
movl %eax, 0xb8(%rbx)
movl %ecx, 0xa4(%rbx)
movl $0x2, 0xa0(%rbx)
testl %esi, %esi
je 0x9e9eb
cmpl 0xc0(%rbx), %eax
jae 0x9e9eb
movl 0xac(%rbx), %eax
subl %esi, %eax
movl 0x50(%rbx), %ecx
movl $0xfffffefa, %edx       # imm = 0xFFFFFEFA
addl %edx, %ecx
cmpl %ecx, %eax
ja 0x9e9eb
movq %rbx, %rdi
callq 0x9ee1e
movl %eax, 0xa0(%rbx)
cmpl $0x5, %eax
ja 0x9e9eb
cmpl $0x1, 0xc8(%rbx)
jne 0x9e9d3
movl $0x2, 0xa0(%rbx)
jmp 0x9e9eb
cmpl $0x3, %eax
jne 0x9e9eb
movl 0xac(%rbx), %eax
subl 0xb0(%rbx), %eax
cmpl $0x1001, %eax           # imm = 0x1001
jae 0x9e9c7
movl 0xb8(%rbx), %ecx
cmpl $0x3, %ecx
jb 0x9ea02
cmpl %ecx, 0xa0(%rbx)
jbe 0x9eabc
cmpl $0x0, 0xa8(%rbx)
je 0x9eaa1
movq 0x60(%rbx), %rax
movl 0xac(%rbx), %ecx
decl %ecx
movzbl (%rax,%rcx), %eax
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb %r15b, (%rcx,%rdx)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb %r15b, (%rcx,%rdx)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb %al, (%rcx,%rdx)
incw 0xd4(%rbx,%rax,4)
movl 0x170c(%rbx), %eax
cmpl 0x1710(%rbx), %eax
jne 0x9ec76
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x9ec4c
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9ec4e
movl $0x1, 0xa8(%rbx)
incl 0xac(%rbx)
decl 0xb4(%rbx)
jmp 0x9e8d9
movl 0xa4(%rbx), %r8d
movl 0xac(%rbx), %esi
movl 0xb4(%rbx), %eax
addl %esi, %eax
addl $-0x3, %eax
addb $-0x3, %cl
notl %r8d
leal (%rsi,%r8), %edi
decl %edi
movl %esi, %edx
addl %r8d, %edx
movq 0x1700(%rbx), %rsi
movl 0x170c(%rbx), %r8d
leal 0x1(%r8), %r9d
movl %r9d, 0x170c(%rbx)
movb %dl, (%rsi,%r8)
movq 0x1700(%rbx), %rsi
movl 0x170c(%rbx), %ebp
leal 0x1(%rbp), %r8d
movl %r8d, 0x170c(%rbx)
movb %dh, (%rsi,%rbp)
movq 0x1700(%rbx), %rdx
movl 0x170c(%rbx), %esi
leal 0x1(%rsi), %r8d
movl %r8d, 0x170c(%rbx)
movb %cl, (%rdx,%rsi)
movzbl %cl, %ecx
leaq 0x596ce(%rip), %rdx     # 0xf8210
movzbl (%rcx,%rdx), %ecx
incw 0x4d8(%rbx,%rcx,4)
movl %edi, %ecx
movl $0xffff, %esi           # imm = 0xFFFF
andl %esi, %ecx
movl %ecx, %edx
shrl $0x7, %edx
addl %r13d, %edx
cmpl %r13d, %ecx
cmovbl %edi, %edx
andl %esi, %edx
leaq 0x594a2(%rip), %rcx     # 0xf8010
movzbl (%rdx,%rcx), %ecx
incw 0x9c8(%rbx,%rcx,4)
movl 0x170c(%rbx), %esi
movl 0x1710(%rbx), %edi
movl 0xb8(%rbx), %r8d
movl 0xac(%rbx), %edx
movl 0xb4(%rbx), %ecx
subl %r8d, %ecx
incl %ecx
movl %ecx, 0xb4(%rbx)
leal -0x2(%r8), %ecx
movl %ecx, 0xb8(%rbx)
addl $-0x3, %r8d
incl %edx
movl %edx, 0xac(%rbx)
cmpl %eax, %edx
ja 0x9ec07
movl 0x80(%rbx), %r9d
movb 0x90(%rbx), %cl
shll %cl, %r9d
leal 0x2(%rdx), %ecx
movq 0x60(%rbx), %r10
movzbl (%r10,%rcx), %ecx
xorl %r9d, %ecx
andl 0x8c(%rbx), %ecx
movq 0x70(%rbx), %r9
movl %ecx, 0x80(%rbx)
movq 0x78(%rbx), %r10
movzwl (%r10,%rcx,2), %r11d
movl 0x58(%rbx), %r14d
andl %edx, %r14d
movw %r11w, (%r9,%r14,2)
movw %dx, (%r10,%rcx,2)
movl %r8d, 0xb8(%rbx)
incl %edx
addl $-0x1, %r8d
jb 0x9ebb4
movl $0x0, 0xa8(%rbx)
movl $0x2, 0xa0(%rbx)
movl %edx, 0xac(%rbx)
cmpl %edi, %esi
jne 0x9e8d9
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x9ec91
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9ec93
xorl %esi, %esi
movl 0xac(%rbx), %edx
subq %rax, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x9f838
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9d803
incl 0xac(%rbx)
decl 0xb4(%rbx)
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x9e8d9
jmp 0x9eccc
xorl %esi, %esi
movl %edx, %edx
subq %rax, %rdx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x9f838
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9d803
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x9e8d9
jmp 0x9ee0c
xorl %r14d, %r14d
jmp 0x9ee0c
cmpl $0x0, 0xa8(%rbx)
je 0x9ed4e
movq 0x60(%rbx), %rax
movl 0xac(%rbx), %ecx
decl %ecx
movzbl (%rax,%rcx), %eax
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
xorl %esi, %esi
movb %sil, (%rcx,%rdx)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %edi
movl %edi, 0x170c(%rbx)
movb %sil, (%rcx,%rdx)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb %al, (%rcx,%rdx)
incw 0xd4(%rbx,%rax,4)
movl $0x0, 0xa8(%rbx)
movl 0xac(%rbx), %edx
cmpl $0x2, %edx
movl $0x2, %eax
cmovbl %edx, %eax
movl %eax, 0x172c(%rbx)
cmpl $0x4, %r12d
jne 0x9ed7f
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x9ed9f
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9eda1
cmpl $0x0, 0x170c(%rbx)
je 0x9ee06
movq 0x98(%rbx), %rax
xorl %r14d, %r14d
testq %rax, %rax
js 0x9edd9
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9eddb
xorl %esi, %esi
subq %rax, %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x9f838
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9d803
movq (%rbx), %rax
cmpl $0x1, 0x20(%rax)
movl $0x3, %r14d
sbbl $0x0, %r14d
jmp 0x9ee0c
xorl %esi, %esi
subq %rax, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x9f838
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9d803
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
je 0x9ee0c
movl $0x1, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq