// File: /workspace/github_cpp_makefile_star2_O3/lvandeve[P]lodepng/lodepng.cpp
// Function: readChunk_zTXt(LodePNGInfo*, LodePNGDecoderSettings const*, unsigned char const*, unsigned long)
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 0x8cae
xorl %ebp, %ebp
xorl %eax, %eax
cmpb $0x0, (%r15,%rbp)
je 0x8cae
incl %eax
movq %rax, %rbp
cmpq %r14, %rax
jb 0x8c9d
leal 0x2(%rax), %r12d
cmpq %r14, %r12
jae 0x8cc6
leal -0x50(%rax), %ecx
cmpl $-0x4f, %ecx
jae 0x8cee
movl $0x59, %ebp
jmp 0x8ccb
movl $0x4b, %ebp
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x22a0
movq %r14, %rdi
callq 0x22a0
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 0x22b0
testq %rax, %rax
je 0x8d31
movq %rax, (%rsp)
movq (%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x21e0
movq (%rsp), %rdi
movb $0x0, (%rdi,%rbp)
cmpb $0x0, (%r15,%rbx)
je 0x8d38
movl $0x48, %ebp
xorl %r14d, %r14d
jmp 0x8cd0
movl $0x53, %ebp
jmp 0x8ccb
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 0xd24c
movq (%rbp), %rcx
cmpq 0x8(%rbx), %rcx
movl $0x70, %ebp
cmovbel %eax, %ebp
movq (%r13), %r14
testl %eax, %eax
je 0x8d90
testl %ebp, %ebp
je 0x8d90
movq (%rsp), %rdi
jmp 0x8cd0
movq 0x10(%rsp), %rdi
movq (%rsp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5b44
movq %rbx, %rdi
movl %eax, %ebp
movq 0x8(%rsp), %r14
jmp 0x8cd0