// File: /workspace/github_c_makefile_star2_O2/imaya[P]zopfli-for-emscripten/squeeze.c
// Function: LZ77OptimalRun
static double LZ77OptimalRun(ZopfliBlockState* s,
    const unsigned char* in, size_t instart, size_t inend,
    unsigned short** path, size_t* pathsize,
    unsigned short* length_array, CostModelFun* costmodel,
    void* costcontext, ZopfliLZ77Store* store) {
  double cost = GetBestLengths(
      s, in, instart, inend, costmodel, costcontext, length_array);
  free(*path);
  *path = 0;
  *pathsize = 0;
  TraceBackwards(inend - instart, length_array, path, pathsize);
  FollowPath(s, in, instart, inend, *path, *pathsize, store);
  assert(cost < ZOPFLI_LARGE_FLOAT);
  return cost;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movq %r9, 0x78(%rsp)
movq %r8, 0x70(%rsp)
movq %rcx, %rbx
movq %rdx, 0x18(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x50(%rsp)
movsd 0x19a0(%rip), %xmm0     # 0x7008
xorl %ebp, %ebp
pushq $0x3
popq %r15
pushq $0x1
popq %r12
cmpl $0x103, %r15d           # imm = 0x103
je 0x56ad
movl %r15d, %edi
movl %r12d, %esi
movq 0x330(%rsp), %rdx
movsd %xmm0, 0x10(%rsp)
callq *0x328(%rsp)
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
cmoval %r15d, %ebp
minsd %xmm1, %xmm0
incl %r15d
jmp 0x5672
movsd 0x1953(%rip), %xmm0     # 0x7008
xorl %r14d, %r14d
pushq $0x3
popq %r12
xorl %r15d, %r15d
cmpq $0x78, %r14
je 0x5703
leaq 0x2954(%rip), %rax      # 0x8020
movl (%r14,%rax), %r13d
movl %r12d, %edi
movl %r13d, %esi
movq 0x330(%rsp), %rdx
movsd %xmm0, 0x10(%rsp)
callq *0x328(%rsp)
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
cmoval %r13d, %r15d
minsd %xmm1, %xmm0
addq $0x4, %r14
jmp 0x56bf
xorl %edx, %edx
movq 0x18(%rsp), %rcx
movq %rcx, %rax
subq $0x8000, %rax           # imm = 0x8000
cmovaeq %rax, %rdx
movq %rdx, 0x38(%rsp)
movl %ebp, %edi
movl %r15d, %esi
movq %rcx, %r15
movq 0x330(%rsp), %rdx
callq *0x328(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rbx, %r12
movb $0x1, %al
subq %r15, %r12
je 0x5b1c
leaq 0x4(,%r12,4), %rdi
callq 0x1120
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x5eda
pushq $0x1
popq %r14
movq %r12, 0x68(%rsp)
leaq 0x1(%r12), %r13
leaq 0x98(%rsp), %r15
movl $0x8000, %edi           # imm = 0x8000
movq %r15, %rsi
callq 0x3ce8
movq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq 0x38(%rsp), %r12
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x3f3c
cmpq 0x18(%rsp), %r12
jae 0x57bd
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x3e2a
incq %r12
jmp 0x57a0
movq 0x18(%rsp), %r15
movq 0x30(%rsp), %rdx
cmpq %r13, %r14
jae 0x57d9
movl $0x7149f2ca, (%rdx,%r14,4) # imm = 0x7149F2CA
incq %r14
jmp 0x57c7
andl $0x0, (%rdx)
movq 0x320(%rsp), %rcx
andw $0x0, (%rcx)
leaq 0x103(%r15), %rax
movq %rax, 0x90(%rsp)
leaq (%r15,%r15), %rax
negq %rax
addq %rcx, %rax
addq $0x204, %rax            # imm = 0x204
movq %rax, 0x88(%rsp)
leaq (,%r15,4), %rax
movq %rdx, %rcx
subq %rax, %rcx
movq %rcx, 0x80(%rsp)
movq %r15, %r13
movq %rbx, 0x60(%rsp)
cmpq %rbx, %r13
jae 0x5ad1
movq %r13, %r12
subq %r15, %r12
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
leaq 0x98(%rsp), %rcx
callq 0x3e2a
leaq 0x205(%r13), %rax
cmpq %rbx, %rax
jae 0x593f
cmpq 0x90(%rsp), %r13
jbe 0x593f
movq 0xd8(%rsp), %rax
movl %r13d, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
cmpw $0x205, (%rax,%rcx,2)   # imm = 0x205
jb 0x593f
leal 0x7efe(%r13), %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
cmpw $0x103, (%rax,%rcx,2)   # imm = 0x103
jb 0x593f
movq %rbp, %rbx
movl $0x102, %edi            # imm = 0x102
pushq $0x1
popq %rsi
movq 0x330(%rsp), %rdx
callq *0x328(%rsp)
movsd %xmm0, 0x20(%rsp)
movq 0x88(%rsp), %rax
leaq (%rax,%r13,2), %r15
movq 0x80(%rsp), %rax
movq %r13, %rbp
leaq (%rax,%r13,4), %r13
xorl %r14d, %r14d
cmpq $0x102, %r14            # imm = 0x102
je 0x592e
cvtss2sd (%r13,%r14,4), %xmm0
addsd 0x20(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x408(%r13,%r14,4)
movw $0x102, (%r15,%r14,2)   # imm = 0x102
leaq 0x1(%r14,%rbp), %rsi
movq %rbx, %rdi
movq 0x60(%rsp), %rdx
leaq 0x98(%rsp), %rcx
callq 0x3e2a
incq %r14
jmp 0x58e4
addq %r14, %r12
addq %r14, %rbp
movq %rbp, %r13
movq %rbx, %rbp
movq 0x60(%rsp), %rbx
subq $0x8, %rsp
movl $0x102, %r9d            # imm = 0x102
movq 0x58(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq %rbp, %rdx
movq %r13, %rcx
movq %rbx, %r8
leaq 0x16(%rsp), %rax
pushq %rax
leaq 0x5e(%rsp), %rax
pushq %rax
leaq 0xf8(%rsp), %rax
pushq %rax
callq 0x453e
addq $0x20, %rsp
leaq 0x1(%r13), %rax
movq %rax, 0x58(%rsp)
cmpq %rbx, %rax
movq 0x30(%rsp), %rdx
ja 0x59f5
cvtss2sd (%rdx,%r12,4), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rdx, %r14
movzbl (%rbp,%r13), %edi
xorl %esi, %esi
movq 0x330(%rsp), %rdx
callq *0x328(%rsp)
addsd 0x20(%rsp), %xmm0
ucomisd 0x2324(%rip), %xmm0     # 0x7ce8
jb 0x5e9c
cvtss2sd 0x4(%r14,%r12,4), %xmm1
ucomisd %xmm0, %xmm1
movq %r14, %rdx
jbe 0x59f5
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%rdx,%r12,4)
movq 0x320(%rsp), %rax
movw $0x1, 0x2(%rax,%r12,2)
movq 0x320(%rsp), %rax
leaq (%rax,%r12,2), %r14
leaq (%rdx,%r12,4), %rbp
pushq $0x3
popq %r15
movzwl 0xe(%rsp), %eax
leaq (%r15,%r13), %rcx
cmpq %rbx, %rcx
ja 0x5abd
cmpq %rax, %r15
ja 0x5abd
movss (%rbp,%r15,4), %xmm3
movss (%rdx,%r12,4), %xmm0
movaps %xmm3, %xmm1
subss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm2
ucomisd %xmm1, %xmm2
jae 0x5ab5
movss %xmm3, 0x40(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
movzwl 0xe0(%rsp,%r15,2), %esi
movl %r15d, %edi
movq 0x330(%rsp), %rdx
callq *0x328(%rsp)
addsd 0x20(%rsp), %xmm0
ucomisd 0x2267(%rip), %xmm0     # 0x7ce8
jb 0x5da4
cvtss2sd 0x40(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movq 0x30(%rsp), %rdx
jbe 0x5ab5
cmpq $0x103, %r15            # imm = 0x103
jae 0x5dc3
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rbp,%r15,4)
movw %r15w, (%r14,%r15,2)
incq %r15
jmp 0x5a09
movq 0x28(%rsp), %rbp
movq 0x18(%rsp), %r15
movq 0x58(%rsp), %r13
jmp 0x582d
movq 0x68(%rsp), %r12
movss (%rdx,%r12,4), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x5ee2
movq %rdx, %r14
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x3de7
movq %r14, %rdi
callq 0x1030
movsd 0x14f5(%rip), %xmm0     # 0x7008
ucomisd 0x10(%rsp), %xmm0
seta %al
movb %al, 0x30(%rsp)
movq 0x70(%rsp), %r13
movq (%r13), %rdi
callq 0x1030
andq $0x0, (%r13)
movq 0x78(%rsp), %r14
andq $0x0, (%r14)
testq %r12, %r12
je 0x5bef
xorl %edi, %edi
xorl %eax, %eax
movq 0x38(%rsp), %rbp
movq %rax, %rsi
decq %rax
testq %rax, %rsi
jne 0x5b6c
testq %rsi, %rsi
je 0x5b71
shlq $0x2, %rsi
callq 0x1140
movq (%r14), %rsi
jmp 0x5b7b
movq %rdi, %rax
jmp 0x5b7f
pushq $0x2
popq %rdi
callq 0x1120
xorl %esi, %esi
movq %rax, (%r13)
movq 0x320(%rsp), %rcx
movzwl (%rcx,%r12,2), %ecx
movw %cx, (%rax,%rsi,2)
leaq 0x1(%rsi), %r8
movq %r8, (%r14)
cmpq %rcx, %r12
jb 0x5de2
cmpw $0x103, %cx             # imm = 0x103
jae 0x5e20
testq %rcx, %rcx
je 0x5e01
movq %rax, %rdi
movq %r8, %rax
subq %rcx, %r12
jne 0x5b4e
movq %rax, %r12
movq %rax, %rcx
shrq %rcx
movq %rdi, %r14
leaq (%rdi,%rsi,2), %rax
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x5bfa
movzwl (%r14,%rdx,2), %esi
movzwl (%rax), %edi
movw %di, (%r14,%rdx,2)
movw %si, (%rax)
incq %rdx
addq $-0x2, %rax
jmp 0x5bd1
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x38(%rsp), %rbp
cmpq %r15, %rbx
je 0x5d87
leaq 0xe0(%rsp), %r15
movl $0x8000, %edi           # imm = 0x8000
movq %r15, %rsi
callq 0x3ce8
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x3f3c
cmpq 0x18(%rsp), %rbp
jae 0x5c4a
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x3e2a
incq %rbp
jmp 0x5c2b
xorl %r15d, %r15d
leaq 0xe0(%rsp), %r13
movq 0x18(%rsp), %rbp
movq %r14, 0x20(%rsp)
movq %r12, 0x40(%rsp)
cmpq %r12, %r15
je 0x5d7a
cmpq %rbx, %rbp
jae 0x5e5e
movzwl (%r14,%r15,2), %r12d
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x3e2a
cmpw $0x3, %r12w
movq %r15, 0x10(%rsp)
jb 0x5d1a
subq $0x8, %rsp
movq 0x58(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %rbp, %rcx
movq %rbx, %r8
movq %r12, %r9
leaq 0xa0(%rsp), %rax
pushq %rax
leaq 0x1e(%rsp), %rax
pushq %rax
pushq $0x0
callq 0x453e
addq $0x20, %rsp
movzwl 0x98(%rsp), %eax
cmpw %r12w, %ax
sete %cl
cmpw $0x3, %ax
setb %al
orb %cl, %al
je 0x5e7d
movzwl 0xe(%rsp), %ecx
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movl %r12d, %r8d
callq 0x44dc
movzwl 0xe(%rsp), %esi
movl %r12d, %edi
movq 0x338(%rsp), %rdx
callq 0x4443
jmp 0x5d32
movzbl (%r14,%rbp), %edi
xorl %esi, %esi
movq 0x338(%rsp), %rdx
callq 0x4443
pushq $0x1
popq %r12
movq %rbp, %r15
addq %r12, %rbp
cmpq %rbx, %rbp
ja 0x5e3f
pushq $0x1
popq %r14
cmpq %r12, %r14
jae 0x5d63
leaq (%r15,%r14), %rsi
movq 0x28(%rsp), %rdi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x3e2a
incq %r14
jmp 0x5d45
movq 0x10(%rsp), %r15
incq %r15
movq 0x20(%rsp), %r14
movq 0x40(%rsp), %r12
jmp 0x5c64
leaq 0xe0(%rsp), %rdi
callq 0x3de7
cmpb $0x0, 0x30(%rsp)
je 0x5ebb
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2034(%rip), %rdi      # 0x7ddf
leaq 0x1f78(%rip), %rsi      # 0x7d2a
leaq 0x2033(%rip), %rcx      # 0x7dec
movl $0x121, %edx            # imm = 0x121
callq 0x10b0
leaq 0x209d(%rip), %rdi      # 0x7e67
leaq 0x1f59(%rip), %rsi      # 0x7d2a
leaq 0x2014(%rip), %rcx      # 0x7dec
movl $0x123, %edx            # imm = 0x123
callq 0x10b0
leaq 0x20aa(%rip), %rdi      # 0x7e93
leaq 0x1f3a(%rip), %rsi      # 0x7d2a
leaq 0x20b9(%rip), %rcx      # 0x7eb0
movl $0x13f, %edx            # imm = 0x13F
callq 0x10b0
leaq 0x2121(%rip), %rdi      # 0x7f29
leaq 0x1f1b(%rip), %rsi      # 0x7d2a
leaq 0x209a(%rip), %rcx      # 0x7eb0
movl $0x141, %edx            # imm = 0x141
callq 0x10b0
leaq 0x20da(%rip), %rdi      # 0x7f01
leaq 0x1efc(%rip), %rsi      # 0x7d2a
leaq 0x207b(%rip), %rcx      # 0x7eb0
movl $0x140, %edx            # imm = 0x140
callq 0x10b0
leaq 0x21bc(%rip), %rdi      # 0x8002
leaq 0x1edd(%rip), %rsi      # 0x7d2a
leaq 0x20fa(%rip), %rcx      # 0x7f4e
movl $0x17d, %edx            # imm = 0x17D
callq 0x10b0
leaq 0x20dd(%rip), %rdi      # 0x7f42
leaq 0x1ebe(%rip), %rsi      # 0x7d2a
leaq 0x20db(%rip), %rcx      # 0x7f4e
movl $0x168, %edx            # imm = 0x168
callq 0x10b0
leaq 0x2142(%rip), %rdi      # 0x7fc6
leaq 0x1e9f(%rip), %rsi      # 0x7d2a
leaq 0x20bc(%rip), %rcx      # 0x7f4e
movl $0x172, %edx            # imm = 0x172
callq 0x10b0
leaq 0x1f3c(%rip), %rdi      # 0x7ddf
leaq 0x1e80(%rip), %rsi      # 0x7d2a
leaq 0x1f3b(%rip), %rcx      # 0x7dec
movl $0x112, %edx            # imm = 0x112
callq 0x10b0
leaq 0x1e4e(%rip), %rdi      # 0x7d10
leaq 0x1e61(%rip), %rsi      # 0x7d2a
leaq 0x1e64(%rip), %rcx      # 0x7d34
movl $0x1bb, %edx            # imm = 0x1BB
callq 0x10b0
pushq $-0x1
popq %rdi
callq 0x1170
leaq 0x1f94(%rip), %rdi      # 0x7e7d
leaq 0x1e3a(%rip), %rsi      # 0x7d2a
leaq 0x1ef5(%rip), %rcx      # 0x7dec
movl $0x12a, %edx            # imm = 0x12A
callq 0x10b0