// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: addChunk_iCCP(ucvector*, LodePNGInfo const*, LodePNGCompressSettings*)
static unsigned addChunk_iCCP(ucvector* out, const LodePNGInfo* info, LodePNGCompressSettings* zlibsettings) {
  unsigned error = 0;
  ucvector data, compressed;
  size_t i;

  ucvector_init(&data);
  ucvector_init(&compressed);
  for(i = 0; info->iccp_name[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)info->iccp_name[i]);
  if(i < 1 || i > 79) return 89; /*error: invalid keyword size*/
  ucvector_push_back(&data, 0); /*0 termination char*/
  ucvector_push_back(&data, 0); /*compression method: 0*/

  error = zlib_compress(&compressed.data, &compressed.size,
                        info->iccp_profile, info->iccp_profile_size, zlibsettings);
  if(!error) {
    for(i = 0; i != compressed.size; ++i) ucvector_push_back(&data, compressed.data[i]);
    error = addChunk(out, "iCCP", data.data, data.size);
  }

  ucvector_cleanup(&compressed);
  ucvector_cleanup(&data);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0xf0(%rsi), %rax
movb (%rax), %r13b
testb %r13b, %r13b
je 0x6dbdb
movq %rdx, 0x30(%rsp)
movq $-0x1, %rbp
xorl %r15d, %r15d
xorl %edx, %edx
xorl %edi, %edi
movq %rsi, 0x18(%rsp)
leaq 0x1(%rdx), %rbx
cmpq %rbx, %r15
jae 0x6d9fa
leaq (%r15,%r15), %rax
leaq (%rbx,%rbx,2), %r12
shrq %r12
cmpq %rbx, %rax
cmovbq %rbx, %r12
movq %r12, %rsi
movq %r15, 0x20(%rsp)
movq %rdi, %r15
movq %rdx, %r14
callq 0x3a730
movq %r14, %rdx
movq 0x18(%rsp), %rsi
movq %r15, %rdi
movq 0x20(%rsp), %r15
testq %rax, %rax
jne 0x6da00
jmp 0x6da0e
movq %rdi, %rax
movq %r15, %r12
movb %r13b, -0x1(%rax,%rbx)
movq %r12, %r15
movq %rbx, %rdx
movq %rax, %rdi
movq 0xf0(%rsi), %rax
movb 0x2(%rbp,%rax), %r13b
incq %rbp
testb %r13b, %r13b
jne 0x6d9b5
cmpq $0x4e, %rbp
movq 0x30(%rsp), %r12
ja 0x6dbdb
leaq 0x1(%rdx), %rcx
cmpq %rcx, %r15
jae 0x6da76
leaq (%r15,%r15), %rax
leaq (%rcx,%rcx,2), %rbp
shrq %rbp
cmpq %rcx, %rax
cmovbq %rcx, %rbp
movq %rbp, %rsi
movq %rdi, %rbx
movq %rcx, %r14
movq %rdx, %r13
callq 0x3a730
movq %r13, %rdx
movq %r14, %rcx
movq %rax, %r14
testq %rax, %rax
jne 0x6da7c
movq %rcx, %r13
movq %rdx, %rcx
movq %rbx, %r14
jmp 0x6da8b
movq %rdi, %r14
movq %r15, %rbp
movb $0x0, (%r14,%rdx)
addq $0x2, %rdx
movq %rdx, %r13
movq %rbp, %r15
cmpq %r13, %r15
jae 0x6dac3
movq %rcx, %rbx
leaq (%r15,%r15), %rax
leaq (,%r13,2), %rbp
addq %r13, %rbp
shrq %rbp
cmpq %r13, %rax
cmovbq %r13, %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3a730
testq %rax, %rax
movq 0x18(%rsp), %rcx
jne 0x6dace
jmp 0x6dadd
movq %r14, %rax
movq %r15, %rbp
movq 0x18(%rsp), %rcx
movb $0x0, -0x1(%rax,%r13)
movq %rbp, %r15
movq %r13, %rbx
movq %rax, %r14
leaq 0x8(%rsp), %r13
movq 0xf8(%rcx), %rdx
movl 0x100(%rcx), %ecx
movq 0x18(%r12), %rax
movq %rsp, %rdi
movq %r13, %rsi
movq %r12, %r8
testq %rax, %rax
je 0x6db06
callq *%rax
jmp 0x6db0b
callq 0x67631
testl %eax, %eax
jne 0x6dbba
movq %rbx, %rbp
cmpq $0x0, 0x8(%rsp)
je 0x6db89
xorl %r13d, %r13d
movq %r14, %r8
movq (%rsp), %rax
movb (%rax,%r13), %r12b
leaq 0x1(%rbp), %r14
cmpq %r14, %r15
jae 0x6db69
leaq (%r15,%r15), %rax
leaq (%r14,%r14,2), %rbx
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r15, 0x20(%rsp)
movq %r8, %r15
callq 0x3a730
movq %r15, %r8
movq 0x20(%rsp), %r15
testq %rax, %rax
jne 0x6db6f
jmp 0x6db7d
movq %r8, %rax
movq %r15, %rbx
movb %r12b, -0x1(%rax,%r14)
movq %rbx, %r15
movq %r14, %rbp
movq %rax, %r8
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x6db24
jmp 0x6db8c
movq %r14, %r8
movq 0x28(%rsp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x1b364(%rip), %rcx     # 0x88f00
movq %rbx, %rdi
movl %ebp, %edx
movq %r8, %r14
callq 0x67b70
testl %eax, %eax
jne 0x6dbb5
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
leaq 0x8(%rsp), %r13
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movq (%rsp), %rdi
callq 0x3a540
movq $0x0, (%rsp)
movq %r14, %rdi
callq 0x3a540
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq