// File: /workspace/github_cpp_makefile_star2_O2/DimitriFourny[P]uaf_replacer/main.cc
// Function: get_type_name[abi:cxx11](rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator> const&, char const*)
std::string get_type_name(const rapidjson::Document& document, 
                          const char* type_id) {
  std::string type_name = std::string("#") + type_id;
  if (!document.HasMember(type_id)) {
    return type_name;
  }

  if (document[type_id].HasMember("name")) {
    return std::string(document[type_id]["name"].GetString());
  } 

  if (document[type_id].HasMember("type")) {
    std::string type = document[type_id]["type"].GetString();

    // pointer
    if (type == "pointer" && document[type_id].HasMember("type_id")) {
      type_id = document[type_id]["type_id"].GetString();
      return get_type_name(document, type_id) + "*";
    }

    // const
    if (type == "const" && document[type_id].HasMember("type_id")) {
      type_id = document[type_id]["type_id"].GetString();
      return "const " + get_type_name(document, type_id);
    }

    // array
    if (type == "array" && document[type_id].HasMember("type_id")) {
      std::string suffix = "[]";
      if (document[type_id].HasMember("count")) {
        uint64_t count = document[type_id]["count"].GetUint64();
        suffix = "[" + std::to_string(count) + "]";
      }

      type_id = document[type_id]["type_id"].GetString();
      return get_type_name(document, type_id) + suffix;
    }
  }

  return type_name;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x3c02(%rip), %rsi      # 0x608f
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x378a
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %r15, %rdx
callq 0x376b
leaq 0x48(%rsp), %rdi
callq 0x20b0
movq %r14, %rdi
movq %r15, %rsi
callq 0x37c6
testb %al, %al
je 0x27ee
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3bb4(%rip), %rsi      # 0x6091
movq %rax, %rdi
callq 0x37c6
testb %al, %al
je 0x2520
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3b96(%rip), %rsi      # 0x6091
movq %rax, %rdi
callq 0x3ef6
movq %rax, %rdi
callq 0x37ec
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x378a
jmp 0x2830
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3b64(%rip), %rsi      # 0x6096
movq %rax, %rdi
callq 0x37c6
testb %al, %al
je 0x27ee
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3b42(%rip), %rsi      # 0x6096
movq %rax, %rdi
callq 0x3ef6
movq %rax, %rdi
callq 0x37ec
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rax, %rsi
callq 0x378a
leaq 0x3b1e(%rip), %rsi      # 0x609b
leaq 0x48(%rsp), %rdi
callq 0x382d
testb %al, %al
je 0x25f4
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3b06(%rip), %rsi      # 0x60a3
movq %rax, %rdi
callq 0x37c6
testb %al, %al
je 0x25f4
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3ae8(%rip), %rsi      # 0x60a3
movq %rax, %rdi
callq 0x3ef6
movq %rax, %rdi
callq 0x37ec
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x246f
leaq 0x3ac9(%rip), %rdx      # 0x60ab
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x376b
jmp 0x27ce
leaq 0x3ab2(%rip), %rsi      # 0x60ad
leaq 0x48(%rsp), %rdi
callq 0x382d
testb %al, %al
je 0x2672
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3a88(%rip), %rsi      # 0x60a3
movq %rax, %rdi
callq 0x37c6
testb %al, %al
je 0x2672
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3a6a(%rip), %rsi      # 0x60a3
movq %rax, %rdi
callq 0x3ef6
movq %rax, %rdi
callq 0x37ec
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x246f
leaq 0x3a53(%rip), %rsi      # 0x60b3
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x383a
jmp 0x27ce
leaq 0x3a41(%rip), %rsi      # 0x60ba
leaq 0x48(%rsp), %rdi
callq 0x382d
testb %al, %al
je 0x27e4
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3a06(%rip), %rsi      # 0x60a3
movq %rax, %rdi
callq 0x37c6
testb %al, %al
je 0x27e4
leaq 0x3a0c(%rip), %rsi      # 0x60c0
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x378a
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x39ee(%rip), %rsi      # 0x60c3
movq %rax, %rdi
callq 0x37c6
testb %al, %al
je 0x2780
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x39cc(%rip), %rsi      # 0x60c3
movq %rax, %rdi
callq 0x3ef6
movq %rax, %rdi
callq 0x385e
leaq 0x88(%rsp), %rdi
movq %rax, %rsi
callq 0x3888
leaq 0x39ab(%rip), %rsi      # 0x60c9
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x383a
leaq 0x5d76(%rip), %rdx      # 0x84b0
leaq 0x68(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x376b
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %r12
movq %r12, %rsi
callq 0x21b0
movq %r12, %rdi
callq 0x20b0
leaq 0xa8(%rsp), %rdi
callq 0x20b0
leaq 0x88(%rsp), %rdi
callq 0x20b0
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ef6
leaq 0x3911(%rip), %rsi      # 0x60a3
movq %rax, %rdi
callq 0x3ef6
movq %rax, %rdi
callq 0x37ec
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x246f
leaq 0x68(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x38ca
leaq 0x68(%rsp), %rdi
callq 0x20b0
leaq 0x8(%rsp), %rdi
callq 0x20b0
leaq 0x48(%rsp), %rdi
callq 0x20b0
jmp 0x2830
leaq 0x48(%rsp), %rdi
callq 0x20b0
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdx
cmpq %rax, %rdx
je 0x2811
movq %rdx, (%rbx)
movq 0x38(%rsp), %rcx
movq %rcx, 0x10(%rbx)
jmp 0x2817
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x30(%rsp), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x20b0
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x20b0
jmp 0x2861
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x2875
jmp 0x288a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x20b0
jmp 0x288d
jmp 0x288a
jmp 0x288a
jmp 0x289f
jmp 0x288a
jmp 0x289f
jmp 0x288a
jmp 0x289f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20b0
jmp 0x28a2
jmp 0x28bd
jmp 0x28bd
jmp 0x28bd
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x20b0
jmp 0x28c0
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x28c5
movq %rax, %rbx
jmp 0x28ca
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2250