// File: /workspace/github_c_makefile_star2_O2/madler[P]pigz/zopfli/src/zopfli/blocksplitter.c
// Function: ZopfliBlockSplit
void ZopfliBlockSplit(const ZopfliOptions* options,
                      const unsigned char* in, size_t instart, size_t inend,
                      size_t maxblocks, size_t** splitpoints, size_t* npoints) {
  size_t pos = 0;
  size_t i;
  ZopfliBlockState s;
  size_t* lz77splitpoints = 0;
  size_t nlz77points = 0;
  ZopfliLZ77Store store;
  ZopfliHash hash;
  ZopfliHash* h = &hash;

  ZopfliInitLZ77Store(in, &store);
  ZopfliInitBlockState(options, instart, inend, 0, &s);
  ZopfliAllocHash(ZOPFLI_WINDOW_SIZE, h);

  *npoints = 0;
  *splitpoints = 0;

  /* Unintuitively, Using a simple LZ77 method here instead of ZopfliLZ77Optimal
  results in better blocks. */
  ZopfliLZ77Greedy(&s, in, instart, inend, &store, h);

  ZopfliBlockSplitLZ77(options,
                       &store, maxblocks,
                       &lz77splitpoints, &nlz77points);

  /* Convert LZ77 positions to positions in the uncompressed input. */
  pos = instart;
  if (nlz77points > 0) {
    for (i = 0; i < store.size; i++) {
      size_t length = store.dists[i] == 0 ? 1 : store.litlens[i];
      if (lz77splitpoints[*npoints] == i) {
        ZOPFLI_APPEND_DATA(pos, splitpoints, npoints);
        if (*npoints == nlz77points) break;
      }
      pos += length;
    }
  }
  assert(*npoints == nlz77points);

  free(lz77splitpoints);
  ZopfliCleanBlockState(&s);
  ZopfliCleanLZ77Store(&store);
  ZopfliCleanHash(h);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, %rbx
movq %r8, 0x8(%rsp)
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbp
movq 0x110(%rsp), %r15
leaq 0x10(%rsp), %rax
andq $0x0, (%rax)
leaq 0x20(%rsp), %rax
andq $0x0, (%rax)
leaq 0x28(%rsp), %rsi
movq %r12, %rdi
callq 0x109e8
leaq 0x70(%rsp), %r8
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x11273
leaq 0x90(%rsp), %rsi
movl $0x8000, %edi           # imm = 0x8000
callq 0x11fa8
andq $0x0, (%r15)
movq %rbx, 0x18(%rsp)
andq $0x0, (%rbx)
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r13, %rcx
leaq 0x28(%rsp), %r8
leaq 0x90(%rsp), %r9
callq 0x11a93
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rbx
movq %rbx, %r8
callq 0xffb4
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x106f8
movq 0x10(%rsp), %rbp
xorl %r12d, %r12d
pushq $0x1
popq %rdi
movq %rcx, 0x8(%rsp)
movq 0x18(%rsp), %r13
cmpq 0x38(%rsp), %r12
jae 0x106f8
movq 0x30(%rsp), %rax
cmpw $0x0, (%rax,%r12,2)
movq %rdi, %rbx
je 0x10691
movq 0x28(%rsp), %rax
movzwl (%rax,%r12,2), %ebx
movq (%r15), %rsi
cmpq (%rbp,%rsi,8), %r12
jne 0x106ed
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0x106bb
testq %rsi, %rsi
je 0x106c5
movq (%r13), %rdi
shlq $0x4, %rsi
callq 0x3430
movq (%r15), %rsi
jmp 0x106cf
movq 0x18(%rsp), %rax
movq (%rax), %rax
jmp 0x106db
pushq $0x8
popq %rdi
callq 0x33d0
xorl %esi, %esi
movq %rax, (%r13)
movq 0x8(%rsp), %rcx
pushq $0x1
popq %rdi
movq %r14, (%rax,%rsi,8)
movq (%r15), %rax
incq %rax
movq %rax, (%r15)
cmpq %rcx, %rax
je 0x106f8
addq %rbx, %r14
incq %r12
jmp 0x1066c
cmpq %rcx, (%r15)
jne 0x1073a
movq 0x10(%rsp), %rdi
callq 0x3050
leaq 0x70(%rsp), %rdi
callq 0x112ba
leaq 0x28(%rsp), %rdi
callq 0x10a05
leaq 0x90(%rsp), %rdi
callq 0x1209d
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5a02(%rip), %rdi      # 0x16143
leaq 0x5956(%rip), %rsi      # 0x1609e
leaq 0x5a0c(%rip), %rcx      # 0x1615b
movl $0x13a, %edx            # imm = 0x13A
callq 0x3220