// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
movq 0x20(%rsi), %rax
movq %rax, 0x40(%rsp)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %rax, 0x18(%rsp)
movl $0x0, %ebp
testq %rcx, %rcx
je 0xcdfa
xorl %ebp, %ebp
xorl %eax, %eax
cmpb $0x0, (%r15,%rbp)
je 0xcdfa
incl %eax
movq %rax, %rbp
cmpq %r14, %rax
jb 0xcde9
leal 0x2(%rax), %r12d
cmpq %r14, %r12
jae 0xce12
leal -0x50(%rax), %ecx
cmpl $-0x4f, %ecx
jae 0xce3a
movl $0x59, %ebp
jmp 0xce17
movl $0x4b, %ebp
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x2030
movq %r14, %rdi
callq 0x2030
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, 0x10(%rsp)
movl %eax, %ebx
incq %rbx
movq %rbx, %rdi
callq 0x21a0
testq %rax, %rax
je 0xce7d
movq %rax, (%rsp)
movq (%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x2170
movq (%rsp), %rdi
movb $0x0, (%rdi,%rbp)
cmpb $0x0, (%r15,%rbx)
je 0xce84
movl $0x48, %ebp
xorl %r14d, %r14d
jmp 0xce1c
movl $0x53, %ebp
jmp 0xce17
subl %r12d, %r14d
movq 0x40(%r13), %rax
leaq 0x20(%rsp), %rbx
movq %rax, 0x8(%rbx)
addq %r12, %r15
leaq 0x8(%rsp), %r13
leaq 0x18(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
movq %r15, %rcx
movq %r14, %r8
movq %rbx, %r9
callq 0x11e84
movq (%rbp), %rcx
cmpq 0x8(%rbx), %rcx
movl $0x70, %ebp
cmovbel %eax, %ebp
movq (%r13), %r14
testl %eax, %eax
je 0xcedc
testl %ebp, %ebp
je 0xcedc
movq (%rsp), %rdi
jmp 0xce1c
movq 0x10(%rsp), %rdi
movq (%rsp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x9f9d
movq %rbx, %rdi
movl %eax, %ebp
movq 0x8(%rsp), %r14
jmp 0xce1c