// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %rcx, -0x70(%rbp)
movq %rsi, %rbx
movq %rdi, -0x58(%rbp)
movq %rdx, -0x68(%rbp)
movq %rdx, %rdi
callq 0x5120
movq %rax, -0x60(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movb (%rbx), %r14b
testb %r14b, %r14b
je 0x21d61
incq %rbx
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %edi, %edi
leaq 0x1(%r13), %r12
leaq 0x4(,%r13,4), %rax
cmpq %r15, %rax
jbe 0x21d3a
movq %r15, -0x38(%rbp)
leaq (,%r12,8), %r15
movq %r15, %rsi
movq %rdi, -0x30(%rbp)
callq 0x5500
testq %rax, %rax
je 0x21d55
xorl %ecx, %ecx
movq %rax, %rdi
jmp 0x21d3c
xorl %ecx, %ecx
movq %r12, %r13
testb %cl, %cl
jne 0x21d48
movb %r14b, -0x1(%rdi,%r13)
movb (%rbx), %r14b
incq %rbx
testb %r14b, %r14b
jne 0x21d05
jmp 0x21d69
movb $0x1, %cl
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %r15
jmp 0x21d3f
xorl %edi, %edi
xorl %r13d, %r13d
xorl %r15d, %r15d
leaq 0x1(%r13), %r14
leaq 0x4(,%r13,4), %rax
cmpq %r15, %rax
jbe 0x21d9f
movq %r15, %r12
leaq (,%r14,8), %rbx
movq %rbx, %rsi
movq %rdi, %r15
callq 0x5500
testq %rax, %rax
je 0x21da3
xorl %ecx, %ecx
movq %rax, %rdi
movq %rbx, %r15
jmp 0x21dae
xorl %ecx, %ecx
jmp 0x21dae
movb $0x1, %cl
movq %r13, %r14
movq %r15, %rdi
movq %r12, %r15
testb %cl, %cl
jne 0x21db8
movb $0x0, -0x1(%rdi,%r14)
leaq 0x1(%r14), %rbx
leaq 0x4(,%r14,4), %rax
cmpq %r15, %rax
jbe 0x21deb
movq %r15, %r13
leaq (,%rbx,8), %r15
movq %r15, %rsi
movq %rdi, %r12
callq 0x5500
testq %rax, %rax
je 0x21def
xorl %ecx, %ecx
movq %rax, %rdi
jmp 0x21dfa
xorl %ecx, %ecx
jmp 0x21dfa
movb $0x1, %cl
movq %r14, %rbx
movq %r12, %rdi
movq %r13, %r15
movq %r15, %r12
testb %cl, %cl
jne 0x21e06
movb $0x0, -0x1(%rdi,%rbx)
movq %rdi, %r15
leaq -0x48(%rbp), %r14
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movq -0x68(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x70(%rbp), %r8
callq 0x1cf1d
testl %eax, %eax
jne 0x21ece
cmpq $0x0, -0x48(%rbp)
je 0x21e9f
xorl %r14d, %r14d
movq %r15, %r8
movq -0x50(%rbp), %rax
movb (%rax,%r14), %r15b
leaq 0x1(%rbx), %r13
leaq 0x4(,%rbx,4), %rax
cmpq %r12, %rax
jbe 0x21e7a
movq %r12, -0x38(%rbp)
leaq (,%r13,8), %r12
movq %r8, %rdi
movq %r12, %rsi
movq %r8, -0x30(%rbp)
callq 0x5500
testq %rax, %rax
je 0x21e93
xorl %ecx, %ecx
movq %rax, %r8
jmp 0x21e7c
xorl %ecx, %ecx
movq %r13, %rbx
testb %cl, %cl
jne 0x21e88
movb %r15b, -0x1(%r8,%rbx)
incq %r14
cmpq -0x48(%rbp), %r14
jb 0x21e3a
jmp 0x21ea2
movb $0x1, %cl
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r12
jmp 0x21e7f
movq %r15, %r8
movq -0x58(%rbp), %r14
leaq 0x8(%r14), %rsi
leaq 0xfd1c(%rip), %rcx      # 0x31bcd
movq %r14, %rdi
movl %ebx, %edx
movq %r8, %r15
callq 0x1d440
testl %eax, %eax
jne 0x21eca
movq 0x8(%r14), %rax
movq %rax, 0x10(%r14)
leaq -0x48(%rbp), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq -0x50(%rbp), %rdi
callq 0x5390
movq $0x0, -0x50(%rbp)
movq %r15, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5390