// File: /workspace/github_cpp_makefile_star2_O3/phillip-h[P]fractal-gen/lodepng.cpp
// Function: addChunk_zTXt(ucvector*, char const*, char const*, LodePNGCompressSettings*)
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 %rdi, 0x30(%rsp)
movq %rdx, %rdi
movq %rcx, %rbx
movq %rsi, %r14
movq %rdx, 0x28(%rsp)
callq 0x2090
vxorps %xmm0, %xmm0, %xmm0
movq $0x0, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %rax, 0x20(%rsp)
vmovaps %xmm0, (%rsp)
movb (%r14), %r14b
testb %r14b, %r14b
je 0xc8fb
movq $-0x1, %r12
movq %rbx, 0x38(%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %edi, %edi
leaq 0x1(%r15), %rbp
cmpq %rbp, %r13
jae 0xc728
leaq (%rbp,%rbp,2), %rbx
leaq (%r13,%r13), %rax
movq %r15, 0x40(%rsp)
movq %r13, %r15
movq %rdi, %r13
shrq %rbx
cmpq %rbp, %rax
cmovbq %rbp, %rbx
movq %rbx, %rsi
callq 0x2260
movq %r13, %rdi
movq %r15, %r13
movq 0x40(%rsp), %r15
testq %rax, %rax
jne 0xc72e
jmp 0xc73c
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 0xc6e6
cmpq $0x4e, %r12
movq 0x38(%rsp), %r12
ja 0xc8fb
leaq 0x1(%r15), %rcx
cmpq %rcx, %r13
jae 0xc79a
leaq (%rcx,%rcx,2), %rbx
leaq (%r13,%r13), %rax
movq %rdi, %rbp
movq %rcx, %r14
shrq %rbx
cmpq %rcx, %rax
cmovbq %rcx, %rbx
movq %rbx, %rsi
callq 0x2260
movq %r14, %rcx
testq %rax, %rax
jne 0xc7a0
movq %rcx, %r14
movq %r15, %rcx
movq %rbp, %r15
jmp 0xc7b2
movq %rdi, %rax
movq %r13, %rbx
movb $0x0, (%rax,%r15)
addq $0x2, %r15
movq %rbx, %r13
movq %r15, %r14
movq %rax, %r15
cmpq %r14, %r13
jae 0xc7df
leaq (%r14,%r14,2), %rbx
leaq (%r13,%r13), %rax
movq %r15, %rdi
movq %rcx, %rbp
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %rbx, %rsi
callq 0x2260
testq %rax, %rax
jne 0xc7e5
jmp 0xc7f4
movq %r15, %rax
movq %r13, %rbx
movb $0x0, -0x1(%rax,%r14)
movq %rbx, %r13
movq %rax, %r15
movq %r14, %rbp
movq 0x18(%r12), %rax
leaq 0x8(%rsp), %r14
movq %rsp, %rdi
movq %r14, %rsi
testq %rax, %rax
je 0xc81a
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r12, %r8
callq *%rax
jmp 0xc82c
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r12, %r8
callq 0x6f8b
testl %eax, %eax
jne 0xc8d9
cmpq $0x0, 0x8(%rsp)
je 0xc8a8
xorl %r14d, %r14d
movq %r15, %r8
movq (%rsp), %rax
leaq 0x1(%rbp), %r15
movb (%rax,%r14), %r12b
cmpq %r15, %r13
jae 0xc888
leaq (%r15,%r15,2), %rbx
leaq (%r13,%r13), %rax
movq %r13, 0x18(%rsp)
movq %r8, %rdi
movq %r8, %r13
shrq %rbx
cmpq %r15, %rax
cmovbq %r15, %rbx
movq %rbx, %rsi
callq 0x2260
movq %r13, %r8
movq 0x18(%rsp), %r13
testq %rax, %rax
jne 0xc88e
jmp 0xc89c
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 0xc842
jmp 0xc8ab
movq %r15, %r8
movq 0x30(%rsp), %rbx
leaq 0x69ba(%rip), %rcx      # 0x13271
movl %ebp, %edx
movq %r8, %r15
leaq 0x8(%rbx), %rsi
movq %rbx, %rdi
callq 0x74dc
testl %eax, %eax
jne 0xc8d4
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
leaq 0x8(%rsp), %r14
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, (%r14)
movq (%rsp), %rdi
callq 0x21b0
movq %r15, %rdi
movq $0x0, (%rsp)
callq 0x21b0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq