// File: /workspace/github_c_makefile_star2_O0/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliLZ77GetHistogram
void ZopfliLZ77GetHistogram(const ZopfliLZ77Store* lz77,
                           size_t lstart, size_t lend,
                           size_t* ll_counts, size_t* d_counts) {
  size_t i;
  if (lstart + ZOPFLI_NUM_LL * 3 > lend) {
    memset(ll_counts, 0, sizeof(*ll_counts) * ZOPFLI_NUM_LL);
    memset(d_counts, 0, sizeof(*d_counts) * ZOPFLI_NUM_D);
    for (i = lstart; i < lend; i++) {
      ll_counts[lz77->ll_symbol[i]]++;
      if (lz77->dists[i] != 0) d_counts[lz77->d_symbol[i]]++;
    }
  } else {
    /* Subtract the cumulative histograms at the end and the start to get the
    histogram for this range. */
    ZopfliLZ77GetHistogramAt(lz77, lend - 1, ll_counts, d_counts);
    if (lstart > 0) {
      size_t ll_counts2[ZOPFLI_NUM_LL];
      size_t d_counts2[ZOPFLI_NUM_D];
      ZopfliLZ77GetHistogramAt(lz77, lstart - 1, ll_counts2, d_counts2);

      for (i = 0; i < ZOPFLI_NUM_LL; i++) {
        ll_counts[i] -= ll_counts2[i];
      }
      for (i = 0; i < ZOPFLI_NUM_D; i++) {
        d_counts[i] -= d_counts2[i];
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa30, %rsp            # imm = 0xA30
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
addq $0x360, %rax            # imm = 0x360
cmpq -0x18(%rbp), %rax
jbe 0x1789f
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x900, %edx            # imm = 0x900
callq 0x3260
movq -0x28(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x3260
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x1789a
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x30(%rbp), %rdx
movzwl (%rcx,%rdx,2), %ecx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
je 0x1788a
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq -0x30(%rbp), %rdx
movzwl (%rcx,%rdx,2), %ecx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x1788c
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1782b
jmp 0x17961
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
subq $0x1, %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x17970
cmpq $0x0, -0x10(%rbp)
jbe 0x1795f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
subq $0x1, %rsi
leaq -0x930(%rbp), %rdx
leaq -0xa30(%rbp), %rcx
callq 0x17970
movq $0x0, -0x30(%rbp)
cmpq $0x120, -0x30(%rbp)     # imm = 0x120
jae 0x17921
movq -0x30(%rbp), %rax
movq -0x930(%rbp,%rax,8), %rsi
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x178ea
movq $0x0, -0x30(%rbp)
cmpq $0x20, -0x30(%rbp)
jae 0x1795d
movq -0x30(%rbp), %rax
movq -0xa30(%rbp,%rax,8), %rsi
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x17929
jmp 0x1795f
jmp 0x17961
addq $0xa30, %rsp            # imm = 0xA30
popq %rbp
retq
nopw (%rax,%rax)