// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1070
movq %rax, -0x68(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x8f00
movq $0x0, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x9b1f
movq -0x20(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq -0x58(%rbp), %rdi
movzbl (%rax,%rcx), %esi
callq 0x2660
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x9aeb
cmpq $0x1, -0x60(%rbp)
jb 0x9b2d
cmpq $0x4f, -0x60(%rbp)
jbe 0x9b39
movl $0x59, -0x4(%rbp)
jmp 0x9cde
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x2660
movl -0x14(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
leaq -0x58(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x2660
movq $0x0, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x9ba7
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq -0x58(%rbp), %rdi
movzbl (%rax,%rcx), %esi
callq 0x2660
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x9b73
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x2660
movq $0x0, -0x60(%rbp)
movq -0x30(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x9bee
movq -0x30(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq -0x58(%rbp), %rdi
movzbl (%rax,%rcx), %esi
callq 0x2660
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x9bba
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x2660
cmpl $0x0, -0x14(%rbp)
je 0x9c70
leaq -0x80(%rbp), %rdi
callq 0x8f00
leaq -0x80(%rbp), %rdi
leaq -0x80(%rbp), %rsi
addq $0x8, %rsi
movq -0x38(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq 0x10(%rbp), %r8
callq 0x11680
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x9c65
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x78(%rbp), %rax
je 0x9c63
movq -0x80(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq -0x58(%rbp), %rdi
movzbl (%rax,%rcx), %esi
callq 0x2660
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x9c36
jmp 0x9c65
leaq -0x80(%rbp), %rdi
callq 0xf0d0
jmp 0x9cae
movq $0x0, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x9cac
movq -0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq -0x58(%rbp), %rdi
movzbl (%rax,%rcx), %esi
callq 0x2660
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x9c78
jmp 0x9cae
cmpl $0x0, -0x3c(%rbp)
jne 0x9ccf
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq -0x50(%rbp), %rcx
leaq 0xb77f(%rip), %rsi      # 0x15446
callq 0x116f0
movl %eax, -0x3c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xf0d0
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)