// File: /workspace/github_c_makefile_star2_O0/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliLZ77GetHistogramAt
static void ZopfliLZ77GetHistogramAt(const ZopfliLZ77Store* lz77, size_t lpos,
                                     size_t* ll_counts, size_t* d_counts) {
  /* The real histogram is created by using the histogram for this chunk, but
  all superfluous values of this chunk subtracted. */
  size_t llpos = ZOPFLI_NUM_LL * (lpos / ZOPFLI_NUM_LL);
  size_t dpos = ZOPFLI_NUM_D * (lpos / ZOPFLI_NUM_D);
  size_t i;
  for (i = 0; i < ZOPFLI_NUM_LL; i++) {
    ll_counts[i] = lz77->ll_counts[llpos + i];
  }
  for (i = lpos + 1; i < llpos + ZOPFLI_NUM_LL && i < lz77->size; i++) {
    ll_counts[lz77->ll_symbol[i]]--;
  }
  for (i = 0; i < ZOPFLI_NUM_D; i++) {
    d_counts[i] = lz77->d_counts[dpos + i];
  }
  for (i = lpos + 1; i < dpos + ZOPFLI_NUM_D && i < lz77->size; i++) {
    if (lz77->dists[i] != 0) d_counts[lz77->d_symbol[i]]--;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl $0x120, %ecx            # imm = 0x120
xorl %edx, %edx
divq %rcx
imulq $0x120, %rax, %rax      # imm = 0x120
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
shrq $0x5, %rax
shlq $0x5, %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x120, -0x38(%rbp)     # imm = 0x120
jae 0x179ed
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x28(%rbp), %rcx
addq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x179b5
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rdx
addq $0x120, %rdx            # imm = 0x120
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x39(%rbp)
jae 0x17a24
movq -0x38(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
setb %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x17a2d
jmp 0x17a5b
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x38(%rbp), %rdx
movzwl (%rcx,%rdx,2), %ecx
movq (%rax,%rcx,8), %rdx
addq $-0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x179f9
movq $0x0, -0x38(%rbp)
cmpq $0x20, -0x38(%rbp)
jae 0x17a98
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x30(%rbp), %rcx
addq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x17a63
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
addq $0x20, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x3a(%rbp)
jae 0x17acc
movq -0x38(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
setb %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
testb $0x1, %al
jne 0x17ad5
jmp 0x17b1a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
je 0x17b0a
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq -0x38(%rbp), %rdx
movzwl (%rcx,%rdx,2), %ecx
movq (%rax,%rcx,8), %rdx
addq $-0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x17b0c
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x17aa4
popq %rbp
retq
nopl (%rax)