// File: /workspace/github_cpp_makefile_star2_O2/nvanbenschoten[P]byzantine-agreement/src/main.cc
// Function: GetMaliciousBehavior(args::ValueFlagList<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector, args::ValueReader<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, bool)
generals::MaliciousBehavior GetMaliciousBehavior(StringFlagList& malicious,
                                                 bool is_commander) {
  // Create the MaliciousBehavior instance.
  generals::MaliciousBehavior b = generals::MaliciousBehavior::NONE;
  try {
    for (const auto mal : args::get(malicious)) {
      b |= generals::StringToMaliciousBehavior(mal);
    }
  } catch (std::invalid_argument e) {
    throw args::ValidationError(e.what());
  }

  // Validate that the malicious behavior is valid for the general type.
  if (is_commander) {
    for (auto const& not_avail : only_lieutenant_behavior) {
      if (generals::Exhibits(b, not_avail)) {
        throw args::ValidationError(
            "only a lieutenant can have the malicious behavior \"" +
            generals::MaliciousBehaviorString(not_avail) + "\"");
      }
    }
  } else {
    for (auto const& not_avail : only_commander_behavior) {
      if (generals::Exhibits(b, not_avail)) {
        throw args::ValidationError(
            "only a commander can have the malicious behavior \"" +
            generals::MaliciousBehaviorString(not_avail) + "\"");
      }
    }
  }

  return b;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebp
movq 0xc8(%rdi), %r14
movq 0xd0(%rdi), %r13
xorl %ebx, %ebx
leaq 0x8(%rsp), %r15
leaq 0x68(%rsp), %r12
cmpq %r13, %r14
je 0x678d
movq %r15, %rdi
movq %r14, %rsi
callq 0x5480
movq %r12, %rdi
movq %r15, %rsi
callq 0x5480
movq %r12, %rdi
callq 0xeef6
orl %eax, %ebx
movq %r12, %rdi
callq 0x56b8
movq %r15, %rdi
callq 0x56b8
addq $0x20, %r14
jmp 0x6752
testb %bpl, %bpl
je 0x67b8
movq 0x18d9f(%rip), %r15     # 0x1f538
leaq 0x18d88(%rip), %r14     # 0x1f528
cmpq %r14, %r15
je 0x67e2
testl %ebx, 0x20(%r15)
jne 0x67f6
movq %r15, %rdi
callq 0x53a0
movq %rax, %r15
jmp 0x67a0
movq 0x18da9(%rip), %r15     # 0x1f568
leaq 0x18d92(%rip), %r14     # 0x1f558
cmpq %r14, %r15
je 0x67e2
testl %ebx, 0x20(%r15)
jne 0x6868
movq %r15, %rdi
callq 0x53a0
movq %rax, %r15
jmp 0x67c6
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x51c0
movq %rax, %r14
movl 0x20(%r15), %esi
leaq 0x48(%rsp), %rdi
callq 0xefa0
leaq 0xd229(%rip), %rsi      # 0x13a3f
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x86c2
leaq 0xd278(%rip), %rdx      # 0x13aa4
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x86a3
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x85f0
xorl %ebp, %ebp
leaq 0x17bac(%rip), %rsi     # 0x1e400
movq 0x1871d(%rip), %rdx     # 0x1ef78
movq %r14, %rdi
callq 0x55c0
jmp 0x69ce
pushq $0x10
popq %rdi
callq 0x51c0
movq %rax, %r14
movl 0x20(%r15), %esi
leaq 0x48(%rsp), %rdi
callq 0xefa0
leaq 0xd1eb(%rip), %rsi      # 0x13a73
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x86c2
leaq 0xd206(%rip), %rdx      # 0x13aa4
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x86a3
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x85f0
xorl %ebp, %ebp
leaq 0x17b3a(%rip), %rsi     # 0x1e400
movq 0x186ab(%rip), %rdx     # 0x1ef78
movq %r14, %rdi
callq 0x55c0
jmp 0x69ce
jmp 0x68de
jmp 0x68ed
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x56b8
jmp 0x68f3
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x28(%rsp), %rdi
callq 0x56b8
jmp 0x6907
jmp 0x6901
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x48(%rsp), %rdi
callq 0x56b8
testb %bpl, %bpl
jne 0x6920
jmp 0x69fc
jmp 0x691d
movq %rax, %rbx
movq %r14, %rdi
callq 0x5270
jmp 0x69fc
movq %rdx, %r14
movq %rax, %rbx
jmp 0x6957
movq %rdx, %r14
movq %rax, %rbx
jmp 0x694d
movq %rdx, %r14
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x56b8
leaq 0x8(%rsp), %rdi
callq 0x56b8
cmpl $0x1, %r14d
jne 0x69fc
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 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x852c
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x85f0
xorl %ebp, %ebp
leaq 0x17a41(%rip), %rsi     # 0x1e400
movq 0x185b2(%rip), %rdx     # 0x1ef78
movq %r14, %rdi
callq 0x55c0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x56b8
testb %bpl, %bpl
jne 0x69e5
jmp 0x69ed
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