// File: /workspace/github_c_makefile_star2_O1/snej[P]zdelta/trees.c
// Function: send_tree
local void send_tree (s, tree, max_code)
     deflate_state *s;
     ct_data *tree; /* the tree to be scanned */
     int max_code;       /* and its largest code of non zero frequency */
{
  int n;                     /* iterates over all tree elements */
  int prevlen = -1;          /* last emitted length */
  int curlen;                /* length of current code */
  int nextlen = tree[0].Len; /* length of next code */
  int count = 0;             /* repeat count of the current code */
  int max_count = 7;         /* max repeat count */
  int min_count = 4;         /* min repeat count */

  /* tree[max_code+1].Len = -1; */  /* guard already set */
  if (nextlen == 0) max_count = 138, min_count = 3;

  for (n = 0; n <= max_code; n++) {
    Tracevv((stderr, "code: %3u len: %3u\n", n, tree[n].Len));
    curlen = nextlen; nextlen = tree[n+1].Len;
    if (++count < max_count && curlen == nextlen) {
      continue;
    } else if (count < min_count) {
      do { send_code(s, curlen, s->bl_tree); 
      } while (--count != 0);
      
    } else if (curlen != 0) {
      if (curlen != prevlen) {
	send_code(s, curlen, s->bl_tree); count--; 
      }
      Assert(count >= 3 && count <= 6, " 3_6?");
      send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
    } else if (count <= 10) {
      send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
    } else {
      send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
    }

    count = 0; prevlen = curlen;
    if (nextlen == 0) {
      max_count = 138, min_count = 3;
    } else if (curlen == nextlen) {
      max_count = 6, min_count = 3;
    } else {
      max_count = 7, min_count = 4;
    }
  }
}

// Assembly:
testl %edx, %edx
js 0x63cc
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movzwl 0x2(%rsi), %r8d
xorl %ecx, %ecx
testl %r8d, %r8d
movl $0x8a, %r9d
movl $0x7, %eax
cmovel %r9d, %eax
setne %cl
addl $0x3, %ecx
incl %edx
xorl %r9d, %r9d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r11d, %r11d
movl %r8d, %r10d
movzwl 0x6(%rsi,%r9,4), %r8d
leal 0x1(%r11), %ebx
cmpl %eax, %ebx
jge 0x5ed3
cmpl %r8d, %r10d
jne 0x5ed3
movl %ebp, %r10d
jmp 0x63b2
cmpl %ecx, %ebx
jge 0x5f83
movl %r10d, %eax
movzwl 0xd92(%rdi,%rax,4), %r11d
movl 0x1a74(%rdi), %ecx
movl $0x10, %r15d
subl %r11d, %r15d
movzwl 0xd90(%rdi,%rax,4), %ebp
movl %ebp, %r14d
shll %cl, %r14d
cmpl %r15d, %ecx
jle 0x5f65
orw 0x1a70(%rdi), %r14w
movw %r14w, 0x1a70(%rdi)
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r15
leal 0x1(%r15), %r12d
movl %r12d, 0x28(%rdi)
movb %r14b, (%rcx,%r15)
movb 0x1a71(%rdi), %cl
movq 0x10(%rdi), %r14
movslq 0x28(%rdi), %r15
leal 0x1(%r15), %r12d
movl %r12d, 0x28(%rdi)
movb %cl, (%r14,%r15)
movl 0x1a74(%rdi), %r14d
movb $0x10, %cl
subb %r14b, %cl
shrl %cl, %ebp
movw %bp, 0x1a70(%rdi)
leal (%r11,%r14), %ecx
addl $-0x10, %ecx
jmp 0x5f70
orw %r14w, 0x1a70(%rdi)
addl %r11d, %ecx
movl %ecx, 0x1a74(%rdi)
decl %ebx
jne 0x5ede
jmp 0x638d
testl %r10d, %r10d
je 0x6020
cmpl %ebp, %r10d
je 0x614e
movl %r10d, %ebx
movzwl 0xd92(%rdi,%rbx,4), %eax
movl 0x1a74(%rdi), %ecx
movl $0x10, %r14d
subl %eax, %r14d
movzwl 0xd90(%rdi,%rbx,4), %ebx
movl %ebx, %ebp
shll %cl, %ebp
cmpl %r14d, %ecx
jle 0x613c
orw 0x1a70(%rdi), %bp
movw %bp, 0x1a70(%rdi)
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r14
leal 0x1(%r14), %r15d
movl %r15d, 0x28(%rdi)
movb %bpl, (%rcx,%r14)
movb 0x1a71(%rdi), %cl
movq 0x10(%rdi), %r14
movslq 0x28(%rdi), %r15
leal 0x1(%r15), %ebp
movl %ebp, 0x28(%rdi)
movb %cl, (%r14,%r15)
movl 0x1a74(%rdi), %r14d
movb $0x10, %cl
subb %r14b, %cl
shrl %cl, %ebx
movw %bx, 0x1a70(%rdi)
leal (%rax,%r14), %ecx
addl $-0x10, %ecx
jmp 0x6145
cmpl $0x9, %r11d
jg 0x60b3
movzwl 0xdd6(%rdi), %ebx
movl 0x1a74(%rdi), %eax
movl $0x10, %r15d
subl %ebx, %r15d
movzwl 0xdd4(%rdi), %ebp
movl %ebp, %r14d
movl %eax, %ecx
shll %cl, %r14d
cmpl %r15d, %eax
jle 0x6268
orw 0x1a70(%rdi), %r14w
movw %r14w, 0x1a70(%rdi)
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r15d
movl %r15d, 0x28(%rdi)
movb %r14b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r14
leal 0x1(%r14), %r15d
movl %r15d, 0x28(%rdi)
movb %al, (%rcx,%r14)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %ebp
movw %bp, 0x1a70(%rdi)
addl %ebx, %eax
addl $-0x10, %eax
jmp 0x6272
movzwl 0xdda(%rdi), %ebx
movl 0x1a74(%rdi), %eax
movl $0x10, %r15d
subl %ebx, %r15d
movzwl 0xdd8(%rdi), %ebp
movl %ebp, %r14d
movl %eax, %ecx
shll %cl, %r14d
cmpl %r15d, %eax
jle 0x62e3
orw 0x1a70(%rdi), %r14w
movw %r14w, 0x1a70(%rdi)
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r15d
movl %r15d, 0x28(%rdi)
movb %r14b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r14
leal 0x1(%r14), %r15d
movl %r15d, 0x28(%rdi)
movb %al, (%rcx,%r14)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %ebp
movw %bp, 0x1a70(%rdi)
addl %ebx, %eax
addl $-0x10, %eax
jmp 0x62ed
orw %bp, 0x1a70(%rdi)
addl %eax, %ecx
movl %ecx, 0x1a74(%rdi)
movl %r11d, %ebx
movzwl 0xdd2(%rdi), %r11d
movl 0x1a74(%rdi), %eax
movl $0x10, %r15d
subl %r11d, %r15d
movzwl 0xdd0(%rdi), %ebp
movl %ebp, %r14d
movl %eax, %ecx
shll %cl, %r14d
cmpl %r15d, %eax
jle 0x61d2
orw 0x1a70(%rdi), %r14w
movw %r14w, 0x1a70(%rdi)
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %r15d
movl %r15d, 0x28(%rdi)
movb %r14b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r14
leal 0x1(%r14), %r15d
movl %r15d, 0x28(%rdi)
movb %al, (%rcx,%r14)
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %ebp
movw %bp, 0x1a70(%rdi)
addl %r11d, %eax
addl $-0x10, %eax
jmp 0x61dd
orw %r14w, 0x1a70(%rdi)
addl %r11d, %eax
movl %eax, 0x1a74(%rdi)
cmpl $0xf, %eax
jl 0x624f
addl $-0x3, %ebx
movl %ebx, %r11d
movl %eax, %ecx
shll %cl, %r11d
orw 0x1a70(%rdi), %r11w
movw %r11w, 0x1a70(%rdi)
movq 0x10(%rdi), %rax
movslq 0x28(%rdi), %rcx
leal 0x1(%rcx), %ebp
movl %ebp, 0x28(%rdi)
movb %r11b, (%rax,%rcx)
movb 0x1a71(%rdi), %al
movq 0x10(%rdi), %rcx
movslq 0x28(%rdi), %r11
leal 0x1(%r11), %ebp
movl %ebp, 0x28(%rdi)
movb %al, (%rcx,%r11)
movzwl %bx, %r11d
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r11d
movw %r11w, 0x1a70(%rdi)
addl $-0xe, %eax
jmp 0x6387
addl $0xfffd, %ebx           # imm = 0xFFFD
movl %eax, %ecx
shll %cl, %ebx
orw %bx, 0x1a70(%rdi)
addl $0x2, %eax
jmp 0x6387
orw %r14w, 0x1a70(%rdi)
addl %ebx, %eax
movl %eax, 0x1a74(%rdi)
cmpl $0xe, %eax
jl 0x6357
addl $-0x2, %r11d
movl %r11d, %ebx
movl %eax, %ecx
shll %cl, %ebx
orw 0x1a70(%rdi), %bx
movw %bx, 0x1a70(%rdi)
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)
movzwl %r11w, %r11d
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r11d
movw %r11w, 0x1a70(%rdi)
addl $-0xd, %eax
jmp 0x6387
orw %r14w, 0x1a70(%rdi)
addl %ebx, %eax
movl %eax, 0x1a74(%rdi)
cmpl $0xa, %eax
jl 0x6370
addl $-0xa, %r11d
movl %r11d, %ebx
movl %eax, %ecx
shll %cl, %ebx
orw 0x1a70(%rdi), %bx
movw %bx, 0x1a70(%rdi)
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)
movzwl %r11w, %r11d
movl 0x1a74(%rdi), %eax
movb $0x10, %cl
subb %al, %cl
shrl %cl, %r11d
movw %r11w, 0x1a70(%rdi)
addl $-0x9, %eax
jmp 0x6387
addl $0xfffe, %r11d          # imm = 0xFFFE
movl %eax, %ecx
shll %cl, %r11d
orw %r11w, 0x1a70(%rdi)
addl $0x3, %eax
jmp 0x6387
addl $0xfff6, %r11d          # imm = 0xFFF6
movl %eax, %ecx
shll %cl, %r11d
orw %r11w, 0x1a70(%rdi)
addl $0x7, %eax
movl %eax, 0x1a74(%rdi)
xorl %ebx, %ebx
testl %r8d, %r8d
je 0x63a8
xorl %eax, %eax
cmpl %r8d, %r10d
sete %al
movl $0x4, %ecx
subl %eax, %ecx
xorl $0x7, %eax
jmp 0x63b2
movl $0x8a, %eax
movl $0x3, %ecx
incq %r9
movl %r10d, %ebp
movl %ebx, %r11d
cmpq %rdx, %r9
jne 0x5eb5
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)