// File: mhe[P]raytracerframework_cpp/lodepng.cpp
// Function: LodePNG_IText_add(LodePNG_IText*, char const*, char const*, char const*, char const*)
unsigned LodePNG_IText_add(LodePNG_IText* text, const char* key, const char* langtag, const char* transkey, const char* str)
{
  char** new_keys = (char**)(realloc(text->keys, sizeof(char*) * (text->num + 1)));
  char** new_langtags = (char**)(realloc(text->langtags, sizeof(char*) * (text->num + 1)));
  char** new_transkeys = (char**)(realloc(text->transkeys, sizeof(char*) * (text->num + 1)));
  char** new_strings = (char**)(realloc(text->strings, sizeof(char*) * (text->num + 1)));
  if(!new_keys || !new_langtags || !new_transkeys || !new_strings)
  {
    free(new_keys);
    free(new_langtags);
    free(new_transkeys);
    free(new_strings);
    return 9934;
  }
  
  text->num++;
  text->keys = new_keys;
  text->langtags = new_langtags;
  text->transkeys = new_transkeys;
  text->strings = new_strings;
  
  string_init(&text->keys[text->num - 1]);
  string_set(&text->keys[text->num - 1], key);
  
  string_init(&text->langtags[text->num - 1]);
  string_set(&text->langtags[text->num - 1], langtag);
  
  string_init(&text->transkeys[text->num - 1]);
  string_set(&text->transkeys[text->num - 1], transkey);
  
  string_init(&text->strings[text->num - 1]);
  string_set(&text->strings[text->num - 1], str);
  
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x5650
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x5650
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x5650
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x5650
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x26bb8
cmpq $0x0, -0x40(%rbp)
je 0x26bb8
cmpq $0x0, -0x48(%rbp)
je 0x26bb8
cmpq $0x0, -0x50(%rbp)
jne 0x26be8
movq -0x38(%rbp), %rdi
callq 0x54b0
movq -0x40(%rbp), %rdi
callq 0x54b0
movq -0x48(%rbp), %rdi
callq 0x54b0
movq -0x50(%rbp), %rdi
callq 0x54b0
movl $0x26ce, -0x4(%rbp)     # imm = 0x26CE
jmp 0x26d35
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x26820
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x26850
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x26820
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x26850
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x26820
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x26850
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x26820
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x26850
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop