// File: /workspace/github_c_makefile_star2_O2/imaya[P]zopfli-for-emscripten/zlib_container.c
// Function: ZopfliZlibCompress
void ZopfliZlibCompress(const ZopfliOptions* options,
                        const unsigned char* in, size_t insize,
                        unsigned char** out, size_t* outsize) {
  unsigned char bitpointer = 0;
  unsigned checksum = adler32(in, (unsigned)insize);
  unsigned cmf = 120;  /* CM 8, CINFO 7. See zlib spec.*/
  unsigned flevel = 0;
  unsigned fdict = 0;
  unsigned cmfflg = 256 * cmf + fdict * 32 + flevel * 64;
  unsigned fcheck = 31 - cmfflg % 31;
  cmfflg += fcheck;

  ZOPFLI_APPEND_DATA(cmfflg / 256, out, outsize);
  ZOPFLI_APPEND_DATA(cmfflg % 256, out, outsize);

  ZopfliDeflate(options, 2 /* dynamic block */, 1 /* final */,
                in, insize, &bitpointer, out, outsize);

  ZOPFLI_APPEND_DATA((checksum >> 24) % 256, out, outsize);
  ZOPFLI_APPEND_DATA((checksum >> 16) % 256, out, outsize);
  ZOPFLI_APPEND_DATA((checksum >> 8) % 256, out, outsize);
  ZOPFLI_APPEND_DATA(checksum % 256, out, outsize);

  if (options->verbose) {
    fprintf(stderr,
            "Original Size: %d, Compressed: %d, Compression: %f%% Removed\n",
            (int)insize, (int)*outsize,
            100.0f * (float)(insize - *outsize) / (float)insize);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movq %rcx, %r12
movq %rsi, %rbp
movq %rdi, 0x10(%rsp)
movb $0x0, 0xf(%rsp)
movq %rdx, %r15
movl %edx, %ecx
xorl %r13d, %r13d
pushq $0x1
popq %rbx
movl $0x15ae, %esi           # imm = 0x15AE
movl $0xfff1, %edi           # imm = 0xFFF1
movq %rbp, %r8
testq %rcx, %rcx
je 0x645f
cmpq %rsi, %rcx
movl $0x15ae, %eax           # imm = 0x15AE
cmovbq %rcx, %rax
xorl %edx, %edx
cmpq %rdx, %rax
je 0x6445
movzbl (%r8,%rdx), %r9d
addl %r9d, %ebx
addl %ebx, %r13d
incq %rdx
jmp 0x6430
subq %rax, %rcx
addq %rax, %r8
movl %ebx, %eax
xorl %edx, %edx
divl %edi
movl %edx, %ebx
movl %r13d, %eax
xorl %edx, %edx
divl %edi
movl %edx, %r13d
jmp 0x641d
movq (%r14), %rsi
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0x6481
testq %rsi, %rsi
je 0x6487
movq (%r12), %rdi
addq %rsi, %rsi
callq 0x1140
movq (%r14), %rsi
jmp 0x6491
movq (%r12), %rax
jmp 0x6495
pushq $0x1
popq %rdi
callq 0x1120
xorl %esi, %esi
movq %rax, (%r12)
movb $0x78, (%rax,%rsi)
movq (%r14), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r14)
testq %rax, %rsi
je 0x64ae
movq (%r12), %rax
jmp 0x64d2
testq %rsi, %rsi
je 0x64c4
movq (%r12), %rdi
addq %rsi, %rsi
callq 0x1140
movq (%r14), %rsi
jmp 0x64ce
pushq $0x1
popq %rdi
callq 0x1120
xorl %esi, %esi
movq %rax, (%r12)
movb $0x1, (%rax,%rsi)
incq (%r14)
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %r9
movq 0x10(%rsp), %rdi
movq %rbp, %rcx
movq %r15, %r8
pushq %r14
pushq %r12
callq 0x275f
popq %rax
popq %rcx
movq (%r14), %rsi
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0x651c
testq %rsi, %rsi
je 0x6522
movq (%r12), %rdi
addq %rsi, %rsi
callq 0x1140
movq (%r14), %rsi
jmp 0x652c
movq (%r12), %rax
jmp 0x6530
pushq $0x1
popq %rdi
callq 0x1120
xorl %esi, %esi
movq %rax, (%r12)
movq %r13, %rcx
movb %ch, (%rax,%rsi)
movq (%r14), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r14)
testq %rax, %rsi
je 0x654b
movq (%r12), %rax
jmp 0x6572
testq %rsi, %rsi
je 0x6561
movq (%r12), %rdi
addq %rsi, %rsi
callq 0x1140
movq (%r14), %rsi
jmp 0x656b
pushq $0x1
popq %rdi
callq 0x1120
xorl %esi, %esi
movq %rax, (%r12)
movq %r13, %rcx
movb %cl, (%rax,%rsi)
movq (%r14), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r14)
testq %rax, %rsi
je 0x658a
movq (%r12), %rax
jmp 0x65ae
testq %rsi, %rsi
je 0x65a0
movq (%r12), %rdi
addq %rsi, %rsi
callq 0x1140
movq (%r14), %rsi
jmp 0x65aa
pushq $0x1
popq %rdi
callq 0x1120
xorl %esi, %esi
movq %rax, (%r12)
movb %bh, (%rax,%rsi)
movq (%r14), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r14)
testq %rax, %rsi
je 0x65c6
movq (%r12), %rax
jmp 0x65ea
testq %rsi, %rsi
je 0x65dc
movq (%r12), %rdi
addq %rsi, %rsi
callq 0x1140
movq (%r14), %rsi
jmp 0x65e6
pushq $0x1
popq %rdi
callq 0x1120
xorl %esi, %esi
movq %rax, (%r12)
movb %bl, (%rax,%rsi)
movq (%r14), %rcx
incq %rcx
movq %rcx, (%r14)
movq 0x10(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x660f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x59e2(%rip), %rax      # 0xbff8
movq %r15, %rdx
subq %rcx, %rdx
js 0x6625
cvtsi2ss %rdx, %xmm0
jmp 0x663a
movq %rdx, %rsi
shrq %rsi
andl $0x1, %edx
orq %rsi, %rdx
cvtsi2ss %rdx, %xmm0
addss %xmm0, %xmm0
movq (%rax), %rdi
mulss 0x1273(%rip), %xmm0     # 0x78b8
testq %r15, %r15
js 0x6651
cvtsi2ss %r15, %xmm1
jmp 0x6669
movq %r15, %rax
shrq %rax
movl %r15d, %edx
andl $0x1, %edx
orq %rax, %rdx
cvtsi2ss %rdx, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1244(%rip), %rsi      # 0x78bc
movl %r15d, %edx
movb $0x1, %al
callq 0x10f0
jmp 0x6600
nop