// File: /workspace/github_cpp_makefile_star2_O1/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 %rdi, 0x48(%rsp)
movq $-0x1, %r13
cmpb $0x0, 0x1(%rdx,%r13)
leaq 0x1(%r13), %r13
jne 0x6ec7e
movq %rdx, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movb (%rsi), %r12b
testb %r12b, %r12b
je 0x6ed44
movq %rcx, 0x50(%rsp)
movq $-0x1, %r14
xorl %ebx, %ebx
xorl %edx, %edx
xorl %edi, %edi
movq %rsi, 0x40(%rsp)
leaq 0x1(%rdx), %r15
cmpq %r15, %rbx
jae 0x6ed05
movq %rdx, 0x8(%rsp)
leaq (%rbx,%rbx), %rax
leaq (%r15,%r15,2), %rbp
shrq %rbp
cmpq %r15, %rax
cmovbq %r15, %rbp
movq %rbp, %rsi
movq %rbx, 0x30(%rsp)
movq %rdi, %rbx
callq 0x3a720
testq %rax, %rax
je 0x6ed0c
xorl %ecx, %ecx
movq %rax, %rdi
movq %r15, %rdx
movq %rbp, %rbx
jmp 0x6ed1b
xorl %ecx, %ecx
movq %r15, %rdx
jmp 0x6ed20
movb $0x1, %cl
movq %rbx, %rdi
movq 0x30(%rsp), %rbx
movq 0x8(%rsp), %rdx
movq 0x40(%rsp), %rsi
testb %cl, %cl
jne 0x6ed29
movb %r12b, -0x1(%rdi,%rdx)
movb 0x2(%rsi,%r14), %r12b
incq %r14
testb %r12b, %r12b
jne 0x6ecc3
cmpq $0x4f, %r14
setae %al
movq 0x50(%rsp), %rcx
jmp 0x6ed4c
movb $0x1, %al
xorl %edi, %edi
xorl %edx, %edx
xorl %ebx, %ebx
testb %al, %al
jne 0x6ef2b
movq %rcx, %rbp
leaq 0x1(%rdx), %r14
cmpq %r14, %rbx
jae 0x6ed94
movq %rdx, 0x8(%rsp)
leaq (%rbx,%rbx), %rax
leaq (%r14,%r14,2), %r15
shrq %r15
cmpq %r14, %rax
cmovbq %r14, %r15
movq %r15, %rsi
movq %rbx, %r12
movq %rdi, %rbx
callq 0x3a720
testq %rax, %rax
je 0x6ed98
xorl %ecx, %ecx
movq %rax, %rdi
movq %r15, %rbx
jmp 0x6eda5
xorl %ecx, %ecx
jmp 0x6eda5
movb $0x1, %cl
movq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r12, %rbx
testb %cl, %cl
jne 0x6edaf
movb $0x0, -0x1(%rdi,%r14)
leaq 0x1(%r14), %rdx
cmpq %rdx, %rbx
jae 0x6edec
leaq (%rbx,%rbx), %rax
movq %rbx, 0x30(%rsp)
leaq (%rdx,%rdx,2), %rbx
shrq %rbx
cmpq %rdx, %rax
movq %rdx, %r12
cmovbq %rdx, %rbx
movq %rbx, %rsi
movq %rdi, %r15
callq 0x3a720
testq %rax, %rax
je 0x6edf0
xorl %ecx, %ecx
movq %rax, %rdi
movq %r12, %rdx
jmp 0x6edfd
xorl %ecx, %ecx
jmp 0x6edfd
movb $0x1, %cl
movq %r14, %rdx
movq %r15, %rdi
movq 0x30(%rsp), %rbx
testb %cl, %cl
movq %rbp, %r8
jne 0x6ee09
movb $0x0, -0x1(%rdi,%rdx)
movq %rdx, %r12
movq %rdi, %r15
leaq 0x18(%rsp), %r14
movq 0x18(%r8), %rax
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
testq %rax, %rax
je 0x6ee31
movq 0x38(%rsp), %rdx
movq %r13, %rcx
callq *%rax
jmp 0x6ee3e
movq 0x38(%rsp), %rdx
movq %r13, %rcx
callq 0x67c2b
testl %eax, %eax
jne 0x6ef09
cmpq $0x0, 0x18(%rsp)
je 0x6eed7
xorl %r14d, %r14d
movq %r15, %r8
movq %r12, %rdx
movq 0x10(%rsp), %rax
movb (%rax,%r14), %r12b
leaq 0x1(%rdx), %r13
cmpq %r13, %rbx
jae 0x6eeae
movq %rdx, 0x8(%rsp)
leaq (%rbx,%rbx), %rax
leaq (,%r13,2), %r15
addq %r13, %r15
shrq %r15
cmpq %r13, %rax
cmovbq %r13, %r15
movq %r8, %rdi
movq %r15, %rsi
movq %rbx, %rbp
movq %r8, %rbx
callq 0x3a720
testq %rax, %rax
je 0x6eeb5
xorl %ecx, %ecx
movq %rax, %r8
movq %r13, %rdx
movq %r15, %rbx
jmp 0x6eec2
xorl %ecx, %ecx
movq %r13, %rdx
jmp 0x6eec2
movb $0x1, %cl
movq %rbx, %r8
movq %rbp, %rbx
movq 0x8(%rsp), %rdx
testb %cl, %cl
jne 0x6eecb
movb %r12b, -0x1(%r8,%rdx)
incq %r14
cmpq 0x18(%rsp), %r14
jne 0x6ee5b
jmp 0x6eedd
movq %r15, %r8
movq %r12, %rdx
movq 0x48(%rsp), %r14
leaq 0x8(%r14), %rsi
leaq 0x1afd0(%rip), %rcx     # 0x89ebd
movq %r14, %rdi
movq %r8, %r15
callq 0x68168
testl %eax, %eax
jne 0x6ef04
movq 0x8(%r14), %rax
movq %rax, 0x10(%r14)
leaq 0x18(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq 0x10(%rsp), %rdi
callq 0x3a530
movq $0x0, 0x10(%rsp)
movq %r15, %rdi
callq 0x3a530
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq