// File: phillip-h[P]fractal-gen/lodepng.cpp
// Function: lodepng_add_itext(LodePNGInfo*, char const*, char const*, char const*, char const*)
unsigned lodepng_add_itext(LodePNGInfo* info, const char* key, const char* langtag,
                           const char* transkey, const char* str)
{
  char** new_keys = (char**)(lodepng_realloc(info->itext_keys, sizeof(char*) * (info->itext_num + 1)));
  char** new_langtags = (char**)(lodepng_realloc(info->itext_langtags, sizeof(char*) * (info->itext_num + 1)));
  char** new_transkeys = (char**)(lodepng_realloc(info->itext_transkeys, sizeof(char*) * (info->itext_num + 1)));
  char** new_strings = (char**)(lodepng_realloc(info->itext_strings, sizeof(char*) * (info->itext_num + 1)));
  if(!new_keys || !new_langtags || !new_transkeys || !new_strings)
  {
    lodepng_free(new_keys);
    lodepng_free(new_langtags);
    lodepng_free(new_transkeys);
    lodepng_free(new_strings);
    return 83; /*alloc fail*/
  }

  ++info->itext_num;
  info->itext_keys = new_keys;
  info->itext_langtags = new_langtags;
  info->itext_transkeys = new_transkeys;
  info->itext_strings = new_strings;

  string_init(&info->itext_keys[info->itext_num - 1]);
  string_set(&info->itext_keys[info->itext_num - 1], key);

  string_init(&info->itext_langtags[info->itext_num - 1]);
  string_set(&info->itext_langtags[info->itext_num - 1], langtag);

  string_init(&info->itext_transkeys[info->itext_num - 1]);
  string_set(&info->itext_transkeys[info->itext_num - 1], transkey);

  string_init(&info->itext_strings[info->itext_num - 1]);
  string_set(&info->itext_strings[info->itext_num - 1], str);

  return 0;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0x68(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x8890
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x8890
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq 0x78(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x8890
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movq 0x80(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x8890
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x9410
cmpq $0x0, 0x18(%rsp)
je 0x9410
cmpq $0x0, 0x10(%rsp)
je 0x9410
cmpq $0x0, 0x8(%rsp)
jne 0x9445
movq 0x20(%rsp), %rdi
callq 0x78b0
movq 0x18(%rsp), %rdi
callq 0x78b0
movq 0x10(%rsp), %rdi
callq 0x78b0
movq 0x8(%rsp), %rdi
callq 0x78b0
movl $0x53, 0x54(%rsp)
jmp 0x95c3
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq 0x20(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x68(%rax)
movq 0x18(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x70(%rax)
movq 0x10(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x78(%rax)
movq 0x8(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x80(%rax)
movq 0x48(%rsp), %rax
movq 0x68(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x91b0
movq 0x48(%rsp), %rax
movq 0x68(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x40(%rsp), %rsi
callq 0x91d0
movq 0x48(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x91b0
movq 0x48(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x91d0
movq 0x48(%rsp), %rax
movq 0x78(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x91b0
movq 0x48(%rsp), %rax
movq 0x78(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x91d0
movq 0x48(%rsp), %rax
movq 0x80(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x91b0
movq 0x48(%rsp), %rax
movq 0x80(%rax), %rdi
movq 0x48(%rsp), %rax
movq 0x60(%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x28(%rsp), %rsi
callq 0x91d0
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)