// File: /workspace/github_c_makefile_star2_O0/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: ZopfliCalculateBlockSize
double ZopfliCalculateBlockSize(const ZopfliLZ77Store* lz77,
                                size_t lstart, size_t lend, int btype) {
  unsigned ll_lengths[ZOPFLI_NUM_LL];
  unsigned d_lengths[ZOPFLI_NUM_D];

  double result = 3; /* bfinal and btype bits */

  if (btype == 0) {
    size_t length = ZopfliLZ77GetByteRange(lz77, lstart, lend);
    size_t rem = length % 65535;
    size_t blocks = length / 65535 + (rem ? 1 : 0);
    /* An uncompressed block must actually be split into multiple blocks if it's
       larger than 65535 bytes long. Eeach block header is 5 bytes: 3 bits,
       padding, LEN and NLEN (potential less padding for first one ignored). */
    return blocks * 5 * 8 + length * 8;
  } if (btype == 1) {
    GetFixedTree(ll_lengths, d_lengths);
    result += CalculateBlockSymbolSize(
        ll_lengths, d_lengths, lz77, lstart, lend);
  } else {
    result += GetDynamicLengths(lz77, lstart, lend, ll_lengths, d_lengths);
  }

  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x570, %rsp            # imm = 0x570
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movsd 0xb536(%rip), %xmm0     # 0x1ddb8
movsd %xmm0, -0x538(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x12958
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x17730
movq %rax, -0x540(%rbp)
movq -0x540(%rbp), %rax
movq %rax, -0x558(%rbp)
movabsq $-0x7fff7fff7fff7fff, %rcx # imm = 0x8000800080008001
mulq %rcx
movq -0x558(%rbp), %rax
shrq $0xf, %rdx
movq %rdx, %rsi
shlq $0x10, %rsi
subq %rsi, %rdx
addq %rdx, %rax
movq %rax, -0x548(%rbp)
movq -0x540(%rbp), %rax
mulq %rcx
movq %rdx, %rax
shrq $0xf, %rax
movq -0x548(%rbp), %rcx
subq $0x1, %rcx
sbbq $-0x1, %rax
movq %rax, -0x550(%rbp)
movq -0x550(%rbp), %rax
leaq (%rax,%rax,4), %rcx
movq -0x540(%rbp), %rax
shlq $0x3, %rax
leaq (%rax,%rcx,8), %rax
movq %rax, %xmm0
movaps 0x989d(%rip), %xmm1     # 0x1c1d0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x98a1(%rip), %xmm1     # 0x1c1e0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x12a13
cmpl $0x1, -0x24(%rbp)
jne 0x129d7
leaq -0x4b0(%rbp), %rdi
movq %rdi, -0x568(%rbp)
leaq -0x530(%rbp), %rsi
movq %rsi, -0x560(%rbp)
callq 0x12a30
movq -0x568(%rbp), %rdi
movq -0x560(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x12b30
movq %rax, %xmm0
movaps 0x9826(%rip), %xmm1     # 0x1c1d0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x982a(%rip), %xmm1     # 0x1c1e0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
addsd -0x538(%rbp), %xmm0
movsd %xmm0, -0x538(%rbp)
jmp 0x12a06
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x4b0(%rbp), %rcx
leaq -0x530(%rbp), %r8
callq 0x12be0
addsd -0x538(%rbp), %xmm0
movsd %xmm0, -0x538(%rbp)
movsd -0x538(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x570, %rsp            # imm = 0x570
popq %rbp
retq
nopw %cs:(%rax,%rax)