// File: /workspace/github_c_makefile_star2_O0/aap[P]pdp11/lodepng.c
// Function: readChunk_iCCP
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;

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

  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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movl $0x28, %edx
callq 0x2170
movq -0x10(%rbp), %rax
movl $0x1, 0xe8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0x116de
movq -0x10(%rbp), %rdi
callq 0xc2f0
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x69(%rbp)
jae 0x11709
movq -0x20(%rbp), %rax
movl -0x64(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x11712
jmp 0x1171f
jmp 0x11714
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x116e5
movl -0x64(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
cmpq -0x28(%rbp), %rax
jb 0x11739
movl $0x4b, -0x4(%rbp)
jmp 0x1189a
cmpl $0x1, -0x64(%rbp)
jb 0x11745
cmpl $0x4f, -0x64(%rbp)
jbe 0x11751
movl $0x59, -0x4(%rbp)
jmp 0x1189a
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
callq 0x9810
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
jne 0x11788
movl $0x53, -0x4(%rbp)
jmp 0x1189a
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rax
movl -0x64(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x64(%rbp), %eax
je 0x117cf
movq -0x20(%rbp), %rax
movl -0x30(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rax
movl -0x30(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x117a1
movq -0x20(%rbp), %rax
movl -0x64(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x117f0
movl $0x48, -0x4(%rbp)
jmp 0x1189a
movl -0x64(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
cmpq -0x28(%rbp), %rax
jbe 0x1180e
movl $0x4b, -0x4(%rbp)
jmp 0x1189a
movq -0x28(%rbp), %rax
subl -0x68(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
addq $0xf8, %rdi
movq -0x20(%rbp), %rcx
movl -0x68(%rbp), %eax
addq %rax, %rcx
movl -0x64(%rbp), %eax
movl %eax, %r8d
leaq -0x38(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x60(%rbp), %r9
callq 0x1add0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x1186a
movq -0x38(%rbp), %rax
cmpq -0x58(%rbp), %rax
jbe 0x1186a
movl $0x71, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x100(%rax)
cmpl $0x0, -0x2c(%rbp)
jne 0x11894
movq -0x10(%rbp), %rax
cmpl $0x0, 0x100(%rax)
jne 0x11894
movl $0x64, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)