// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
movq %r8, (%rsp)
movq %rcx, %rbp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
movq %rdi, 0x10(%rsp)
movq 0x110(%rsp), %r12
xorl %ebx, %ebx
leaq 0x8(%rsp), %rax
movq %rbx, (%rax)
leaq 0x20(%rsp), %rax
movq %rbx, (%rax)
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x11284
leaq 0x70(%rsp), %r8
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x11b91
leaq 0x90(%rsp), %rsi
movl $0x8000, %edi           # imm = 0x8000
callq 0x12938
movq %rbx, (%r12)
movq 0x18(%rsp), %r13
movq %rbx, (%r13)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
leaq 0x28(%rsp), %rbx
movq %rbx, %r8
leaq 0x90(%rsp), %r9
callq 0x12403
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq (%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rbx
movq %rbx, %r8
callq 0x108a4
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x10f44
cmpq $0x0, 0x38(%rsp)
je 0x10f44
movq %r13, %r15
movq 0x8(%rsp), %r8
xorl %ebp, %ebp
movq %r8, (%rsp)
movq 0x30(%rsp), %rax
cmpw $0x0, (%rax,%rbp,2)
je 0x10ec6
movq 0x28(%rsp), %rax
movzwl (%rax,%rbp,2), %ebx
jmp 0x10ecb
movl $0x1, %ebx
movq (%r12), %rsi
cmpq (%r8,%rsi,8), %rbp
jne 0x10f2d
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0x10f0e
movq %r12, %r13
movq %rdi, %r12
testq %rsi, %rsi
je 0x10ef7
movq (%r15), %rdi
shlq $0x4, %rsi
callq 0x3430
jmp 0x10f01
movl $0x8, %edi
callq 0x33d0
movq %rax, (%r15)
movq %r12, %rdi
movq %r13, %r12
movq (%rsp), %r8
movq (%r15), %rax
movq (%r12), %rcx
movq %r14, (%rax,%rcx,8)
movq (%r12), %rax
incq %rax
movq %rax, (%r12)
cmpq %rdi, %rax
jne 0x10f2d
xorl %eax, %eax
jmp 0x10f32
addq %rbx, %r14
movb $0x1, %al
testb %al, %al
je 0x10f44
incq %rbp
cmpq 0x38(%rsp), %rbp
jb 0x10eaf
cmpq %rdi, (%r12)
jne 0x10f87
movq 0x8(%rsp), %rdi
callq 0x3050
leaq 0x70(%rsp), %rdi
callq 0x11bdd
leaq 0x28(%rsp), %rdi
callq 0x112a1
leaq 0x90(%rsp), %rdi
callq 0x12a41
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6175(%rip), %rdi      # 0x17103
leaq 0x60c9(%rip), %rsi      # 0x1705e
leaq 0x617f(%rip), %rcx      # 0x1711b
movl $0x13a, %edx            # imm = 0x13A
callq 0x3220