// File: /workspace/github_cpp_makefile_star2_O2/nvanbenschoten[P]byzantine-agreement/src/main.cc
// Function: ValidateOrder(args::ValueFlag<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, args::ValueReader<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, bool)
std::experimental::optional<msg::Order> ValidateOrder(StringFlag& order,
                                                      bool is_commander) {
  if (is_commander) {
    if (!order) {
      throw args::UsageError("the commander must specify an order");
    }

    try {
      auto order_val = args::get(order);
      return msg::StringToOrder(order_val);
    } catch (std::invalid_argument e) {
      throw args::ValidationError(e.what());
    }
  } else {
    if (order) {
      throw args::ValidationError(
          "only the commander process can specify an order");
    }
    return {};
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x10(%rax)
testl %ebp, %ebp
je 0x6569
testb %al, %al
je 0x657f
addq $0xc8, %r14
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x5480
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5480
leaq 0x38(%rsp), %rdi
callq 0xe8b8
movl %eax, (%rbx)
movb $0x1, 0x4(%rbx)
leaq 0x38(%rsp), %rdi
callq 0x56b8
leaq 0x8(%rsp), %rdi
callq 0x56b8
jmp 0x6571
testb %al, %al
jne 0x65cd
andq $0x0, (%rbx)
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x51c0
movq %rax, %r14
leaq 0xd45a(%rip), %rsi      # 0x139eb
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x852c
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x85ae
xorl %ebp, %ebp
leaq 0x17e2f(%rip), %rsi     # 0x1e3e8
movq 0x189b8(%rip), %rdx     # 0x1ef78
movq %r14, %rdi
callq 0x55c0
jmp 0x66e7
pushq $0x10
popq %rdi
callq 0x51c0
movq %rax, %r14
leaq 0xd430(%rip), %rsi      # 0x13a0f
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x852c
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x85f0
xorl %ebp, %ebp
leaq 0x17df9(%rip), %rsi     # 0x1e400
movq 0x1896a(%rip), %rdx     # 0x1ef78
movq %r14, %rdi
callq 0x55c0
jmp 0x66e7
jmp 0x661d
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x56b8
testb %bpl, %bpl
jne 0x6639
jmp 0x6715
jmp 0x6636
movq %rax, %rbx
movq %r14, %rdi
callq 0x5270
jmp 0x6715
movq %rdx, %r14
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x56b8
jmp 0x665e
movq %rdx, %r14
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x56b8
jmp 0x6670
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x6715
movq %rbx, %rdi
callq 0x53e0
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x8594
movq %rbx, %rdi
callq 0x5150
pushq $0x10
popq %rdi
callq 0x51c0
movq %rax, %r14
movq %r15, %rdi
callq 0x54d0
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %rax, %rsi
callq 0x852c
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x85f0
xorl %ebp, %ebp
leaq 0x17d28(%rip), %rsi     # 0x1e400
movq 0x18899(%rip), %rdx     # 0x1ef78
movq %r14, %rdi
callq 0x55c0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x56b8
testb %bpl, %bpl
jne 0x66fe
jmp 0x6706
movq %rax, %rbx
movq %r14, %rdi
callq 0x5270
leaq 0x28(%rsp), %rdi
callq 0x56c8
callq 0x5560
movq %rbx, %rdi
callq 0x55e0
movq %rax, %rdi
callq 0x85c3