// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/zlib-1.3.0.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:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movl %esi, 0x64(%rsp)
movq 0x68(%rsp), %rax
cmpl $0x102, 0xb4(%rax)      # imm = 0x102
ja 0xd3e52
movq 0x68(%rsp), %rdi
callq 0xd09f0
movq 0x68(%rsp), %rax
cmpl $0x102, 0xb4(%rax)      # imm = 0x102
ja 0xd3e3d
cmpl $0x0, 0x64(%rsp)
jne 0xd3e3d
movl $0x0, 0x74(%rsp)
jmp 0xd45fd
movq 0x68(%rsp), %rax
cmpl $0x0, 0xb4(%rax)
jne 0xd3e50
jmp 0xd4461
jmp 0xd3e52
movq 0x68(%rsp), %rax
movl $0x0, 0xa0(%rax)
movq 0x68(%rsp), %rax
cmpl $0x3, 0xb4(%rax)
jb 0xd40ce
movq 0x68(%rsp), %rax
cmpl $0x0, 0xac(%rax)
jbe 0xd40ce
movq 0x68(%rsp), %rax
movq 0x60(%rax), %rax
movq 0x68(%rsp), %rcx
movl 0xac(%rcx), %ecx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movzbl (%rax), %eax
movl %eax, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
movq 0x50(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0xd40cc
movl 0x5c(%rsp), %eax
movq 0x50(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0xd40cc
movl 0x5c(%rsp), %eax
movq 0x50(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0xd40cc
movq 0x68(%rsp), %rax
movq 0x60(%rax), %rax
movq 0x68(%rsp), %rcx
movl 0xac(%rcx), %ecx
addq %rcx, %rax
addq $0x102, %rax            # imm = 0x102
movq %rax, 0x48(%rsp)
jmp 0xd3f38
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movzbl 0x1(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x42(%rsp)
jne 0xd4071
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rax
setb %al
movb %al, 0x42(%rsp)
movb 0x42(%rsp), %al
testb $0x1, %al
jne 0xd3f36
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rcx, %rax
movl $0x102, %ecx            # imm = 0x102
subl %eax, %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0xa0(%rax)
movq 0x68(%rsp), %rax
movl 0xa0(%rax), %eax
movq 0x68(%rsp), %rcx
cmpl 0xb4(%rcx), %eax
jbe 0xd40ca
movq 0x68(%rsp), %rax
movl 0xb4(%rax), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0xa0(%rax)
jmp 0xd40cc
jmp 0xd40ce
movq 0x68(%rsp), %rax
cmpl $0x3, 0xa0(%rax)
jb 0xd42a3
movq 0x68(%rsp), %rax
movl 0xa0(%rax), %eax
subl $0x3, %eax
movb %al, 0x47(%rsp)
movw $0x1, 0x44(%rsp)
movw 0x44(%rsp), %ax
movb %al, %dl
movq 0x68(%rsp), %rax
movq 0x1700(%rax), %rax
movq 0x68(%rsp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movzwl 0x44(%rsp), %eax
sarl $0x8, %eax
movb %al, %dl
movq 0x68(%rsp), %rax
movq 0x1700(%rax), %rax
movq 0x68(%rsp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movb 0x47(%rsp), %dl
movq 0x68(%rsp), %rax
movq 0x1700(%rax), %rax
movq 0x68(%rsp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movw 0x44(%rsp), %ax
addw $-0x1, %ax
movw %ax, 0x44(%rsp)
movq 0x68(%rsp), %rax
movzbl 0x47(%rsp), %ecx
movl %ecx, %edx
leaq 0xa241c(%rip), %rcx     # 0x1765c0
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 0x68(%rsp), %rax
addq $0x9c8, %rax            # imm = 0x9C8
movq %rax, 0x38(%rsp)
movzwl 0x44(%rsp), %eax
cmpl $0x100, %eax            # imm = 0x100
jge 0xd41fc
movzwl 0x44(%rsp), %eax
movl %eax, %ecx
leaq 0xa21ce(%rip), %rax     # 0x1763c0
movzbl (%rax,%rcx), %eax
movl %eax, 0x34(%rsp)
jmp 0xd421b
movzwl 0x44(%rsp), %eax
sarl $0x7, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xa21ad(%rip), %rax     # 0x1763c0
movzbl (%rax,%rcx), %eax
movl %eax, 0x34(%rsp)
movq 0x38(%rsp), %rax
movl 0x34(%rsp), %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,4), %dx
addw $0x1, %dx
movw %dx, (%rax,%rcx,4)
movq 0x68(%rsp), %rax
movl 0x170c(%rax), %eax
movq 0x68(%rsp), %rcx
cmpl 0x1710(%rcx), %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x60(%rsp)
movq 0x68(%rsp), %rax
movl 0xa0(%rax), %edx
movq 0x68(%rsp), %rax
movl 0xb4(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xb4(%rax)
movq 0x68(%rsp), %rax
movl 0xa0(%rax), %ecx
movq 0x68(%rsp), %rax
addl 0xac(%rax), %ecx
movl %ecx, 0xac(%rax)
movq 0x68(%rsp), %rax
movl $0x0, 0xa0(%rax)
jmp 0xd43a1
movq 0x68(%rsp), %rax
movq 0x60(%rax), %rax
movq 0x68(%rsp), %rcx
movl 0xac(%rcx), %ecx
movb (%rax,%rcx), %al
movb %al, 0x43(%rsp)
movq 0x68(%rsp), %rax
movq 0x1700(%rax), %rax
movq 0x68(%rsp), %rdx
movl 0x170c(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x170c(%rdx)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq 0x68(%rsp), %rax
movq 0x1700(%rax), %rax
movq 0x68(%rsp), %rdx
movl 0x170c(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x170c(%rdx)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movb 0x43(%rsp), %dl
movq 0x68(%rsp), %rax
movq 0x1700(%rax), %rax
movq 0x68(%rsp), %rsi
movl 0x170c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x170c(%rsi)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq 0x68(%rsp), %rax
movzbl 0x43(%rsp), %ecx
movw 0xd4(%rax,%rcx,4), %dx
addw $0x1, %dx
movw %dx, 0xd4(%rax,%rcx,4)
movq 0x68(%rsp), %rax
movl 0x170c(%rax), %eax
movq 0x68(%rsp), %rcx
cmpl 0x1710(%rcx), %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x60(%rsp)
movq 0x68(%rsp), %rax
movl 0xb4(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xb4(%rax)
movq 0x68(%rsp), %rax
movl 0xac(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xac(%rax)
cmpl $0x0, 0x60(%rsp)
je 0xd445c
movq 0x68(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rax
cmpq $0x0, 0x98(%rax)
jl 0xd43e6
movq 0x68(%rsp), %rax
movq 0x60(%rax), %rax
movq 0x68(%rsp), %rcx
movq 0x98(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
jmp 0xd43ef
xorl %eax, %eax
movq %rax, 0x20(%rsp)
jmp 0xd43ef
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x68(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, %edx
movq 0x68(%rsp), %rax
subq 0x98(%rax), %rdx
xorl %ecx, %ecx
callq 0xd6b40
movq 0x68(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, %ecx
movq 0x68(%rsp), %rax
movq %rcx, 0x98(%rax)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0xd2f00
movq 0x68(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0xd445a
movl $0x0, 0x74(%rsp)
jmp 0xd45fd
jmp 0xd445c
jmp 0xd3dfd
movq 0x68(%rsp), %rax
movl $0x0, 0x172c(%rax)
cmpl $0x4, 0x64(%rsp)
jne 0xd4539
movq 0x68(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x68(%rsp), %rax
cmpq $0x0, 0x98(%rax)
jl 0xd44b5
movq 0x68(%rsp), %rax
movq 0x60(%rax), %rax
movq 0x68(%rsp), %rcx
movq 0x98(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
jmp 0xd44be
xorl %eax, %eax
movq %rax, 0x10(%rsp)
jmp 0xd44be
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x68(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, %edx
movq 0x68(%rsp), %rax
subq 0x98(%rax), %rdx
movl $0x1, %ecx
callq 0xd6b40
movq 0x68(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, %ecx
movq 0x68(%rsp), %rax
movq %rcx, 0x98(%rax)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0xd2f00
movq 0x68(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0xd452c
movl $0x2, 0x74(%rsp)
jmp 0xd45fd
movl $0x3, 0x74(%rsp)
jmp 0xd45fd
movq 0x68(%rsp), %rax
cmpl $0x0, 0x170c(%rax)
je 0xd45f5
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rax
cmpq $0x0, 0x98(%rax)
jl 0xd4584
movq 0x68(%rsp), %rax
movq 0x60(%rax), %rax
movq 0x68(%rsp), %rcx
movq 0x98(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, (%rsp)
jmp 0xd458c
xorl %eax, %eax
movq %rax, (%rsp)
jmp 0xd458c
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
movq 0x68(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, %edx
movq 0x68(%rsp), %rax
subq 0x98(%rax), %rdx
xorl %ecx, %ecx
callq 0xd6b40
movq 0x68(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, %ecx
movq 0x68(%rsp), %rax
movq %rcx, 0x98(%rax)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0xd2f00
movq 0x68(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0xd45f3
movl $0x0, 0x74(%rsp)
jmp 0xd45fd
jmp 0xd45f5
movl $0x1, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)