// File: nvanbenschoten[P]byzantine-agreement/src/main.cc
// Function: GetProcesses(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::experimental::fundamentals_v1::optional<unsigned short>)
generals::ProcessList GetProcesses(
    const std::string hostfile,
    std::experimental::optional<unsigned short> default_port) {
  generals::ProcessList processes;
  std::ifstream file(hostfile);
  if (!file) {
    throw std::runtime_error("could not open hostfile");
  }

  std::string host;
  while (file >> host) {
    try {
      auto addr = net::AddressWithDefaultPort(host, default_port);
      processes.push_back(addr);
    } catch (std::invalid_argument e) {
      throw args::UsageError(e.what());
    }
  }
  return processes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x350, %rsp            # imm = 0x350
movq %rdx, -0x300(%rbp)
movq %rsi, -0x2e8(%rbp)
movq %rdi, -0x2f8(%rbp)
movq %rdi, %rax
movq %rax, -0x2f0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0xc900
movq -0x2e8(%rbp), %rsi
leaq -0x228(%rbp), %rdi
movl $0x8, %edx
callq 0x66a0
jmp 0x79b9
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x6210
movb %al, -0x301(%rbp)
jmp 0x79d9
movb -0x301(%rbp), %al
testb $0x1, %al
jne 0x79e8
jmp 0x7a7d
movl $0x10, %edi
callq 0x6240
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x310(%rbp)
leaq 0x2ee81(%rip), %rsi     # 0x36887
callq 0x6190
jmp 0x7a0d
movq -0x310(%rbp), %rdi
movq 0x4b5d5(%rip), %rsi     # 0x52ff0
movq 0x4b54e(%rip), %rdx     # 0x52f70
callq 0x6730
jmp 0x7d79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x7d59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x7d2f
movq -0x310(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
callq 0x6300
jmp 0x7d2f
leaq -0x258(%rbp), %rdi
callq 0x65f0
leaq -0x228(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x6550
movq %rax, -0x318(%rbp)
jmp 0x7aa5
movq -0x318(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x6530
movb %al, -0x319(%rbp)
jmp 0x7ac3
movb -0x319(%rbp), %al
testb $0x1, %al
jne 0x7ad2
jmp 0x7cff
leaq -0x2a0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x61d0
jmp 0x7ae7
movq -0x300(%rbp), %rsi
leaq -0x2a4(%rbp), %rdi
callq 0xc920
jmp 0x7afc
leaq -0x280(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
leaq -0x2a4(%rbp), %rdx
callq 0x359c0
jmp 0x7b18
leaq -0x2a0(%rbp), %rdi
callq 0x6878
movq -0x2f8(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0xc950
jmp 0x7b39
leaq -0x280(%rbp), %rdi
callq 0xc9c0
jmp 0x7cfa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x7d23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x7bb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x6878
jmp 0x7bb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x280(%rbp), %rdi
callq 0xc9c0
movl -0x234(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x7d23
movq -0x230(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x6510
movq %rax, %rsi
leaq -0x2b8(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0xc9e0
movq -0x348(%rbp), %rdi
callq 0x61a0
movb $0x1, -0x2da(%rbp)
movl $0x10, %edi
callq 0x6240
movq -0x340(%rbp), %rdi
movq %rax, -0x338(%rbp)
callq 0x6640
movq %rax, -0x330(%rbp)
leaq -0x2d9(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x6760
movq -0x330(%rbp), %rsi
movq -0x328(%rbp), %rdx
leaq -0x2d8(%rbp), %rdi
callq 0xc850
jmp 0x7c55
movq -0x338(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0xca20
jmp 0x7c6a
movq -0x338(%rbp), %rdi
movb $0x0, -0x2da(%rbp)
leaq 0x4a721(%rip), %rsi     # 0x523a0
leaq 0x4dda(%rip), %rdx      # 0xca60
callq 0x6730
jmp 0x7d79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x7cc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x6878
leaq -0x2d9(%rbp), %rdi
callq 0x6460
testb $0x1, -0x2da(%rbp)
jne 0x7cd9
jmp 0x7ce5
movq -0x338(%rbp), %rdi
callq 0x6300
leaq -0x2b8(%rbp), %rdi
callq 0x6880
callq 0x66c0
jmp 0x7cf8
jmp 0x7d23
jmp 0x7a89
movb $0x1, -0x19(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x6878
leaq -0x228(%rbp), %rdi
callq 0x6120
testb $0x1, -0x19(%rbp)
jne 0x7d49
jmp 0x7d3d
leaq -0x258(%rbp), %rdi
callq 0x6878
leaq -0x228(%rbp), %rdi
callq 0x6120
jmp 0x7d59
movq -0x2f8(%rbp), %rdi
callq 0xca90
movq -0x2f0(%rbp), %rax
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq
movq -0x2f8(%rbp), %rdi
callq 0xca90
movq -0x230(%rbp), %rdi
callq 0x6750
movq %rax, %rdi
callq 0xca80
nopl (%rax)