// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xab0, %rsp            # imm = 0xAB0
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa48(%rbp)
movq $0x0, -0xa58(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1381a
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x17730
movq %rax, -0xa68(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x137a4
xorl %eax, %eax
movq %rax, -0xa88(%rbp)
jmp 0x137bb
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa88(%rbp)
movq -0xa88(%rbp), %rax
movq %rax, -0xa70(%rbp)
movq -0xa70(%rbp), %rax
addq -0xa68(%rbp), %rax
movq %rax, -0xa78(%rbp)
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %esi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0xa70(%rbp), %rcx
movq -0xa78(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x13330
jmp 0x13ab2
movl -0x20(%rbp), %edi
movq 0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
movq 0x28(%rbp), %rcx
callq 0x15520
movl -0x1c(%rbp), %edi
andl $0x1, %edi
movq 0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
movq 0x28(%rbp), %rcx
callq 0x15520
movl -0x1c(%rbp), %edi
andl $0x2, %edi
sarl %edi
movq 0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
movq 0x28(%rbp), %rcx
callq 0x15520
cmpl $0x1, -0x1c(%rbp)
jne 0x1387c
leaq -0x4c0(%rbp), %rdi
leaq -0x540(%rbp), %rsi
callq 0x12a30
jmp 0x13923
cmpl $0x2, -0x1c(%rbp)
jne 0x13884
jmp 0x138a3
leaq 0xa636(%rip), %rdi      # 0x1dec1
leaq 0xa582(%rip), %rsi      # 0x1de14
movl $0x2cc, %edx            # imm = 0x2CC
leaq 0xa62e(%rip), %rcx      # 0x1decc
callq 0x3220
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x4c0(%rbp), %rcx
leaq -0x540(%rbp), %r8
callq 0x12be0
movq 0x28(%rbp), %rax
movq (%rax), %rax
movl %eax, -0xa7c(%rbp)
leaq -0x4c0(%rbp), %rdi
leaq -0x540(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq 0x20(%rbp), %rcx
movq 0x28(%rbp), %r8
callq 0x15610
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x13921
movq 0xf6fa(%rip), %rax      # 0x22ff8
movq (%rax), %rdi
movq 0x28(%rbp), %rax
movq (%rax), %rax
movl -0xa7c(%rbp), %ecx
subq %rcx, %rax
movl %eax, %edx
leaq 0xa643(%rip), %rsi      # 0x1df5d
movb $0x0, %al
callq 0x3340
jmp 0x13923
leaq -0x4c0(%rbp), %rdi
leaq -0x9c0(%rbp), %rcx
movl $0x120, %esi            # imm = 0x120
movl $0xf, %edx
callq 0x16730
leaq -0x540(%rbp), %rdi
leaq -0xa40(%rbp), %rcx
movl $0x20, %esi
movl $0xf, %edx
callq 0x16730
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa48(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x10(%rbp), %rcx
leaq -0x9c0(%rbp), %r8
leaq -0x4c0(%rbp), %r9
leaq -0xa40(%rbp), %r14
leaq -0x540(%rbp), %rbx
movq 0x18(%rbp), %r11
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x156f0
movl -0x5c0(%rbp), %edi
movl -0xc0(%rbp), %esi
movq 0x18(%rbp), %rdx
movq 0x20(%rbp), %rcx
movq 0x28(%rbp), %r8
callq 0x15400
movq -0x30(%rbp), %rax
movq %rax, -0xa60(%rbp)
movq -0xa60(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x13a5c
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xa60(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jne 0x13a1a
movl $0x1, %eax
movl %eax, -0xa8c(%rbp)
jmp 0x13a32
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0xa60(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0xa8c(%rbp)
movl -0xa8c(%rbp), %eax
cltq
addq -0xa58(%rbp), %rax
movq %rax, -0xa58(%rbp)
movq -0xa60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa60(%rbp)
jmp 0x139e8
movq 0x28(%rbp), %rax
movq (%rax), %rax
subq -0xa48(%rbp), %rax
movq %rax, -0xa50(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x13ab2
movq 0xf577(%rip), %rax      # 0x22ff8
movq (%rax), %rdi
movq -0xa50(%rbp), %rax
movl %eax, %edx
movq -0xa50(%rbp), %rax
shrq $0xa, %rax
movl %eax, %ecx
movq -0xa58(%rbp), %rax
movl %eax, %r8d
leaq 0xa4c0(%rip), %rsi      # 0x1df6b
movb $0x0, %al
callq 0x3340
addq $0xab0, %rsp            # imm = 0xAB0
popq %rbx
popq %r14
popq %rbp
retq
nop