// File: /workspace/github_c_makefile_star2_O3/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 $0xffff, %r15d          # imm = 0xFFFF
movl $0x100, %r13d           # imm = 0x100
cmpl $0x106, 0xb4(%rbx)      # imm = 0x106
jae 0x9df79
testl %r12d, %r12d
sete %r14b
movq %rbx, %rdi
callq 0x9bb46
movl 0xb4(%rbx), %ecx
cmpl $0x106, %ecx            # imm = 0x106
setb %al
testb %al, %r14b
jne 0x9e338
testl %ecx, %ecx
je 0x9e340
movl 0xa0(%rbx), %edx
movl 0xb0(%rbx), %eax
cmpl $0x2, %ecx
ja 0x9df85
movl %edx, 0xb8(%rbx)
movl %eax, 0xa4(%rbx)
movl $0x2, 0xa0(%rbx)
jmp 0x9e035
movl 0xa0(%rbx), %edx
movl 0xb0(%rbx), %eax
movl 0x80(%rbx), %esi
movb 0x90(%rbx), %cl
shll %cl, %esi
movl 0xac(%rbx), %ecx
leal 0x2(%rcx), %edi
movq 0x60(%rbx), %r8
movzbl (%r8,%rdi), %edi
xorl %esi, %edi
andl 0x8c(%rbx), %edi
movq 0x70(%rbx), %r8
movl %edi, 0x80(%rbx)
movq 0x78(%rbx), %r9
movzwl (%r9,%rdi,2), %esi
movl 0x58(%rbx), %r10d
andl %ecx, %r10d
movw %si, (%r8,%r10,2)
movw %cx, (%r9,%rdi,2)
movl %edx, 0xb8(%rbx)
movl %eax, 0xa4(%rbx)
movl $0x2, 0xa0(%rbx)
testl %esi, %esi
je 0x9e035
movl $0x2, %eax
cmpl 0xc0(%rbx), %edx
jae 0x9e05a
subl %esi, %ecx
movl 0x50(%rbx), %edx
movl $0xfffffefa, %edi       # imm = 0xFFFFFEFA
addl %edi, %edx
cmpl %edx, %ecx
ja 0x9e05a
movq %rbx, %rdi
callq 0x9e48a
movl %eax, 0xa0(%rbx)
cmpl $0x5, %eax
ja 0x9e05a
cmpl $0x1, 0xc8(%rbx)
jne 0x9e03c
movl $0x2, 0xa0(%rbx)
movl $0x2, %eax
jmp 0x9e05a
movl $0x2, %eax
jmp 0x9e060
cmpl $0x3, %eax
jne 0x9e05a
movl 0xac(%rbx), %ecx
subl 0xb0(%rbx), %ecx
movl $0x3, %eax
cmpl $0x1001, %ecx           # imm = 0x1001
jae 0x9e024
movl 0xb8(%rbx), %edx
cmpl $0x3, %edx
jb 0x9e205
cmpl %edx, %eax
ja 0x9e205
movl 0xa4(%rbx), %r8d
movl 0xac(%rbx), %esi
movl 0xb4(%rbx), %eax
addl %esi, %eax
addl $-0x3, %eax
addb $-0x3, %dl
notl %r8d
leal (%rsi,%r8), %edi
decl %edi
movl %esi, %ecx
addl %r8d, %ecx
movq 0x1700(%rbx), %rsi
movl 0x170c(%rbx), %r8d
leal 0x1(%r8), %r9d
movl %r9d, 0x170c(%rbx)
movb %cl, (%rsi,%r8)
movq 0x1700(%rbx), %rsi
movl 0x170c(%rbx), %ebp
leal 0x1(%rbp), %r8d
movl %r8d, 0x170c(%rbx)
movb %ch, (%rsi,%rbp)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %esi
leal 0x1(%rsi), %r8d
movl %r8d, 0x170c(%rbx)
movb %dl, (%rcx,%rsi)
movzbl %dl, %ecx
leaq 0x5a089(%rip), %rdx     # 0xf8180
movzbl (%rcx,%rdx), %ecx
incw 0x4d8(%rbx,%rcx,4)
movl %edi, %ecx
andl %r15d, %ecx
movl %ecx, %edx
shrl $0x7, %edx
addl %r13d, %edx
cmpl %r13d, %ecx
cmovbl %edi, %edx
andl %r15d, %edx
leaq 0x59e60(%rip), %rcx     # 0xf7f80
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 0x9e1b9
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 0x9e166
movl $0x0, 0xa8(%rbx)
movl $0x2, 0xa0(%rbx)
movl %edx, 0xac(%rbx)
cmpl %edi, %esi
jne 0x9df12
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x9e2ba
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9e2bc
cmpl $0x0, 0xa8(%rbx)
je 0x9e29f
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 %edi, %edi
movb %dil, (%rcx,%rdx)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb %dil, (%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 0x9e31f
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x9e2f5
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9e2f7
movl $0x1, 0xa8(%rbx)
incl 0xac(%rbx)
decl 0xb4(%rbx)
jmp 0x9df12
xorl %esi, %esi
movl %edx, %edx
subq %rax, %rdx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x9ee9f
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9ce14
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x9df12
jmp 0x9e478
xorl %esi, %esi
movl 0xac(%rbx), %edx
subq %rax, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x9ee9f
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9ce14
incl 0xac(%rbx)
decl 0xb4(%rbx)
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x9df12
xorl %r14d, %r14d
jmp 0x9e478
cmpl $0x0, 0xa8(%rbx)
je 0x9e3ba
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 0x9e3eb
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x9e40b
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9e40d
cmpl $0x0, 0x170c(%rbx)
je 0x9e472
movq 0x98(%rbx), %rax
xorl %r14d, %r14d
testq %rax, %rax
js 0x9e445
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x9e447
xorl %esi, %esi
subq %rax, %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x9ee9f
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9ce14
movq (%rbx), %rax
cmpl $0x1, 0x20(%rax)
movl $0x3, %r14d
sbbl $0x0, %r14d
jmp 0x9e478
xorl %esi, %esi
subq %rax, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x9ee9f
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x9ce14
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
je 0x9e478
movl $0x1, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq