// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq 0x20(%rsi), %rax
movq %rax, 0x50(%rsp)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x10(%rsp)
andq $0x0, 0x28(%rsp)
pushq $0x2
popq %rbx
leal -0x2(%rbx), %ebp
cmpq %r15, %rbp
jae 0xb6a7
cmpb $0x0, (%r12,%rbp)
je 0xb6a7
incl %ebx
jmp 0xb694
movl %ebx, %r14d
cmpq %r15, %r14
jae 0xb6bb
leal -0x52(%rbx), %eax
cmpl $-0x4f, %eax
jae 0xb6e1
pushq $0x59
jmp 0xb6bd
pushq $0x4b
popq %rbp
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x2030
movq %r15, %rdi
callq 0x2030
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, 0x18(%rsp)
leal -0x1(%rbx), %edi
movq %rdi, 0x20(%rsp)
callq 0x21a0
testq %rax, %rax
je 0xb72a
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x8adc
movq 0x8(%rsp), %rdi
movb $0x0, (%rdi,%rbp)
movq 0x20(%rsp), %rax
cmpb $0x0, (%r12,%rax)
je 0xb72e
pushq $0x48
popq %rbp
xorl %r15d, %r15d
jmp 0xb6c3
pushq $0x53
jmp 0xb6bd
subl %ebx, %r15d
movq 0x40(%r13), %rax
leaq 0x30(%rsp), %rbx
movq %rax, 0x8(%rbx)
addq %r14, %r12
leaq 0x10(%rsp), %r13
leaq 0x28(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rbx, %r9
callq 0x10157
movq (%rbp), %rcx
cmpq 0x8(%rbx), %rcx
pushq $0x70
popq %rbp
cmovbel %eax, %ebp
movq (%r13), %r15
testl %eax, %eax
je 0xb785
testl %ebp, %ebp
je 0xb785
movq 0x8(%rsp), %rdi
jmp 0xb6c3
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
movq %r15, %rdx
callq 0x8cd8
movq %rbx, %rdi
movl %eax, %ebp
movq 0x10(%rsp), %r15
jmp 0xb6c3