// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: addChunk_zTXt
static unsigned addChunk_zTXt(ucvector* out, const char* keyword, const char* textstring,
                              LodePNGCompressSettings* zlibsettings)
{
  unsigned error = 0;
  ucvector data, compressed;
  size_t i, textsize = strlen(textstring);

  ucvector_init(&data);
  ucvector_init(&compressed);
  for(i = 0; keyword[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)keyword[i]);
  if(i < 1 || i > 79) return 89; /*error: invalid keyword size*/
  ucvector_push_back(&data, 0); /*0 termination char*/
  ucvector_push_back(&data, 0); /*compression method: 0*/

  error = zlib_compress(&compressed.data, &compressed.size,
                        (unsigned char*)textstring, textsize, zlibsettings);
  if(!error)
  {
    for(i = 0; i != compressed.size; ++i) ucvector_push_back(&data, compressed.data[i]);
    error = addChunk(out, "zTXt", data.data, data.size);
  }

  ucvector_cleanup(&compressed);
  ucvector_cleanup(&data);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rdx, %rdi
callq 0x1090
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movb (%r14), %r14b
testb %r14b, %r14b
je 0x9ef9
movq %rbx, 0x38(%rsp)
movq $-0x1, %r12
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %edi, %edi
leaq 0x1(%r15), %rbp
cmpq %rbp, %r13
jae 0x9d1f
leaq (,%r13,2), %rax
leaq (,%rbp,2), %rbx
addq %rbp, %rbx
shrq %rbx
cmpq %rbp, %rax
cmovbq %rbp, %rbx
movq %rbx, %rsi
movq %r15, 0x40(%rsp)
movq %r13, %r15
movq %rdi, %r13
callq 0x1130
movq %r13, %rdi
movq %r15, %r13
movq 0x40(%rsp), %r15
testq %rax, %rax
jne 0x9d25
jmp 0x9d33
movq %rdi, %rax
movq %r13, %rbx
movb %r14b, -0x1(%rax,%rbp)
movq %rbx, %r13
movq %rax, %rdi
movq %rbp, %r15
movq 0x18(%rsp), %rax
movb 0x2(%rax,%r12), %r14b
incq %r12
testb %r14b, %r14b
jne 0x9cd4
cmpq $0x4e, %r12
movq 0x38(%rsp), %r12
ja 0x9ef9
leaq 0x1(%r15), %rcx
cmpq %rcx, %r13
jae 0x9d94
leaq (,%r13,2), %rax
leaq (%rcx,%rcx,2), %rbx
shrq %rbx
cmpq %rcx, %rax
cmovbq %rcx, %rbx
movq %rbx, %rsi
movq %rdi, %rbp
movq %rcx, %r14
callq 0x1130
movq %r14, %rcx
testq %rax, %rax
jne 0x9d9a
movq %rcx, %r14
movq %r15, %rcx
movq %rbp, %r15
jmp 0x9dac
movq %rdi, %rax
movq %r13, %rbx
movb $0x0, (%rax,%r15)
addq $0x2, %r15
movq %r15, %r14
movq %rbx, %r13
movq %rax, %r15
cmpq %r14, %r13
jae 0x9ddc
leaq (,%r13,2), %rax
leaq (%r14,%r14,2), %rbx
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %rcx, %rbp
callq 0x1130
testq %rax, %rax
jne 0x9de2
jmp 0x9df1
movq %r15, %rax
movq %r13, %rbx
movb $0x0, -0x1(%rax,%r14)
movq %rbx, %r13
movq %rax, %r15
movq %r14, %rbp
leaq 0x8(%rsp), %r14
movq 0x18(%r12), %rax
movq %rsp, %rdi
movq %r14, %rsi
testq %rax, %rax
je 0x9e17
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r12, %r8
callq *%rax
jmp 0x9e29
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r12, %r8
callq 0x44b8
testl %eax, %eax
jne 0x9ed9
cmpq $0x0, 0x8(%rsp)
je 0x9ea8
xorl %r14d, %r14d
movq %r15, %r8
movq (%rsp), %rax
movb (%rax,%r14), %r12b
leaq 0x1(%rbp), %r15
cmpq %r15, %r13
jae 0x9e88
leaq (,%r13,2), %rax
leaq (%r15,%r15,2), %rbx
shrq %rbx
cmpq %r15, %rax
cmovbq %r15, %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r13, 0x18(%rsp)
movq %r8, %r13
callq 0x1130
movq %r13, %r8
movq 0x18(%rsp), %r13
testq %rax, %rax
jne 0x9e8e
jmp 0x9e9c
movq %r8, %rax
movq %r13, %rbx
movb %r12b, -0x1(%rax,%r15)
movq %rbx, %r13
movq %rax, %r8
movq %r15, %rbp
incq %r14
cmpq 0x8(%rsp), %r14
jne 0x9e3f
jmp 0x9eab
movq %r15, %r8
movq 0x30(%rsp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x5ba2(%rip), %rcx      # 0xfa5d
movq %rbx, %rdi
movl %ebp, %edx
movq %r8, %r15
callq 0x4a14
testl %eax, %eax
jne 0x9ed4
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
leaq 0x8(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq (%rsp), %rdi
callq 0x1030
movq $0x0, (%rsp)
movq %r15, %rdi
callq 0x1030
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq