// File: 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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x102, 0xb4(%rax)      # imm = 0x102
ja 0x96671
movq -0x10(%rbp), %rdi
callq 0x93620
movq -0x10(%rbp), %rax
cmpl $0x102, 0xb4(%rax)      # imm = 0x102
ja 0x9665d
cmpl $0x0, -0x14(%rbp)
jne 0x9665d
movl $0x0, -0x4(%rbp)
jmp 0x96d77
movq -0x10(%rbp), %rax
cmpl $0x0, 0xb4(%rax)
jne 0x9666f
jmp 0x96bfd
jmp 0x96671
movq -0x10(%rbp), %rax
movl $0x0, 0xa0(%rax)
movq -0x10(%rbp), %rax
cmpl $0x3, 0xb4(%rax)
jb 0x968ae
movq -0x10(%rbp), %rax
cmpl $0x0, 0xac(%rax)
jbe 0x968ae
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0xac(%rcx), %ecx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x968ac
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x968ac
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x968ac
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0xac(%rcx), %ecx
addq %rcx, %rax
addq $0x102, %rax            # imm = 0x102
movq %rax, -0x30(%rbp)
jmp 0x96743
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x36(%rbp)
jne 0x96859
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
setb %al
movb %al, -0x36(%rbp)
movb -0x36(%rbp), %al
testb $0x1, %al
jne 0x96741
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl $0x102, %ecx            # imm = 0x102
subl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xa0(%rax)
movq -0x10(%rbp), %rax
movl 0xa0(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xb4(%rcx), %eax
jbe 0x968aa
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xa0(%rax)
jmp 0x968ac
jmp 0x968ae
movq -0x10(%rbp), %rax
cmpl $0x3, 0xa0(%rax)
jb 0x96a61
movq -0x10(%rbp), %rax
movl 0xa0(%rax), %eax
subl $0x3, %eax
movb %al, -0x31(%rbp)
movw $0x1, -0x34(%rbp)
movw -0x34(%rbp), %ax
movb %al, %dl
movq -0x10(%rbp), %rax
movq 0x1700(%rax), %rax
movq -0x10(%rbp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movzwl -0x34(%rbp), %eax
sarl $0x8, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq 0x1700(%rax), %rax
movq -0x10(%rbp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movb -0x31(%rbp), %dl
movq -0x10(%rbp), %rax
movq 0x1700(%rax), %rax
movq -0x10(%rbp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movw -0x34(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movzbl -0x31(%rbp), %ecx
movl %ecx, %edx
leaq 0x2796d(%rip), %rcx     # 0xbe2e0
movzbl (%rcx,%rdx), %ecx
addl $0x100, %ecx            # imm = 0x100
addl $0x1, %ecx
movslq %ecx, %rcx
movw 0xd4(%rax,%rcx,4), %dx
addw $0x1, %dx
movw %dx, 0xd4(%rax,%rcx,4)
movq -0x10(%rbp), %rax
addq $0x9c8, %rax            # imm = 0x9C8
movq %rax, -0x40(%rbp)
movzwl -0x34(%rbp), %eax
cmpl $0x100, %eax            # imm = 0x100
jge 0x969c6
movzwl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0x27723(%rip), %rax     # 0xbe0e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
jmp 0x969e3
movzwl -0x34(%rbp), %eax
sarl $0x7, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0x27704(%rip), %rax     # 0xbe0e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,4), %dx
addw $0x1, %dx
movw %dx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movl 0x170c(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1710(%rcx), %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0xa0(%rax), %edx
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xb4(%rax)
movq -0x10(%rbp), %rax
movl 0xa0(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0xac(%rax), %ecx
movl %ecx, 0xac(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xa0(%rax)
jmp 0x96b4e
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0xac(%rcx), %ecx
movb (%rax,%rcx), %al
movb %al, -0x35(%rbp)
movq -0x10(%rbp), %rax
movq 0x1700(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x170c(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x170c(%rdx)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x1700(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x170c(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x170c(%rdx)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movb -0x35(%rbp), %dl
movq -0x10(%rbp), %rax
movq 0x1700(%rax), %rax
movq -0x10(%rbp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movzbl -0x35(%rbp), %ecx
movw 0xd4(%rax,%rcx,4), %dx
addw $0x1, %dx
movw %dx, 0xd4(%rax,%rcx,4)
movq -0x10(%rbp), %rax
movl 0x170c(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1710(%rcx), %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xb4(%rax)
movq -0x10(%rbp), %rax
movl 0xac(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xac(%rax)
cmpl $0x0, -0x18(%rbp)
je 0x96bf8
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x98(%rax)
jl 0x96b8c
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x98(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
jmp 0x96b94
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x96b94
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
subq 0x98(%rax), %rdx
xorl %ecx, %ecx
callq 0x9f410
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x98(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x95880
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x96bf6
movl $0x0, -0x4(%rbp)
jmp 0x96d77
jmp 0x96bf8
jmp 0x96622
movq -0x10(%rbp), %rax
movl $0x0, 0x172c(%rax)
cmpl $0x4, -0x14(%rbp)
jne 0x96cc2
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x98(%rax)
jl 0x96c49
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x98(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
jmp 0x96c51
xorl %eax, %eax
movq %rax, -0x68(%rbp)
jmp 0x96c51
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
subq 0x98(%rax), %rdx
movl $0x1, %ecx
callq 0x9f410
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x98(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x95880
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x96cb6
movl $0x2, -0x4(%rbp)
jmp 0x96d77
movl $0x3, -0x4(%rbp)
jmp 0x96d77
movq -0x10(%rbp), %rax
cmpl $0x0, 0x170c(%rax)
je 0x96d70
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x98(%rax)
jl 0x96d07
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x98(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
jmp 0x96d0f
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0x96d0f
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
subq 0x98(%rax), %rdx
xorl %ecx, %ecx
callq 0x9f410
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x98(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x95880
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x96d6e
movl $0x0, -0x4(%rbp)
jmp 0x96d77
jmp 0x96d70
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)