// File: /workspace/github_c_makefile_star2_O0/aap[P]pdp11/lodepng.c
// Function: readChunk_zTXt
static unsigned readChunk_zTXt(LodePNGInfo* info, const LodePNGDecoderSettings* decoder,
                               const unsigned char* data, size_t chunkLength) {
  unsigned error = 0;

  /*copy the object to change parameters in it*/
  LodePNGDecompressSettings zlibsettings = decoder->zlibsettings;

  unsigned length, string2_begin;
  char *key = 0;
  unsigned char* str = 0;
  size_t size = 0;

  while(!error) /*not really a while loop, only used to break on error*/ {
    for(length = 0; length < chunkLength && data[length] != 0; ++length) ;
    if(length + 2 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination, 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;

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

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

    length = (unsigned)chunkLength - string2_begin;
    zlibsettings.max_output_size = decoder->max_text_size;
    /*will fail if zlib error, e.g. if length is too small*/
    error = zlib_decompress(&str, &size, 0, &data[string2_begin],
                            length, &zlibsettings);
    /*error: compressed text larger than  decoder->max_text_size*/
    if(error && size > zlibsettings.max_output_size) error = 112;
    if(error) break;
    error = lodepng_add_text_sized(info, key, (char*)str, size);
    break;
  }

  lodepng_free(key);
  lodepng_free(str);

  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x50(%rbp), %rdi
movl $0x28, %edx
callq 0x2170
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
cmpl $0x0, -0x24(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x10c9e
jmp 0x10e05
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x71(%rbp)
jae 0x10cc9
movq -0x18(%rbp), %rax
movl -0x54(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x10cd2
jmp 0x10cdf
jmp 0x10cd4
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x10ca5
movl -0x54(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
cmpq -0x20(%rbp), %rax
jb 0x10cf9
movl $0x4b, -0x24(%rbp)
jmp 0x10e05
cmpl $0x1, -0x54(%rbp)
jb 0x10d05
cmpl $0x4f, -0x54(%rbp)
jbe 0x10d11
movl $0x59, -0x24(%rbp)
jmp 0x10e05
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
callq 0x9810
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x10d37
movl $0x53, -0x24(%rbp)
jmp 0x10e05
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x54(%rbp), %eax
movl %eax, %edx
callq 0xb820
movq -0x60(%rbp), %rax
movl -0x54(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x54(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x10d75
movl $0x48, -0x24(%rbp)
jmp 0x10e05
movl -0x54(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpq -0x20(%rbp), %rax
jbe 0x10d90
movl $0x4b, -0x24(%rbp)
jmp 0x10e05
movq -0x20(%rbp), %rax
subl -0x58(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rcx
movl -0x58(%rbp), %eax
addq %rax, %rcx
movl -0x54(%rbp), %eax
movl %eax, %r8d
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x50(%rbp), %r9
callq 0x1add0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x10de5
movq -0x70(%rbp), %rax
cmpq -0x48(%rbp), %rax
jbe 0x10de5
movl $0x70, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x10ded
jmp 0x10e05
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
callq 0xbd60
movl %eax, -0x24(%rbp)
movq -0x60(%rbp), %rdi
callq 0xa2f0
movq -0x68(%rbp), %rdi
callq 0xa2f0
movl -0x24(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)