// File: /workspace/github_cpp_makefile_star2_O3/mhe[P]raytracerframework_cpp/lodepng.cpp
// Function: addChunk_zTXt(ucvector*, char const*, char const*, LodeZlib_DeflateSettings*)
static unsigned addChunk_zTXt(ucvector* out, const char* keyword, const char* textstring, LodeZlib_DeflateSettings* 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]);
  ucvector_push_back(&data, 0); /* 0 termination char*/
  ucvector_push_back(&data, 0); /*compression method: 0*/
  
  error = LodePNG_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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, -0x38(%rbp)
movq %rsi, %rbx
movq %rdi, -0x78(%rbp)
movq %rdx, -0x50(%rbp)
movq %rdx, %rdi
callq 0x4120
movq %rax, -0x48(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movb (%rbx), %r14b
testb %r14b, %r14b
je 0x20a4f
incq %rbx
xorl %r13d, %r13d
xorl %esi, %esi
xorl %edi, %edi
leaq 0x1(%rsi), %r12
leaq 0x4(,%rsi,4), %rax
cmpq %r13, %rax
jbe 0x20a2e
leaq (,%r12,8), %r15
movq %rsi, -0x40(%rbp)
movq %r15, %rsi
movq %rdi, -0x30(%rbp)
callq 0x44f0
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdi
testq %rax, %rax
jne 0x20a34
jmp 0x20a42
movq %rdi, %rax
movq %r13, %r15
movb %r14b, -0x1(%rax,%r12)
movq %r15, %r13
movq %r12, %rsi
movq %rax, %rdi
movb (%rbx), %r14b
incq %rbx
testb %r14b, %r14b
jne 0x209f6
jmp 0x20a56
xorl %edi, %edi
xorl %esi, %esi
xorl %r13d, %r13d
leaq 0x1(%rsi), %rdx
leaq 0x4(,%rsi,4), %r14
cmpq %r13, %r14
jbe 0x20a9e
movq %r13, -0x30(%rbp)
leaq (,%rdx,8), %r15
movq %rsi, %r13
movq %r15, %rsi
movq %rdi, %r12
movq %rdx, %rbx
callq 0x44f0
movq %r13, %rsi
movq %rbx, %rdx
testq %rax, %rax
jne 0x20aa4
movq %rdx, %rbx
movq %rsi, %rdx
movq %r12, %rdi
movq -0x30(%rbp), %r15
jmp 0x20aba
movq %rdi, %rax
movq %r13, %r15
movb $0x0, (%rax,%rsi)
leaq 0x8(,%rsi,4), %r14
addq $0x2, %rsi
movq %rsi, %rbx
movq %rax, %rdi
cmpq %r15, %r14
jbe 0x20aec
movq %rdx, %r13
movq %r15, -0x30(%rbp)
leaq (,%rbx,8), %r15
movq %rdi, %r14
movq %r15, %rsi
callq 0x44f0
testq %rax, %rax
movq -0x38(%rbp), %r8
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
jne 0x20afb
jmp 0x20b0a
movq %rdi, %rax
movq -0x38(%rbp), %r8
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
movb $0x0, -0x1(%rax,%rbx)
movq %r15, -0x30(%rbp)
movq %rbx, %r13
movq %rax, %r14
leaq -0x68(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x1be80
testl %eax, %eax
jne 0x20bde
movq -0x68(%rbp), %rsi
testq %rsi, %rsi
je 0x20bb2
xorl %r12d, %r12d
movq %r14, %r8
movq -0x30(%rbp), %rcx
movq %r13, %rdx
movq -0x70(%rbp), %rax
movb (%rax,%r12), %dil
leaq 0x1(%rdx), %r14
leaq 0x4(,%rdx,4), %rax
cmpq %rcx, %rax
jbe 0x20b90
leaq (,%r14,8), %r15
movb %dil, -0x38(%rbp)
movq %r8, %rdi
movq %rsi, -0x40(%rbp)
movq %r15, %rsi
movq %r8, %rbx
movq %rcx, %r13
movq %rdx, -0x30(%rbp)
callq 0x44f0
movb -0x38(%rbp), %dil
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq %r13, %rcx
movq %rbx, %r8
testq %rax, %rax
jne 0x20b96
jmp 0x20ba8
movq %r8, %rax
movq %rcx, %r15
movb %dil, -0x1(%rax,%r14)
movq -0x68(%rbp), %rsi
movq %r15, %rcx
movq %r14, %rdx
movq %rax, %r8
incq %r12
cmpq %rsi, %r12
jb 0x20b39
jmp 0x20bb8
movq %r14, %r8
movq %r13, %rdx
movq -0x78(%rbp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x10016(%rip), %rcx     # 0x30bdd
movq %rbx, %rdi
movq %r8, %r14
callq 0x1c3c3
testl %eax, %eax
jne 0x20bde
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq -0x70(%rbp), %rdi
callq 0x4380
movq %r14, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4380