// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/zlib1.3.1/deflate.c
// Function: deflate_fast
local block_state deflate_fast(deflate_state *s, int flush) {
    IPos hash_head;       /* head of the hash chain */
    int bflush;           /* set if current block must be flushed */

    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.
         * At this point we have always match_length < MIN_MATCH
         */
        if (hash_head != NIL && 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 >= MIN_MATCH) {
            check_match(s, s->strstart, s->match_start, s->match_length);

            _tr_tally_dist(s, s->strstart - s->match_start,
                           s->match_length - MIN_MATCH, bflush);

            s->lookahead -= s->match_length;

            /* Insert new strings in the hash table only if the match length
             * is not too large. This saves time but degrades compression.
             */
#ifndef FASTEST
            if (s->match_length <= s->max_insert_length &&
                s->lookahead >= MIN_MATCH) {
                s->match_length--; /* string at strstart already in table */
                do {
                    s->strstart++;
                    INSERT_STRING(s, s->strstart, hash_head);
                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are
                     * always MIN_MATCH bytes ahead.
                     */
                } while (--s->match_length != 0);
                s->strstart++;
            } else
#endif
            {
                s->strstart += s->match_length;
                s->match_length = 0;
                s->ins_h = s->window[s->strstart];
                UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]);
#if MIN_MATCH != 3
                Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
                /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
                 * matter since it will be recomputed at next deflate call.
                 */
            }
        } else {
            /* No match, output a literal byte */
            Tracevv((stderr,"%c", s->window[s->strstart]));
            _tr_tally_lit(s, s->window[s->strstart], bflush);
            s->lookahead--;
            s->strstart++;
        }
        if (bflush) FLUSH_BLOCK(s, 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, %ebp
movq %rdi, %rbx
movl $0xfffffefa, %r15d      # imm = 0xFFFFFEFA
leaq 0x19e29(%rip), %r12     # 0x662e0
movl $0xffff, %r13d          # imm = 0xFFFF
movl %esi, 0x4(%rsp)
cmpl $0x105, 0xb4(%rbx)      # imm = 0x105
ja 0x4c4ff
testl %ebp, %ebp
sete %r14b
movq %rbx, %rdi
callq 0x4a532
movl 0xb4(%rbx), %eax
cmpl $0x106, %eax            # imm = 0x106
setb %cl
testb %cl, %r14b
jne 0x4c81e
testl %eax, %eax
je 0x4c826
cmpl $0x3, %eax
jb 0x4c558
movl 0x80(%rbx), %edx
movb 0x90(%rbx), %cl
shll %cl, %edx
movl 0xac(%rbx), %eax
leal 0x2(%rax), %ecx
movq 0x60(%rbx), %rsi
movq 0x70(%rbx), %rdi
movzbl (%rsi,%rcx), %ecx
xorl %edx, %ecx
andl 0x8c(%rbx), %ecx
movl %ecx, 0x80(%rbx)
movq 0x78(%rbx), %rdx
movzwl (%rdx,%rcx,2), %esi
movl 0x58(%rbx), %r8d
andl %eax, %r8d
movw %si, (%rdi,%r8,2)
movw %ax, (%rdx,%rcx,2)
testl %esi, %esi
je 0x4c558
subl %esi, %eax
movl 0x50(%rbx), %ecx
addl %r15d, %ecx
cmpl %ecx, %eax
jbe 0x4c560
movl 0xa0(%rbx), %eax
jmp 0x4c56e
movq %rbx, %rdi
callq 0x4ce8a
movl %eax, 0xa0(%rbx)
cmpl $0x3, %eax
jb 0x4c6ec
addb $-0x3, %al
movl 0xac(%rbx), %ecx
subl 0xb0(%rbx), %ecx
movq 0x1700(%rbx), %rdx
movl 0x170c(%rbx), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x170c(%rbx)
movb %cl, (%rdx,%rsi)
movq 0x1700(%rbx), %rdx
movl 0x170c(%rbx), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x170c(%rbx)
movb %ch, (%rdx,%rsi)
movq 0x1700(%rbx), %rdx
movl 0x170c(%rbx), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x170c(%rbx)
movb %al, (%rdx,%rsi)
decl %ecx
movzbl %al, %eax
movzbl (%r12,%rax), %eax
incw 0x4d8(%rbx,%rax,4)
movl %ecx, %eax
andl %r13d, %eax
movl %eax, %edx
shrl $0x7, %edx
movl $0x100, %esi            # imm = 0x100
addl %esi, %edx
cmpl %esi, %eax
cmovbl %ecx, %edx
andl %r13d, %edx
leaq 0x19ade(%rip), %rax     # 0x660e0
movzbl (%rax,%rdx), %eax
incw 0x9c8(%rbx,%rax,4)
movl 0x170c(%rbx), %edx
movl 0x1710(%rbx), %esi
movl 0xa0(%rbx), %edi
movl 0xb4(%rbx), %eax
subl %edi, %eax
movl %eax, 0xb4(%rbx)
cmpl 0xc0(%rbx), %edi
setbe %cl
cmpl $0x3, %eax
setae %al
andb %cl, %al
cmpb $0x1, %al
jne 0x4c779
movq %r12, %rbp
leal -0x1(%rdi), %eax
movl %eax, 0xa0(%rbx)
movl 0x90(%rbx), %ecx
movq 0x60(%rbx), %r8
movl 0x8c(%rbx), %r9d
movq 0x78(%rbx), %r10
movq 0x70(%rbx), %r11
movl 0x58(%rbx), %r14d
movl 0xac(%rbx), %eax
movl 0x80(%rbx), %r13d
addl $-0x2, %edi
incl %eax
shll %cl, %r13d
movl %eax, 0xac(%rbx)
leal 0x2(%rax), %r15d
movzbl (%r8,%r15), %r15d
xorl %r13d, %r15d
andl %r9d, %r15d
movl %r15d, 0x80(%rbx)
movzwl (%r10,%r15,2), %r13d
movl %r14d, %r12d
andl %eax, %r12d
movw %r13w, (%r11,%r12,2)
movw %ax, (%r10,%r15,2)
movl %edi, 0xa0(%rbx)
incl %eax
movl %r15d, %r13d
addl $-0x1, %edi
jb 0x4c682
movl %eax, 0xac(%rbx)
cmpl %esi, %edx
movl $0xfffffefa, %r15d      # imm = 0xFFFFFEFA
movq %rbp, %r12
movl 0x4(%rsp), %ebp
movl $0xffff, %r13d          # imm = 0xFFFF
jne 0x4c4c1
jmp 0x4c7cf
movq 0x60(%rbx), %rax
movl 0xac(%rbx), %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), %ecx
decl 0xb4(%rbx)
movl 0xac(%rbx), %eax
incl %eax
cmpl 0x1710(%rbx), %ecx
movl %eax, 0xac(%rbx)
jne 0x4c4c1
jmp 0x4c7cf
movl 0xac(%rbx), %r8d
leal (%r8,%rdi), %eax
movl %eax, 0xac(%rbx)
movl $0x0, 0xa0(%rbx)
movq 0x60(%rbx), %r9
movzbl (%r9,%rax), %r10d
movl %r10d, 0x80(%rbx)
movb 0x90(%rbx), %cl
shll %cl, %r10d
leal (%r8,%rdi), %ecx
incl %ecx
movzbl (%r9,%rcx), %ecx
xorl %r10d, %ecx
andl 0x8c(%rbx), %ecx
movl %ecx, 0x80(%rbx)
cmpl %esi, %edx
jne 0x4c4c1
movq 0x98(%rbx), %rcx
testq %rcx, %rcx
js 0x4c7e3
movl %ecx, %esi
addq 0x60(%rbx), %rsi
jmp 0x4c7e5
xorl %esi, %esi
movl %eax, %edx
subq %rcx, %rdx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x51617
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x4b800
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x4c4c1
jmp 0x4c8e3
xorl %r14d, %r14d
jmp 0x4c8e3
movl 0xac(%rbx), %edx
cmpl $0x2, %edx
movl $0x2, %eax
cmovbl %edx, %eax
movl %eax, 0x172c(%rbx)
cmpl $0x4, %ebp
jne 0x4c856
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x4c876
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x4c878
cmpl $0x0, 0x170c(%rbx)
je 0x4c8dd
movq 0x98(%rbx), %rax
xorl %r14d, %r14d
testq %rax, %rax
js 0x4c8b0
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x4c8b2
xorl %esi, %esi
subq %rax, %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x51617
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x4b800
movq (%rbx), %rax
cmpl $0x1, 0x20(%rax)
movl $0x3, %r14d
sbbl $0x0, %r14d
jmp 0x4c8e3
xorl %esi, %esi
subq %rax, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x51617
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x4b800
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
je 0x4c8e3
movl $0x1, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq