// File: /workspace/github_c_makefile_star2_O1/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, 0x2afa(%rip)      # 0x40b4
je 0x1625
movw $0x45, 0x2afb(%rip)     # 0x40c0
movzwl 0x2acc(%rip), %eax      # 0x4098
rolw $0x8, %ax
movw %ax, 0x2aeb(%rip)       # 0x40c2
callq 0x10b0
bswapl %eax
movw %ax, 0x2adf(%rip)       # 0x40c4
movl $0x67ff0000, 0x2ad7(%rip) # imm = 0x67FF0000
movw $0x0, 0x2ad2(%rip)      # 0x40ca
leaq 0x12ac1(%rip), %rdi     # 0x140c0
callq 0x10a0
movl %eax, 0x2ac2(%rip)      # 0x40cc
leaq 0x12abf(%rip), %rdi     # 0x140d0
callq 0x10a0
movl %eax, 0x2ab4(%rip)      # 0x40d0
leaq 0x2ab1(%rip), %rbx      # 0x40d4
jmp 0x162c
leaq 0x2a94(%rip), %rbx      # 0x40c0
movb $0x22, (%rbx)
movw $0x1, %bp
movw %bp, 0x4(%rbx)
leaq 0x12ab2(%rip), %rdi     # 0x140f0
callq 0x10a0
movl %eax, 0xc(%rbx)
movw %bp, 0x14(%rbx)
leaq 0x12a8f(%rip), %rdi     # 0x140e0
callq 0x10a0
movl %eax, 0x16(%rbx)
movl $0x13, %ecx
xorl %eax, %eax
movq %rbx, %rdx
movzwl (%rdx), %esi
addq $0x2, %rdx
addq %rsi, %rax
decl %ecx
cmpl $0x1, %ecx
ja 0x1663
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, 0x2(%rbx)
cmpl $0x0, 0x2a20(%rip)      # 0x40b4
je 0x16de
movl 0x29fc(%rip), %ecx      # 0x4098
sarl %ecx
testl %ecx, %ecx
jle 0x16c0
incl %ecx
leaq 0x2a15(%rip), %rdx      # 0x40c0
xorl %eax, %eax
movzwl (%rdx), %esi
addq $0x2, %rdx
addq %rsi, %rax
decl %ecx
cmpl $0x1, %ecx
jg 0x16ad
jmp 0x16c2
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, 0x29ec(%rip)       # 0x40ca
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq