// File: /workspace/github_c_makefile_star2_O3/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, 0x48(%rsp)
movq %r8, 0x60(%rsp)
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, 0x10(%rsp)
movq %rdi, 0x68(%rsp)
movq 0x330(%rsp), %r14
movl $0x3, %r12d
xorl %ebp, %ebp
movsd 0x237d(%rip), %xmm0     # 0xa008
movsd %xmm0, 0x18(%rsp)
movl %r12d, %edi
movl $0x1, %esi
movq %r14, %rdx
callq *0x328(%rsp)
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
cmoval %r12d, %ebp
minsd %xmm1, %xmm0
incl %r12d
cmpl $0x103, %r12d           # imm = 0x103
jne 0x7c8b
xorl %r14d, %r14d
movsd 0x233c(%rip), %xmm0     # 0xa008
xorl %r12d, %r12d
movsd %xmm0, 0x18(%rsp)
leaq 0x3494(%rip), %rax      # 0xb170
movl (%r14,%rax), %r13d
movl $0x3, %edi
movl %r13d, %esi
movq 0x330(%rsp), %rdx
callq *0x328(%rsp)
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
cmoval %r13d, %r12d
minsd %xmm1, %xmm0
addq $0x4, %r14
cmpq $0x78, %r14
jne 0x7ccf
xorl %ecx, %ecx
movq %r15, %rax
subq $0x8000, %rax           # imm = 0x8000
cmovaeq %rax, %rcx
movq %rcx, 0x58(%rsp)
movl %ebp, %edi
movl %r12d, %esi
movq 0x330(%rsp), %rdx
callq *0x328(%rsp)
movsd %xmm0, 0x18(%rsp)
movq %rbx, %r14
movb $0x1, %al
subq %r15, %r14
movq %r14, 0x40(%rsp)
je 0x82b3
leaq 0x4(,%r14,4), %rdi
callq 0x1130
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x869b
leaq 0x1(%r14), %rbp
movl $0x8000, %r13d          # imm = 0x8000
leaq 0x98(%rsp), %r12
movl $0x8000, %edi           # imm = 0x8000
movq %r12, %rsi
callq 0x4584
movq 0x10(%rsp), %rdi
movq 0x58(%rsp), %r14
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x4d9a
cmpq %r15, %r14
jae 0x7dd6
cmpq %r13, %r15
cmovbq %r15, %r13
negq %r13
leaq 0x98(%rsp), %r12
leaq (%r15,%r13), %rsi
movq 0x10(%rsp), %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x4c75
incq %r13
jne 0x7dbd
cmpq $0x2, %rbp
movq 0x40(%rsp), %rsi
movq 0x328(%rsp), %r13
movq 0x30(%rsp), %rdi
jb 0x7ee5
leaq 0x3(%rsi), %rax
andq $-0x4, %rax
leaq -0x1(%rsi), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
xorl %ecx, %ecx
movdqa 0x23fe(%rip), %xmm1     # 0xa210
movdqa 0x2406(%rip), %xmm2     # 0xa220
movdqa 0x240e(%rip), %xmm3     # 0xa230
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rcx, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x7e74
movl $0x7149f2ca, 0x4(%rdi,%rcx,4) # imm = 0x7149F2CA
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x7e8a
movl $0x7149f2ca, 0x8(%rdi,%rcx,4) # imm = 0x7149F2CA
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %edx
testb $0x1, %dl
je 0x7ec6
movl $0x7149f2ca, 0xc(%rdi,%rcx,4) # imm = 0x7149F2CA
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x7ed8
movl $0x7149f2ca, 0x10(%rdi,%rcx,4) # imm = 0x7149F2CA
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0x7e2a
movl $0x0, (%rdi)
movq 0x320(%rsp), %rax
movw $0x0, (%rax)
cmpq %r15, %rbx
jbe 0x826b
leaq 0x103(%r15), %rax
movq %rax, 0x88(%rsp)
movq 0x320(%rsp), %rcx
subq %r15, %rcx
subq %r15, %rcx
addq $0x204, %rcx            # imm = 0x204
movq %rcx, 0x80(%rsp)
leaq (,%r15,4), %rax
movq 0x30(%rsp), %rcx
subq %rax, %rcx
movq %rcx, 0x78(%rsp)
leaq 0x98(%rsp), %rcx
movq %r15, %r12
movq %rbx, 0x70(%rsp)
movq %r12, %rax
subq %r15, %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4c75
leaq 0x205(%r12), %rax
cmpq %rbx, %rax
jae 0x806f
cmpq 0x88(%rsp), %r12
movq 0x330(%rsp), %r14
jbe 0x806a
movq 0xd8(%rsp), %rax
movl %r12d, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
movzwl (%rax,%rcx,2), %ecx
cmpl $0x205, %ecx            # imm = 0x205
jb 0x806a
leal 0x7efe(%r12), %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
cmpw $0x103, (%rax,%rcx,2)   # imm = 0x103
jb 0x806a
movl $0x102, %edi            # imm = 0x102
movl $0x1, %esi
movq %r14, %rdx
callq *%r13
movsd %xmm0, 0x20(%rsp)
movq 0x80(%rsp), %rax
leaq (%rax,%r12,2), %rbx
movq 0x78(%rsp), %rax
leaq (%rax,%r12,4), %rbp
xorl %r14d, %r14d
movq %r12, %r13
leaq 0x98(%rsp), %r12
xorps %xmm0, %xmm0
cvtss2sd (%rbp,%r14,4), %xmm0
addsd 0x20(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x408(%rbp,%r14,4)
movw $0x102, (%rbx,%r14,2)   # imm = 0x102
leaq 0x1(%r14,%r13), %rsi
movq 0x10(%rsp), %rdi
movq 0x70(%rsp), %rdx
movq %r12, %rcx
callq 0x4c75
incq %r14
cmpq $0x102, %r14            # imm = 0x102
jne 0x8008
addq %r14, %r13
addq %r14, 0x38(%rsp)
movq 0x70(%rsp), %rbx
movq 0x330(%rsp), %r14
movq %r12, %rsi
jmp 0x8082
movq %r12, %r13
jmp 0x807a
movq %r12, %r13
movq 0x330(%rsp), %r14
leaq 0x98(%rsp), %rsi
subq $0x8, %rsp
movl $0x102, %r9d            # imm = 0x102
movq 0x70(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
movq %rbx, %r8
leaq 0x16(%rsp), %rax
pushq %rax
leaq 0x66(%rsp), %rax
pushq %rax
leaq 0xf8(%rsp), %rax
pushq %rax
callq 0x69f3
addq $0x20, %rsp
leaq 0x1(%r13), %r12
cmpq %rbx, %r12
movq 0x38(%rsp), %r8
ja 0x814c
movq %rbx, %rbp
movq %r12, %rbx
movq 0x30(%rsp), %r12
xorps %xmm0, %xmm0
cvtss2sd (%r12,%r8,4), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x10(%rsp), %rax
movzbl (%rax,%r13), %edi
xorl %esi, %esi
movq %r14, %rdx
movq %r8, %r14
callq *0x328(%rsp)
addsd 0x20(%rsp), %xmm0
ucomisd 0x2cdb(%rip), %xmm0     # 0xade8
jb 0x865d
xorps %xmm1, %xmm1
cvtss2sd 0x4(%r12,%r14,4), %xmm1
ucomisd %xmm0, %xmm1
movq %rbx, %r12
movq %rbp, %rbx
movq %r14, %r8
jbe 0x814c
cvtsd2ss %xmm0, %xmm0
movq 0x30(%rsp), %rax
movss %xmm0, 0x4(%rax,%r8,4)
movq 0x320(%rsp), %rax
movw $0x1, 0x2(%rax,%r8,2)
leaq 0x3(%r13), %rax
cmpq %rbx, %rax
ja 0x824d
cmpw $0x3, 0xe(%rsp)
jb 0x824d
movq 0x30(%rsp), %rcx
movss (%rcx,%r8,4), %xmm2
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x320(%rsp), %rax
leaq (%rax,%r8,2), %rax
movq %rax, 0x90(%rsp)
leaq (%rcx,%r8,4), %r14
movl $0x3, %ebp
movss %xmm2, 0x2c(%rsp)
movss (%r14,%rbp,4), %xmm3
movaps %xmm3, %xmm0
subss %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x8228
movss %xmm3, 0x20(%rsp)
movzwl 0xe0(%rsp,%rbp,2), %esi
movl %ebp, %edi
movq 0x330(%rsp), %rdx
callq *0x328(%rsp)
addsd 0x38(%rsp), %xmm0
ucomisd 0x2bfe(%rip), %xmm0     # 0xade8
jb 0x8565
xorps %xmm1, %xmm1
cvtss2sd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movss 0x2c(%rsp), %xmm2
jbe 0x8228
cmpq $0x103, %rbp            # imm = 0x103
jae 0x8584
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%r14,%rbp,4)
movq 0x90(%rsp), %rax
movw %bp, (%rax,%rbp,2)
leaq 0x1(,%r13), %rax
addq %rbp, %rax
cmpq %rbx, %rax
ja 0x824d
leaq 0x1(%rbp), %rax
movzwl 0xe(%rsp), %ecx
cmpq %rcx, %rbp
movq %rax, %rbp
jb 0x81a0
cmpq %rbx, %r12
movq 0x40(%rsp), %rsi
movq 0x328(%rsp), %r13
leaq 0x98(%rsp), %rcx
jb 0x7f52
movq 0x30(%rsp), %r14
movss (%r14,%rsi,4), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x86a5
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x4c32
movq %r14, %rdi
callq 0x1030
movsd 0x1d5e(%rip), %xmm0     # 0xa008
ucomisd 0x18(%rsp), %xmm0
seta %al
movb %al, 0x2c(%rsp)
movq 0x60(%rsp), %r14
movq (%r14), %rdi
callq 0x1030
xorl %r13d, %r13d
movq %r13, (%r14)
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %rax
movq %r13, (%rax)
xorl %eax, %eax
testq %r14, %r14
je 0x8393
xorl %r13d, %r13d
leaq -0x1(%r13), %rcx
testq %rcx, %r13
jne 0x830c
testq %r13, %r13
je 0x8311
shlq $0x2, %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x1150
movq 0x48(%rsp), %rcx
movq (%rcx), %rdx
jmp 0x831d
movq %r13, %rdx
jmp 0x8325
movl $0x2, %edi
callq 0x1130
xorl %edx, %edx
movq 0x60(%rsp), %rcx
movq %rax, (%rcx)
movq 0x320(%rsp), %rcx
movzwl (%rcx,%r14,2), %ecx
movw %cx, (%rax,%rdx,2)
leaq 0x1(%rdx), %r13
movq 0x48(%rsp), %rsi
movq %r13, (%rsi)
cmpq %rcx, %r14
jb 0x85a3
cmpl $0x103, %ecx            # imm = 0x103
jae 0x85e1
testq %rcx, %rcx
je 0x85c2
subq %rcx, %r14
jne 0x82e5
cmpq $0x2, %r13
jb 0x8393
movq %r13, %rcx
shrq %rcx
leaq (%rax,%rdx,2), %r8
xorl %edx, %edx
movzwl (%rax,%rdx,2), %esi
movzwl (%r8), %edi
movw %di, (%rax,%rdx,2)
movw %si, (%r8)
incq %rdx
addq $-0x2, %r8
cmpq %rdx, %rcx
jne 0x8377
cmpq %r15, %rbx
je 0x8548
movq %rax, 0x20(%rsp)
movl $0x8000, %r14d          # imm = 0x8000
leaq 0xe0(%rsp), %rbp
movl $0x8000, %edi           # imm = 0x8000
movq %rbp, %rsi
callq 0x4584
movq 0x10(%rsp), %rdi
movq 0x58(%rsp), %r12
movq %r12, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x4d9a
cmpq %r15, %r12
jae 0x8404
cmpq %r14, %r15
cmovbq %r15, %r14
negq %r14
leaq 0xe0(%rsp), %r12
leaq (%r15,%r14), %rsi
movq 0x10(%rsp), %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x4c75
incq %r14
jne 0x83eb
testq %r13, %r13
movq 0x20(%rsp), %rax
je 0x853b
xorl %ecx, %ecx
leaq 0xe0(%rsp), %rbp
cmpq %rbx, %r15
jae 0x8600
movq %rcx, 0x18(%rsp)
movzwl (%rax,%rcx,2), %r12d
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x4c75
cmpw $0x3, %r12w
jb 0x850e
subq $0x8, %rsp
movq 0x70(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r8
movq %r12, %r9
leaq 0xa0(%rsp), %rax
pushq %rax
leaq 0x1e(%rsp), %rax
pushq %rax
pushq $0x0
callq 0x69f3
addq $0x20, %rsp
movzwl 0x98(%rsp), %eax
cmpw %r12w, %ax
sete %cl
cmpw $0x3, %ax
setb %al
orb %cl, %al
je 0x861f
movzwl 0xe(%rsp), %ecx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r12d, %r8d
callq 0x697f
movzwl 0xe(%rsp), %esi
movl %r12d, %edi
movq 0x338(%rsp), %rdx
callq 0x68df
leaq (%r15,%r12), %rax
movq %rax, 0x38(%rsp)
cmpq %rbx, %rax
ja 0x863e
movq %rbx, %r14
decq %r12
incq %r15
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
callq 0x4c75
incq %r15
decq %r12
jne 0x84eb
movq 0x38(%rsp), %r15
movq %r14, %rbx
jmp 0x8525
movzbl (%r14,%r15), %edi
xorl %esi, %esi
movq 0x338(%rsp), %rdx
callq 0x68df
incq %r15
movq 0x18(%rsp), %rcx
incq %rcx
cmpq %r13, %rcx
movq 0x20(%rsp), %rax
jne 0x841c
leaq 0xe0(%rsp), %rdi
callq 0x4c32
cmpb $0x0, 0x2c(%rsp)
je 0x867c
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29c3(%rip), %rdi      # 0xaf2f
leaq 0x2907(%rip), %rsi      # 0xae7a
leaq 0x29c2(%rip), %rcx      # 0xaf3c
movl $0x121, %edx            # imm = 0x121
callq 0x10b0
leaq 0x2a2c(%rip), %rdi      # 0xafb7
leaq 0x28e8(%rip), %rsi      # 0xae7a
leaq 0x29a3(%rip), %rcx      # 0xaf3c
movl $0x123, %edx            # imm = 0x123
callq 0x10b0
leaq 0x2a39(%rip), %rdi      # 0xafe3
leaq 0x28c9(%rip), %rsi      # 0xae7a
leaq 0x2a48(%rip), %rcx      # 0xb000
movl $0x13f, %edx            # imm = 0x13F
callq 0x10b0
leaq 0x2ab0(%rip), %rdi      # 0xb079
leaq 0x28aa(%rip), %rsi      # 0xae7a
leaq 0x2a29(%rip), %rcx      # 0xb000
movl $0x141, %edx            # imm = 0x141
callq 0x10b0
leaq 0x2a69(%rip), %rdi      # 0xb051
leaq 0x288b(%rip), %rsi      # 0xae7a
leaq 0x2a0a(%rip), %rcx      # 0xb000
movl $0x140, %edx            # imm = 0x140
callq 0x10b0
leaq 0x2a8b(%rip), %rdi      # 0xb092
leaq 0x286c(%rip), %rsi      # 0xae7a
leaq 0x2a89(%rip), %rcx      # 0xb09e
movl $0x168, %edx            # imm = 0x168
callq 0x10b0
leaq 0x2af0(%rip), %rdi      # 0xb116
leaq 0x284d(%rip), %rsi      # 0xae7a
leaq 0x2a6a(%rip), %rcx      # 0xb09e
movl $0x172, %edx            # imm = 0x172
callq 0x10b0
leaq 0x2b0d(%rip), %rdi      # 0xb152
leaq 0x282e(%rip), %rsi      # 0xae7a
leaq 0x2a4b(%rip), %rcx      # 0xb09e
movl $0x17d, %edx            # imm = 0x17D
callq 0x10b0
leaq 0x28cb(%rip), %rdi      # 0xaf2f
leaq 0x280f(%rip), %rsi      # 0xae7a
leaq 0x28ca(%rip), %rcx      # 0xaf3c
movl $0x112, %edx            # imm = 0x112
callq 0x10b0
leaq 0x27dd(%rip), %rdi      # 0xae60
leaq 0x27f0(%rip), %rsi      # 0xae7a
leaq 0x27f3(%rip), %rcx      # 0xae84
movl $0x1bb, %edx            # imm = 0x1BB
callq 0x10b0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1180
leaq 0x2921(%rip), %rdi      # 0xafcd
leaq 0x27c7(%rip), %rsi      # 0xae7a
leaq 0x2882(%rip), %rcx      # 0xaf3c
movl $0x12a, %edx            # imm = 0x12A
callq 0x10b0