// File: /workspace/github_cpp_makefile_star2_O3/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, 0x20(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %r12
movl %esi, 0x14(%rsp)
movq %rdi, 0x50(%rsp)
movq %r9, 0x28(%rsp)
movq %r9, %rdi
callq 0x20d0
movq %rax, 0x18(%rsp)
movb (%r12), %r13b
testb %r13b, %r13b
je 0xae26
incq %r12
xorl %ecx, %ecx
xorl %ebx, %ebx
movq $0x0, (%rsp)
leaq 0x1(%rbx), %r15
cmpq %r15, %rcx
jae 0xae02
leaq (%r15,%r15), %rbp
movq (%rsp), %rdi
movq %rbp, %rsi
movq %rcx, %r14
callq 0x2320
movq %r14, %rcx
testq %rax, %rax
jne 0xae09
jmp 0xae18
movq (%rsp), %rax
movq %rcx, %rbp
movb %r13b, -0x1(%rax,%r15)
movq %rbp, %rcx
movq %r15, %rbx
movq %rax, (%rsp)
movb (%r12), %r13b
incq %r12
testb %r13b, %r13b
jne 0xaddc
jmp 0xae32
movq $0x0, (%rsp)
xorl %ebx, %ebx
xorl %ecx, %ecx
leaq 0x1(%rbx), %r13
cmpq %r13, %rcx
jae 0xae62
movq %rcx, %r15
leaq (,%r13,2), %rbp
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x2320
testq %rax, %rax
jne 0xae69
movq %r13, %r12
movq %rbx, %r13
movq %r15, %rbp
jmp 0xae78
movq (%rsp), %rax
movq %rcx, %rbp
movb $0x0, (%rax,%rbx)
addq $0x2, %rbx
movq %rbx, %r12
movq %rax, (%rsp)
cmpl $0x0, 0x14(%rsp)
setne %r14b
cmpq %r12, %rbp
jae 0xaeb3
movq %rbp, 0x48(%rsp)
leaq (%r12,%r12), %rbp
movq (%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2320
testq %rax, %rax
jne 0xaeb7
movq %r12, %r15
movq %r13, %r12
movq %rbx, %r13
movq 0x48(%rsp), %rcx
jmp 0xaec7
movq (%rsp), %rax
movb %r14b, -0x1(%rax,%r12)
leaq 0x1(%r12), %r15
movq %rbp, %rcx
movq %rax, %r13
cmpq %r15, %rcx
jae 0xaee8
leaq (%r15,%r15), %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %rcx, %r14
callq 0x2320
movq %r14, %rcx
testq %rax, %rax
jne 0xaeee
jmp 0xaefd
movq %r13, %rax
movq %rcx, %rbp
movb $0x0, -0x1(%rax,%r15)
movq %rbp, %rcx
movq %r15, %r12
movq %rax, %r13
movq 0x8(%rsp), %rax
movb (%rax), %r15b
testb %r15b, %r15b
je 0xaf6a
incq 0x8(%rsp)
leaq 0x1(%r12), %r14
cmpq %r14, %rcx
jae 0xaf41
leaq (%r14,%r14), %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %r13, %rbx
movq %r12, %r13
movq %rcx, %r12
callq 0x2320
movq %r12, %rcx
movq %r13, %r12
movq %rbx, %r13
testq %rax, %rax
jne 0xaf47
jmp 0xaf55
movq %r13, %rax
movq %rcx, %rbp
movb %r15b, -0x1(%rax,%r14)
movq %rbp, %rcx
movq %r14, %r12
movq %rax, %r13
movq 0x8(%rsp), %rax
movb (%rax), %r15b
incq %rax
movq %rax, 0x8(%rsp)
testb %r15b, %r15b
jne 0xaf0f
leaq 0x1(%r12), %r14
cmpq %r14, %rcx
jae 0xaf95
leaq (%r14,%r14), %rbx
movq %r13, %rdi
movq %rbx, %rsi
movq %rcx, %r15
callq 0x2320
movq %r15, %rcx
testq %rax, %rax
movq 0x20(%rsp), %r15
jne 0xafa0
jmp 0xafaf
movq %r13, %rax
movq %rcx, %rbx
movq 0x20(%rsp), %r15
movb $0x0, -0x1(%rax,%r14)
movq %rbx, %rcx
movq %r14, %r12
movq %rax, %r13
movb (%r15), %bpl
testb %bpl, %bpl
je 0xb00d
incq %r15
leaq 0x1(%r12), %r14
cmpq %r14, %rcx
jae 0xafee
leaq (%r14,%r14), %rbx
movq %r13, %rdi
movq %rbx, %rsi
movq %r13, (%rsp)
movq %r12, %r13
movq %rcx, %r12
callq 0x2320
movq %r12, %rcx
movq %r13, %r12
movq (%rsp), %r13
testq %rax, %rax
jne 0xaff4
jmp 0xb002
movq %r13, %rax
movq %rcx, %rbx
movb %bpl, -0x1(%rax,%r14)
movq %rbx, %rcx
movq %r14, %r12
movq %rax, %r13
movb (%r15), %bpl
incq %r15
testb %bpl, %bpl
jne 0xafba
leaq 0x1(%r12), %r14
cmpq %r14, %rcx
jae 0xb044
leaq (%r14,%r14), %rbx
movq %r13, %rdi
movq %rbx, %rsi
movq %r13, %r15
movq %r12, %r13
movq %rcx, %r12
callq 0x2320
movq %r12, %rcx
movq %r13, %r12
movq %rax, %r13
testq %rax, %rax
movq 0x28(%rsp), %rdx
jne 0xb04c
jmp 0xb05b
movq %rcx, %rbx
movq 0x28(%rsp), %rdx
movb $0x0, -0x1(%r13,%r14)
movq %rbx, %rcx
movq %r14, %r12
movq %r13, %r15
cmpl $0x0, 0x14(%rsp)
je 0xb098
movq %rcx, %rbx
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
testq %rax, %rax
je 0xb105
movq 0x18(%rsp), %rcx
callq *%rax
jmp 0xb10f
movb (%rdx), %bpl
testb %bpl, %bpl
je 0xb19f
incq %rdx
leaq 0x1(%r12), %r14
cmpq %r14, %rcx
jae 0xb0e1
leaq (%r14,%r14), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r15, (%rsp)
movq %r12, %r15
movq %rcx, %r12
movq %rdx, %r13
callq 0x2320
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %r12
movq (%rsp), %r15
testq %rax, %rax
jne 0xb0e7
jmp 0xb0f5
movq %r15, %rax
movq %rcx, %rbx
movb %bpl, -0x1(%rax,%r14)
movq %rbx, %rcx
movq %r14, %r12
movq %rax, %r15
movb (%rdx), %bpl
incq %rdx
testb %bpl, %bpl
jne 0xb0a7
jmp 0xb19f
movq 0x18(%rsp), %rcx
callq 0x5460
testl %eax, %eax
movq %r15, (%rsp)
movl %eax, 0x8(%rsp)
jne 0xb17f
cmpq $0x0, 0x38(%rsp)
je 0xb17f
movq %rbx, %rcx
xorl %r13d, %r13d
movq 0x30(%rsp), %rax
movb (%rax,%r13), %bl
leaq 0x1(%r12), %r14
cmpq %r14, %rcx
jae 0xb15f
leaq (%r14,%r14), %r15
movq (%rsp), %rdi
movq %r15, %rsi
movq %r12, %rbp
movq %rcx, %r12
callq 0x2320
movq %r12, %rcx
movq %rbp, %r12
testq %rax, %rax
jne 0xb166
jmp 0xb175
movq (%rsp), %rax
movq %rcx, %r15
movb %bl, -0x1(%rax,%r14)
movq %r15, %rcx
movq %r14, %r12
movq %rax, (%rsp)
incq %r13
cmpq 0x38(%rsp), %r13
jb 0xb129
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rax
movups %xmm0, (%rax)
movq 0x30(%rsp), %rdi
callq 0x2220
cmpl $0x0, 0x8(%rsp)
movq (%rsp), %r15
jne 0xb1c9
movq 0x50(%rsp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x8359(%rip), %rcx      # 0x13508
movq %rbx, %rdi
movl %r12d, %edx
movq %r15, %r8
callq 0x5951
testl %eax, %eax
jne 0xb1c9
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq %r15, %rdi
callq 0x2220
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq