// File: /workspace/github_cpp_makefile_star2_O1/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 0x18(%rsp), %rsi
movl $0x0, (%rsi)
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rcx
movl $0x1, %edx
callq 0x12e48
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r15 # imm = 0xCCCCCCCCCCCCCCCD
imulq %r15, %rax
cmpq $0x2, %rax
jb 0x11d42
leaq 0x20(%rbx), %rax
movq %rax, 0x88(%rsp)
movl $0x1, %r13d
movl $0x2, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x1192e
testb %al, %al
je 0x11d24
movl 0x64(%rbx), %eax
movl %eax, 0x50(%rsp)
movq %rbx, %rdi
callq 0x11e7c
movl %eax, 0x54(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x12e8e
leaq 0xea68(%rip), %rdi      # 0x20578
leaq 0x5bd5(%rip), %rsi      # 0x176ec
callq 0x12f0e
movq %rax, %r14
movb 0x8(%rax), %al
testb $0x1, %al
je 0x11b33
movq (%r14), %rdi
leaq 0x50(%rsp), %rsi
callq 0x11271
movq %r14, %rdi
leaq 0x5bb9(%rip), %rsi      # 0x176f6
callq 0x12f42
movq %rax, %r14
movb 0x8(%rax), %al
testb $0x1, %al
je 0x11b57
movq (%r14), %rdi
movq %r13, %rsi
callq 0x5220
movq %r14, %rdi
leaq 0x4ff4(%rip), %rsi      # 0x16b55
callq 0x12f76
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r13, %rdx
jbe 0x11daf
leaq (,%r13,4), %rcx
addq %r13, %rcx
leaq (%rax,%rcx,8), %rsi
movq 0x88(%rsp), %rdi
callq 0x13128
testq %rax, %rax
je 0x11da3
movq 0x30(%rax), %rcx
movq 0x38(%rax), %r13
testq %r13, %r13
je 0x11bc6
movq 0xe3d5(%rip), %rax      # 0x1ff90
cmpb $0x0, (%rax)
je 0x11bd7
incl 0x8(%r13)
jmp 0x11bdc
movq %rbx, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq %r13, 0x28(%rsp)
jmp 0x11c07
lock
incl 0x8(%r13)
movq %rbx, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq %r13, 0x28(%rsp)
testq %r13, %r13
je 0x11c07
movq 0xe399(%rip), %rax      # 0x1ff90
cmpb $0x0, (%rax)
je 0x11c02
incl 0x8(%r13)
jmp 0x11c07
lock
incl 0x8(%r13)
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x12e8e
movq $0x0, 0x8(%rsp)
movl $0x40, %edi
callq 0x5330
leaq 0xe06e(%rip), %rcx      # 0x1fca8
movq %rcx, (%rax)
movq 0x18(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r12, 0x18(%rax)
movq 0x28(%rsp), %rcx
movq %r12, 0x28(%rsp)
movq %rcx, 0x18(%rax)
movq %r12, 0x20(%rsp)
movq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rax)
movq 0x38(%rsp), %rcx
movq %rcx, 0x28(%rax)
movq 0x40(%rsp), %rcx
movq %rcx, 0x30(%rax)
movq 0x48(%rsp), %rcx
movq %rcx, 0x38(%rax)
leaq 0x38(%rsp), %rcx
movq %r12, 0x10(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq %rax, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x5300
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x11cbf
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1461a
cmpq $0x0, 0x8(%rsp)
jne 0x11e22
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x11cf1
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x11d00
callq 0x100e8
testq %r13, %r13
je 0x11d0d
movq %r13, %rdi
callq 0x100e8
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x11d24
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 0x11ad4
movq 0x70(%rsp), %r14
movq 0x78(%rsp), %r15
cmpq %r15, %r14
je 0x11d65
cmpq $0x0, (%r14)
je 0x11d5f
movq %r14, %rdi
callq 0x55c0
addq $0x8, %r14
jmp 0x11d4c
movl 0x68(%rbx), %ebx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x11d85
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
leaq 0x70(%rsp), %rdi
callq 0x1323a
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5997(%rip), %rdi      # 0x17741
callq 0x54d0
leaq 0x5070(%rip), %rdi      # 0x16e26
movq %r13, %rsi
xorl %eax, %eax
callq 0x5520
movq %rax, %rbx
jmp 0x11e69
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x11e13
callq 0x100e8
jmp 0x11e13
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x11def
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x10(%rsp)
jmp 0x11e09
jmp 0x11e32
jmp 0x11e06
cmpq $0x0, 0x8(%rsp)
jne 0x11e22
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x11ece
testq %r13, %r13
je 0x11e35
movq %r13, %rdi
callq 0x100e8
jmp 0x11e35
callq 0x50e0
jmp 0x11e2d
jmp 0x11e32
jmp 0x11e2d
movq %rax, %rbx
jmp 0x11e4c
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x11e4c
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x11e69
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
leaq 0x70(%rsp), %rdi
callq 0x1323a
movq %rbx, %rdi
callq 0x5600
nop