// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/zlib-1.3.0.1/trees.c
// Function: compress_block
local void compress_block(deflate_state *s, const ct_data *ltree,
                          const ct_data *dtree) {
    unsigned dist;      /* distance of matched string */
    int lc;             /* match length or unmatched char (if dist == 0) */
    unsigned sx = 0;    /* running index in symbol buffers */
    unsigned code;      /* the code to send */
    int extra;          /* number of extra bits to send */

    if (s->sym_next != 0) do {
#ifdef LIT_MEM
        dist = s->d_buf[sx];
        lc = s->l_buf[sx++];
#else
        dist = s->sym_buf[sx++] & 0xff;
        dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
        lc = s->sym_buf[sx++];
#endif
        if (dist == 0) {
            send_code(s, lc, ltree); /* send a literal byte */
            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
        } else {
            /* Here, lc is the match length - MIN_MATCH */
            code = _length_code[lc];
            send_code(s, code + LITERALS + 1, ltree);   /* send length code */
            extra = extra_lbits[code];
            if (extra != 0) {
                lc -= base_length[code];
                send_bits(s, lc, extra);       /* send the extra length bits */
            }
            dist--; /* dist is now the match distance - 1 */
            code = d_code(dist);
            Assert (code < D_CODES, "bad d_code");

            send_code(s, code, dtree);       /* send the distance code */
            extra = extra_dbits[code];
            if (extra != 0) {
                dist -= (unsigned)base_dist[code];
                send_bits(s, dist, extra);   /* send the extra distance bits */
            }
        } /* literal or match pair ? */

        /* Check for no overlay of pending_buf on needed symbols */
#ifdef LIT_MEM
        Assert(s->pending < (s->lit_bufsize << 1) + sx, "pendingBuf overflow");
#else
        Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
#endif

    } while (sx < s->sym_next);

    send_code(s, END_BLOCK, ltree);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $0x0, 0x170c(%rdi)
movl $0x10, %r15d
je 0x7faaa
xorl %r8d, %r8d
leaq 0x61b2c(%rip), %r11     # 0xe1290
movq 0x1700(%rdi), %rcx
leal 0x1(%r8), %r10d
movl %r8d, %ebx
movzbl (%rcx,%rbx), %ebx
leal 0x2(%r8), %r14d
movzbl (%rcx,%r10), %r12d
shll $0x8, %r12d
orl %ebx, %r12d
movzbl (%rcx,%r14), %r13d
je 0x7f827
leaq 0x61cf8(%rip), %rax     # 0xe1490
movzbl (%r13,%rax), %r10d
movzwl 0x406(%rsi,%r10,4), %ebx
movl 0x1734(%rdi), %ecx
movl %r15d, %eax
subl %ebx, %eax
movzwl 0x404(%rsi,%r10,4), %r14d
movl %r14d, %ebp
shll %cl, %ebp
orw 0x1730(%rdi), %bp
movw %bp, 0x1730(%rdi)
cmpl %eax, %ecx
jle 0x7f8a9
movq 0x10(%rdi), %rax
movq 0x28(%rdi), %rcx
leaq 0x1(%rcx), %r9
movq %r9, 0x28(%rdi)
movb %bpl, (%rax,%rcx)
movb 0x1731(%rdi), %al
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r9
leaq 0x1(%r9), %rbp
movq %rbp, 0x28(%rdi)
movb %al, (%rcx,%r9)
movl 0x1734(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r14d
movw %r14w, 0x1730(%rdi)
leal (%rbx,%rax), %ecx
addl $-0x10, %ecx
movl %r14d, %ebp
jmp 0x7f8ab
movzwl 0x2(%rsi,%r13,4), %r10d
movl 0x1734(%rdi), %ecx
movl %r15d, %r14d
subl %r10d, %r14d
movzwl (%rsi,%r13,4), %ebx
movl %ebx, %ebp
shll %cl, %ebp
orw 0x1730(%rdi), %bp
movw %bp, 0x1730(%rdi)
cmpl %r14d, %ecx
jle 0x7f93c
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r14
leaq 0x1(%r14), %r12
movq %r12, 0x28(%rdi)
movb %bpl, (%rcx,%r14)
movb 0x1731(%rdi), %cl
movq 0x10(%rdi), %r14
movq 0x28(%rdi), %r12
leaq 0x1(%r12), %r13
movq %r13, 0x28(%rdi)
movb %cl, (%r14,%r12)
movl 0x1734(%rdi), %r14d
movb $0x10, %cl
subb %r14b, %cl
shrl %cl, %ebx
movw %bx, 0x1730(%rdi)
leal (%r10,%r14), %ecx
addl $-0x10, %ecx
jmp 0x7fa91
addl %ebx, %ecx
movl %ecx, 0x1734(%rdi)
leaq -0x1c(%r10), %rax
cmpq $-0x14, %rax
jb 0x7f95d
leaq 0x6233a(%rip), %rax     # 0xe1c00
subl (%rax,%r10,4), %r13d
leaq 0x621bf(%rip), %rax     # 0xe1a90
movl (%rax,%r10,4), %r10d
movl %r15d, %eax
subl %r10d, %eax
cmpl %eax, %ecx
jle 0x7f944
movzwl %r13w, %ebx
shll %cl, %r13d
orl %r13d, %ebp
movw %bp, 0x1730(%rdi)
movq 0x10(%rdi), %rax
movq 0x28(%rdi), %rcx
leaq 0x1(%rcx), %r9
movq %r9, 0x28(%rdi)
movb %bpl, (%rax,%rcx)
movb 0x1731(%rdi), %al
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r9
leaq 0x1(%r9), %r14
movq %r14, 0x28(%rdi)
movb %al, (%rcx,%r9)
movl 0x1734(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %ebx
movw %bx, 0x1730(%rdi)
leal (%r10,%rax), %ecx
addl $-0x10, %ecx
movl %ebx, %ebp
jmp 0x7f957
addl %r10d, %ecx
jmp 0x7fa91
shll %cl, %r13d
orl %r13d, %ebp
movw %bp, 0x1730(%rdi)
addl %ecx, %r10d
movl %r10d, %ecx
movl %ecx, 0x1734(%rdi)
leal -0x1(%r12), %r13d
movl %r13d, %eax
shrl $0x7, %eax
addl $0x100, %eax            # imm = 0x100
cmpl $0x101, %r12d           # imm = 0x101
cmovbl %r13d, %eax
movzbl (%rax,%r11), %r10d
movzwl 0x2(%rdx,%r10,4), %r12d
movl %r15d, %eax
movzwl (%rdx,%r10,4), %ebx
movl %ebx, %r9d
shll %cl, %r9d
subl %r12d, %eax
orl %r9d, %ebp
movw %bp, 0x1730(%rdi)
cmpl %eax, %ecx
jle 0x7f9ee
movq 0x10(%rdi), %rax
movq 0x28(%rdi), %rcx
leaq 0x1(%rcx), %r9
movq %r9, 0x28(%rdi)
movb %bpl, (%rax,%rcx)
movb 0x1731(%rdi), %al
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r9
leaq 0x1(%r9), %r14
movq %r14, 0x28(%rdi)
movb %al, (%rcx,%r9)
movl 0x1734(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %ebx
movw %bx, 0x1730(%rdi)
leal (%r12,%rax), %ecx
addl $-0x10, %ecx
movl %ebx, %ebp
jmp 0x7f9f1
addl %r12d, %ecx
movl %ecx, 0x1734(%rdi)
cmpb $0x4, %r10b
jb 0x7fa97
leaq 0x62278(%rip), %rax     # 0xe1c80
subl (%rax,%r10,4), %r13d
leaq 0x620fd(%rip), %rax     # 0xe1b10
movl (%rax,%r10,4), %r10d
movl %r15d, %eax
subl %r10d, %eax
cmpl %eax, %ecx
jle 0x7fa7e
movzwl %r13w, %eax
shll %cl, %r13d
orl %r13d, %ebp
movw %bp, 0x1730(%rdi)
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r9
leaq 0x1(%r9), %rbx
movq %rbx, 0x28(%rdi)
movb %bpl, (%rcx,%r9)
movb 0x1731(%rdi), %cl
movq 0x10(%rdi), %r9
movq 0x28(%rdi), %rbx
leaq 0x1(%rbx), %r14
movq %r14, 0x28(%rdi)
movb %cl, (%r9,%rbx)
movl 0x1734(%rdi), %r9d
movb $0x10, %cl
subb %r9b, %cl
shrl %cl, %eax
movw %ax, 0x1730(%rdi)
leal (%r10,%r9), %ecx
addl $-0x10, %ecx
jmp 0x7fa91
shll %cl, %r13d
orl %r13d, %ebp
movw %bp, 0x1730(%rdi)
addl %ecx, %r10d
movl %r10d, %ecx
movl %ecx, 0x1734(%rdi)
addl $0x3, %r8d
cmpl 0x170c(%rdi), %r8d
jb 0x7f764
jmp 0x7fab0
movl 0x1734(%rdi), %ecx
movzwl 0x402(%rsi), %edx
subl %edx, %r15d
movzwl 0x400(%rsi), %esi
movl %esi, %r8d
shll %cl, %r8d
orw 0x1730(%rdi), %r8w
movw %r8w, 0x1730(%rdi)
cmpl %r15d, %ecx
jle 0x7fb25
movq 0x10(%rdi), %rax
movq 0x28(%rdi), %rcx
leaq 0x1(%rcx), %r9
movq %r9, 0x28(%rdi)
movb %r8b, (%rax,%rcx)
movb 0x1731(%rdi), %al
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r8
leaq 0x1(%r8), %r9
movq %r9, 0x28(%rdi)
movb %al, (%rcx,%r8)
movl 0x1734(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %esi
movw %si, 0x1730(%rdi)
leal (%rdx,%rax), %ecx
addl $-0x10, %ecx
jmp 0x7fb27
addl %edx, %ecx
movl %ecx, 0x1734(%rdi)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq