// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %r9, %rdi
movq %r8, 0x30(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, %r14
movl %esi, 0x14(%rsp)
movq %r9, 0x38(%rsp)
callq 0x2090
movb (%r14), %r13b
movq %rax, 0x28(%rsp)
testb %r13b, %r13b
je 0xcfad
movq $-0x1, %rbx
xorl %ecx, %ecx
xorl %r15d, %r15d
xorl %edi, %edi
movq %r14, 0x20(%rsp)
leaq 0x1(%r15), %r12
cmpq %r12, %rcx
jae 0xcb42
leaq (%r12,%r12,2), %rbp
leaq (%rcx,%rcx), %rax
movq %r15, 0x8(%rsp)
movq %rdi, %r14
movq %rcx, %r15
shrq %rbp
cmpq %r12, %rax
cmovbq %r12, %rbp
movq %rbp, %rsi
callq 0x2260
movq %r15, %rcx
movq %r14, %rdi
movq 0x8(%rsp), %r15
movq 0x20(%rsp), %r14
testq %rax, %rax
jne 0xcb48
jmp 0xcb56
movq %rdi, %rax
movq %rcx, %rbp
movb %r13b, -0x1(%rax,%r12)
movq %rbp, %rcx
movq %rax, %rdi
movq %r12, %r15
movb 0x2(%r14,%rbx), %r13b
incq %rbx
testb %r13b, %r13b
jne 0xcafd
cmpq $0x4e, %rbx
ja 0xcfad
leaq 0x1(%r15), %r14
cmpq %r14, %rcx
jae 0xcba9
leaq (%r14,%r14,2), %rbp
leaq (%rcx,%rcx), %rax
movq %rdi, %rbx
movq %rcx, %r12
shrq %rbp
cmpq %r14, %rax
cmovbq %r14, %rbp
movq %rbp, %rsi
callq 0x2260
testq %rax, %rax
jne 0xcbaf
movq %r14, %rdx
movq %r15, %r14
movq %rbx, %rdi
movq %r12, %rcx
jmp 0xcbc1
movq %rdi, %rax
movq %rcx, %rbp
movb $0x0, (%rax,%r15)
addq $0x2, %r15
movq %rbp, %rcx
movq %rax, %rdi
movq %r15, %rdx
cmpl $0x0, 0x14(%rsp)
setne %bl
cmpq %rdx, %rcx
jae 0xcc07
leaq (%rdx,%rdx,2), %rbp
leaq (%rcx,%rcx), %rax
movq %rdi, %r15
movq %rcx, %r12
movq %rdx, %r13
shrq %rbp
cmpq %rdx, %rax
cmovbq %rdx, %rbp
movq %rbp, %rsi
callq 0x2260
movq %r13, %rdx
testq %rax, %rax
jne 0xcc0d
movq %rdx, %rbx
movq %r14, %rdx
movq %r15, %rdi
movq %r12, %rcx
jmp 0xcc1b
movq %rdi, %rax
movq %rcx, %rbp
movb %bl, -0x1(%rax,%rdx)
leaq 0x1(%rdx), %rbx
movq %rbp, %rcx
movq %rax, %rdi
cmpq %rbx, %rcx
jae 0xcc58
leaq (%rbx,%rbx,2), %rbp
leaq (%rcx,%rcx), %rax
movq %rdi, %r14
movq %rcx, %r15
movq %rdx, %r12
shrq %rbp
cmpq %rbx, %rax
cmovbq %rbx, %rbp
movq %rbp, %rsi
callq 0x2260
movq 0x18(%rsp), %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r14, %rdi
testq %rax, %rax
jne 0xcc63
jmp 0xcc71
movq 0x18(%rsp), %rsi
movq %rdi, %rax
movq %rcx, %rbp
movb $0x0, -0x1(%rax,%rbx)
movq %rbp, %rcx
movq %rax, %rdi
movq %rbx, %rdx
movb (%rsi), %bl
testb %bl, %bl
je 0xccdd
incq %rsi
leaq 0x1(%rdx), %r14
cmpq %r14, %rcx
jae 0xccc0
leaq (%r14,%r14,2), %rbp
leaq (%rcx,%rcx), %rax
movq %rsi, 0x18(%rsp)
movq %rdi, %r15
movq %rcx, %r12
movq %rdx, %r13
shrq %rbp
cmpq %r14, %rax
cmovbq %r14, %rbp
movq %rbp, %rsi
callq 0x2260
movq 0x18(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %rdi
testq %rax, %rax
jne 0xccc6
jmp 0xccd4
movq %rdi, %rax
movq %rcx, %rbp
movb %bl, -0x1(%rax,%r14)
movq %rbp, %rcx
movq %rax, %rdi
movq %r14, %rdx
movb (%rsi), %bl
incq %rsi
testb %bl, %bl
jne 0xcc7a
leaq 0x1(%rdx), %rbx
cmpq %rbx, %rcx
jae 0xcd1e
leaq (%rbx,%rbx,2), %r13
leaq (%rcx,%rcx), %rax
movq %rdi, %r14
movq %rcx, %r15
movq %rdx, %r12
shrq %r13
cmpq %rbx, %rax
cmovbq %rbx, %r13
movq %r13, %rsi
callq 0x2260
movq %r15, %rcx
movq 0x30(%rsp), %r15
movq %r12, %rdx
movq %r14, %rdi
testq %rax, %rax
jne 0xcd29
jmp 0xcd37
movq 0x30(%rsp), %r15
movq %rdi, %rax
movq %rcx, %r13
movb $0x0, -0x1(%rax,%rbx)
movq %r13, %rcx
movq %rax, %rdi
movq %rbx, %rdx
movb (%r15), %bl
testb %bl, %bl
je 0xcd9f
incq %r15
leaq 0x1(%rdx), %r14
cmpq %r14, %rcx
jae 0xcd81
leaq (%r14,%r14,2), %r13
leaq (%rcx,%rcx), %rax
movq %rdi, 0x8(%rsp)
movq %rcx, %r12
movq %rdx, %rbp
shrq %r13
cmpq %r14, %rax
cmovbq %r14, %r13
movq %r13, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
movq %r12, %rcx
testq %rax, %rax
jne 0xcd87
jmp 0xcd95
movq %rdi, %rax
movq %rcx, %r13
movb %bl, -0x1(%rax,%r14)
movq %r13, %rcx
movq %rax, %rdi
movq %r14, %rdx
movb (%r15), %bl
incq %r15
testb %bl, %bl
jne 0xcd41
leaq 0x1(%rdx), %r14
cmpq %r14, %rcx
jae 0xcde8
leaq (%r14,%r14,2), %rbx
leaq (%rcx,%rcx), %rax
movq %rdi, %r15
movq %rcx, %r12
movq %rdx, %r13
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %rbx, %rsi
callq 0x2260
movq %r13, %rdx
movq 0x38(%rsp), %r13
movq 0xa0(%rsp), %r8
movq %r12, %rcx
movq %r15, %r9
testq %rax, %rax
jne 0xcdfb
jmp 0xce0a
movq 0x38(%rsp), %r13
movq 0xa0(%rsp), %r8
movq %rdi, %rax
movq %rcx, %rbx
movb $0x0, -0x1(%rax,%r14)
movq %rbx, %rcx
movq %rax, %r9
movq %r14, %rdx
cmpl $0x0, 0x14(%rsp)
je 0xce51
leaq 0x48(%rsp), %rsi
vxorps %xmm0, %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movq %rdx, %r15
movq %rcx, %rbp
movq %r9, %r14
movq %r13, %rdx
vmovaps %xmm0, -0x8(%rsi)
movq $0x0, 0x8(%rsi)
movq 0x18(%r8), %rax
testq %rax, %rax
je 0xcec9
movq 0x28(%rsp), %rcx
callq *%rax
jmp 0xced3
movb (%r13), %bpl
testb %bpl, %bpl
je 0xcf78
incq %r13
leaq 0x1(%rdx), %r14
cmpq %r14, %rcx
jae 0xcea4
leaq (%r14,%r14,2), %rbx
leaq (%rcx,%rcx), %rax
movq %r9, %rdi
movq %r9, %r15
movq %rcx, %r12
movq %rdx, 0x8(%rsp)
shrq %rbx
cmpq %r14, %rax
cmovbq %r14, %rbx
movq %rbx, %rsi
callq 0x2260
movq 0x8(%rsp), %rdx
movq %r12, %rcx
movq %r15, %r9
testq %rax, %rax
jne 0xceaa
jmp 0xceb8
movq %r9, %rax
movq %rcx, %rbx
movb %bpl, -0x1(%rax,%r14)
movq %rbx, %rcx
movq %rax, %r9
movq %r14, %rdx
movb (%r13), %bpl
incq %r13
testb %bpl, %bpl
jne 0xce61
jmp 0xcf78
movq 0x28(%rsp), %rcx
callq 0x6f8b
movq %r14, %rcx
movq %r15, %r13
movl %eax, 0x20(%rsp)
testl %eax, %eax
jne 0xcf51
cmpq $0x0, 0x48(%rsp)
je 0xcf51
xorl %r12d, %r12d
movq 0x40(%rsp), %rax
leaq 0x1(%r13), %r14
movb (%rax,%r12), %sil
cmpq %r14, %rbp
jae 0xcf33
leaq (%r14,%r14,2), %r15
leaq (%rbp,%rbp), %rax
movq %rcx, %rdi
movb %sil, 0x8(%rsp)
movq %rcx, %rbx
shrq %r15
cmpq %r14, %rax
cmovbq %r14, %r15
movq %r15, %rsi
callq 0x2260
movb 0x8(%rsp), %sil
movq %rbx, %rcx
testq %rax, %rax
jne 0xcf39
jmp 0xcf47
movq %rcx, %rax
movq %rbp, %r15
movb %sil, -0x1(%rax,%r14)
movq %r15, %rbp
movq %rax, %rcx
movq %r14, %r13
incq %r12
cmpq 0x48(%rsp), %r12
jne 0xceec
vxorps %xmm0, %xmm0, %xmm0
leaq 0x48(%rsp), %rax
movq %rcx, %rbx
vmovups %xmm0, (%rax)
movq 0x40(%rsp), %rdi
callq 0x21b0
cmpl $0x0, 0x20(%rsp)
movq %r13, %rdx
movq %rbx, %r9
jne 0xcfa5
movq 0x60(%rsp), %rbx
leaq 0x62f2(%rip), %rcx      # 0x13276
movq %r9, %r14
movq %r9, %r8
leaq 0x8(%rbx), %rsi
movq %rbx, %rdi
callq 0x74dc
testl %eax, %eax
jne 0xcfa2
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq %r14, %r9
movq %r9, %rdi
callq 0x21b0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq