// File: /workspace/github_cpp_makefile_star2_O3/nvanbenschoten[P]byzantine-agreement/src/general.cc
// Function: generals::Commander::Decide()
msg::Order Commander::Decide() {
  // Send in parallel so that some Lieutenants don't end up far ahead of
  // others.
  threadutil::ThreadGroup senders;
  auto ids = std::vector<unsigned int>{0};
  for (unsigned int pid = 1; pid < processes_.size(); ++pid) {
    if (ShouldSendMsg()) {
      msg::Message msg{round_, OrderForMsg(), ids};
      logging::out << "Sending  " << msg << " to p" << pid << "\n";

      udp::ClientPtr client = ClientForId(pid);
      senders.AddThread([this, client, msg] {
        MaybeDelaySend();
        SendMessage(client, msg);
      });
    }
  }
  senders.JoinAll();
  return order_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
leaq 0x10(%rsp), %rsi
movl $0x0, (%rsi)
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rcx
movl $0x1, %edx
callq 0x12de8
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r15 # imm = 0xCCCCCCCCCCCCCCCD
imulq %r15, %rax
cmpq $0x2, %rax
jb 0x11c1e
leaq 0x20(%rbx), %rax
movq %rax, 0x88(%rsp)
movl $0x1, %r13d
movl $0x2, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x11818
testb %al, %al
je 0x11bf4
movl 0x64(%rbx), %eax
movl %eax, 0x50(%rsp)
movq %rbx, %rdi
callq 0x11d4e
movl %eax, 0x54(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x12e2e
leaq 0xeb80(%rip), %rdi      # 0x20578
leaq 0x5d35(%rip), %rsi      # 0x17734
callq 0x12eae
movq %rax, %r14
movb 0x8(%rax), %al
testb $0x1, %al
je 0x11a1b
movq (%r14), %rdi
leaq 0x50(%rsp), %rsi
callq 0x11055
movq %r14, %rdi
leaq 0x5d19(%rip), %rsi      # 0x1773e
callq 0x12ee2
movq %rax, %r14
movb 0x8(%rax), %al
testb $0x1, %al
je 0x11a3f
movq (%r14), %rdi
movq %r13, %rsi
callq 0x5220
movq %r14, %rdi
leaq 0x510c(%rip), %rsi      # 0x16b55
callq 0x12f16
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r13, %rdx
jbe 0x11c8b
leaq (,%r13,4), %rcx
addq %r13, %rcx
leaq (%rax,%rcx,8), %rsi
movq 0x88(%rsp), %rdi
callq 0x130c8
testq %rax, %rax
je 0x11c7f
movq 0x30(%rax), %rcx
movq 0x38(%rax), %r13
testq %r13, %r13
je 0x11abd
movq 0xe4ed(%rip), %rax      # 0x1ff90
cmpb $0x0, (%rax)
je 0x11ad2
incl 0x8(%r13)
movq %rbx, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq %r13, 0x20(%rsp)
jmp 0x11aef
movq %rbx, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
jmp 0x11af3
lock
incl 0x8(%r13)
cmpb $0x0, (%rax)
movq %rbx, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq %r13, 0x20(%rsp)
je 0x11c14
incl 0x8(%r13)
movq 0x50(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x12e2e
movq $0x0, (%rsp)
movl $0x40, %edi
callq 0x5330
leaq 0xe183(%rip), %rcx      # 0x1fca8
movq %rcx, (%rax)
movaps 0x10(%rsp), %xmm0
movups %xmm0, 0x8(%rax)
movq 0x20(%rsp), %rcx
movq %r12, 0x20(%rsp)
movq %rcx, 0x18(%rax)
movq %r12, 0x18(%rsp)
movq 0x28(%rsp), %rcx
movq %rcx, 0x20(%rax)
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x28(%rax)
movq 0x40(%rsp), %rcx
movq %rcx, 0x38(%rax)
leaq 0x30(%rsp), %rcx
movq %r12, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
movq %rax, 0x8(%rsp)
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x5300
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x11b92
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x70(%rsp), %rdi
movq %rsp, %rsi
callq 0x145b2
cmpq $0x0, (%rsp)
jne 0x11cf4
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x11bc1
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x11bd0
callq 0xff02
testq %r13, %r13
je 0x11bdd
movq %r13, %rdi
callq 0xff02
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x11bf4
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movl %ebp, %r13d
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
sarq $0x3, %rax
imulq %r15, %rax
incl %ebp
cmpq %r13, %rax
ja 0x119bc
jmp 0x11c1e
lock
incl 0x8(%r13)
jmp 0x11af3
movq 0x70(%rsp), %r14
movq 0x78(%rsp), %r15
cmpq %r15, %r14
je 0x11c41
cmpq $0x0, (%r14)
je 0x11c3b
movq %r14, %rdi
callq 0x55c0
addq $0x8, %r14
jmp 0x11c28
movl 0x68(%rbx), %ebx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x11c61
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
leaq 0x70(%rsp), %rdi
callq 0x131e0
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5b03(%rip), %rdi      # 0x17789
callq 0x54d0
leaq 0x5194(%rip), %rdi      # 0x16e26
movq %r13, %rsi
xorl %eax, %eax
callq 0x5520
movq %rax, %rbx
jmp 0x11d3b
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x11ce5
callq 0xff02
jmp 0x11ce5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x11cdb
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x11cdb
jmp 0x11d04
jmp 0x11cd8
cmpq $0x0, (%rsp)
jne 0x11cf4
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x11da4
testq %r13, %r13
je 0x11d07
movq %r13, %rdi
callq 0xff02
jmp 0x11d07
callq 0x50e0
jmp 0x11cff
jmp 0x11d04
jmp 0x11cff
movq %rax, %rbx
jmp 0x11d1e
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x11d1e
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x11d3b
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
leaq 0x70(%rsp), %rdi
callq 0x131e0
movq %rbx, %rdi
callq 0x5600
nop