// File: /workspace/github_cpp_makefile_star2_O3/DimitriFourny[P]uaf_replacer/main.cc
// Function: dump_member(rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator> const&, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>> const&, unsigned long, unsigned int)
void dump_member(const rapidjson::Document& document,   
                 const rapidjson::Value& member, uint64_t base_offset, 
                 unsigned int deep_size) {
  if (!member.HasMember("name")) {
    return; 
  }

  // Dumped format: offset type name
  uint64_t offset = member["offset"].GetUint64() + base_offset;
  printf("    +0x%-3lx ", offset);
  for (size_t j = 0; j < deep_size; j++) {
    printf("    ");
  }

  const char* type_id = "";
  std::string type_name = "";
  if (member.HasMember("type_id")) {
    type_id = member["type_id"].GetString();
    type_name = get_type_name(document, type_id);
  }
  printf("%s %s\n", type_name.c_str(), member["name"].GetString());

  // Show the submembers
  if (document.HasMember(type_id)) {
    if (document[type_id].HasMember("members")) {
      dump_members(document, document[type_id], document[type_id]["members"], 
        offset, deep_size+1);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
leaq 0x3c3d(%rip), %rdx      # 0x7091
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x4ae8
movq (%r12), %r12
movq %r13, %rdi
callq 0x4aa8
cmpq %rax, %r12
je 0x363c
leaq 0x3c4e(%rip), %rsi      # 0x70cb
movq %r13, %rdi
callq 0x4d34
testb $0x1, 0xf(%rax)
je 0x364b
addq (%rax), %r14
leaq 0x3c39(%rip), %rdi      # 0x70d2
movq %r14, %rsi
xorl %eax, %eax
callq 0x2050
testl %ebx, %ebx
je 0x34bf
movl %ebx, %ebp
leaq 0x3c30(%rip), %r12      # 0x70e0
movq %r12, %rdi
xorl %eax, %eax
callq 0x2050
decq %rbp
jne 0x34b0
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x3bbf(%rip), %r12      # 0x708e
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x4a12
leaq 0x3bbd(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0x4ae8
movq 0x28(%rsp), %rbp
movq %r13, %rdi
callq 0x4aa8
cmpq %rax, %rbp
je 0x355c
leaq 0x3b97(%rip), %rsi      # 0x70a3
movq %r13, %rdi
callq 0x4d34
movq %rax, %rdi
callq 0x474e
movq %rax, %r12
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2cf7
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rbp
movq %rbp, %rsi
callq 0x21c0
movq (%rbp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x355c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0x8(%rsp), %rbp
leaq 0x3b29(%rip), %rsi      # 0x7091
movq %r13, %rdi
callq 0x4d34
movq %rax, %rdi
callq 0x474e
leaq 0x3b70(%rip), %rdi      # 0x70ef
movq %rbp, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4ae8
movq 0x28(%rsp), %r13
movq %r15, %rdi
callq 0x4aa8
cmpq %rax, %r13
je 0x3620
movq %r15, %rdi
movq %r12, %rsi
callq 0x4d34
movq %rax, %r13
leaq 0x3b22(%rip), %rdx      # 0x70e5
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x4ae8
movq 0x28(%rsp), %rbp
movq %r13, %rdi
callq 0x4aa8
cmpq %rax, %rbp
je 0x3620
movq %r15, %rdi
movq %r12, %rsi
callq 0x4d34
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x4d34
leaq 0x3ae3(%rip), %rsi      # 0x70e5
movq %rax, %rdi
callq 0x4d34
incl %ebx
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
movq %r14, %rcx
movl %ebx, %r8d
callq 0x3693
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x363c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x43fc(%rip), %rdi      # 0x7a4e
leaq 0x3e79(%rip), %rsi      # 0x74d2
leaq 0x440a(%rip), %rcx      # 0x7a6a
movl $0x6cc, %edx            # imm = 0x6CC
callq 0x20e0
jmp 0x366c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x368b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x2250