// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/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 = lodepng_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,
                        (const 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 %rsi, %r8
movq %rdi, 0x38(%rsp)
movq $-0x1, %r13
cmpb $0x0, 0x1(%rdx,%r13)
leaq 0x1(%r13), %r13
jne 0x6e42c
movq %r13, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movb (%r8), %r14b
testb %r14b, %r14b
je 0x6e6b2
movq %rdx, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq $-0x1, %r12
xorl %ecx, %ecx
xorl %esi, %esi
xorl %r15d, %r15d
movq %r8, 0x50(%rsp)
leaq 0x1(%rsi), %rbp
cmpq %rbp, %rcx
jae 0x6e4c0
leaq (%rcx,%rcx), %rax
leaq (,%rbp,2), %rbx
addq %rbp, %rbx
shrq %rbx
cmpq %rbp, %rax
cmovbq %rbp, %rbx
movq %r15, %rdi
movq %rsi, 0x8(%rsp)
movq %rbx, %rsi
movq %rcx, %r13
callq 0x3a730
movq 0x50(%rsp), %r8
movq 0x8(%rsp), %rsi
movq %r13, %rcx
testq %rax, %rax
jne 0x6e4c6
jmp 0x6e4d4
movq %r15, %rax
movq %rcx, %rbx
movb %r14b, -0x1(%rax,%rbp)
movq %rbx, %rcx
movq %rbp, %rsi
movq %rax, %r15
movb 0x2(%r8,%r12), %r14b
incq %r12
testb %r14b, %r14b
jne 0x6e477
cmpq $0x4e, %r12
movq 0x48(%rsp), %r13
movq 0x40(%rsp), %rbp
ja 0x6e6b2
leaq 0x1(%rsi), %rdx
cmpq %rdx, %rcx
movq %rdx, 0x8(%rsp)
jae 0x6e543
leaq (%rcx,%rcx), %rax
leaq (%rdx,%rdx,2), %rbx
shrq %rbx
cmpq %rdx, %rax
cmovbq %rdx, %rbx
movq %r15, %rdi
movq %rsi, %r14
movq %rbx, %rsi
movq %r15, %r12
movq %rcx, %r15
callq 0x3a730
movq %r14, %rsi
testq %rax, %rax
jne 0x6e549
movq 0x8(%rsp), %r14
movq %rsi, 0x8(%rsp)
movq %r12, %rdi
movq %r15, %rcx
jmp 0x6e55a
movq %r15, %rax
movq %rcx, %rbx
movb $0x0, (%rax,%rsi)
addq $0x2, %rsi
movq %rsi, %r14
movq %rbx, %rcx
movq %rax, %rdi
cmpq %r14, %rcx
jae 0x6e58e
leaq (%rcx,%rcx), %rax
leaq (%r14,%r14,2), %rbx
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %rbx, %rsi
movq %rdi, %r15
movq %rcx, %r12
callq 0x3a730
movq %r12, %rcx
testq %rax, %rax
movq 0x8(%rsp), %r12
jne 0x6e594
jmp 0x6e5a3
movq %rdi, %rax
movq %rcx, %rbx
movb $0x0, -0x1(%rax,%r14)
movq %rbx, %rcx
movq %r14, %r12
movq %rax, %r15
movq %rcx, %rbx
leaq 0x18(%rsp), %r14
movq 0x18(%r13), %rax
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
testq %rax, %rax
je 0x6e5cb
movq 0x30(%rsp), %rcx
movq %r13, %r8
callq *%rax
jmp 0x6e5d8
movq 0x30(%rsp), %rcx
movq %r13, %r8
callq 0x67631
testl %eax, %eax
jne 0x6e690
cmpq $0x0, 0x18(%rsp)
je 0x6e65e
xorl %r14d, %r14d
movq %r15, %r8
movq %rbx, %rcx
movq 0x10(%rsp), %rax
movb (%rax,%r14), %bpl
leaq 0x1(%r12), %r15
cmpq %r15, %rcx
jae 0x6e63e
leaq (%rcx,%rcx), %rax
leaq (%r15,%r15,2), %rbx
shrq %rbx
cmpq %r15, %rax
cmovbq %r15, %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r12, 0x8(%rsp)
movq %r8, %r12
movq %rcx, %r13
callq 0x3a730
movq %r13, %rcx
movq %r12, %r8
movq 0x8(%rsp), %r12
testq %rax, %rax
jne 0x6e644
jmp 0x6e652
movq %r8, %rax
movq %rcx, %rbx
movb %bpl, -0x1(%rax,%r15)
movq %rbx, %rcx
movq %r15, %r12
movq %rax, %r8
incq %r14
cmpq 0x18(%rsp), %r14
jne 0x6e5f1
jmp 0x6e661
movq %r15, %r8
movq 0x38(%rsp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x1a86c(%rip), %rcx     # 0x88edd
movq %rbx, %rdi
movl %r12d, %edx
movq %r8, %r15
callq 0x67b70
testl %eax, %eax
jne 0x6e68b
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
leaq 0x18(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq 0x10(%rsp), %rdi
callq 0x3a540
movq $0x0, 0x10(%rsp)
movq %r15, %rdi
callq 0x3a540
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq