// File: /workspace/github_c_makefile_star2_O3/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 $0xc8, %rsp
movq %r9, %r12
movq %r8, (%rsp)
movq %rcx, %rbp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
xorl %ebx, %ebx
leaq 0x8(%rsp), %rax
movq %rbx, (%rax)
leaq 0x10(%rsp), %rax
movq %rbx, (%rax)
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x117d8
leaq 0x60(%rsp), %r8
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x120ea
leaq 0x80(%rsp), %rsi
movl $0x8000, %edi           # imm = 0x8000
callq 0x133d0
movq 0x100(%rsp), %rax
movq %rbx, (%rax)
movq %rbx, (%r12)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
leaq 0x18(%rsp), %r8
leaq 0x80(%rsp), %r9
callq 0x12911
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
movq (%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x10(%rsp), %rbx
movq %rbx, %r8
callq 0x10da0
movq 0x100(%rsp), %r13
movq %r12, %r15
movq (%rbx), %r12
testq %r12, %r12
je 0x11460
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x11460
movq 0x8(%rsp), %r9
xorl %ebp, %ebp
movq %r9, (%rsp)
movq 0x20(%rsp), %rcx
cmpw $0x0, (%rcx,%rbp,2)
je 0x113f1
movq 0x18(%rsp), %rcx
movzwl (%rcx,%rbp,2), %ebx
jmp 0x113f6
movl $0x1, %ebx
movq (%r13), %rsi
cmpq (%r9,%rsi,8), %rbp
jne 0x11451
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0x11420
testq %rsi, %rsi
je 0x11425
movq (%r15), %rdi
shlq $0x4, %rsi
callq 0x3440
movq (%r13), %rsi
jmp 0x11431
movq (%r15), %rax
jmp 0x11438
movl $0x8, %edi
callq 0x33e0
xorl %esi, %esi
movq %rax, (%r15)
movq (%rsp), %r9
movq %r14, (%rax,%rsi,8)
movq (%r13), %rax
incq %rax
movq %rax, (%r13)
cmpq %r12, %rax
je 0x11460
movq 0x28(%rsp), %rax
addq %rbx, %r14
incq %rbp
cmpq %rax, %rbp
jb 0x113da
cmpq %r12, (%r13)
jne 0x114a3
movq 0x8(%rsp), %rdi
callq 0x3050
leaq 0x60(%rsp), %rdi
callq 0x12136
leaq 0x18(%rsp), %rdi
callq 0x117f5
leaq 0x80(%rsp), %rdi
callq 0x134f6
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5c99(%rip), %rdi      # 0x17143
leaq 0x5bed(%rip), %rsi      # 0x1709e
leaq 0x5ca3(%rip), %rcx      # 0x1715b
movl $0x13a, %edx            # imm = 0x13A
callq 0x3220