// File: /workspace/github_cpp_makefile_star2_O3/nvanbenschoten[P]total-order-multicast/src/process.cc
// Function: process::Process::HandleDataMsg(std::shared_ptr<udp::Client>, char*, unsigned long)
std::experimental::optional<msg::DataMessage> DataMsgFromBuf(char* buf,
                                                             size_t n) {
  // Check to make sure the size of the buffer is correct.
  if (n != sizeof(msg::DataMessage)) {
    return {};
  }

  msg::DataMessage* buf_msg = reinterpret_cast<msg::DataMessage*>(buf);
  msg::DataMessage msg;
  msg.type = ntohl(buf_msg->type);
  msg.sender = ntohl(buf_msg->sender);
  msg.msg_id = ntohl(buf_msg->msg_id);
  msg.data = ntohl(buf_msg->data);
  return msg;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
cmpq $0x10, %rcx
jne 0x6a9a
movl (%rdx), %eax
movdqu (%rdx), %xmm0
pxor %xmm1, %xmm1
movdqa %xmm0, %xmm2
punpckhbw %xmm1, %xmm2    # xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
pshuflw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,7,6,5,4]
punpcklbw %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
pshuflw $0x1b, %xmm0, %xmm0     # xmm0 = xmm0[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,7,6,5,4]
packuswb %xmm2, %xmm0
movdqa %xmm0, (%rsp)
movb $0x1, 0x10(%rsp)
cmpl $0x1000000, %eax        # imm = 0x1000000
jne 0x6a9a
movq %rdi, %r14
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rcx
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %eax
cmpq %rax, %rcx
jbe 0x6a9a
movq %rsi, %rbx
leaq 0x15b9a(%rip), %rdi     # 0x1c500
leaq 0xd956(%rip), %rsi      # 0x142c3
callq 0x7844
movq %rax, %r15
movb 0x8(%rax), %al
testb $0x1, %al
je 0x6987
movq (%r15), %rdi
movq %rsp, %rsi
callq 0x12f8c
leaq 0xe2db(%rip), %rsi      # 0x14c69
movq %r15, %rdi
callq 0x7878
leaq 0x60(%r14), %r15
movq 0x4(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x8946
testq %rax, %rax
je 0x69d0
movdqu 0x4(%rsp), %xmm0
movq 0x10(%rax), %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqu %xmm0, 0x24(%rsp)
movb $0x1, 0x34(%rsp)
jmp 0x6a14
pxor %xmm0, %xmm0
leaq 0x20(%rsp), %rsi
movdqa %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq 0x4(%rsp), %rax
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 0x64a8
movq (%rbx), %rdi
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x6a35
movq 0x15571(%rip), %rax     # 0x1bf98
cmpb $0x0, (%rax)
je 0x6a31
incl 0x8(%rbx)
jmp 0x6a35
lock
incl 0x8(%rbx)
movdqa 0x20(%rsp), %xmm0
leaq 0x40(%rsp), %rsi
movdqa %xmm0, (%rsi)
movl 0x30(%rsp), %eax
movl %eax, 0x10(%rsi)
movl $0x2000000, (%rsi)      # imm = 0x2000000
pxor %xmm0, %xmm0
movdqu 0x4(%rsi), %xmm1
movdqa %xmm1, %xmm2
punpckhbw %xmm0, %xmm2    # xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
pshuflw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,7,6,5,4]
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
pshuflw $0x1b, %xmm1, %xmm0     # xmm0 = xmm1[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,7,6,5,4]
packuswb %xmm2, %xmm0
movdqu %xmm0, 0x4(%rsi)
movl $0x14, %edx
callq 0x1245e
testq %rbx, %rbx
je 0x6a9a
movq %rbx, %rdi
callq 0x78ac
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
testq %rbx, %rbx
je 0x6ab4
movq %rbx, %rdi
callq 0x78ac
movq %r14, %rdi
callq 0x5650