// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: AddLZ77Block
static void AddLZ77Block(const ZopfliOptions* options, int btype, int final,
                         const ZopfliLZ77Store* lz77,
                         size_t lstart, size_t lend,
                         size_t expected_data_size,
                         unsigned char* bp,
                         unsigned char** out, size_t* outsize) {
  unsigned ll_lengths[ZOPFLI_NUM_LL];
  unsigned d_lengths[ZOPFLI_NUM_D];
  unsigned ll_symbols[ZOPFLI_NUM_LL];
  unsigned d_symbols[ZOPFLI_NUM_D];
  size_t detect_block_size = *outsize;
  size_t compressed_size;
  size_t uncompressed_size = 0;
  size_t i;
  if (btype == 0) {
    size_t length = ZopfliLZ77GetByteRange(lz77, lstart, lend);
    size_t pos = lstart == lend ? 0 : lz77->pos[lstart];
    size_t end = pos + length;
    AddNonCompressedBlock(options, final,
                          lz77->data, pos, end, bp, out, outsize);
    return;
  }

  AddBit(final, bp, out, outsize);
  AddBit(btype & 1, bp, out, outsize);
  AddBit((btype & 2) >> 1, bp, out, outsize);

  if (btype == 1) {
    /* Fixed block. */
    GetFixedTree(ll_lengths, d_lengths);
  } else {
    /* Dynamic block. */
    unsigned detect_tree_size;
    assert(btype == 2);

    GetDynamicLengths(lz77, lstart, lend, ll_lengths, d_lengths);

    detect_tree_size = *outsize;
    AddDynamicTree(ll_lengths, d_lengths, bp, out, outsize);
    if (options->verbose) {
      fprintf(stderr, "treesize: %d\n", (int)(*outsize - detect_tree_size));
    }
  }

  ZopfliLengthsToSymbols(ll_lengths, ZOPFLI_NUM_LL, 15, ll_symbols);
  ZopfliLengthsToSymbols(d_lengths, ZOPFLI_NUM_D, 15, d_symbols);

  detect_block_size = *outsize;
  AddLZ77Data(lz77, lstart, lend, expected_data_size,
              ll_symbols, ll_lengths, d_symbols, d_lengths,
              bp, out, outsize);
  /* End symbol. */
  AddHuffmanBits(ll_symbols[256], ll_lengths[256], bp, out, outsize);

  for (i = lstart; i < lend; i++) {
    uncompressed_size += lz77->dists[i] == 0 ? 1 : lz77->litlens[i];
  }
  compressed_size = *outsize - detect_block_size;
  if (options->verbose) {
    fprintf(stderr, "compressed block size: %d (%dk) (unc: %d)\n",
           (int)compressed_size, (int)(compressed_size / 1024),
           (int)(uncompressed_size));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa48, %rsp            # imm = 0xA48
movq %r9, %r15
movq %r8, %r12
movq %rcx, %r14
movl %edx, %ebx
movq %rdi, 0x28(%rsp)
movq 0xa90(%rsp), %r13
movq 0xa88(%rsp), %rax
movq 0xa80(%rsp), %rcx
testl %esi, %esi
je 0xfc5b
movl %esi, %ebp
movq %r15, 0x18(%rsp)
movl %ebx, %edi
movq %rcx, %r15
movq %rcx, %rsi
movq %rax, %rbx
movq %rax, %rdx
movq %r13, %rcx
callq 0x10d24
movl %ebp, %edi
andl $0x1, %edi
movq %r15, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x10d24
movl %ebp, %edi
shrl %edi
andl $0x1, %edi
movq %r15, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x10d24
cmpl $0x1, %ebp
movq %r14, 0x38(%rsp)
movq %r12, 0x30(%rsp)
jne 0xfc79
leaq 0x140(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xee98
movq 0x28(%rsp), %r15
jmp 0xfd49
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x11eb5
cmpq %r15, %r12
jne 0xff9e
xorl %edx, %edx
jmp 0xffa6
leaq 0x140(%rsp), %rbp
leaq 0x40(%rsp), %r15
movq %r14, %rdi
movq %r12, %rsi
movq 0x18(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
callq 0xef0d
movq (%r13), %rax
movq %rax, 0x20(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %ebx, %ebx
movl %r12d, %edx
andl $0x1, %edx
movl %r12d, %ecx
andl $0x2, %ecx
movl %r12d, %r8d
andl $0x4, %r8d
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq %rbp, %rdi
movq %r15, %rsi
xorl %r9d, %r9d
callq 0x103e4
leaq -0x1(%r14), %rcx
cmpq %rax, %rcx
cmovael %r12d, %ebx
cmovaeq %rax, %r14
incl %r12d
cmpl $0x8, %r12d
jne 0xfcad
movl %ebx, %edx
andl $0x1, %edx
movl %ebx, %ecx
andl $0x2, %ecx
andl $0x4, %ebx
movq 0xa90(%rsp), %r13
movq %r13, 0x8(%rsp)
movq 0xa88(%rsp), %rax
movq %rax, (%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movl %ebx, %r8d
movq 0xa80(%rsp), %r9
callq 0x103e4
movq 0x28(%rsp), %r15
cmpl $0x0, (%r15)
movq 0x38(%rsp), %r14
movq 0x30(%rsp), %r12
jne 0xffdd
leaq 0x140(%rsp), %rdi
leaq 0x5c0(%rsp), %rcx
movl $0x120, %esi            # imm = 0x120
movl $0xf, %edx
callq 0x11534
leaq 0x40(%rsp), %rdi
leaq 0xc0(%rsp), %rcx
movl $0x20, %esi
movl $0xf, %edx
callq 0x11534
movq (%r13), %rax
movq %rax, 0x20(%rsp)
cmpq 0x18(%rsp), %r12
jae 0xff45
movq (%r14), %rax
movq 0x8(%r14), %rcx
movzwl (%rcx,%r12,2), %ebx
movzwl (%rax,%r12,2), %ebp
testl %ebx, %ebx
je 0xfe97
movl %ebp, %edi
callq 0x14f25
movl %eax, %r15d
movl %ebx, %edi
callq 0x14ee4
leal -0x3(%rbp), %ecx
movzwl %cx, %ecx
cmpl $0x11e, %ecx            # imm = 0x11E
jae 0x10021
movl %r15d, %ecx
movl 0x140(%rsp,%rcx,4), %esi
testl %esi, %esi
je 0x10040
movl %eax, %r14d
cmpl $0x0, 0x40(%rsp,%r14,4)
je 0x10002
movl 0x5c0(%rsp,%rcx,4), %edi
movq 0xa80(%rsp), %rdx
movq 0xa88(%rsp), %rcx
movq 0xa90(%rsp), %r13
movq %r13, %r8
callq 0x10c7a
movl %ebp, %edi
callq 0x14f17
movl %eax, %r15d
movl %ebp, %edi
callq 0x14f09
movl %r15d, %edi
movl %eax, %esi
movq 0xa80(%rsp), %rbp
movq %rbp, %rdx
movq 0xa88(%rsp), %r15
movq %r15, %rcx
movq %r13, %r8
callq 0x10bc4
movl 0xc0(%rsp,%r14,4), %edi
movl 0x40(%rsp,%r14,4), %esi
movq %rbp, %rdx
movq %rbp, %r14
movq %r15, %rcx
movq %r13, %r8
callq 0x10c7a
movl %ebx, %edi
callq 0x14eb9
movl %eax, %ebp
movl %ebx, %edi
callq 0x14ea4
movl %ebp, %edi
movl %eax, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %r13, %r8
callq 0x10bc4
movq 0x38(%rsp), %r14
jmp 0xfed3
cmpl $0x100, %ebp            # imm = 0x100
jae 0x1007e
movl %ebp, %eax
movl 0x140(%rsp,%rax,4), %esi
testl %esi, %esi
je 0x1005f
movl 0x5c0(%rsp,%rax,4), %edi
movq 0xa80(%rsp), %rdx
movq 0xa88(%rsp), %rcx
movq %r13, %r8
callq 0x10c7a
movq 0x18(%rsp), %rbx
incq %r12
cmpq %r12, %rbx
jne 0xfd98
movl 0x9c0(%rsp), %edi
movl 0x540(%rsp), %esi
movq 0xa80(%rsp), %rdx
movq 0xa88(%rsp), %rcx
movq %r13, %r8
callq 0x10c7a
xorl %r8d, %r8d
movq 0x30(%rsp), %rdx
cmpq %rbx, %rdx
movq 0x28(%rsp), %r15
jae 0xff6e
movq 0x8(%r14), %rax
xorl %r8d, %r8d
cmpw $0x0, (%rax,%rdx,2)
je 0xff33
movq (%r14), %rcx
movzwl (%rcx,%rdx,2), %ecx
jmp 0xff38
movl $0x1, %ecx
addl %ecx, %r8d
incq %rdx
cmpq %rdx, %rbx
jne 0xff23
jmp 0xff6e
movl 0x9c0(%rsp), %edi
movl 0x540(%rsp), %esi
movq 0xa80(%rsp), %rdx
movq 0xa88(%rsp), %rcx
movq %r13, %r8
callq 0x10c7a
xorl %r8d, %r8d
cmpl $0x0, (%r15)
je 0xffcb
movq (%r13), %rdx
subq 0x20(%rsp), %rdx
movq 0xd06c(%rip), %rax      # 0x1cff0
movq (%rax), %rdi
movq %rdx, %rcx
shrq $0xa, %rcx
leaq 0x6f42(%rip), %rsi      # 0x16ed7
xorl %eax, %eax
callq 0x3350
jmp 0xffcb
movq 0x20(%r14), %rcx
movq (%rcx,%r12,8), %rdx
addq %rdx, %rax
movq 0x18(%r14), %rsi
movq %r13, (%rsp)
movl %ebx, %edi
movq %rax, %rcx
movq 0xa80(%rsp), %r8
movq 0xa88(%rsp), %r9
callq 0xf983
addq $0xa48, %rsp            # imm = 0xA48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd00c(%rip), %rax      # 0x1cff0
movq (%rax), %rdi
movl (%r13), %edx
subl 0x20(%rsp), %edx
leaq 0x6ed3(%rip), %rsi      # 0x16ec9
xorl %eax, %eax
callq 0x3350
jmp 0xfd49
leaq 0x7015(%rip), %rdi      # 0x1701e
leaq 0x6e0c(%rip), %rsi      # 0x16e1c
leaq 0x6ef8(%rip), %rcx      # 0x16f0f
movl $0x140, %edx            # imm = 0x140
callq 0x3220
leaq 0x6fc5(%rip), %rdi      # 0x16fed
leaq 0x6ded(%rip), %rsi      # 0x16e1c
leaq 0x6ed9(%rip), %rcx      # 0x16f0f
movl $0x13e, %edx            # imm = 0x13E
callq 0x3220
leaq 0x6fc3(%rip), %rdi      # 0x1700a
leaq 0x6dce(%rip), %rsi      # 0x16e1c
leaq 0x6eba(%rip), %rcx      # 0x16f0f
movl $0x13f, %edx            # imm = 0x13F
callq 0x3220
leaq 0x6f70(%rip), %rdi      # 0x16fd6
leaq 0x6daf(%rip), %rsi      # 0x16e1c
leaq 0x6e9b(%rip), %rcx      # 0x16f0f
movl $0x138, %edx            # imm = 0x138
callq 0x3220
leaq 0x6e7d(%rip), %rdi      # 0x16f02
leaq 0x6d90(%rip), %rsi      # 0x16e1c
leaq 0x6e7c(%rip), %rcx      # 0x16f0f
movl $0x137, %edx            # imm = 0x137
callq 0x3220