// File: /workspace/github_c_makefile_star2_O2/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, 0x18(%rsp)
movl %edi, 0xc(%rsp)
movq 0x60(%rsp), %r12
movq %rcx, 0x10(%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 0xff3c
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0xff3c
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0xff3c
movb $0x0, (%r14)
movq (%r12), %rsi
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0xecac
testq %rsi, %rsi
je 0xecb1
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
movq (%r12), %rsi
jmp 0xecbb
movq (%rbx), %rax
jmp 0xecbe
pushq $0x1
popq %rdi
callq 0x33d0
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 0xecda
movq (%rbx), %rax
jmp 0xecfd
testq %rsi, %rsi
je 0xecf0
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
movq (%r12), %rsi
jmp 0xecfa
pushq $0x1
popq %rdi
callq 0x33d0
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 0xed19
movq (%rbx), %rax
jmp 0xed3c
testq %rsi, %rsi
je 0xed2f
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
movq (%r12), %rsi
jmp 0xed39
pushq $0x1
popq %rdi
callq 0x33d0
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 0xed5b
movq (%rbx), %rax
jmp 0xed84
movl %ecx, %r14d
testq %rsi, %rsi
je 0xed74
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
movq (%r12), %rsi
jmp 0xed7e
pushq $0x1
popq %rdi
callq 0x33d0
xorl %esi, %esi
movq %rax, (%rbx)
movl %r14d, %ecx
movb %ch, (%rax,%rsi)
movq (%r12), %rsi
incq %rsi
movq %rsi, (%r12)
addq 0x18(%rsp), %r13
xorl %r14d, %r14d
cmpq %r14, %r15
je 0xede8
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0xedbe
testq %rsi, %rsi
je 0xedc3
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
movq (%r12), %rsi
jmp 0xedcd
movq (%rbx), %rax
jmp 0xedd0
pushq $0x1
popq %rdi
callq 0x33d0
xorl %esi, %esi
movq %rax, (%rbx)
movb (%r13,%r14), %cl
movb %cl, (%rax,%rsi)
movq (%r12), %rsi
incq %rsi
movq %rsi, (%r12)
incq %r14
jmp 0xed9a
movq %rbp, %r13
movq 0x10(%rsp), %r8
cmpq %r8, %rbp
jb 0xec19
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq