// File: /workspace/github_cpp_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x497d(%rip), %rsi      # 0x708f
leaq 0x4977(%rip), %rdx      # 0x7090
leaq 0x8(%rsp), %rdi
callq 0x442a
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2270
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2757
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x275f
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x278e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x44fa
movq 0x8(%rsp), %r12
movq %r14, %rdi
callq 0x44ba
cmpq %rax, %r12
je 0x28f2
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
movq %rax, %r12
leaq 0x48c8(%rip), %rdx      # 0x7091
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x44fa
movq 0x8(%rsp), %rbp
movq %r12, %rdi
callq 0x44ba
cmpq %rax, %rbp
je 0x281f
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
leaq 0x4897(%rip), %rsi      # 0x7091
movq %rax, %rdi
callq 0x473c
movq %rax, %rdi
callq 0x4160
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x40f0
jmp 0x2935
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
movq %rax, %r12
leaq 0x4862(%rip), %rdx      # 0x7096
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x44fa
movq 0x8(%rsp), %rbp
movq %r12, %rdi
callq 0x44ba
cmpq %rax, %rbp
je 0x28f2
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
leaq 0x482d(%rip), %rsi      # 0x7096
movq %rax, %rdi
callq 0x473c
movq %rax, %rdi
callq 0x4160
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rax, %rsi
callq 0x40f0
leaq 0x4809(%rip), %rsi      # 0x709b
leaq 0x8(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0x2961
leaq 0x4802(%rip), %rsi      # 0x70ad
leaq 0x8(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0x29e6
leaq 0x47f6(%rip), %rsi      # 0x70ba
leaq 0x8(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0x2a99
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x28f2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq 0x48(%rsp), %rcx
cmpq %r13, %rcx
je 0x2911
movq %rcx, (%rbx)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x2919
movups (%r13), %xmm0
movups %xmm0, (%rax)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %r13, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
movb $0x0, 0x58(%rsp)
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x294c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
movq %rax, %r12
leaq 0x472d(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x44fa
movq 0x28(%rsp), %rbp
movq %r12, %rdi
callq 0x44ba
cmpq %rax, %rbp
je 0x28a4
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
leaq 0x46f8(%rip), %rsi      # 0x70a3
movq %rax, %rdi
callq 0x473c
movq %rax, %rdi
callq 0x4160
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x26e7
leaq 0x46d9(%rip), %rsi      # 0x70ab
leaq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rbp
callq 0x2270
jmp 0x2a70
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
movq %rax, %r12
leaq 0x46a8(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x44fa
movq 0x28(%rsp), %rbp
movq %r12, %rdi
callq 0x44ba
cmpq %rax, %rbp
je 0x28bd
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
leaq 0x4673(%rip), %rsi      # 0x70a3
movq %rax, %rdi
callq 0x473c
movq %rax, %rdi
callq 0x4160
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x26e7
leaq 0x465c(%rip), %rcx      # 0x70b3
leaq 0x28(%rsp), %rdi
movl $0x6, %r8d
xorl %esi, %esi
xorl %edx, %edx
leaq 0x18(%rsp), %rbp
callq 0x2170
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x2ba5
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x2bab
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
movq %rax, %r12
leaq 0x45f5(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x44fa
movq 0x28(%rsp), %rbp
movq %r12, %rdi
callq 0x44ba
cmpq %rax, %rbp
je 0x28d6
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x45de(%rip), %rsi      # 0x70c0
leaq 0x45d9(%rip), %rdx      # 0x70c2
leaq 0x28(%rsp), %rdi
callq 0x442a
movq %r14, %rdi
movq %r15, %rsi
leaq 0x18(%rsp), %rbp
callq 0x473c
leaq 0x45b9(%rip), %rsi      # 0x70c3
movq %rax, %rdi
callq 0x412e
testb %al, %al
je 0x2c90
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
leaq 0x4597(%rip), %rsi      # 0x70c3
movq %rax, %rdi
callq 0x473c
testb $0x1, 0xf(%rax)
je 0x2d02
movq (%rax), %rsi
leaq 0x88(%rsp), %rdi
callq 0x4211
leaq 0x4574(%rip), %rsi      # 0x70c9
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x41a1
leaq 0x68ca(%rip), %rsi      # 0x943b
leaq 0xa8(%rsp), %rdi
callq 0x2270
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2bfd
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x2c04
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bdd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2935
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2935
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %r12
movq %rdx, 0x8(%r12)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x21c0
movq (%r12), %rdi
cmpq %rbp, %rdi
je 0x2c44
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0x38(%rsp), %r12
leaq 0x18(%rsp), %rbp
je 0x2c6f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c90
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2140
movq %r14, %rdi
movq %r15, %rsi
callq 0x473c
leaq 0x4401(%rip), %rsi      # 0x70a3
movq %rax, %rdi
callq 0x473c
movq %rax, %rdi
callq 0x4160
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x26e7
leaq 0x68(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x42a1
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cef
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
jne 0x2bd0
jmp 0x2bdd
leaq 0x4d45(%rip), %rdi      # 0x7a4e
leaq 0x47c2(%rip), %rsi      # 0x74d2
leaq 0x4d53(%rip), %rcx      # 0x7a6a
movl $0x6cc, %edx            # imm = 0x6CC
callq 0x20e0
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d4a
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2d4a
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2da9
movq 0x98(%rsp), %rsi
jmp 0x2d7d
jmp 0x2da6
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2da9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2da9
jmp 0x2da6
jmp 0x2da6
jmp 0x2dc8
jmp 0x2d91
jmp 0x2dc8
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x2db3
jmp 0x2dcb
jmp 0x2dc8
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2dcb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2dcb
jmp 0x2e02
jmp 0x2e02
jmp 0x2e02
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2e05
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2e05
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e1c
movq 0x18(%rsp), %rsi
jmp 0x2e14
movq %rax, %rbx
jmp 0x2e1c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e1c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x2250