// File: /workspace/github_cpp_makefile_star2_O1/phillip-h[P]fractal-gen/lodepng.cpp
// Function: addChunk_iTXt(ucvector*, unsigned int, char const*, char const*, char const*, char const*, LodePNGCompressSettings*)
static unsigned addChunk_iTXt(ucvector* out, unsigned compressed, const char* keyword, const char* langtag,
                              const char* transkey, const char* textstring, LodePNGCompressSettings* zlibsettings)
{
  unsigned error = 0;
  ucvector data;
  size_t i, textsize = strlen(textstring);

  ucvector_init(&data);

  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); /*null termination char*/
  ucvector_push_back(&data, compressed ? 1 : 0); /*compression flag*/
  ucvector_push_back(&data, 0); /*compression method*/
  for(i = 0; langtag[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)langtag[i]);
  ucvector_push_back(&data, 0); /*null termination char*/
  for(i = 0; transkey[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)transkey[i]);
  ucvector_push_back(&data, 0); /*null termination char*/

  if(compressed)
  {
    ucvector compressed_data;
    ucvector_init(&compressed_data);
    error = zlib_compress(&compressed_data.data, &compressed_data.size,
                          (unsigned char*)textstring, textsize, zlibsettings);
    if(!error)
    {
      for(i = 0; i != compressed_data.size; ++i) ucvector_push_back(&data, compressed_data.data[i]);
    }
    ucvector_cleanup(&compressed_data);
  }
  else /*not compressed*/
  {
    for(i = 0; textstring[i] != 0; ++i) ucvector_push_back(&data, (unsigned char)textstring[i]);
  }

  if(!error) error = addChunk(out, "iTXt", data.data, data.size);
  ucvector_cleanup(&data);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %rbx
movq %r8, 0x50(%rsp)
movq %rcx, %r14
movq %rdx, %r13
movl %esi, 0xc(%rsp)
movq %rdi, 0x28(%rsp)
movq %r9, %rdi
callq 0x2090
movq %rax, 0x20(%rsp)
movb (%r13), %r15b
testb %r15b, %r15b
movq %rbx, 0x18(%rsp)
movq %r14, 0x48(%rsp)
je 0xcbc8
movq $-0x1, %r14
xorl %edx, %edx
xorl %r12d, %r12d
xorl %r8d, %r8d
movq %r13, 0x10(%rsp)
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0xcb91
movq %r12, %r13
leaq (%rdx,%rdx), %rax
leaq (%rbx,%rbx,2), %r12
shrq %r12
cmpq %rbx, %rax
cmovbq %rbx, %r12
movq %r8, %rdi
movq %rdx, (%rsp)
movq %r12, %rsi
movq %r8, %rbp
callq 0x2260
testq %rax, %rax
je 0xcb95
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r13, %r12
jmp 0xcba1
xorl %ecx, %ecx
jmp 0xcba6
movb $0x1, %cl
movq %r13, %r12
movq %rbp, %r8
movq (%rsp), %rdx
movq 0x10(%rsp), %r13
testb %cl, %cl
jne 0xcbb2
movb %r15b, -0x1(%r8,%rbx)
movq %rbx, %r12
movb 0x2(%r13,%r14), %r15b
incq %r14
testb %r15b, %r15b
jne 0xcb4e
cmpq $0x4f, %r14
setae %al
jmp 0xcbd2
movb $0x1, %al
xorl %r8d, %r8d
xorl %r12d, %r12d
xorl %edx, %edx
testb %al, %al
jne 0xd063
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0xcc1c
movq %r12, %r14
leaq (%rdx,%rdx), %rax
leaq (%rbx,%rbx,2), %r12
shrq %r12
cmpq %rbx, %rax
cmovbq %rbx, %r12
movq %r8, %rdi
movq %rdx, %r13
movq %r12, %rsi
movq %r8, %r15
callq 0x2260
testq %rax, %rax
je 0xcc20
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0xcc2b
xorl %ecx, %ecx
jmp 0xcc2b
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
jne 0xcc38
movb $0x0, -0x1(%r8,%rbx)
movq %rbx, %r12
cmpl $0x0, 0xc(%rsp)
setne %bl
leaq 0x1(%r12), %r14
cmpq %r14, %rdx
jae 0xcc82
movq %r12, %r15
leaq (%rdx,%rdx), %rax
leaq (%r14,%r14,2), %r12
shrq %r12
cmpq %r14, %rax
cmovbq %r14, %r12
movq %r8, %rdi
movq %rdx, %rbp
movq %r12, %rsi
movq %r8, %r13
callq 0x2260
testq %rax, %rax
je 0xcc86
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r15, %r12
jmp 0xcc91
xorl %ecx, %ecx
jmp 0xcc91
movb $0x1, %cl
movq %r15, %r12
movq %r13, %r8
movq %rbp, %rdx
testb %cl, %cl
jne 0xcc9d
movb %bl, -0x1(%r8,%r14)
movq %r14, %r12
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0xccdf
movq %r12, %r14
leaq (%rdx,%rdx), %rax
leaq (%rbx,%rbx,2), %r12
shrq %r12
cmpq %rbx, %rax
cmovbq %rbx, %r12
movq %r8, %rdi
movq %rdx, %r13
movq %r12, %rsi
movq %r8, %r15
callq 0x2260
testq %rax, %rax
je 0xcce3
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0xccee
xorl %ecx, %ecx
jmp 0xccee
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
movq 0x48(%rsp), %r13
jne 0xcd00
movb $0x0, -0x1(%r8,%rbx)
movq %rbx, %r12
movb (%r13), %bpl
testb %bpl, %bpl
je 0xcd77
incq %r13
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0xcd4f
movq %r12, %r14
leaq (%rdx,%rdx), %rax
leaq (%rbx,%rbx,2), %r12
shrq %r12
cmpq %rbx, %rax
cmovbq %rbx, %r12
movq %r8, %rdi
movq %rdx, (%rsp)
movq %r12, %rsi
movq %r8, %r15
callq 0x2260
testq %rax, %rax
je 0xcd53
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0xcd5f
xorl %ecx, %ecx
jmp 0xcd5f
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq (%rsp), %rdx
testb %cl, %cl
jne 0xcd6b
movb %bpl, -0x1(%r8,%rbx)
movq %rbx, %r12
movb (%r13), %bpl
incq %r13
testb %bpl, %bpl
jne 0xcd0c
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0xcdb9
movq %r12, %r14
leaq (%rdx,%rdx), %rax
leaq (%rbx,%rbx,2), %r12
shrq %r12
cmpq %rbx, %rax
cmovbq %rbx, %r12
movq %r8, %rdi
movq %rdx, %r13
movq %r12, %rsi
movq %r8, %r15
callq 0x2260
testq %rax, %rax
je 0xcdbd
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0xcdc8
xorl %ecx, %ecx
jmp 0xcdc8
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
jne 0xcdd5
movb $0x0, -0x1(%r8,%rbx)
movq %rbx, %r12
movq 0x50(%rsp), %r13
movb (%r13), %bpl
testb %bpl, %bpl
je 0xce51
incq %r13
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0xce29
movq %r12, %r14
leaq (%rdx,%rdx), %rax
leaq (%rbx,%rbx,2), %r12
shrq %r12
cmpq %rbx, %rax
cmovbq %rbx, %r12
movq %r8, %rdi
movq %rdx, (%rsp)
movq %r12, %rsi
movq %r8, %r15
callq 0x2260
testq %rax, %rax
je 0xce2d
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0xce39
xorl %ecx, %ecx
jmp 0xce39
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq (%rsp), %rdx
testb %cl, %cl
jne 0xce45
movb %bpl, -0x1(%r8,%rbx)
movq %rbx, %r12
movb (%r13), %bpl
incq %r13
testb %bpl, %bpl
jne 0xcde6
leaq 0x1(%r12), %r14
cmpq %r14, %rdx
jae 0xce8d
leaq (%rdx,%rdx), %rax
leaq (%r14,%r14,2), %rbx
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %r8, %rdi
movq %rdx, %r13
movq %rbx, %rsi
movq %r8, %r15
callq 0x2260
testq %rax, %rax
je 0xce91
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rdx
jmp 0xce99
xorl %ecx, %ecx
jmp 0xce99
movb $0x1, %cl
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
movq 0x18(%rsp), %rbp
jne 0xceab
movb $0x0, -0x1(%r8,%r14)
movq %r14, %r12
cmpl $0x0, 0xc(%rsp)
je 0xcef9
movq %rdx, %r14
movq %r8, %rbp
movq 0x90(%rsp), %r8
vxorps %xmm0, %xmm0, %xmm0
leaq 0x38(%rsp), %rsi
vmovaps %xmm0, -0x8(%rsi)
movq $0x0, 0x8(%rsi)
movq 0x18(%r8), %rax
leaq 0x30(%rsp), %rdi
testq %rax, %rax
je 0xcf74
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq *%rax
jmp 0xcf83
movb (%rbp), %r14b
movb $0x1, %cl
testb %r14b, %r14b
je 0xd028
incq %rbp
leaq 0x1(%r12), %r15
cmpq %r15, %rdx
jae 0xcf48
leaq (%rdx,%rdx), %rax
leaq (%r15,%r15,2), %rbx
shrq %rbx
cmpq %r15, %rax
cmovbq %r15, %rbx
movq %r8, %rdi
movq %rdx, (%rsp)
movq %rbx, %rsi
movq %r8, %r13
callq 0x2260
testq %rax, %rax
je 0xcf4c
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rdx
jmp 0xcf55
xorl %ecx, %ecx
jmp 0xcf55
movb $0x1, %cl
movq %r13, %r8
movq (%rsp), %rdx
testb %cl, %cl
jne 0xcf61
movb %r14b, -0x1(%r8,%r15)
movq %r15, %r12
movb (%rbp), %r14b
incq %rbp
testb %r14b, %r14b
jne 0xcf0b
movb $0x1, %cl
jmp 0xd028
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x6f94
testl %eax, %eax
movl %eax, 0x10(%rsp)
jne 0xd006
cmpq $0x0, 0x38(%rsp)
je 0xd006
movq %r14, %rsi
xorl %r14d, %r14d
movq 0x30(%rsp), %rax
movb (%rax,%r14), %r15b
leaq 0x1(%r12), %r13
cmpq %r13, %rsi
jae 0xcfe3
movq %r12, %rbx
leaq (%rsi,%rsi), %rax
leaq (%r13,%r13,2), %r12
shrq %r12
cmpq %r13, %rax
cmovbq %r13, %r12
movq %rbp, %rdi
movq %rsi, (%rsp)
movq %r12, %rsi
callq 0x2260
testq %rax, %rax
je 0xcfe7
xorl %ecx, %ecx
movq %rax, %rbp
movq %r12, %rsi
movq %rbx, %r12
jmp 0xcff0
xorl %ecx, %ecx
jmp 0xcff0
movb $0x1, %cl
movq %rbx, %r12
movq (%rsp), %rsi
testb %cl, %cl
jne 0xcffc
movb %r15b, -0x1(%rbp,%r13)
movq %r13, %r12
incq %r14
cmpq 0x38(%rsp), %r14
jne 0xcf99
vxorps %xmm0, %xmm0, %xmm0
leaq 0x38(%rsp), %rax
vmovups %xmm0, (%rax)
movq 0x30(%rsp), %rdi
callq 0x21b0
movq %rbp, %r8
cmpl $0x0, 0x10(%rsp)
sete %cl
testb %cl, %cl
je 0xd05b
movq 0x28(%rsp), %rdi
leaq 0x8(%rdi), %rsi
leaq 0x61da(%rip), %rcx      # 0x13216
movl %r12d, %edx
movq %r8, %rbx
callq 0x74cd
movq %rbx, %r8
testl %eax, %eax
jne 0xd05b
movq 0x28(%rsp), %rcx
movq 0x8(%rcx), %rax
movq %rax, 0x10(%rcx)
movq %r8, %rdi
callq 0x21b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq