// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rcx, 0x50(%rsp)
movq %rsi, %rbx
movq %rdi, 0x48(%rsp)
movq %rdx, 0x38(%rsp)
movq %rdx, %rdi
callq 0x2090
movq %rax, 0x30(%rsp)
vxorps %xmm0, %xmm0, %xmm0
vmovaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movb (%rbx), %r14b
testb %r14b, %r14b
je 0xc747
movq $-0x1, %r12
xorl %edx, %edx
xorl %r13d, %r13d
xorl %edi, %edi
movq %rbx, 0x40(%rsp)
leaq 0x1(%r13), %r15
cmpq %r15, %rdx
jae 0xc70f
movq %r13, 0x8(%rsp)
leaq (%rdx,%rdx), %rax
leaq (%r15,%r15,2), %rbp
shrq %rbp
cmpq %r15, %rax
cmovbq %r15, %rbp
movq %rbp, %rsi
movq %rdi, %r13
movq %rdx, %rbx
callq 0x2260
testq %rax, %rax
je 0xc713
xorl %ecx, %ecx
movq %rax, %rdi
movq %rbp, %rdx
movq 0x8(%rsp), %r13
jmp 0xc720
xorl %ecx, %ecx
jmp 0xc725
movb $0x1, %cl
movq %r13, %rdi
movq 0x8(%rsp), %r13
movq %rbx, %rdx
movq 0x40(%rsp), %rbx
testb %cl, %cl
jne 0xc731
movb %r14b, -0x1(%rdi,%r15)
movq %r15, %r13
movb 0x2(%rbx,%r12), %r14b
incq %r12
testb %r14b, %r14b
jne 0xc6cd
cmpq $0x4f, %r12
setae %al
jmp 0xc750
movb $0x1, %al
xorl %edi, %edi
xorl %r13d, %r13d
xorl %edx, %edx
testb %al, %al
jne 0xc910
leaq 0x1(%r13), %r14
cmpq %r14, %rdx
jae 0xc790
leaq (%rdx,%rdx), %rax
leaq (%r14,%r14,2), %rbx
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %rbx, %rsi
movq %rdi, %r15
movq %rdx, %r12
callq 0x2260
testq %rax, %rax
je 0xc794
xorl %ecx, %ecx
movq %rax, %rdi
movq %rbx, %rdx
jmp 0xc79c
xorl %ecx, %ecx
jmp 0xc79c
movb $0x1, %cl
movq %r15, %rdi
movq %r12, %rdx
testb %cl, %cl
jne 0xc7a9
movb $0x0, -0x1(%rdi,%r14)
movq %r14, %r13
leaq 0x1(%r13), %r14
cmpq %r14, %rdx
jae 0xc7e1
leaq (%rdx,%rdx), %rax
leaq (%r14,%r14,2), %rbx
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %rbx, %rsi
movq %rdi, %r15
movq %rdx, %r12
callq 0x2260
testq %rax, %rax
je 0xc7e5
xorl %ecx, %ecx
movq %rax, %rdi
movq %rbx, %rdx
jmp 0xc7ed
xorl %ecx, %ecx
jmp 0xc7ed
movb $0x1, %cl
movq %r15, %rdi
movq %r12, %rdx
testb %cl, %cl
jne 0xc7fa
movb $0x0, -0x1(%rdi,%r14)
movq %r14, %r13
movq %rdx, %rbx
movq %rdi, %r15
leaq 0x18(%rsp), %r14
movq 0x50(%rsp), %r8
movq 0x18(%r8), %rax
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
testq %rax, %rax
je 0xc829
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq *%rax
jmp 0xc838
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x6f94
testl %eax, %eax
jne 0xc8ec
cmpq $0x0, 0x18(%rsp)
je 0xc8ba
xorl %r14d, %r14d
movq %r15, %r8
movq 0x10(%rsp), %rax
movb (%rax,%r14), %bpl
leaq 0x1(%r13), %r15
cmpq %r15, %rbx
jae 0xc894
movq %r13, 0x8(%rsp)
leaq (%rbx,%rbx), %rax
leaq (%r15,%r15,2), %r12
shrq %r12
cmpq %r15, %rax
cmovbq %r15, %r12
movq %r8, %rdi
movq %r12, %rsi
movq %r8, %r13
callq 0x2260
testq %rax, %rax
je 0xc898
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rbx
jmp 0xc89d
xorl %ecx, %ecx
jmp 0xc8a2
movb $0x1, %cl
movq %r13, %r8
movq 0x8(%rsp), %r13
testb %cl, %cl
jne 0xc8ae
movb %bpl, -0x1(%r8,%r15)
movq %r15, %r13
incq %r14
cmpq 0x18(%rsp), %r14
jne 0xc84e
jmp 0xc8bd
movq %r15, %r8
movq 0x48(%rsp), %r14
leaq 0x8(%r14), %rsi
leaq 0x6944(%rip), %rcx      # 0x13211
movq %r14, %rdi
movl %r13d, %edx
movq %r8, %r15
callq 0x74cd
testl %eax, %eax
jne 0xc8e7
movq 0x8(%r14), %rax
movq %rax, 0x10(%r14)
leaq 0x18(%rsp), %r14
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, (%r14)
movq 0x10(%rsp), %rdi
callq 0x21b0
movq $0x0, 0x10(%rsp)
movq %r15, %rdi
callq 0x21b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq