// File: trapexit[P]bbf/src/bbf_find_files.cpp
// Function: bbf::find_files(Options const&)
AppError
  find_files(const Options &opts_)
  {
    int rv;
    BlockToFileMapper b2fm;
    std::vector<uint64_t> badblocks;

    rv = BadBlockFile::read(opts_.input_file,badblocks);
    if(rv < 0)
      return AppError::reading_badblocks_file(-rv,opts_.input_file);

    b2fm.scan(opts_.device);

    const std::string none = "[none]";
    for(uint64_t i = 0, ei = badblocks.size(); i != ei; i++)
      {
        std::pair<bool,std::string> entry;
        const uint64_t badblock = badblocks[i];

        entry = b2fm.find(badblock);

        std::cout << badblock
                  << " "
                  << (entry.first ? entry.second : none)
                  << std::endl;
      }

    return AppError::success();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x120(%rbp)
movq %rdi, %rax
movq %rax, -0x118(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x154e0
leaq -0x60(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x7250
movq -0x110(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x78, %rdi
callq 0x5020
movl %eax, -0x104(%rbp)
jmp 0xcc69
movl -0x104(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0xccb0
movq -0x120(%rbp), %rdi
movl -0x14(%rbp), %esi
negl %esi
movq -0x10(%rbp), %rdx
addq $0x78, %rdx
callq 0x17790
jmp 0xcc93
movl $0x1, -0x70(%rbp)
jmp 0xcec0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xcee2
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
leaq -0x48(%rbp), %rdi
callq 0x15500
jmp 0xccc3
leaq -0x91(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x48a0
movq -0x128(%rbp), %rdx
leaq 0x16560(%rip), %rsi     # 0x23244
leaq -0x90(%rbp), %rdi
callq 0x7620
jmp 0xccf2
leaq -0x91(%rbp), %rdi
callq 0x45b0
movq $0x0, -0xa0(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x58d0
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0xa8(%rbp), %rax
je 0xce8f
leaq -0xd0(%rbp), %rdi
callq 0xcf00
jmp 0xcd3b
movq -0xa0(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xb5f0
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdx
leaq -0x100(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x158a0
jmp 0xcd6e
leaq -0xd0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movq %rsi, -0x138(%rbp)
callq 0xcf30
movq -0x138(%rbp), %rdi
callq 0xcf70
movq -0xd8(%rbp), %rsi
movq 0x2a20e(%rip), %rdi     # 0x36fb0
callq 0x4100
movq %rax, -0x130(%rbp)
jmp 0xcdb0
movq -0x130(%rbp), %rdi
leaq 0x1652f(%rip), %rsi     # 0x232ed
callq 0x4540
movq %rax, -0x140(%rbp)
jmp 0xcdcc
testb $0x1, -0xd0(%rbp)
je 0xcde9
leaq -0xd0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x148(%rbp)
jmp 0xcdf9
leaq -0x90(%rbp), %rax
movq %rax, -0x148(%rbp)
jmp 0xcdf9
movq -0x140(%rbp), %rdi
movq -0x148(%rbp), %rsi
callq 0x44a0
movq %rax, -0x150(%rbp)
jmp 0xce15
movq -0x150(%rbp), %rdi
movq 0x2a175(%rip), %rsi     # 0x36f98
callq 0x4580
jmp 0xce2a
leaq -0xd0(%rbp), %rdi
callq 0xcf70
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0xcd19
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x45b0
jmp 0xcee2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xceb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xcf70
jmp 0xceb2
movq -0x120(%rbp), %rdi
callq 0x17420
jmp 0xce9d
movl $0x1, -0x70(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4300
jmp 0xcec0
leaq -0x90(%rbp), %rdi
callq 0x4300
jmp 0xcee2
leaq -0x60(%rbp), %rdi
callq 0x7360
leaq -0x48(%rbp), %rdi
callq 0xa7b0
movq -0x118(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x7360
leaq -0x48(%rbp), %rdi
callq 0xa7b0
movq -0x68(%rbp), %rdi
callq 0x4890
nopl (%rax)