// File: /workspace/github_c_makefile_star2_O0/tditlu[P]shadetabler/src/lodepng/lodepng.c
// Function: readChunk_iTXt
static unsigned readChunk_iTXt(LodePNGInfo* info, const LodePNGDecompressSettings* zlibsettings,
                               const unsigned char* data, size_t chunkLength) {
  unsigned error = 0;
  unsigned i;

  unsigned length, begin, compressed;
  char *key = 0, *langtag = 0, *transkey = 0;

  while(!error) /*not really a while loop, only used to break on error*/ {
    /*Quick check if the chunk length isn't too small. Even without check
    it'd still fail with other error checks below if it's too short. This just gives a different error code.*/
    if(chunkLength < 5) CERROR_BREAK(error, 30); /*iTXt chunk too short*/

    /*read the key*/
    for(length = 0; length < chunkLength && data[length] != 0; ++length) ;
    if(length + 3 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination char, corrupt?*/
    if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/

    key = (char*)lodepng_malloc(length + 1);
    if(!key) CERROR_BREAK(error, 83); /*alloc fail*/

    lodepng_memcpy(key, data, length);
    key[length] = 0;

    /*read the compression method*/
    compressed = data[length + 1];
    if(data[length + 2] != 0) CERROR_BREAK(error, 72); /*the 0 byte indicating compression must be 0*/

    /*even though it's not allowed by the standard, no error is thrown if
    there's no null termination char, if the text is empty for the next 3 texts*/

    /*read the langtag*/
    begin = length + 3;
    length = 0;
    for(i = begin; i < chunkLength && data[i] != 0; ++i) ++length;

    langtag = (char*)lodepng_malloc(length + 1);
    if(!langtag) CERROR_BREAK(error, 83); /*alloc fail*/

    lodepng_memcpy(langtag, data + begin, length);
    langtag[length] = 0;

    /*read the transkey*/
    begin += length + 1;
    length = 0;
    for(i = begin; i < chunkLength && data[i] != 0; ++i) ++length;

    transkey = (char*)lodepng_malloc(length + 1);
    if(!transkey) CERROR_BREAK(error, 83); /*alloc fail*/

    lodepng_memcpy(transkey, data + begin, length);
    transkey[length] = 0;

    /*read the actual text*/
    begin += length + 1;

    length = (unsigned)chunkLength < begin ? 0 : (unsigned)chunkLength - begin;

    if(compressed) {
      unsigned char* str = 0;
      size_t size = 0;
      /*will fail if zlib error, e.g. if length is too small*/
      error = zlib_decompress(&str, &size, 0, &data[begin],
                              length, zlibsettings);
      if(!error) error = lodepng_add_itext_sized(info, key, langtag, transkey, (char*)str, size);
      lodepng_free(str);
    } else {
      error = lodepng_add_itext_sized(info, key, langtag, transkey, (char*)(data + begin), length);
    }

    break;
  }

  lodepng_free(key);
  lodepng_free(langtag);
  lodepng_free(transkey);

  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
cmpl $0x0, -0x24(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xb9e9
jmp 0xbcee
cmpq $0x5, -0x20(%rbp)
jae 0xb9fc
movl $0x1e, -0x24(%rbp)
jmp 0xbcee
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x61(%rbp)
jae 0xba27
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0xba30
jmp 0xba3d
jmp 0xba32
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xba03
movl -0x2c(%rbp), %eax
addl $0x3, %eax
movl %eax, %eax
cmpq -0x20(%rbp), %rax
jb 0xba57
movl $0x4b, -0x24(%rbp)
jmp 0xbcee
cmpl $0x1, -0x2c(%rbp)
jb 0xba63
cmpl $0x4f, -0x2c(%rbp)
jbe 0xba6f
movl $0x59, -0x24(%rbp)
jmp 0xbcee
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
callq 0x3de0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xba95
movl $0x53, -0x24(%rbp)
jmp 0xbcee
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x2c(%rbp), %eax
movl %eax, %edx
callq 0x6440
movq -0x40(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x2, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0xbae6
movl $0x48, -0x24(%rbp)
jmp 0xbcee
movl -0x2c(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x62(%rbp)
jae 0xbb20
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x62(%rbp)
movb -0x62(%rbp), %al
testb $0x1, %al
jne 0xbb29
jmp 0xbb3d
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xbafc
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
callq 0x3de0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xbb63
movl $0x53, -0x24(%rbp)
jmp 0xbcee
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x30(%rbp), %eax
addq %rax, %rsi
movl -0x2c(%rbp), %eax
movl %eax, %edx
callq 0x6440
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x63(%rbp)
jae 0xbbc3
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x63(%rbp)
movb -0x63(%rbp), %al
testb $0x1, %al
jne 0xbbcc
jmp 0xbbe0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xbb9f
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
callq 0x3de0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xbc06
movl $0x53, -0x24(%rbp)
jmp 0xbcee
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x30(%rbp), %eax
addq %rax, %rsi
movl -0x2c(%rbp), %eax
movl %eax, %edx
callq 0x6440
movq -0x50(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl -0x30(%rbp), %eax
jae 0xbc45
xorl %eax, %eax
movl %eax, -0x68(%rbp)
jmp 0xbc4f
movq -0x20(%rbp), %rax
subl -0x30(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0xbcc4
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x18(%rbp), %rcx
movl -0x30(%rbp), %eax
addq %rax, %rcx
movl -0x2c(%rbp), %eax
movl %eax, %r8d
movq -0x10(%rbp), %r9
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x144e0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xbcb9
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0x60(%rbp), %r9
callq 0x6cd0
movl %eax, -0x24(%rbp)
movq -0x58(%rbp), %rdi
callq 0x5060
jmp 0xbcec
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %r8
movl -0x30(%rbp), %eax
addq %rax, %r8
movl -0x2c(%rbp), %eax
movl %eax, %r9d
callq 0x6cd0
movl %eax, -0x24(%rbp)
jmp 0xbcee
movq -0x40(%rbp), %rdi
callq 0x5060
movq -0x48(%rbp), %rdi
callq 0x5060
movq -0x50(%rbp), %rdi
callq 0x5060
movl -0x24(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)