// File: /workspace/github_cpp_makefile_star2_O1/nvanbenschoten[P]total-order-multicast/src/process.cc
// Function: process::Process::HandleSeqMsg(std::shared_ptr<udp::Client>, char*, unsigned long, std::function<void (msg::SeqMessage&)>)
void Process::HandleSeqMsg(const udp::ClientPtr client, char* buf, size_t n,
                           const deliverMsgFn deliver) {
  auto seq_msg = SeqMsgFromBuf(buf, n);
  if (!seq_msg || !ValidSeqMsg(*seq_msg, processes_.size())) {
    // If the seq message was not valid, return without trying to use it.
    return;
  }
  logging::out << "Received message " << *seq_msg << "\n";

  // Forward our sequence number so that it is always larger than any other
  // we have seen.
  ForwardSeqNum(seq_msg->final_seq);

  // Respond to the sender.
  msg::SeqAckMessage seqack_msg;
  seqack_msg.sender = seq_msg->sender;
  seqack_msg.msg_id = seq_msg->msg_id;
  SendSeqAckMsg(client, seqack_msg);

  // Set the message as deliverable in the HoldBackQueue. This may result in one
  // or more messages being delivered.
  hold_back_queue_.SetDeliverable(*seq_msg, deliver);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpq $0x14, %rcx
jne 0x6ad6
movl (%rdx), %eax
movl 0x4(%rdx), %ecx
bswapl %eax
bswapl %ecx
movl 0x8(%rdx), %esi
bswapl %esi
movl 0xc(%rdx), %edi
bswapl %edi
movl 0x10(%rdx), %edx
bswapl %edx
movl %eax, (%rsp)
movl %ecx, 0x4(%rsp)
movl %esi, 0x8(%rsp)
movl %edi, 0xc(%rsp)
movl %edx, 0x10(%rsp)
movb $0x1, 0x14(%rsp)
jmp 0x6ae6
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpb $0x1, 0x14(%rsp)
jne 0x6c14
cmpl $0x3, (%rsp)
jne 0x6c14
movq 0x8(%rbx), %rcx
subq (%rbx), %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
movl 0x4(%rsp), %ecx
cmpq %rcx, %rax
jbe 0x6c14
movl 0x10(%rsp), %ecx
cmpq %rcx, %rax
jbe 0x6c14
leaq 0x159cb(%rip), %rdi     # 0x1c500
leaq 0xd787(%rip), %rsi      # 0x142c3
callq 0x7854
movq %rax, %r12
movb 0x8(%rax), %al
testb $0x1, %al
je 0x6b57
movq (%r12), %rdi
movq %rsp, %rsi
callq 0x132d6
leaq 0xe10b(%rip), %rsi      # 0x14c69
movq %r12, %rdi
callq 0x7888
movl 0xc(%rsp), %eax
cmpl %eax, 0xc8(%rbx)
jae 0x6b78
movl %eax, 0xc8(%rbx)
movl 0x4(%rsp), %ecx
movl 0x8(%rsp), %eax
shlq $0x20, %rcx
movq (%r15), %rdi
movq 0x8(%r15), %r15
testq %r15, %r15
je 0x6ba7
movq 0x15401(%rip), %rdx     # 0x1bf98
cmpb $0x0, (%rdx)
je 0x6ba2
incl 0x8(%r15)
jmp 0x6ba7
lock
incl 0x8(%r15)
leaq 0x38(%rsp), %rsi
movq %rcx, (%rsi)
movl $0x4000000, (%rsi)      # imm = 0x4000000
movl 0x4(%rsi), %ecx
bswapl %ecx
movl %ecx, 0x4(%rsi)
bswapl %eax
movl %eax, 0x8(%rsi)
movl $0xc, %edx
callq 0x12632
testq %r15, %r15
je 0x6bd9
movq %r15, %rdi
callq 0x78bc
addq $0x60, %rbx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x77ee
movq %rsp, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x653a
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x6c14
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x6c40
movq %rax, %rbx
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x6c58
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x6c58
movq %rax, %rdi
callq 0x792b
movq %rax, %rbx
testq %r15, %r15
je 0x6c58
movq %r15, %rdi
callq 0x78bc
movq %rbx, %rdi
callq 0x5650