// File: /workspace/github_cpp_makefile_star2_O1/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 0x424d(%rip), %rdx      # 0x7091
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x44fa
movq (%r12), %r12
movq %r13, %rdi
callq 0x44ba
cmpq %rax, %r12
je 0x302c
leaq 0x425e(%rip), %rsi      # 0x70cb
movq %r13, %rdi
callq 0x473c
testb $0x1, 0xf(%rax)
je 0x303b
addq (%rax), %r14
leaq 0x4249(%rip), %rdi      # 0x70d2
movq %r14, %rsi
xorl %eax, %eax
callq 0x2050
testl %ebx, %ebx
je 0x2eaf
movl %ebx, %ebp
leaq 0x4240(%rip), %r12      # 0x70e0
movq %r12, %rdi
xorl %eax, %eax
callq 0x2050
decq %rbp
jne 0x2ea0
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x41cf(%rip), %r12      # 0x708e
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x442a
leaq 0x41cd(%rip), %rdx      # 0x70a3
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0x44fa
movq 0x28(%rsp), %rbp
movq %r13, %rdi
callq 0x44ba
cmpq %rax, %rbp
je 0x2f4c
leaq 0x41a7(%rip), %rsi      # 0x70a3
movq %r13, %rdi
callq 0x473c
movq %rax, %rdi
callq 0x4160
movq %rax, %r12
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x26e7
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rbp
movq %rbp, %rsi
callq 0x21c0
movq (%rbp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2f4c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0x8(%rsp), %rbp
leaq 0x4139(%rip), %rsi      # 0x7091
movq %r13, %rdi
callq 0x473c
movq %rax, %rdi
callq 0x4160
leaq 0x4180(%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 0x44fa
movq 0x28(%rsp), %r13
movq %r15, %rdi
callq 0x44ba
cmpq %rax, %r13
je 0x3010
movq %r15, %rdi
movq %r12, %rsi
callq 0x473c
movq %rax, %r13
leaq 0x4132(%rip), %rdx      # 0x70e5
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x44fa
movq 0x28(%rsp), %rbp
movq %r13, %rdi
callq 0x44ba
cmpq %rax, %rbp
je 0x3010
movq %r15, %rdi
movq %r12, %rsi
callq 0x473c
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x473c
leaq 0x40f3(%rip), %rsi      # 0x70e5
movq %rax, %rdi
callq 0x473c
incl %ebx
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
movq %r14, %rcx
movl %ebx, %r8d
callq 0x3083
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x302c
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 0x4a0c(%rip), %rdi      # 0x7a4e
leaq 0x4489(%rip), %rsi      # 0x74d2
leaq 0x4a1a(%rip), %rcx      # 0x7a6a
movl $0x6cc, %edx            # imm = 0x6CC
callq 0x20e0
jmp 0x305c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x307b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x2250