// File: trapexit[P]bbf/src/options.cpp
// Function: Options::validate() const
AppError
Options::validate(void) const
{
  switch(instruction)
    {
    case Options::_INVALID:
      return AppError::argument_invalid("instruction is invalid");
    case Options::FILETHRASH:
      break;
    case Options::FSTHRASH:
      break;
    case Options::BURNIN:
      if(captcha.empty())
        return AppError::argument_required("captcha");
    case Options::SCAN:
      break;
    case Options::FIX:
    case Options::FIX_FILE:
    case Options::WRITE_PSEUDO_UNCORRECTABLE_WL:
    case Options::WRITE_PSEUDO_UNCORRECTABLE_WOL:
    case Options::WRITE_FLAGGED_UNCORRECTABLE_WL:
    case Options::WRITE_FLAGGED_UNCORRECTABLE_WOL:
      if(captcha.empty())
        return AppError::argument_required("captcha");
      break;
    case Options::FIND_FILES:
      break;
    case Options::SECURITY_ERASE:
    case Options::ENHANCED_SECURITY_ERASE:
      if(captcha.empty())
        return AppError::argument_required("captcha");
      break;
    case Options::DUMP_FILES:
    case Options::INFO:
    case Options::CAPTCHA:
      break;
    default:
      break;
    }

  if(start_block >= end_block)
    return AppError::argument_invalid("start block >= end block");

  return AppError::success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x108(%rbp)
movq %rdi, %rax
movq %rax, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
movl (%rax), %eax
incl %eax
movl %eax, %ecx
movq %rcx, -0xf0(%rbp)
subl $0x11, %eax
ja 0x1a685
movq -0xf0(%rbp), %rax
leaq 0x9815(%rip), %rcx      # 0x23be8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x31(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x48a0
movq -0x110(%rbp), %rdx
leaq 0x9a5d(%rip), %rsi      # 0x23e57
leaq -0x30(%rbp), %rdi
callq 0x7620
jmp 0x1a405
movq -0x108(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17510
jmp 0x1a417
leaq -0x30(%rbp), %rdi
callq 0x4300
leaq -0x31(%rbp), %rdi
callq 0x45b0
jmp 0x1a73a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1a451
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4300
leaq -0x31(%rbp), %rdi
callq 0x45b0
jmp 0x1a74a
jmp 0x1a687
jmp 0x1a687
movq -0xf8(%rbp), %rdi
addq $0x98, %rdi
callq 0x4840
testb $0x1, %al
jne 0x1a485
jmp 0x1a508
leaq -0x69(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x48a0
movq -0x118(%rbp), %rdx
leaq 0x986f(%rip), %rsi      # 0x23d12
leaq -0x68(%rbp), %rdi
callq 0x7620
jmp 0x1a4ae
movq -0x108(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x17490
jmp 0x1a4c0
leaq -0x68(%rbp), %rdi
callq 0x4300
leaq -0x69(%rbp), %rdi
callq 0x45b0
jmp 0x1a73a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1a4fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x4300
leaq -0x69(%rbp), %rdi
callq 0x45b0
jmp 0x1a74a
jmp 0x1a50a
jmp 0x1a687
movq -0xf8(%rbp), %rdi
addq $0x98, %rdi
callq 0x4840
testb $0x1, %al
jne 0x1a52b
jmp 0x1a5c3
leaq -0x91(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x48a0
movq -0x120(%rbp), %rdx
leaq 0x97c6(%rip), %rsi      # 0x23d12
leaq -0x90(%rbp), %rdi
callq 0x7620
jmp 0x1a55a
movq -0x108(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x17490
jmp 0x1a56f
leaq -0x90(%rbp), %rdi
callq 0x4300
leaq -0x91(%rbp), %rdi
callq 0x45b0
jmp 0x1a73a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1a5b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4300
leaq -0x91(%rbp), %rdi
callq 0x45b0
jmp 0x1a74a
jmp 0x1a687
jmp 0x1a687
movq -0xf8(%rbp), %rdi
addq $0x98, %rdi
callq 0x4840
testb $0x1, %al
jne 0x1a5e9
jmp 0x1a681
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x48a0
movq -0x128(%rbp), %rdx
leaq 0x9708(%rip), %rsi      # 0x23d12
leaq -0xb8(%rbp), %rdi
callq 0x7620
jmp 0x1a618
movq -0x108(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x17490
jmp 0x1a62d
leaq -0xb8(%rbp), %rdi
callq 0x4300
leaq -0xb9(%rbp), %rdi
callq 0x45b0
jmp 0x1a73a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1a670
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x4300
leaq -0xb9(%rbp), %rdi
callq 0x45b0
jmp 0x1a74a
jmp 0x1a687
jmp 0x1a687
jmp 0x1a687
movq -0xf8(%rbp), %rcx
movq 0x38(%rcx), %rax
cmpq 0x40(%rcx), %rax
jb 0x1a72e
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x48a0
movq -0x130(%rbp), %rdx
leaq 0x97b1(%rip), %rsi      # 0x23e6e
leaq -0xe0(%rbp), %rdi
callq 0x7620
jmp 0x1a6cb
movq -0x108(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x17510
jmp 0x1a6e0
leaq -0xe0(%rbp), %rdi
callq 0x4300
leaq -0xe1(%rbp), %rdi
callq 0x45b0
jmp 0x1a73a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1a720
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x4300
leaq -0xe1(%rbp), %rdi
callq 0x45b0
jmp 0x1a74a
movq -0x108(%rbp), %rdi
callq 0x17420
movq -0x100(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x4890
nopw %cs:(%rax,%rax)
nopl (%rax)