// File: /workspace/github_c_makefile_star2_O3/dropletzhu[P]msuite/pim_sender.c
// Function: make_pim_register_stop
int make_pim_register_stop()
{
	struct ip *iph;
	struct _SPimHdr *pim_header;
	struct _SPimSmUnAlignedRegStopMsg *register_stop;
	char *header = datagram;
	in_addr_t tmp_group, tmp_source;

	if( has_local_source ) {
		iph = (struct ip*)(header);
		iph->ip_hl = 5;
		iph->ip_v = 4;
		iph->ip_tos = 0;
		iph->ip_len = htons(length);
		iph->ip_id = htonl(random());
		iph->ip_off = 0;
		iph->ip_ttl = 255;
		iph->ip_p = IPPROTO_PIM;
		iph->ip_sum = 0;
		iph->ip_src.s_addr = inet_addr (local_source);
		iph->ip_dst.s_addr = inet_addr (rp);

		header += sizeof(struct ip);
	}

	pim_header = (struct _SPimHdr*)(header);
	pim_header->msgtpe = PIMSM_REGISTER_STOP_MSG;
	pim_header->pimver = 2;
	header += sizeof(struct _SPimHdr);

	register_stop = (struct _SPimSmUnAlignedRegStopMsg*)header;
	register_stop->EncGrpAddr.u1AddrFamily = PIMSM_ADDRFMLY_IPV4;
	register_stop->EncGrpAddr.u1EncType = PIMSM_ENCTYPE_IPV4;
	tmp_group = inet_addr(mcast_group);
	memcpy(&(register_stop->EncGrpAddr.u4GrpAddr),&tmp_group,4);
	register_stop->EncUcastAddr.u1AddrFamily = PIMSM_ADDRFMLY_IPV4;
	register_stop->EncUcastAddr.u1EncType = PIMSM_ENCTYPE_IPV4;
	tmp_source = inet_addr(mcast_source);
	memcpy(&(register_stop->EncUcastAddr.u4UcastAddr),&tmp_source,4);

	pim_header->u2Checksum = csum((unsigned short*)pim_header,(sizeof(struct _SPimHdr)+sizeof(struct _SPimSmUnAlignedRegStopMsg))>>1);

	if( has_local_source ) {
		iph->ip_sum = csum((unsigned short*)iph, length>>1);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0x0, 0x2ae4(%rip)      # 0x40b4
je 0x163b
movw $0x45, 0x2ae5(%rip)     # 0x40c0
movzwl 0x2ab6(%rip), %eax      # 0x4098
rolw $0x8, %ax
movw %ax, 0x2ad5(%rip)       # 0x40c2
callq 0x10b0
bswapl %eax
movw %ax, 0x2ac9(%rip)       # 0x40c4
movl $0x67ff0000, 0x2ac1(%rip) # imm = 0x67FF0000
movw $0x0, 0x2abc(%rip)      # 0x40ca
leaq 0x12aab(%rip), %rdi     # 0x140c0
callq 0x10a0
movl %eax, 0x2aac(%rip)      # 0x40cc
leaq 0x12aa9(%rip), %rdi     # 0x140d0
callq 0x10a0
movl %eax, 0x2a9e(%rip)      # 0x40d0
leaq 0x2a9b(%rip), %rbx      # 0x40d4
jmp 0x1642
leaq 0x2a7e(%rip), %rbx      # 0x40c0
movb $0x22, (%rbx)
movw $0x1, %bp
movw %bp, 0x4(%rbx)
leaq 0x12a9c(%rip), %rdi     # 0x140f0
callq 0x10a0
movl %eax, 0xc(%rbx)
movw %bp, 0x14(%rbx)
leaq 0x12a79(%rip), %rdi     # 0x140e0
callq 0x10a0
movl %eax, 0x16(%rbx)
pxor %xmm0, %xmm0
xorl %eax, %eax
pxor %xmm1, %xmm1
movd (%rbx,%rax,2), %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
paddq %xmm2, %xmm1
addq $0x2, %rax
cmpq $0x12, %rax
jne 0x1679
pshufd $0xee, %xmm1, %xmm0     # xmm0 = xmm1[2,3,2,3]
paddq %xmm1, %xmm0
movq %xmm0, %rax
movzwl %ax, %ecx
shrq $0x10, %rax
addl %ecx, %eax
movl %eax, %ecx
shrl $0x10, %ecx
addl %eax, %ecx
notl %ecx
movw %cx, 0x2(%rbx)
cmpl $0x0, 0x29f5(%rip)      # 0x40b4
je 0x1709
movl 0x29d1(%rip), %ecx      # 0x4098
sarl %ecx
testl %ecx, %ecx
jle 0x16eb
incl %ecx
leaq 0x29ea(%rip), %rdx      # 0x40c0
xorl %eax, %eax
movzwl (%rdx), %esi
addq $0x2, %rdx
addq %rsi, %rax
decl %ecx
cmpl $0x1, %ecx
ja 0x16d8
jmp 0x16ed
xorl %eax, %eax
movq %rax, %rcx
shrq $0x10, %rcx
movzwl %ax, %eax
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
addl %ecx, %eax
notl %eax
movw %ax, 0x29c1(%rip)       # 0x40ca
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq