// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
movq %rdx, %r12
movq %rsi, 0x8(%rsp)
movl %edi, 0x4(%rsp)
movq 0x60(%rsp), %r13
movq %rcx, 0x10(%rsp)
cmpl $0x0, 0x4(%rsp)
setne %al
leaq 0xffff(%r12), %rdx
movl %ecx, %esi
subl %r12d, %esi
cmpq %rcx, %rdx
movl $0xffff, %edx           # imm = 0xFFFF
cmovbel %edx, %esi
movl %esi, %r15d
movzwl %si, %edx
movq %rdx, %rbp
addq %r12, %rdx
movq %rdx, 0x20(%rsp)
cmpq %rcx, %rdx
setae %cl
andb %al, %cl
movzbl %cl, %edi
movq 0x18(%rsp), %r14
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x10831
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x10831
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x10831
movb $0x0, (%r14)
movq (%r13), %rsi
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0xf632
testq %rsi, %rsi
je 0xf625
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
jmp 0xf62f
movl $0x1, %edi
callq 0x33d0
movq %rax, (%rbx)
movq (%rbx), %rax
movq (%r13), %rcx
movq %rbp, %rdx
movb %dl, (%rax,%rcx)
movq (%r13), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r13)
testq %rax, %rsi
jne 0xf672
testq %rsi, %rsi
je 0xf662
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
jmp 0xf66c
movl $0x1, %edi
callq 0x33d0
movq %rax, (%rbx)
movq %rbp, %rdx
movq (%rbx), %rax
movq (%r13), %rcx
movb %dh, (%rax,%rcx)
movq (%r13), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r13)
testq %rax, %rsi
jne 0xf6af
testq %rsi, %rsi
je 0xf69f
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
jmp 0xf6a9
movl $0x1, %edi
callq 0x33d0
movq %rax, (%rbx)
movq %rbp, %rdx
movq %rdx, %rdi
movl %r15d, %edx
notl %edx
movq (%rbx), %rax
movq (%r13), %rcx
movb %dl, (%rax,%rcx)
movq (%r13), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%r13)
testq %rax, %rsi
jne 0xf6fa
movl %edx, %r14d
testq %rsi, %rsi
je 0xf6e7
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
jmp 0xf6f1
movl $0x1, %edi
callq 0x33d0
movq %rax, (%rbx)
movq %rbp, %rdi
movl %r14d, %edx
movq (%rbx), %rax
movq (%r13), %rcx
movb %dh, (%rax,%rcx)
incq (%r13)
testq %rdi, %rdi
je 0xf75f
movq 0x8(%rsp), %rax
leaq (%rax,%r12), %r14
xorl %r15d, %r15d
movq (%r13), %rsi
leaq -0x1(%rsi), %rax
testq %rax, %rsi
jne 0xf745
testq %rsi, %rsi
je 0xf738
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x3430
jmp 0xf742
movl $0x1, %edi
callq 0x33d0
movq %rax, (%rbx)
movb (%r14,%r15), %al
movq (%rbx), %rcx
movq (%r13), %rdx
movb %al, (%rcx,%rdx)
incq (%r13)
incq %r15
cmpq %r15, %rbp
jne 0xf719
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
cmovbq %rax, %r12
jb 0xf593
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq