// File: /workspace/github_c_makefile_star2_O2/snej[P]zdelta/trees.c
// Function: compress_block
local void compress_block(s, ltree, dtree, zdtree)
    deflate_state *s;
    ct_data *ltree;  /* literal tree      */
    ct_data *dtree;  /* distance tree     */
    ct_data *zdtree; /* zdelta code 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 */

  unsigned zd;        /* zdelta pointer */
  
  if (s->last_lit != 0) do {
    zd   = s->z_buf[lx];
    dist = s->d_buf[lx];
    lc   = s->l_buf[lx++];
    if (zd == LITERAL) {
      send_code(s, dist, dtree); /* send a literal byte */
      TraceHuf( (stderr, "d:%u\n", dist) );
      Tracecv(isgraph(dist), (stderr," '%c' ", dist));
    } else {
      /* Here dist is the match distance */
      code = d_code(dist);
      Assert (code < D_CODES, "bad d_code");      
      send_code(s, LITERALS+1+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 */
      }
      code = l_code(lc);        /* Here, lc is the match length - MIN_MATCH */
      extra = extra_lbits[code];
      if(zd == TARGET){                             /* target copy          */
	send_code(s, code, ltree);                  /* send the length code */ 
	if (extra != 0) {
	  lc -= base_length[code];
	  send_bits(s, lc, extra);            /* send the extra length bits */
	}
      }
      else{                                         /* reference copy       */
	send_code(s,code+OFFSET(zd),ltree);         /* send the length code */ 
         if (extra != 0) {
	  lc -= base_length[code];
	  send_bits(s, lc, extra);             /* send the extra length bits */
	}
	Assert ((zd & 0x1f) < Z_CODES, "bad zd_code");
	send_code(s, zd & 0x1f, zdtree);                 /* send zdelta code */
	TraceHuf( (stderr, "z:%u\n", zd) );
      }
    }

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $0x0, 0x1a44(%rdi)
movl $0x10, %r14d
je 0x5868
xorl %r9d, %r9d
movq 0x1a50(%rdi), %rax
movzbl (%rax,%r9), %r12d
movq 0x1a48(%rdi), %rax
movzwl (%rax,%r9,2), %r15d
cmpq $0x40, %r12
jne 0x541a
movl %r15d, %ecx
movzwl 0x2(%rdx,%rcx,4), %r11d
movl 0x1a74(%rdi), %eax
movl %r14d, %ebp
subl %r11d, %ebp
movzwl (%rdx,%rcx,4), %r10d
movl %r10d, %ebx
movl %eax, %ecx
shll %cl, %ebx
orw 0x1a70(%rdi), %bx
movw %bx, 0x1a70(%rdi)
cmpl %ebp, %eax
jle 0x54d1
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %ebp
movl %ebp, 0x28(%rdi)
movb %bl, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %rbx
leal 0x1(%rbx), %ebp
movl %ebp, 0x28(%rdi)
movb %al, (%rcx,%rbx)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r10d
movw %r10w, 0x1a70(%rdi)
addl %r11d, %eax
addl $-0x10, %eax
jmp 0x584e
movq 0x1a38(%rdi), %rax
movl %r15d, %ecx
shrl $0x7, %ecx
addq $0x100, %rcx            # imm = 0x100
cmpw $0x100, %r15w           # imm = 0x100
cmovbq %r15, %rcx
movzwl (%rax,%r9,2), %ebp
leaq 0x3d7c(%rip), %rax      # 0x91c0
movzbl (%rcx,%rax), %r13d
movzwl 0x406(%rdx,%r13,4), %ebx
movl 0x1a74(%rdi), %eax
movl %r14d, %r8d
subl %ebx, %r8d
movzwl 0x404(%rdx,%r13,4), %r10d
movl %r10d, %r11d
movl %eax, %ecx
shll %cl, %r11d
orw 0x1a70(%rdi), %r11w
movw %r11w, 0x1a70(%rdi)
cmpl %r8d, %eax
jle 0x54d9
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r11d
movl %r11d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r10d
movw %r10w, 0x1a70(%rdi)
addl %ebx, %eax
addl $-0x10, %eax
movl %r10d, %r11d
jmp 0x54db
addl %r11d, %eax
jmp 0x584e
addl %ebx, %eax
movl %eax, 0x1a74(%rdi)
cmpb $0x4, %r13b
jb 0x5577
leaq 0x482e(%rip), %rcx      # 0x9d20
movl (%rcx,%r13,4), %ebx
leaq 0x4913(%rip), %rcx      # 0x9e10
subl (%rcx,%r13,4), %r15d
movl %r14d, %r8d
movl %r15d, %r10d
movl %eax, %ecx
shll %cl, %r10d
subl %ebx, %r8d
orl %r10d, %r11d
movw %r11w, 0x1a70(%rdi)
cmpl %r8d, %eax
jle 0x556d
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r10d
movl %r10d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movzwl %r15w, %r11d
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r11d
movw %r11w, 0x1a70(%rdi)
addl %ebx, %eax
addl $-0x10, %eax
jmp 0x5571
addl %eax, %ebx
movl %ebx, %eax
movl %eax, 0x1a74(%rdi)
cmpw $0xff, %bp
ja 0x5582
movl %ebp, %ecx
jmp 0x55a0
movabsq $0x24, %r15
cmpl $0xfff, %ebp            # imm = 0xFFF
je 0x55ac
movl %ebp, %ecx
shrl $0x6, %ecx
addq $0x100, %rcx            # imm = 0x100
leaq 0x3e19(%rip), %r8       # 0x93c0
movzbl (%rcx,%r8), %r15d
leaq 0x45ad(%rip), %rcx      # 0x9b60
movl (%rcx,%r15,4), %r13d
cmpl $0x20, %r12d
jne 0x563a
movzwl 0x2(%rsi,%r15,4), %ebx
movl %r14d, %r8d
movzwl (%rsi,%r15,4), %r12d
movl %r12d, %r10d
movl %eax, %ecx
shll %cl, %r10d
subl %ebx, %r8d
orl %r10d, %r11d
movw %r11w, 0x1a70(%rdi)
cmpl %r8d, %eax
jle 0x56c2
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r10d
movl %r10d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r12d
movw %r12w, 0x1a70(%rdi)
addl %ebx, %eax
addl $-0x10, %eax
movl %r12d, %r11d
jmp 0x56c4
testb %r12b, %r12b
movl $0x94, %ecx
movl $0x128, %r8d            # imm = 0x128
cmovnsl %r8d, %ecx
addq %rsi, %rcx
movzwl 0x2(%rcx,%r15,4), %ebx
movzwl (%rcx,%r15,4), %r10d
movl %r10d, %r8d
movl %eax, %ecx
shll %cl, %r8d
movl %r14d, %ecx
subl %ebx, %ecx
orl %r8d, %r11d
cmpl %ecx, %eax
jle 0x5752
movw %r11w, 0x1a70(%rdi)
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r11d
movl %r11d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r10d
addl %ebx, %eax
addl $-0x10, %eax
movl %r10d, %r11d
jmp 0x5754
addl %ebx, %eax
movl %eax, 0x1a74(%rdi)
testl %r13d, %r13d
je 0x5854
leaq 0x47b6(%rip), %rcx      # 0x9e90
subl (%rcx,%r15,4), %ebp
movl %r14d, %r8d
movl %ebp, %r10d
movl %eax, %ecx
shll %cl, %r10d
subl %r13d, %r8d
orl %r10d, %r11d
movw %r11w, 0x1a70(%rdi)
cmpl %r8d, %eax
jle 0x57ce
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r10d
movl %r10d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movzwl %bp, %eax
movl 0x1a74(%rdi), %r8d
movb $0x10, %cl
subb %r8b, %cl
shrl %cl, %eax
movw %ax, 0x1a70(%rdi)
leal (%r8,%r13), %eax
addl $-0x10, %eax
jmp 0x584e
addl %ebx, %eax
movl %eax, 0x1a74(%rdi)
testl %r13d, %r13d
je 0x57dc
leaq 0x472a(%rip), %rcx      # 0x9e90
subl (%rcx,%r15,4), %ebp
movl %ebp, %r8d
movl %eax, %ecx
shll %cl, %r8d
movl %r14d, %ecx
subl %r13d, %ecx
orl %r8d, %r11d
cmpl %ecx, %eax
jle 0x57d3
movw %r11w, 0x1a70(%rdi)
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r10d
movl %r10d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movzwl %bp, %r11d
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r11d
addl %r13d, %eax
addl $-0x10, %eax
jmp 0x57d6
addl %r13d, %eax
jmp 0x584e
addl %r13d, %eax
movl %eax, 0x1a74(%rdi)
andl $0x1f, %r12d
leaq 0x4365(%rip), %rcx      # 0x9b4c
movzwl (%rcx,%r12,4), %r10d
movl %r10d, %r8d
movl %eax, %ecx
shll %cl, %r8d
orl %r8d, %r11d
movw %r11w, 0x1a70(%rdi)
cmpl $0x10, %eax
jl 0x584c
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r11d
movl %r11d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r10d
movw %r10w, 0x1a70(%rdi)
addl $-0xf, %eax
jmp 0x584e
incl %eax
movl %eax, 0x1a74(%rdi)
incq %r9
movl 0x1a44(%rdi), %ecx
cmpq %rcx, %r9
jb 0x537d
jmp 0x586e
movl 0x1a74(%rdi), %eax
movzwl 0x402(%rdx), %esi
subl %esi, %r14d
movzwl 0x400(%rdx), %r9d
movl %r9d, %r10d
movl %eax, %ecx
shll %cl, %r10d
orw 0x1a70(%rdi), %r10w
movw %r10w, 0x1a70(%rdi)
cmpl %r14d, %eax
jle 0x58e7
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r8d
movl %r8d, 0x28(%rdi)
movb %r10b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r8
leal 0x1(%r8), %r10d
movl %r10d, 0x28(%rdi)
movb %al, (%rcx,%r8)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r9d
movw %r9w, 0x1a70(%rdi)
addl %esi, %eax
addl $-0x10, %eax
jmp 0x58e9
addl %esi, %eax
movl %eax, 0x1a74(%rdi)
movzwl 0x402(%rdx), %eax
movl %eax, 0x1a6c(%rdi)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq