// File: /workspace/github_c_makefile_star2_O1/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: addChunk_iTXt
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 0x1090
movq %rax, 0x20(%rsp)
movb (%r13), %r15b
testb %r15b, %r15b
movq %rbx, 0x18(%rsp)
movq %r14, 0x48(%rsp)
je 0x9a9b
movq $-0x1, %r14
xorl %edx, %edx
xorl %r12d, %r12d
xorl %r8d, %r8d
movq %r13, 0x10(%rsp)
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0x9a64
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 0x1120
testq %rax, %rax
je 0x9a68
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r13, %r12
jmp 0x9a74
xorl %ecx, %ecx
jmp 0x9a79
movb $0x1, %cl
movq %r13, %r12
movq %rbp, %r8
movq (%rsp), %rdx
movq 0x10(%rsp), %r13
testb %cl, %cl
jne 0x9a85
movb %r15b, -0x1(%r8,%rbx)
movq %rbx, %r12
movb 0x2(%r13,%r14), %r15b
incq %r14
testb %r15b, %r15b
jne 0x9a21
cmpq $0x4f, %r14
setae %al
jmp 0x9aa5
movb $0x1, %al
xorl %r8d, %r8d
xorl %r12d, %r12d
xorl %edx, %edx
testb %al, %al
jne 0x9f3c
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0x9aef
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 0x1120
testq %rax, %rax
je 0x9af3
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0x9afe
xorl %ecx, %ecx
jmp 0x9afe
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
jne 0x9b0b
movb $0x0, -0x1(%r8,%rbx)
movq %rbx, %r12
cmpl $0x0, 0xc(%rsp)
setne %bl
leaq 0x1(%r12), %r14
cmpq %r14, %rdx
jae 0x9b55
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 0x1120
testq %rax, %rax
je 0x9b59
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r15, %r12
jmp 0x9b64
xorl %ecx, %ecx
jmp 0x9b64
movb $0x1, %cl
movq %r15, %r12
movq %r13, %r8
movq %rbp, %rdx
testb %cl, %cl
jne 0x9b70
movb %bl, -0x1(%r8,%r14)
movq %r14, %r12
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0x9bb2
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 0x1120
testq %rax, %rax
je 0x9bb6
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0x9bc1
xorl %ecx, %ecx
jmp 0x9bc1
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
movq 0x48(%rsp), %r13
jne 0x9bd3
movb $0x0, -0x1(%r8,%rbx)
movq %rbx, %r12
movb (%r13), %bpl
testb %bpl, %bpl
je 0x9c4a
incq %r13
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0x9c22
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 0x1120
testq %rax, %rax
je 0x9c26
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0x9c32
xorl %ecx, %ecx
jmp 0x9c32
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq (%rsp), %rdx
testb %cl, %cl
jne 0x9c3e
movb %bpl, -0x1(%r8,%rbx)
movq %rbx, %r12
movb (%r13), %bpl
incq %r13
testb %bpl, %bpl
jne 0x9bdf
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0x9c8c
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 0x1120
testq %rax, %rax
je 0x9c90
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0x9c9b
xorl %ecx, %ecx
jmp 0x9c9b
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
jne 0x9ca8
movb $0x0, -0x1(%r8,%rbx)
movq %rbx, %r12
movq 0x50(%rsp), %r13
movb (%r13), %bpl
testb %bpl, %bpl
je 0x9d24
incq %r13
leaq 0x1(%r12), %rbx
cmpq %rbx, %rdx
jae 0x9cfc
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 0x1120
testq %rax, %rax
je 0x9d00
xorl %ecx, %ecx
movq %rax, %r8
movq %r12, %rdx
movq %r14, %r12
jmp 0x9d0c
xorl %ecx, %ecx
jmp 0x9d0c
movb $0x1, %cl
movq %r14, %r12
movq %r15, %r8
movq (%rsp), %rdx
testb %cl, %cl
jne 0x9d18
movb %bpl, -0x1(%r8,%rbx)
movq %rbx, %r12
movb (%r13), %bpl
incq %r13
testb %bpl, %bpl
jne 0x9cb9
leaq 0x1(%r12), %r14
cmpq %r14, %rdx
jae 0x9d60
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 0x1120
testq %rax, %rax
je 0x9d64
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rdx
jmp 0x9d6c
xorl %ecx, %ecx
jmp 0x9d6c
movb $0x1, %cl
movq %r15, %r8
movq %r13, %rdx
testb %cl, %cl
movq 0x18(%rsp), %rbp
jne 0x9d7e
movb $0x0, -0x1(%r8,%r14)
movq %r14, %r12
cmpl $0x0, 0xc(%rsp)
je 0x9dca
movq %rdx, %r14
movq %r8, %rbp
movq 0x90(%rsp), %r8
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rsi
movaps %xmm0, -0x8(%rsi)
movq $0x0, 0x8(%rsi)
movq 0x18(%r8), %rax
leaq 0x30(%rsp), %rdi
testq %rax, %rax
je 0x9e45
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq *%rax
jmp 0x9e54
movb (%rbp), %r14b
movb $0x1, %cl
testb %r14b, %r14b
je 0x9f01
incq %rbp
leaq 0x1(%r12), %r15
cmpq %r15, %rdx
jae 0x9e19
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 0x1120
testq %rax, %rax
je 0x9e1d
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %rdx
jmp 0x9e26
xorl %ecx, %ecx
jmp 0x9e26
movb $0x1, %cl
movq %r13, %r8
movq (%rsp), %rdx
testb %cl, %cl
jne 0x9e32
movb %r14b, -0x1(%r8,%r15)
movq %r15, %r12
movb (%rbp), %r14b
incq %rbp
testb %r14b, %r14b
jne 0x9ddc
movb $0x1, %cl
jmp 0x9f01
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x3e1e
testl %eax, %eax
movl %eax, 0x10(%rsp)
jne 0x9ee1
cmpq $0x0, 0x38(%rsp)
je 0x9ee1
movq %r14, %rsi
xorl %r14d, %r14d
movq 0x30(%rsp), %rax
movb (%rax,%r14), %r15b
leaq 0x1(%r12), %r13
cmpq %r13, %rsi
jae 0x9ebe
movq %r12, %rbx
leaq (%rsi,%rsi), %rax
leaq (,%r13,2), %r12
addq %r13, %r12
shrq %r12
cmpq %r13, %rax
cmovbq %r13, %r12
movq %rbp, %rdi
movq %rsi, (%rsp)
movq %r12, %rsi
callq 0x1120
testq %rax, %rax
je 0x9ec2
xorl %ecx, %ecx
movq %rax, %rbp
movq %r12, %rsi
movq %rbx, %r12
jmp 0x9ecb
xorl %ecx, %ecx
jmp 0x9ecb
movb $0x1, %cl
movq %rbx, %r12
movq (%rsp), %rsi
testb %cl, %cl
jne 0x9ed7
movb %r15b, -0x1(%rbp,%r13)
movq %r13, %r12
incq %r14
cmpq 0x38(%rsp), %r14
jne 0x9e6e
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rax
movups %xmm0, (%rax)
movq 0x30(%rsp), %rdi
callq 0x1030
movq %rbp, %r8
cmpl $0x0, 0x10(%rsp)
sete %cl
testb %cl, %cl
je 0x9f34
movq 0x28(%rsp), %rdi
leaq 0x8(%rdi), %rsi
leaq 0x5a6d(%rip), %rcx      # 0xf982
movl %r12d, %edx
movq %r8, %rbx
callq 0x4357
movq %rbx, %r8
testl %eax, %eax
jne 0x9f34
movq 0x28(%rsp), %rcx
movq 0x8(%rcx), %rax
movq %rax, 0x10(%rcx)
movq %r8, %rdi
callq 0x1030
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq