// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/png/trees.c
// Function: compress_block
local void compress_block(s, ltree, dtree)
    deflate_state *s;
    ct_data *ltree; /* literal tree */
    ct_data *dtree; /* distance tree */
{
    unsigned dist;      /* distance of matched string */
    int lc;             /* match length or unmatched char (if dist == 0) */
    unsigned lx = 0;    /* running index in l_buf */
    unsigned code;      /* the code to send */
    int extra;          /* number of extra bits to send */

    if (s->last_lit != 0) do {
        dist = s->d_buf[lx];
        lc = s->l_buf[lx++];
        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 the 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 -= base_dist[code];
                send_bits(s, dist, extra);   /* send the extra distance bits */
            }
        } /* literal or match pair ? */

        /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
        Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
               "pendingBuf overflow");

    } while (lx < s->last_lit);

    send_code(s, END_BLOCK, ltree);
    s->last_eob_len = ltree[END_BLOCK].Len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $0x0, 0x16fc(%rdi)
je 0x9913e
xorl %eax, %eax
leaq 0x190e1(%rip), %r8      # 0xb1ed0
leaq 0x18eda(%rip), %r10     # 0xb1cd0
movq 0x16f0(%rdi), %rcx
movq 0x1700(%rdi), %r9
movzwl (%r9,%rax,2), %r15d
movzbl (%rcx,%rax), %r12d
testl %r15d, %r15d
je 0x98ea7
movzbl (%r12,%r8), %r13d
movzwl 0x406(%rsi,%r13,4), %r9d
movl 0x1724(%rdi), %ecx
movl $0x10, %ebx
subl %r9d, %ebx
movzwl 0x404(%rsi,%r13,4), %r11d
movl %r11d, %ebp
shll %cl, %ebp
orw 0x1720(%rdi), %bp
movw %bp, 0x1720(%rdi)
cmpl %ebx, %ecx
jle 0x98f2e
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %ebx
leal 0x1(%rbx), %r14d
movl %r14d, 0x28(%rdi)
movb %bpl, (%rcx,%rbx)
movb 0x1721(%rdi), %cl
movq 0x10(%rdi), %rbx
movl 0x28(%rdi), %r14d
leal 0x1(%r14), %ebp
movl %ebp, 0x28(%rdi)
movb %cl, (%rbx,%r14)
movl 0x1724(%rdi), %ebx
movb $0x10, %cl
subb %bl, %cl
shrl %cl, %r11d
movw %r11w, 0x1720(%rdi)
leal (%r9,%rbx), %ecx
addl $-0x10, %ecx
movl %r11d, %ebp
jmp 0x98f31
movzwl 0x2(%rsi,%r12,4), %r9d
movl 0x1724(%rdi), %ecx
movl $0x10, %r15d
subl %r9d, %r15d
movzwl (%rsi,%r12,4), %r11d
movl %r11d, %ebp
shll %cl, %ebp
orw 0x1720(%rdi), %bp
movw %bp, 0x1720(%rdi)
cmpl %r15d, %ecx
jle 0x98fc7
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %r15d
leal 0x1(%r15), %r12d
movl %r12d, 0x28(%rdi)
movb %bpl, (%rcx,%r15)
movb 0x1721(%rdi), %cl
movq 0x10(%rdi), %r15
movl 0x28(%rdi), %r12d
leal 0x1(%r12), %ebp
movl %ebp, 0x28(%rdi)
movb %cl, (%r15,%r12)
movl 0x1724(%rdi), %r15d
movb $0x10, %cl
subb %r15b, %cl
shrl %cl, %r11d
movw %r11w, 0x1720(%rdi)
leal (%r9,%r15), %ecx
addl $-0x10, %ecx
jmp 0x99123
addl %r9d, %ecx
movl %ecx, 0x1724(%rdi)
leaq -0x1c(%r13), %r9
cmpq $-0x14, %r9
jb 0x98fe8
leaq 0x196f4(%rip), %r9      # 0xb2640
subl (%r9,%r13,4), %r12d
leaq 0x19579(%rip), %r9      # 0xb24d0
movl (%r9,%r13,4), %r13d
movl $0x10, %r9d
subl %r13d, %r9d
cmpl %r9d, %ecx
jle 0x98fcf
movzwl %r12w, %r9d
shll %cl, %r12d
orl %r12d, %ebp
movw %bp, 0x1720(%rdi)
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %r11d
leal 0x1(%r11), %ebx
movl %ebx, 0x28(%rdi)
movb %bpl, (%rcx,%r11)
movb 0x1721(%rdi), %cl
movq 0x10(%rdi), %r11
movl 0x28(%rdi), %ebx
leal 0x1(%rbx), %ebp
movl %ebp, 0x28(%rdi)
movb %cl, (%r11,%rbx)
movl 0x1724(%rdi), %r11d
movb $0x10, %cl
subb %r11b, %cl
shrl %cl, %r9d
movw %r9w, 0x1720(%rdi)
leal (%r11,%r13), %ecx
addl $-0x10, %ecx
movl %r9d, %ebp
jmp 0x98fe2
addl %r9d, %ecx
jmp 0x99123
shll %cl, %r12d
orl %r12d, %ebp
movw %bp, 0x1720(%rdi)
addl %ecx, %r13d
movl %r13d, %ecx
movl %ecx, 0x1724(%rdi)
leal -0x1(%r15), %r12d
movl %r12d, %r9d
shrl $0x7, %r9d
addl $0x100, %r9d            # imm = 0x100
cmpl $0x101, %r15d           # imm = 0x101
cmovbl %r12d, %r9d
movzbl (%r9,%r10), %r15d
movzwl 0x2(%rdx,%r15,4), %r13d
movl $0x10, %r11d
movzwl (%rdx,%r15,4), %r9d
movl %r9d, %ebx
shll %cl, %ebx
subl %r13d, %r11d
orl %ebx, %ebp
movw %bp, 0x1720(%rdi)
cmpl %r11d, %ecx
jle 0x9907e
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %r11d
leal 0x1(%r11), %ebx
movl %ebx, 0x28(%rdi)
movb %bpl, (%rcx,%r11)
movb 0x1721(%rdi), %cl
movq 0x10(%rdi), %r11
movl 0x28(%rdi), %ebx
leal 0x1(%rbx), %ebp
movl %ebp, 0x28(%rdi)
movb %cl, (%r11,%rbx)
movl 0x1724(%rdi), %r11d
movb $0x10, %cl
subb %r11b, %cl
shrl %cl, %r9d
movw %r9w, 0x1720(%rdi)
leal (%r11,%r13), %ecx
addl $-0x10, %ecx
movl %r9d, %ebp
jmp 0x99081
addl %r13d, %ecx
movl %ecx, 0x1724(%rdi)
cmpb $0x4, %r15b
jb 0x99129
leaq 0x19628(%rip), %r9      # 0xb26c0
subl (%r9,%r15,4), %r12d
leaq 0x194ad(%rip), %r9      # 0xb2550
movl (%r9,%r15,4), %r15d
movl $0x10, %r9d
subl %r15d, %r9d
cmpl %r9d, %ecx
jle 0x99110
movzwl %r12w, %r9d
shll %cl, %r12d
orl %r12d, %ebp
movw %bp, 0x1720(%rdi)
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %r11d
leal 0x1(%r11), %ebx
movl %ebx, 0x28(%rdi)
movb %bpl, (%rcx,%r11)
movb 0x1721(%rdi), %cl
movq 0x10(%rdi), %r11
movl 0x28(%rdi), %ebx
leal 0x1(%rbx), %ebp
movl %ebp, 0x28(%rdi)
movb %cl, (%r11,%rbx)
movl 0x1724(%rdi), %r11d
movb $0x10, %cl
subb %r11b, %cl
shrl %cl, %r9d
movw %r9w, 0x1720(%rdi)
leal (%r15,%r11), %ecx
addl $-0x10, %ecx
jmp 0x99123
shll %cl, %r12d
orl %r12d, %ebp
movw %bp, 0x1720(%rdi)
addl %ecx, %r15d
movl %r15d, %ecx
movl %ecx, 0x1724(%rdi)
incq %rax
movl 0x16fc(%rdi), %r9d
cmpq %r9, %rax
jb 0x98df6
jmp 0x99144
movl 0x1724(%rdi), %ecx
movzwl 0x402(%rsi), %eax
movl $0x10, %r9d
subl %eax, %r9d
movzwl 0x400(%rsi), %edx
movl %edx, %r8d
shll %cl, %r8d
orw 0x1720(%rdi), %r8w
movw %r8w, 0x1720(%rdi)
cmpl %r9d, %ecx
jle 0x991c2
movq 0x10(%rdi), %rcx
movl 0x28(%rdi), %r9d
leal 0x1(%r9), %r10d
movl %r10d, 0x28(%rdi)
movb %r8b, (%rcx,%r9)
movb 0x1721(%rdi), %cl
movq 0x10(%rdi), %r8
movl 0x28(%rdi), %r9d
leal 0x1(%r9), %r10d
movl %r10d, 0x28(%rdi)
movb %cl, (%r8,%r9)
movl 0x1724(%rdi), %r8d
movb $0x10, %cl
subb %r8b, %cl
shrl %cl, %edx
movw %dx, 0x1720(%rdi)
leal (%rax,%r8), %ecx
addl $-0x10, %ecx
jmp 0x991c4
addl %eax, %ecx
movl %ecx, 0x1724(%rdi)
movzwl 0x402(%rsi), %eax
movl %eax, 0x171c(%rdi)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq