// File: /workspace/github_c_makefile_star2_O1/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)
je 0xa0a1b
xorl %eax, %eax
leaq 0x57b7b(%rip), %r8      # 0xf8210
leaq 0x57974(%rip), %r10     # 0xf8010
movq 0x1700(%rdi), %rcx
leal 0x1(%rax), %r9d
movl %eax, %r11d
movzbl (%rcx,%r11), %r11d
leal 0x2(%rax), %r12d
movzbl (%rcx,%r9), %r15d
shll $0x8, %r15d
orl %r11d, %r15d
movzbl (%rcx,%r12), %r12d
je 0xa075d
movzbl (%r12,%r8), %r13d
movzwl 0x406(%rsi,%r13,4), %ebp
movl 0x1734(%rdi), %ecx
movl $0x10, %ebx
subl %ebp, %ebx
movzwl 0x404(%rsi,%r13,4), %r11d
movl %r11d, %r9d
shll %cl, %r9d
cmpl %ebx, %ecx
jle 0xa07e7
orw 0x1730(%rdi), %r9w
movw %r9w, 0x1730(%rdi)
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %rbx
leaq 0x1(%rbx), %r14
movq %r14, 0x28(%rdi)
movb %r9b, (%rcx,%rbx)
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, %r11d
movw %r11w, 0x1730(%rdi)
leal (%r9,%rbp), %ecx
addl $-0x10, %ecx
jmp 0xa07f1
movzwl 0x2(%rsi,%r12,4), %r15d
movl 0x1734(%rdi), %ecx
movl $0x10, %ebp
subl %r15d, %ebp
movzwl (%rsi,%r12,4), %r9d
movl %r9d, %r11d
shll %cl, %r11d
cmpl %ebp, %ecx
jle 0xa088e
orw 0x1730(%rdi), %r11w
movw %r11w, 0x1730(%rdi)
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r12
leaq 0x1(%r12), %r13
movq %r13, 0x28(%rdi)
movb %r11b, (%rcx,%r12)
movb 0x1731(%rdi), %cl
movq 0x10(%rdi), %r11
movq 0x28(%rdi), %r12
leaq 0x1(%r12), %r13
movq %r13, 0x28(%rdi)
movb %cl, (%r11,%r12)
movl 0x1734(%rdi), %r11d
movb $0x10, %cl
subb %r11b, %cl
shrl %cl, %r9d
movw %r9w, 0x1730(%rdi)
leal (%r15,%r11), %ecx
addl $-0x10, %ecx
jmp 0xa0899
orw %r9w, 0x1730(%rdi)
addl %ebp, %ecx
movl %ecx, 0x1734(%rdi)
leaq -0x1c(%r13), %r9
cmpq $-0x14, %r9
jb 0xa08b9
leaq 0x58174(%rip), %r9      # 0xf8980
subl (%r9,%r13,4), %r12d
leaq 0x57ff9(%rip), %r9      # 0xf8810
movl (%r9,%r13,4), %r13d
movl $0x10, %r9d
subl %r13d, %r9d
cmpl %r9d, %ecx
jle 0xa08a4
movzwl %r12w, %r9d
shll %cl, %r12d
orw 0x1730(%rdi), %r12w
movw %r12w, 0x1730(%rdi)
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r11
leaq 0x1(%r11), %rbx
movq %rbx, 0x28(%rdi)
movb %r12b, (%rcx,%r11)
movb 0x1731(%rdi), %cl
movq 0x10(%rdi), %r11
movq 0x28(%rdi), %rbx
leaq 0x1(%rbx), %r14
movq %r14, 0x28(%rdi)
movb %cl, (%r11,%rbx)
movl 0x1734(%rdi), %r11d
movb $0x10, %cl
subb %r11b, %cl
shrl %cl, %r9d
movw %r9w, 0x1730(%rdi)
addl %r11d, %r13d
addl $-0x10, %r13d
jmp 0xa08b2
orw %r11w, 0x1730(%rdi)
addl %r15d, %ecx
movl %ecx, 0x1734(%rdi)
jmp 0xa0a0c
shll %cl, %r12d
orw %r12w, 0x1730(%rdi)
addl %ecx, %r13d
movl %r13d, 0x1734(%rdi)
leal -0x1(%r15), %ebp
movl %ebp, %ecx
shrl $0x7, %ecx
addl $0x100, %ecx            # imm = 0x100
cmpl $0x101, %r15d           # imm = 0x101
cmovbl %ebp, %ecx
movzbl (%rcx,%r10), %r15d
movzwl 0x2(%rdx,%r15,4), %r12d
movl 0x1734(%rdi), %ecx
movl $0x10, %ebx
subl %r12d, %ebx
movzwl (%rdx,%r15,4), %r9d
movl %r9d, %r11d
shll %cl, %r11d
cmpl %ebx, %ecx
jle 0xa0958
orw 0x1730(%rdi), %r11w
movw %r11w, 0x1730(%rdi)
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %rbx
leaq 0x1(%rbx), %r14
movq %r14, 0x28(%rdi)
movb %r11b, (%rcx,%rbx)
movb 0x1731(%rdi), %cl
movq 0x10(%rdi), %r11
movq 0x28(%rdi), %rbx
leaq 0x1(%rbx), %r14
movq %r14, 0x28(%rdi)
movb %cl, (%r11,%rbx)
movl 0x1734(%rdi), %r11d
movb $0x10, %cl
subb %r11b, %cl
shrl %cl, %r9d
movw %r9w, 0x1730(%rdi)
leal (%r12,%r11), %ecx
addl $-0x10, %ecx
jmp 0xa0963
orw %r11w, 0x1730(%rdi)
addl %r12d, %ecx
movl %ecx, 0x1734(%rdi)
cmpb $0x4, %r15b
jb 0xa0a0c
leaq 0x58086(%rip), %r9      # 0xf8a00
subl (%r9,%r15,4), %ebp
leaq 0x57f0b(%rip), %r9      # 0xf8890
movl (%r9,%r15,4), %r15d
movl $0x10, %r9d
subl %r15d, %r9d
cmpl %r9d, %ecx
jle 0xa09f9
movzwl %bp, %r9d
shll %cl, %ebp
orw 0x1730(%rdi), %bp
movw %bp, 0x1730(%rdi)
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r11
leaq 0x1(%r11), %rbx
movq %rbx, 0x28(%rdi)
movb %bpl, (%rcx,%r11)
movb 0x1731(%rdi), %cl
movq 0x10(%rdi), %r11
movq 0x28(%rdi), %rbx
leaq 0x1(%rbx), %r14
movq %r14, 0x28(%rdi)
movb %cl, (%r11,%rbx)
movl 0x1734(%rdi), %r11d
movb $0x10, %cl
subb %r11b, %cl
shrl %cl, %r9d
movw %r9w, 0x1730(%rdi)
addl %r11d, %r15d
addl $-0x10, %r15d
jmp 0xa0a05
shll %cl, %ebp
orw %bp, 0x1730(%rdi)
addl %ecx, %r15d
movl %r15d, 0x1734(%rdi)
addl $0x3, %eax
cmpl 0x170c(%rdi), %eax
jb 0xa069c
movzwl 0x402(%rsi), %eax
movl 0x1734(%rdi), %ecx
movl $0x10, %r8d
subl %eax, %r8d
movzwl 0x400(%rsi), %edx
movl %edx, %esi
shll %cl, %esi
orw 0x1730(%rdi), %si
movw %si, 0x1730(%rdi)
cmpl %r8d, %ecx
jle 0xa0a99
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %r8
leaq 0x1(%r8), %r9
movq %r9, 0x28(%rdi)
movb %sil, (%rcx,%r8)
movb 0x1731(%rdi), %cl
movq 0x10(%rdi), %rsi
movq 0x28(%rdi), %r8
leaq 0x1(%r8), %r9
movq %r9, 0x28(%rdi)
movb %cl, (%rsi,%r8)
movl 0x1734(%rdi), %esi
movb $0x10, %cl
subb %sil, %cl
shrl %cl, %edx
movw %dx, 0x1730(%rdi)
leal (%rax,%rsi), %ecx
addl $-0x10, %ecx
jmp 0xa0a9b
addl %eax, %ecx
movl %ecx, 0x1734(%rdi)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq