// File: /workspace/github_cpp_makefile_star2_O3/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 0x436d(%rip), %rsi      # 0x708f
leaq 0x4367(%rip), %rdx      # 0x7090
leaq 0x8(%rsp), %rdi
callq 0x4a12
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 0x2d67
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x2d6f
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 0x2d9e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4ae8
movq 0x8(%rsp), %r12
movq %r14, %rdi
callq 0x4aa8
cmpq %rax, %r12
je 0x2f02
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
movq %rax, %r12
leaq 0x42b8(%rip), %rdx      # 0x7091
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x4ae8
movq 0x8(%rsp), %rbp
movq %r12, %rdi
callq 0x4aa8
cmpq %rax, %rbp
je 0x2e2f
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
leaq 0x4287(%rip), %rsi      # 0x7091
movq %rax, %rdi
callq 0x4d34
movq %rax, %rdi
callq 0x474e
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x46de
jmp 0x2f45
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
movq %rax, %r12
leaq 0x4252(%rip), %rdx      # 0x7096
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x4ae8
movq 0x8(%rsp), %rbp
movq %r12, %rdi
callq 0x4aa8
cmpq %rax, %rbp
je 0x2f02
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
leaq 0x421d(%rip), %rsi      # 0x7096
movq %rax, %rdi
callq 0x4d34
movq %rax, %rdi
callq 0x474e
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rax, %rsi
callq 0x46de
leaq 0x41f9(%rip), %rsi      # 0x709b
leaq 0x8(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0x2f71
leaq 0x41f2(%rip), %rsi      # 0x70ad
leaq 0x8(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0x2ff6
leaq 0x41e6(%rip), %rsi      # 0x70ba
leaq 0x8(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0x30a9
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2f02
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq 0x48(%rsp), %rcx
cmpq %r13, %rcx
je 0x2f21
movq %rcx, (%rbx)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x2f29
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 0x2f5c
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 0x4d34
movq %rax, %r12
leaq 0x411d(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x4ae8
movq 0x28(%rsp), %rbp
movq %r12, %rdi
callq 0x4aa8
cmpq %rax, %rbp
je 0x2eb4
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
leaq 0x40e8(%rip), %rsi      # 0x70a3
movq %rax, %rdi
callq 0x4d34
movq %rax, %rdi
callq 0x474e
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2cf7
leaq 0x40c9(%rip), %rsi      # 0x70ab
leaq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rbp
callq 0x2270
jmp 0x3080
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
movq %rax, %r12
leaq 0x4098(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x4ae8
movq 0x28(%rsp), %rbp
movq %r12, %rdi
callq 0x4aa8
cmpq %rax, %rbp
je 0x2ecd
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
leaq 0x4063(%rip), %rsi      # 0x70a3
movq %rax, %rdi
callq 0x4d34
movq %rax, %rdi
callq 0x474e
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2cf7
leaq 0x404c(%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 0x31b5
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x31bb
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
movq %rax, %r12
leaq 0x3fe5(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x4ae8
movq 0x28(%rsp), %rbp
movq %r12, %rdi
callq 0x4aa8
cmpq %rax, %rbp
je 0x2ee6
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x3fce(%rip), %rsi      # 0x70c0
leaq 0x3fc9(%rip), %rdx      # 0x70c2
leaq 0x28(%rsp), %rdi
callq 0x4a12
movq %r14, %rdi
movq %r15, %rsi
leaq 0x18(%rsp), %rbp
callq 0x4d34
leaq 0x3fa9(%rip), %rsi      # 0x70c3
movq %rax, %rdi
callq 0x471c
testb %al, %al
je 0x32a0
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
leaq 0x3f87(%rip), %rsi      # 0x70c3
movq %rax, %rdi
callq 0x4d34
testb $0x1, 0xf(%rax)
je 0x3312
movq (%rax), %rsi
leaq 0x88(%rsp), %rdi
callq 0x47ff
leaq 0x3f64(%rip), %rsi      # 0x70c9
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x478f
leaq 0x62ba(%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 0x320d
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x3214
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 0x31ed
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f45
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2f45
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 0x3254
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 0x327f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x32a0
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2140
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d34
leaq 0x3df1(%rip), %rsi      # 0x70a3
movq %rax, %rdi
callq 0x4d34
movq %rax, %rdi
callq 0x474e
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2cf7
leaq 0x68(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x488f
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x32ff
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
jne 0x31e0
jmp 0x31ed
leaq 0x4735(%rip), %rdi      # 0x7a4e
leaq 0x41b2(%rip), %rsi      # 0x74d2
leaq 0x4743(%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 0x335a
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x335a
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33b9
movq 0x98(%rsp), %rsi
jmp 0x338d
jmp 0x33b6
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33b9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x33b9
jmp 0x33b6
jmp 0x33b6
jmp 0x33d8
jmp 0x33a1
jmp 0x33d8
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x33c3
jmp 0x33db
jmp 0x33d8
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x33db
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x33db
jmp 0x3412
jmp 0x3412
jmp 0x3412
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3415
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x3415
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x342c
movq 0x18(%rsp), %rsi
jmp 0x3424
movq %rax, %rbx
jmp 0x342c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x342c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x2250