// File: /workspace/github_c_makefile_star2_O2/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 $0x248, %rsp            # imm = 0x248
movl %r8d, %ebp
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebx
movl %edi, %esi
movq (%rcx), %rdi
shll $0x9, %esi
callq 0x6c90
leaq 0x48(%rsp), %rdi
pushq $0x34
popq %rdx
movq %r15, %rsi
callq 0x5390
leaq 0xb8(%rsp), %rdi
callq 0x5050
testb %al, %al
je 0x627d
cmpl $0x3, %ebp
je 0x62d1
cmpl $0x2, %ebp
je 0x62a8
cmpl $0x1, %ebp
jne 0x63c8
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6878
movq (%r15), %rdi
movl %ebx, %esi
leaq 0x48(%rsp), %rdx
callq 0x6ca0
leaq 0x30(%rsp), %rdi
jmp 0x63c3
movq 0x5d6c(%rip), %rdi      # 0xbff0
leaq 0xe96(%rip), %rsi       # 0x7121
callq 0x5180
movq %rax, %rdi
movq %r15, %rsi
callq 0x5170
movq %rax, %rdi
callq 0x5100
jmp 0x63d2
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6878
leaq 0x48(%rsp), %rdx
movq %r15, %rdi
movl %ebx, %esi
callq 0x651d
leaq 0x20(%rsp), %rdi
jmp 0x63c3
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6878
movq (%r15), %rdi
callq 0x6aec
movq %rax, %r15
movl $0x20000, %r12d         # imm = 0x20000
leaq 0x48(%rsp), %r13
pushq $0x1
popq %rbp
testl %ebx, %ebx
je 0x63be
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x6c90
movq 0x8(%rsp), %rdi
callq 0x6b8e
movl %eax, %r14d
movq 0x8(%rsp), %rdi
movl $0xff, %esi
callq 0x6c9a
movq 0x8(%rsp), %rdi
callq 0x6b8e
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %r14b, %eax
cmpl %r12d, %ebx
movl $0x20000, %r14d         # imm = 0x20000
cmovbl %ebx, %r14d
orw %cx, %ax
je 0x6367
movzwl %ax, %eax
shll $0x9, %eax
leal 0x200(%rax), %ecx
movq 0x8(%rsp), %rdi
cmpq %rcx, (%rdi)
jge 0x6376
movl %r14d, %esi
movq %r13, %rdi
movl %ebp, %edx
callq 0x5190
jmp 0x63b3
movl %eax, %esi
callq 0x6c90
movl %ebp, %r12d
leaq 0x38(%rsp), %rbp
movq %rbp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x6878
movq %rbp, %rdi
movl %r14d, %esi
movq %r13, %rdx
callq 0x651d
leaq 0x40(%rsp), %rdi
callq 0x67fc
movl %r12d, %ebp
movl $0x20000, %r12d         # imm = 0x20000
subl %r14d, %ebx
incq %r15
jmp 0x62fa
leaq 0x10(%rsp), %rdi
callq 0x67fc
leaq 0x48(%rsp), %rdi
callq 0x5270
leaq 0x48(%rsp), %rdi
callq 0x52a0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6418
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x6420
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x6420
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x67fc
jmp 0x641b
movq %rax, %rbx
jmp 0x6425
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x67fc
leaq 0x48(%rsp), %rdi
callq 0x52a0
movq %rbx, %rdi
callq 0x5350