// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/zlib1.3.1/deflate.c
// Function: deflate_rle
local block_state deflate_rle(deflate_state *s, int flush) {
    int bflush;             /* set if current block must be flushed */
    uInt prev;              /* byte at distance one to match */
    Bytef *scan, *strend;   /* scan goes up to strend for length of run */

    for (;;) {
        /* Make sure that we always have enough lookahead, except
         * at the end of the input file. We need MAX_MATCH bytes
         * for the longest run, plus one for the unrolled loop.
         */
        if (s->lookahead <= MAX_MATCH) {
            fill_window(s);
            if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
                return need_more;
            }
            if (s->lookahead == 0) break; /* flush the current block */
        }

        /* See how many times the previous byte repeats */
        s->match_length = 0;
        if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
            scan = s->window + s->strstart - 1;
            prev = *scan;
            if (prev == *++scan && prev == *++scan && prev == *++scan) {
                strend = s->window + s->strstart + MAX_MATCH;
                do {
                } while (prev == *++scan && prev == *++scan &&
                         prev == *++scan && prev == *++scan &&
                         prev == *++scan && prev == *++scan &&
                         prev == *++scan && prev == *++scan &&
                         scan < strend);
                s->match_length = MAX_MATCH - (uInt)(strend - scan);
                if (s->match_length > s->lookahead)
                    s->match_length = s->lookahead;
            }
            Assert(scan <= s->window + (uInt)(s->window_size - 1),
                   "wild scan");
        }

        /* Emit match if have run of MIN_MATCH or longer, else emit literal */
        if (s->match_length >= MIN_MATCH) {
            check_match(s, s->strstart, s->strstart - 1, s->match_length);

            _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);

            s->lookahead -= s->match_length;
            s->strstart += s->match_length;
            s->match_length = 0;
        } 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 = 0;
    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
xorl %r15d, %r15d
leaq 0x19719(%rip), %r12     # 0x66230
leaq 0x19512(%rip), %r13     # 0x66030
cmpl $0x102, 0xb4(%rbx)      # imm = 0x102
ja 0x4cb57
testl %ebp, %ebp
sete %r14b
movq %rbx, %rdi
callq 0x4b18e
movl 0xb4(%rbx), %eax
cmpl $0x103, %eax            # imm = 0x103
setb %cl
testb %cl, %r14b
jne 0x4cdd8
testl %eax, %eax
je 0x4cde0
movl $0x0, 0xa0(%rbx)
movl 0xb4(%rbx), %eax
cmpl $0x3, %eax
jb 0x4cc57
movl 0xac(%rbx), %ecx
testq %rcx, %rcx
je 0x4cc57
movq 0x60(%rbx), %rdx
movb -0x1(%rdx,%rcx), %sil
cmpb (%rdx,%rcx), %sil
jne 0x4cc57
addq %rcx, %rdx
cmpb 0x1(%rdx), %sil
jne 0x4cc57
cmpb 0x2(%rdx), %sil
jne 0x4cc57
leaq 0x102(%rdx), %rcx
xorl %edi, %edi
cmpb 0x3(%rdx,%rdi), %sil
jne 0x4cc07
cmpb 0x4(%rdx,%rdi), %sil
jne 0x4cc10
cmpb 0x5(%rdx,%rdi), %sil
jne 0x4cc19
cmpb 0x6(%rdx,%rdi), %sil
jne 0x4cc22
cmpb 0x7(%rdx,%rdi), %sil
jne 0x4cc2b
cmpb 0x8(%rdx,%rdi), %sil
jne 0x4cc34
cmpb 0x9(%rdx,%rdi), %sil
jne 0x4cc3d
leaq 0x2(%rdi), %r9
leaq 0x8(%rdi), %r8
cmpq $0xf9, %r9
ja 0x4cbfe
cmpb 0xa(%rdx,%rdi), %sil
movq %r8, %rdi
je 0x4cbb2
addq %r8, %rdx
addq $0x2, %rdx
jmp 0x4cc44
addq %rdi, %rdx
addq $0x3, %rdx
jmp 0x4cc44
addq %rdi, %rdx
addq $0x4, %rdx
jmp 0x4cc44
addq %rdi, %rdx
addq $0x5, %rdx
jmp 0x4cc44
addq %rdi, %rdx
addq $0x6, %rdx
jmp 0x4cc44
addq %rdi, %rdx
addq $0x7, %rdx
jmp 0x4cc44
addq %rdi, %rdx
addq $0x8, %rdx
jmp 0x4cc44
addq %rdi, %rdx
addq $0x9, %rdx
subl %ecx, %edx
addl $0x102, %edx            # imm = 0x102
cmpl %eax, %edx
cmovael %eax, %edx
movl %edx, 0xa0(%rbx)
movl 0xa0(%rbx), %eax
cmpl $0x3, %eax
jb 0x4ccff
addb $-0x3, %al
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb $0x1, (%rcx,%rdx)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb $0x0, (%rcx,%rdx)
movq 0x1700(%rbx), %rcx
movl 0x170c(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x170c(%rbx)
movb %al, (%rcx,%rdx)
movzbl %al, %eax
movzbl (%r12,%rax), %eax
incw 0x4d8(%rbx,%rax,4)
movzbl (%r13), %eax
incw 0x9c8(%rbx,%rax,4)
movl 0x170c(%rbx), %eax
cmpl 0x1710(%rbx), %eax
sete %al
movl 0xa0(%rbx), %ecx
subl %ecx, 0xb4(%rbx)
addl %ecx, 0xac(%rbx)
movl $0x0, 0xa0(%rbx)
jmp 0x4cd7d
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)
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
sete %al
decl 0xb4(%rbx)
incl 0xac(%rbx)
testb %al, %al
je 0x4cb1e
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x4cd99
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x4cd9b
xorl %esi, %esi
movl 0xac(%rbx), %edx
subq %rax, %rdx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x51baa
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x4c46a
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x4cb1e
jmp 0x4cea0
xorl %r14d, %r14d
jmp 0x4cea0
movl $0x0, 0x172c(%rbx)
cmpl $0x4, %ebp
jne 0x4ce03
movq 0x98(%rbx), %rax
testq %rax, %rax
js 0x4ce27
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x4ce29
cmpl $0x0, 0x170c(%rbx)
je 0x4ce9a
movq 0x98(%rbx), %rax
xorl %r14d, %r14d
testq %rax, %rax
js 0x4ce67
movl %eax, %esi
addq 0x60(%rbx), %rsi
jmp 0x4ce69
xorl %esi, %esi
movl 0xac(%rbx), %edx
subq %rax, %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x51baa
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x4c46a
movq (%rbx), %rax
cmpl $0x1, 0x20(%rax)
movl $0x3, %r14d
sbbl $0x0, %r14d
jmp 0x4cea0
xorl %esi, %esi
movl 0xac(%rbx), %edx
subq %rax, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x51baa
movl 0xac(%rbx), %eax
movq %rax, 0x98(%rbx)
movq (%rbx), %rdi
callq 0x4c46a
movq (%rbx), %rax
cmpl $0x0, 0x20(%rax)
je 0x4cea0
movl $0x1, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq