// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: AddNonCompressedBlock
static void AddNonCompressedBlock(const ZopfliOptions* options, int final,
                                  const unsigned char* in, size_t instart,
                                  size_t inend,
                                  unsigned char* bp,
                                  unsigned char** out, size_t* outsize) {
  size_t pos = instart;
  (void)options;
  for (;;) {
    size_t i;
    unsigned short blocksize = 65535;
    unsigned short nlen;
    int currentfinal;

    if (pos + blocksize > inend) blocksize = inend - pos;
    currentfinal = pos + blocksize >= inend;

    nlen = ~blocksize;

    AddBit(final && currentfinal, bp, out, outsize);
    /* BTYPE 00 */
    AddBit(0, bp, out, outsize);
    AddBit(0, bp, out, outsize);

    /* Any bits of input up to the next byte boundary are ignored. */
    *bp = 0;

    ZOPFLI_APPEND_DATA(blocksize % 256, out, outsize);
    ZOPFLI_APPEND_DATA((blocksize / 256) % 256, out, outsize);
    ZOPFLI_APPEND_DATA(nlen % 256, out, outsize);
    ZOPFLI_APPEND_DATA((nlen / 256) % 256, out, outsize);

    for (i = 0; i < blocksize; i++) {
      ZOPFLI_APPEND_DATA(in[pos + i], out, outsize);
    }

    if (currentfinal) break;
    pos += blocksize;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movq %r8, 0x20(%rsp)
movq %rcx, %r8
movq %rdx, %r13
movq %rsi, 0x10(%rsp)
movl %edi, 0xc(%rsp)
movq 0x60(%rsp), %r12
movq %rcx, 0x18(%rsp)
cmpl $0x0, 0xc(%rsp)
setne %al
leaq 0xffff(%r13), %rcx
movl %r8d, %edx
subl %r13d, %edx
cmpq %r8, %rcx
movl $0xffff, %ecx           # imm = 0xFFFF
cmovbel %ecx, %edx
movl %edx, 0x8(%rsp)
movzwl %dx, %ecx
movq %rcx, %r15
leaq (%rcx,%r13), %rbp
cmpq %r8, %rbp
setae %cl
andb %al, %cl
movzbl %cl, %edi
movq 0x20(%rsp), %r14
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x10d24
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x10d24
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x10d24
movb $0x0, (%r14)
movq (%r12), %rsi
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0xfa45
testq %rsi, %rsi
je 0xfa4a
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3440
movq (%r12), %rsi
jmp 0xfa56
movq (%rbx), %rax
jmp 0xfa59
movl $0x1, %edi
callq 0x33e0
xorl %esi, %esi
movq %rax, (%rbx)
movq %r15, %rcx
movb %cl, (%rax,%rsi)
movq (%r12), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r12)
testq %rax, %rsi
je 0xfa75
movq (%rbx), %rax
jmp 0xfa9a
testq %rsi, %rsi
je 0xfa8b
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3440
movq (%r12), %rsi
jmp 0xfa97
movl $0x1, %edi
callq 0x33e0
xorl %esi, %esi
movq %rax, (%rbx)
movq %r15, %rcx
movb %ch, (%rax,%rsi)
movq (%r12), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r12)
testq %rax, %rsi
je 0xfab6
movq (%rbx), %rax
jmp 0xfadb
testq %rsi, %rsi
je 0xfacc
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3440
movq (%r12), %rsi
jmp 0xfad8
movl $0x1, %edi
callq 0x33e0
xorl %esi, %esi
movq %rax, (%rbx)
movl 0x8(%rsp), %ecx
notl %ecx
movb %cl, (%rax,%rsi)
movq (%r12), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r12)
testq %rax, %rsi
je 0xfafa
movq (%rbx), %rax
jmp 0xfb25
movl %ecx, %r14d
testq %rsi, %rsi
je 0xfb13
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3440
movq (%r12), %rsi
jmp 0xfb1f
movl $0x1, %edi
callq 0x33e0
xorl %esi, %esi
movq %rax, (%rbx)
movl %r14d, %ecx
movb %ch, (%rax,%rsi)
movq (%r12), %rsi
incq %rsi
movq %rsi, (%r12)
testq %r15, %r15
je 0xfb8e
addq 0x10(%rsp), %r13
xorl %r14d, %r14d
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0xfb5f
testq %rsi, %rsi
je 0xfb64
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3440
movq (%r12), %rsi
jmp 0xfb70
movq (%rbx), %rax
jmp 0xfb73
movl $0x1, %edi
callq 0x33e0
xorl %esi, %esi
movq %rax, (%rbx)
movb (%r13,%r14), %cl
movb %cl, (%rax,%rsi)
movq (%r12), %rsi
incq %rsi
movq %rsi, (%r12)
incq %r14
cmpq %r14, %r15
jne 0xfb40
movq %rbp, %r13
movq 0x18(%rsp), %r8
cmpq %r8, %rbp
jb 0xf9b2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq