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

  // If we have already seen this message, send back the old ack so that the
  // sequence number does not change.
  auto ack_msg = hold_back_queue_.Lookup(*data_msg);
  if (!ack_msg) {
    // We have not already seen this message, so insert it into the
    // HoldBackQueue.
    ack_msg->sender = data_msg->sender;
    ack_msg->msg_id = data_msg->msg_id;
    ack_msg->proposed_seq = NextSeqNum();
    ack_msg->proposer = id_;

    hold_back_queue_.InsertUndeliverable(*ack_msg, data_msg->data);
  }

  // Respond to the sender.
  SendAckMsg(client, *ack_msg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x10, %rcx
jne 0x68e6
movl (%rdx), %eax
movl 0x4(%rdx), %ecx
bswapl %eax
bswapl %ecx
movl 0x8(%rdx), %esi
bswapl %esi
movl 0xc(%rdx), %edx
bswapl %edx
movl %eax, (%rsp)
movl %ecx, 0x4(%rsp)
movl %esi, 0x8(%rsp)
movl %edx, 0xc(%rsp)
movb $0x1, 0x10(%rsp)
jmp 0x68f5
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movl $0x0, 0x10(%rsp)
cmpb $0x1, 0x10(%rsp)
jne 0x6a57
cmpl $0x1, (%rsp)
jne 0x6a57
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rcx
movl 0x4(%rsp), %eax
cmpq %rax, %rcx
jbe 0x6a57
leaq 0x15bc9(%rip), %rdi     # 0x1c500
leaq 0xd985(%rip), %rsi      # 0x142c3
callq 0x7854
movq %rax, %r15
movb 0x8(%rax), %al
testb $0x1, %al
je 0x6958
movq (%r15), %rdi
movq %rsp, %rsi
callq 0x1316c
leaq 0xe30a(%rip), %rsi      # 0x14c69
movq %r15, %rdi
callq 0x7888
leaq 0x60(%r14), %r15
movq 0x4(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x895e
testq %rax, %rax
je 0x699f
movq 0x4(%rsp), %rcx
movq 0x10(%rax), %rax
movq %rcx, 0x24(%rsp)
movq %rax, 0x2c(%rsp)
movb $0x1, 0x34(%rsp)
jmp 0x69b0
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
cmpb $0x0, 0x34(%rsp)
jne 0x69eb
movq 0x4(%rsp), %rax
leaq 0x20(%rsp), %rsi
movq %rax, 0x4(%rsi)
movl 0xc8(%r14), %eax
incl %eax
movl %eax, 0xc8(%r14)
movl %eax, 0xc(%rsi)
movl 0x50(%r14), %eax
movl %eax, 0x10(%rsi)
movl 0xc(%rsp), %edx
movq %r15, %rdi
callq 0x6442
movq (%rbx), %rdi
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x6a0c
movq 0x1559a(%rip), %rax     # 0x1bf98
cmpb $0x0, (%rax)
je 0x6a08
incl 0x8(%rbx)
jmp 0x6a0c
lock
incl 0x8(%rbx)
movaps 0x20(%rsp), %xmm0
leaq 0x40(%rsp), %rsi
movaps %xmm0, (%rsi)
movl 0x30(%rsp), %eax
movl $0x2000000, (%rsi)      # imm = 0x2000000
movl 0x4(%rsi), %ecx
movl 0x8(%rsi), %edx
bswapl %ecx
movl %ecx, 0x4(%rsi)
bswapl %edx
movl %edx, 0x8(%rsi)
movl 0xc(%rsi), %ecx
bswapl %ecx
movl %ecx, 0xc(%rsi)
bswapl %eax
movl %eax, 0x10(%rsi)
movl $0x14, %edx
callq 0x12632
testq %rbx, %rbx
je 0x6a57
movq %rbx, %rdi
callq 0x78bc
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
testq %rbx, %rbx
je 0x6a71
movq %rbx, %rdi
callq 0x78bc
movq %r14, %rdi
callq 0x5650
nop