// File: /workspace/github_c_makefile_star2_O1/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 0xb488
xorl %r14d, %r14d
xorl %r12d, %r12d
cmpb $0x0, (%r13,%r14)
je 0xb48e
incl %r12d
movq %r12, %r14
cmpq %r15, %r12
jb 0xb473
jmp 0xb48e
xorl %r12d, %r12d
xorl %r14d, %r14d
leal 0x2(%r12), %ebx
movl $0x4b, %ebp
cmpq %r15, %rbx
jae 0xb50c
leal -0x50(%r12), %eax
cmpl $-0x4f, %eax
jae 0xb4ae
movl $0x59, %ebp
jmp 0xb50c
movq %rsi, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
movl %r12d, %eax
movq %rax, 0x28(%rsp)
leaq 0x1(%rax), %rdi
movq %rdi, 0x30(%rsp)
callq 0x10f0
testq %rax, %rax
je 0xb507
movq %rax, %rdi
movb $0x0, (%rax,%r14)
testl %r12d, %r12d
je 0xb4f3
movq %rdi, %r14
movq %r13, %rsi
movq 0x28(%rsp), %rdx
callq 0x10e0
movq %r14, %rdi
movq 0x30(%rsp), %rax
cmpb $0x0, (%r13,%rax)
je 0xb535
movl $0x48, %ebp
jmp 0xb50e
movl $0x53, %ebp
xorl %edi, %edi
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
cmpq %r15, %rbx
ja 0xb50e
movq %rdi, %r14
subl %ebx, %r15d
leaq 0x8(%rsp), %rsi
addq %rbx, %r13
movq 0x20(%rsp), %r8
movq 0x8(%r8), %rax
movq %rsp, %rdi
movq %r13, %rdx
movq %r15, %rcx
testq %rax, %rax
je 0xb563
callq *%rax
jmp 0xb568
callq 0x3cc3
movl %eax, %ebp
testl %eax, %eax
je 0xb573
movq %r14, %rdi
jmp 0xb50e
movq %rsp, %rdi
movq 0x8(%rdi), %rbx
incq %rbx
movq %rbx, %rsi
callq 0xa144
testl %eax, %eax
je 0xb597
movq %rbx, 0x8(%rsp)
movq (%rsp), %rax
movb $0x0, -0x1(%rax,%rbx)
movq (%rsp), %rdx
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x471c
movq %r14, %rdi
movl %eax, %ebp
jmp 0xb50e