// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/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]);
  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 %r8, 0x48(%rsp)
movq %rcx, %r12
movq %rdx, %rbx
movl %esi, 0x14(%rsp)
movq %rdi, 0x28(%rsp)
movq %r9, 0x50(%rsp)
movq %r9, %rdi
callq 0x20d0
movq %rax, 0x20(%rsp)
movb (%rbx), %r15b
testb %r15b, %r15b
je 0xaf65
incq %rbx
xorl %eax, %eax
xorl %r13d, %r13d
xorl %r8d, %r8d
leaq 0x1(%r13), %r14
cmpq %r14, %rax
jae 0xaf3c
movq %rax, 0x8(%rsp)
leaq (%r14,%r14), %rbp
movq %r8, %rdi
movq %rbp, %rsi
movq %r8, 0x18(%rsp)
callq 0x2320
testq %rax, %rax
je 0xaf43
xorl %ecx, %ecx
movq %rax, %r8
movq %r14, %r13
movq %rbp, %rax
jmp 0xaf4f
xorl %ecx, %ecx
movq %r14, %r13
jmp 0xaf4f
movb $0x1, %cl
movq 0x18(%rsp), %r8
movq 0x8(%rsp), %rax
testb %cl, %cl
jne 0xaf58
movb %r15b, -0x1(%r8,%r13)
movb (%rbx), %r15b
incq %rbx
testb %r15b, %r15b
jne 0xaf08
jmp 0xaf6d
xorl %r8d, %r8d
xorl %r13d, %r13d
xorl %eax, %eax
leaq 0x1(%r13), %r15
cmpq %r15, %rax
jae 0xaf9a
movq %rax, %rbp
leaq (%r15,%r15), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r14
callq 0x2320
testq %rax, %rax
je 0xaf9e
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rax
jmp 0xafa9
xorl %ecx, %ecx
jmp 0xafa9
movb $0x1, %cl
movq %r13, %r15
movq %r14, %r8
movq %rbp, %rax
testb %cl, %cl
jne 0xafb3
movb $0x0, -0x1(%r8,%r15)
cmpl $0x0, 0x14(%rsp)
setne %bpl
leaq 0x1(%r15), %r14
cmpq %r14, %rax
jae 0xafeb
movq %rax, 0x8(%rsp)
leaq (%r14,%r14), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r13
callq 0x2320
testq %rax, %rax
je 0xafef
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rax
jmp 0xaffc
xorl %ecx, %ecx
jmp 0xaffc
movb $0x1, %cl
movq %r15, %r14
movq %r13, %r8
movq 0x8(%rsp), %rax
testb %cl, %cl
jne 0xb005
movb %bpl, -0x1(%r8,%r14)
leaq 0x1(%r14), %rbp
cmpq %rbp, %rax
jae 0xb036
movq %rax, %r13
leaq (,%rbp,2), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r15
callq 0x2320
testq %rax, %rax
je 0xb03a
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rax
jmp 0xb045
xorl %ecx, %ecx
jmp 0xb045
movb $0x1, %cl
movq %r14, %rbp
movq %r15, %r8
movq %r13, %rax
testb %cl, %cl
jne 0xb04f
movb $0x0, -0x1(%r8,%rbp)
movb (%r12), %r14b
testb %r14b, %r14b
je 0xb0b9
incq %r12
leaq 0x1(%rbp), %r15
cmpq %r15, %rax
jae 0xb090
movq %rbp, 0x8(%rsp)
movq %rax, %rbp
leaq (%r15,%r15), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r13
callq 0x2320
testq %rax, %rax
je 0xb097
xorl %ecx, %ecx
movq %rax, %r8
movq %r15, %rbp
movq %rbx, %rax
jmp 0xb0a4
xorl %ecx, %ecx
movq %r15, %rbp
jmp 0xb0a4
movb $0x1, %cl
movq %r13, %r8
movq %rbp, %rax
movq 0x8(%rsp), %rbp
testb %cl, %cl
jne 0xb0ad
movb %r14b, -0x1(%r8,%rbp)
movb (%r12), %r14b
incq %r12
testb %r14b, %r14b
jne 0xb05b
leaq 0x1(%rbp), %r13
cmpq %r13, %rax
jae 0xb0ea
movq %rax, %r15
leaq (,%r13,2), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r14
callq 0x2320
testq %rax, %rax
je 0xb0ee
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rax
jmp 0xb0f9
xorl %ecx, %ecx
jmp 0xb0f9
movb $0x1, %cl
movq %rbp, %r13
movq %r14, %r8
movq %r15, %rax
testb %cl, %cl
jne 0xb103
movb $0x0, -0x1(%r8,%r13)
movq 0x48(%rsp), %r12
movb (%r12), %bpl
testb %bpl, %bpl
je 0xb172
incq %r12
leaq 0x1(%r13), %r14
cmpq %r14, %rax
jae 0xb149
movq %r13, 0x8(%rsp)
movq %rax, %r13
leaq (%r14,%r14), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r15
callq 0x2320
testq %rax, %rax
je 0xb150
xorl %ecx, %ecx
movq %rax, %r8
movq %r14, %r13
movq %rbx, %rax
jmp 0xb15d
xorl %ecx, %ecx
movq %r14, %r13
jmp 0xb15d
movb $0x1, %cl
movq %r15, %r8
movq %r13, %rax
movq 0x8(%rsp), %r13
testb %cl, %cl
jne 0xb166
movb %bpl, -0x1(%r8,%r13)
movb (%r12), %bpl
incq %r12
testb %bpl, %bpl
jne 0xb114
leaq 0x1(%r13), %rbp
cmpq %rbp, %rax
jae 0xb1a3
movq %rax, %r15
leaq (,%rbp,2), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r14
callq 0x2320
testq %rax, %rax
je 0xb1a7
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rax
jmp 0xb1b2
xorl %ecx, %ecx
jmp 0xb1b2
movb $0x1, %cl
movq %r13, %rbp
movq %r14, %r8
movq %r15, %rax
testb %cl, %cl
jne 0xb1bc
movb $0x0, -0x1(%r8,%rbp)
cmpl $0x0, 0x14(%rsp)
movq 0x50(%rsp), %r15
je 0xb204
movq %rax, %r14
movq %r8, %r12
movq 0x90(%rsp), %r8
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rsi
movaps %xmm0, -0x8(%rsi)
movq $0x0, 0x8(%rsi)
movq 0x10(%r8), %rax
leaq 0x30(%rsp), %rdi
movq %r15, %rdx
testq %rax, %rax
je 0xb279
movq 0x20(%rsp), %rcx
callq *%rax
jmp 0xb283
movb (%r15), %r14b
movb $0x1, %cl
testb %r14b, %r14b
je 0xb318
incq %r15
leaq 0x1(%rbp), %r12
cmpq %r12, %rax
jae 0xb24a
movq %rbp, 0x8(%rsp)
movq %rax, %rbp
leaq (%r12,%r12), %rbx
movq %r8, %rdi
movq %rbx, %rsi
movq %r8, %r13
callq 0x2320
testq %rax, %rax
je 0xb251
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rbp
movq %rbx, %rax
jmp 0xb25e
xorl %ecx, %ecx
movq %r12, %rbp
jmp 0xb25e
movb $0x1, %cl
movq %r13, %r8
movq %rbp, %rax
movq 0x8(%rsp), %rbp
testb %cl, %cl
jne 0xb267
movb %r14b, -0x1(%r8,%rbp)
movb (%r15), %r14b
incq %r15
testb %r14b, %r14b
jne 0xb215
movb $0x1, %cl
jmp 0xb318
movq 0x20(%rsp), %rcx
callq 0x5296
testl %eax, %eax
movl %eax, 0x18(%rsp)
jne 0xb2f8
cmpq $0x0, 0x38(%rsp)
je 0xb2f8
movq %r14, %rbx
xorl %r14d, %r14d
movq 0x30(%rsp), %rax
movb (%rax,%r14), %r15b
leaq 0x1(%rbp), %r13
cmpq %r13, %rbx
jae 0xb2d2
movq %rbp, 0x8(%rsp)
movq %rbx, %rbp
leaq (,%r13,2), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2320
testq %rax, %rax
je 0xb2ec
xorl %ecx, %ecx
movq %rax, %r12
jmp 0xb2d4
xorl %ecx, %ecx
movq %r13, %rbp
testb %cl, %cl
jne 0xb2e0
movb %r15b, -0x1(%r12,%rbp)
incq %r14
cmpq 0x38(%rsp), %r14
jb 0xb299
jmp 0xb2f8
movb $0x1, %cl
movq %rbp, %rbx
movq 0x8(%rsp), %rbp
jmp 0xb2d7
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rax
movups %xmm0, (%rax)
movq 0x30(%rsp), %rdi
callq 0x2220
movq %r12, %r8
cmpl $0x0, 0x18(%rsp)
sete %cl
testb %cl, %cl
je 0xb34a
movq 0x28(%rsp), %rdi
leaq 0x8(%rdi), %rsi
leaq 0x810c(%rip), %rcx      # 0x13438
movl %ebp, %edx
movq %r8, %rbx
callq 0x579a
movq %rbx, %r8
testl %eax, %eax
jne 0xb34a
movq 0x28(%rsp), %rcx
movq 0x8(%rcx), %rax
movq %rax, 0x10(%rcx)
movq %r8, %rdi
callq 0x2220
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq