// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: readChunk_iCCP(LodePNGInfo*, LodePNGDecoderSettings const*, unsigned char const*, unsigned long)
static unsigned readChunk_iCCP(LodePNGInfo* info, const LodePNGDecoderSettings* decoder,
                               const unsigned char* data, size_t chunkLength) {
  unsigned error = 0;
  unsigned i;
  size_t size = 0;
  /*copy the object to change parameters in it*/
  LodePNGDecompressSettings zlibsettings = decoder->zlibsettings;

  unsigned length, string2_begin;

  if(info->iccp_defined) lodepng_clear_icc(info);
  info->iccp_defined = 1;

  for(length = 0; length < chunkLength && data[length] != 0; ++length) ;
  if(length + 2 >= chunkLength) return 75; /*no null termination, corrupt?*/
  if(length < 1 || length > 79) return 89; /*keyword too short or long*/

  info->iccp_name = (char*)lodepng_malloc(length + 1);
  if(!info->iccp_name) return 83; /*alloc fail*/

  info->iccp_name[length] = 0;
  for(i = 0; i != length; ++i) info->iccp_name[i] = (char)data[i];

  if(data[length + 1] != 0) return 72; /*the 0 byte indicating compression must be 0*/

  string2_begin = length + 2;
  if(string2_begin > chunkLength) return 75; /*no null termination, corrupt?*/

  length = (unsigned)chunkLength - string2_begin;
  zlibsettings.max_output_size = decoder->max_icc_size;
  error = zlib_decompress(&info->iccp_profile, &size, 0,
                          &data[string2_begin],
                          length, &zlibsettings);
  /*error: ICC profile larger than decoder->max_icc_size*/
  if(error && size > zlibsettings.max_output_size) error = 113;
  info->iccp_profile_size = (unsigned)size;
  if(!error && !info->iccp_profile_size) error = 100; /*invalid ICC profile size*/
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
andq $0x0, 0x18(%rsp)
movq 0x20(%rsi), %rax
movq %rax, 0x40(%rsp)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
cmpl $0x0, 0xfc(%rdi)
je 0x7d57
movq %rbx, %rdi
callq 0x4fa7
movl $0x1, 0xfc(%rbx)
pushq $0x2
popq %rbp
leal -0x2(%rbp), %r13d
cmpq %r14, %r13
jae 0x7d78
cmpb $0x0, (%r15,%r13)
je 0x7d78
incl %ebp
jmp 0x7d64
movl %ebp, %ecx
cmpq %r14, %rcx
jae 0x7d8b
leal -0x52(%rbp), %eax
cmpl $-0x4f, %eax
jae 0x7d9d
pushq $0x59
jmp 0x7d8d
pushq $0x4b
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, 0x8(%rsp)
leal -0x1(%rbp), %edi
movq %rdi, 0x10(%rsp)
callq 0x2280
movq %rax, 0x100(%rbx)
testq %rax, %rax
je 0x7ded
movb $0x0, (%rax,%r13)
movl %r13d, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x7ddd
movb (%r15,%rcx), %dl
movq 0x100(%rbx), %rsi
movb %dl, (%rsi,%rcx)
incq %rcx
jmp 0x7dc5
movq 0x10(%rsp), %rax
cmpb $0x0, (%r15,%rax)
je 0x7df1
pushq $0x48
jmp 0x7d8d
pushq $0x53
jmp 0x7d8d
subl %ebp, %r14d
movq 0x48(%r12), %rax
leaq 0x20(%rsp), %r12
movq %rax, 0x8(%r12)
leaq 0x108(%rbx), %rdi
addq 0x8(%rsp), %r15
xorl %ebp, %ebp
leaq 0x18(%rsp), %r13
movq %r13, %rsi
xorl %edx, %edx
movq %r15, %rcx
movq %r14, %r8
movq %r12, %r9
callq 0xb6ed
movl %eax, %ecx
movq (%r13), %rdx
cmpq 0x8(%r12), %rdx
pushq $0x71
popq %rax
cmovbel %ecx, %eax
movl %edx, 0x110(%rbx)
testl %ecx, %ecx
je 0x7e4c
testl %eax, %eax
jne 0x7d8e
testl %edx, %edx
pushq $0x64
popq %rax
cmovel %eax, %ebp
movl %ebp, %eax
jmp 0x7d8e