// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: readChunk_zTXt
static unsigned readChunk_zTXt(LodePNGInfo* info, const LodePNGDecompressSettings* zlibsettings,
                               const unsigned char* data, size_t chunkLength)
{
  unsigned error = 0;
  unsigned i;

  unsigned length, string2_begin;
  char *key = 0;
  ucvector decoded;

  ucvector_init(&decoded);

  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*/

    key[length] = 0;
    for(i = 0; i != length; ++i) key[i] = (char)data[i];

    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 = chunkLength - string2_begin;
    /*will fail if zlib error, e.g. if length is too small*/
    error = zlib_decompress(&decoded.data, &decoded.size,
                            (unsigned char*)(&data[string2_begin]),
                            length, zlibsettings);
    if(error) break;
    ucvector_push_back(&decoded, 0);

    error = lodepng_add_text(info, key, (char*)decoded.data);

    break;
  }

  lodepng_free(key);
  ucvector_cleanup(&decoded);

  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r15
movq %rdx, %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
testq %rcx, %rcx
je 0xb91c
xorl %r12d, %r12d
xorl %eax, %eax
cmpb $0x0, (%r13,%r12)
je 0xb921
incl %eax
movq %rax, %r12
cmpq %r15, %rax
jb 0xb908
jmp 0xb921
xorl %eax, %eax
xorl %r12d, %r12d
leal 0x2(%rax), %ebx
cmpq %r15, %rbx
jae 0xb938
leal -0x50(%rax), %ecx
cmpl $-0x4f, %ecx
jae 0xb96a
movl $0x59, %ebp
jmp 0xb93d
movl $0x4b, %ebp
xorl %r14d, %r14d
movq %r14, %rdi
callq 0x1030
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
movq (%rsp), %rdi
callq 0x1030
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movl %eax, %ebp
leaq 0x1(%rbp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x1100
testq %rax, %rax
je 0xb9d7
movq %rax, %r14
movb $0x0, (%rax,%r12)
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x10f0
movl $0x48, %ebp
movq 0x30(%rsp), %rax
cmpb $0x0, (%r13,%rax)
jne 0xb940
subl %ebx, %r15d
leaq 0x8(%rsp), %rsi
addq %rbx, %r13
movq 0x28(%rsp), %r8
movq 0x8(%r8), %rax
movq %rsp, %rdi
movq %r13, %rdx
movq %r15, %rcx
testq %rax, %rax
je 0xb9e1
callq *%rax
jmp 0xb9e6
movl $0x53, %ebp
jmp 0xb93d
callq 0x435d
movl %eax, %ebp
testl %eax, %eax
jne 0xb940
movq %rsp, %rdi
movq 0x8(%rdi), %rbx
incq %rbx
movq %rbx, %rsi
callq 0xa7a0
testl %eax, %eax
je 0xba14
movq %rbx, 0x8(%rsp)
movq (%rsp), %rax
movb $0x0, -0x1(%rax,%rbx)
movq (%rsp), %rdx
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x4dc7
movl %eax, %ebp
jmp 0xb940