// File: /workspace/github_c_makefile_star2_O1/mrkite[P]regs/src/2mg.cc
// Function: doFile(unsigned short, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::shared_ptr<TheHandle>, int)
static void doFile(uint16_t key, uint32_t len, std::string name,
                   Handle h, int type) {
  h->seek(key * 512);
  std::ofstream f(name, std::ios::out | std::ios::binary | std::ios::trunc);
  if (!f.is_open()) {
    std::cerr << "Failed to create " << name << std::endl;
    return;
  }
  switch (type) {
    case 1:
      dumpSeedling(h, len, f);
      break;
    case 2:
      dumpSapling(h, len, f);
      break;
    case 3:
      dumpTree(h, len, f);
      break;
  }
  f.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movl %r8d, %r15d
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movl %edi, %esi
movq (%rcx), %rdi
shll $0x9, %esi
callq 0x7476
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movl $0x34, %edx
callq 0x5380
leaq 0x98(%rsp), %rdi
callq 0x5060
testb %al, %al
je 0x696e
cmpl $0x3, %r15d
je 0x69ef
cmpl $0x2, %r15d
je 0x69c8
cmpl $0x1, %r15d
jne 0x6b2d
movq (%rbx), %rdi
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x6b14
movq 0x666b(%rip), %rax      # 0xcfc8
cmpb $0x0, (%rax)
je 0x6b10
incl 0x8(%rbx)
jmp 0x6b14
movq 0x667b(%rip), %rdi      # 0xcff0
leaq 0x17a5(%rip), %rsi      # 0x8121
movl $0x11, %edx
callq 0x5200
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x665c(%rip), %rdi      # 0xcff0
callq 0x5200
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5120
jmp 0x6b37
movq (%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x6a10
movq 0x65e3(%rip), %rcx      # 0xcfc8
cmpb $0x0, (%rcx)
je 0x6a0c
incl 0x8(%rax)
jmp 0x6a10
movq (%rbx), %r14
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x6a2f
movq 0x65c6(%rip), %rax      # 0xcfc8
cmpb $0x0, (%rax)
je 0x6a2b
incl 0x8(%rbx)
jmp 0x6a2f
lock
incl 0x8(%rax)
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movl %ebp, %esi
callq 0x6d08
movq 0x10(%rsp), %rbx
jmp 0x6b20
lock
incl 0x8(%rbx)
movq %r14, %rdi
callq 0x72a6
testl %ebp, %ebp
je 0x6b20
movq %rax, %r15
leaq 0x28(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x7476
movq %r14, %rdi
callq 0x7348
movl %eax, %r13d
movl $0xff, %esi
movq %r14, %rdi
callq 0x7480
movq %r14, %rdi
callq 0x7348
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %r13b, %eax
movl $0x20000, %edx          # imm = 0x20000
cmpl %edx, %ebp
movl $0x20000, %r13d         # imm = 0x20000
cmovbl %ebp, %r13d
orw %cx, %ax
je 0x6aa3
movzwl %ax, %eax
shll $0x9, %eax
leal 0x200(%rax), %ecx
cmpq %rcx, (%r14)
jge 0x6ab5
movl %r13d, %esi
movq %r12, %rdi
movl $0x1, %edx
callq 0x5190
jmp 0x6b02
movl %eax, %esi
movq %r14, %rdi
callq 0x7476
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
testq %rbx, %rbx
je 0x6ae3
movq 0x64f3(%rip), %rax      # 0xcfc8
cmpb $0x0, (%rax)
je 0x6adf
incl 0x8(%rbx)
jmp 0x6ae3
lock
incl 0x8(%rbx)
leaq 0x18(%rsp), %rdi
movl %r13d, %esi
movq %r12, %rdx
callq 0x6d08
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x6b02
callq 0x6fa6
incq %r15
subl %r13d, %ebp
jne 0x6a47
jmp 0x6b20
lock
incl 0x8(%rbx)
movl %ebp, %esi
leaq 0x28(%rsp), %rdx
callq 0x7486
testq %rbx, %rbx
je 0x6b2d
movq %rbx, %rdi
callq 0x6fa6
leaq 0x28(%rsp), %rdi
callq 0x5270
movq 0x647a(%rip), %rax      # 0xcfb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x30(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x28(%rsp,%rcx)
callq 0x5150
leaq 0x120(%rsp), %rdi
callq 0x50c0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6ba7
jmp 0x6ba7
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
jne 0x6bb2
jmp 0x6bb7
movq %rax, %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x6baa
callq 0x6fa6
jmp 0x6baa
movq %rax, %r14
jmp 0x6bb7
movq %rax, %r14
testq %rbx, %rbx
je 0x6bb7
movq %rbx, %rdi
callq 0x6fa6
leaq 0x28(%rsp), %rdi
callq 0x52a0
movq %r14, %rdi
callq 0x5340