// File: /workspace/github_cpp_makefile_star2_O3/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&)>)
std::experimental::optional<msg::SeqMessage> SeqMsgFromBuf(char* buf,
                                                           size_t n) {
  // Check to make sure the size of the buffer is correct.
  if (n != sizeof(msg::SeqMessage)) {
    return {};
  }

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpq $0x14, %rcx
jne 0x6c47
movl (%rdx), %ecx
movl 0x10(%rdx), %eax
bswapl %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)
movl %eax, 0x10(%rsp)
movb $0x1, 0x14(%rsp)
cmpl $0x3000000, %ecx        # imm = 0x3000000
jne 0x6c47
movq %rdi, %rbx
movq 0x8(%rdi), %rdx
subq (%rdi), %rdx
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %edx
cmpq %rdx, %rcx
jbe 0x6c47
cmpq %rax, %rcx
jbe 0x6c47
movq %r8, %r14
movq %rsi, %r15
leaq 0x1598e(%rip), %rdi     # 0x1c500
leaq 0xd74a(%rip), %rsi      # 0x142c3
callq 0x7844
movq %rax, %r12
movb 0x8(%rax), %al
testb $0x1, %al
je 0x6b94
movq (%r12), %rdi
movq %rsp, %rsi
callq 0x130f6
leaq 0xe0ce(%rip), %rsi      # 0x14c69
movq %r12, %rdi
callq 0x7878
movl 0xc(%rsp), %eax
cmpl %eax, 0xc8(%rbx)
jae 0x6bb5
movl %eax, 0xc8(%rbx)
movl 0x4(%rsp), %ecx
movl 0x8(%rsp), %eax
movq (%r15), %rdi
movq 0x8(%r15), %r15
testq %r15, %r15
je 0x6be0
movq 0x153c8(%rip), %rdx     # 0x1bf98
cmpb $0x0, (%rdx)
je 0x6bdb
incl 0x8(%r15)
jmp 0x6be0
lock
incl 0x8(%r15)
leaq 0x3c(%rsp), %rsi
movl $0x4000000, (%rsi)      # imm = 0x4000000
bswapl %ecx
movl %ecx, 0x4(%rsi)
bswapl %eax
movl %eax, 0x8(%rsi)
movl $0xc, %edx
callq 0x1245e
testq %r15, %r15
je 0x6c0c
movq %r15, %rdi
callq 0x78ac
addq $0x60, %rbx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x77e6
movq %rsp, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x659c
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x6c47
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 0x6c73
movq %rax, %rbx
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x6c8b
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x6c8b
movq %rax, %rdi
callq 0x791b
movq %rax, %rbx
testq %r15, %r15
je 0x6c8b
movq %r15, %rdi
callq 0x78ac
movq %rbx, %rdi
callq 0x5650
nop