// File: /workspace/github_c_makefile_star2_O3/dropletzhu[P]msuite/msender6.c
// Function: main
int
main (int argc, char *argv[])
{
	struct sockaddr_in6 addr;
	int fd, ch, i = 1;
	int hops = 1;
	char msgbuf[BUF_LEN], source[IP_LEN], group[IP_LEN], port[PORT_LEN];
	char ifname[NAME_LEN];
	unsigned int ifindex = 0;
	int length = 256;
	int count = 0;

	if (argc <= 1)
	{
	    usage();
	    return 0;
	}

	while ((ch = getopt (argc, argv, "s:i:g:p:h:l:c:")) != -1)
	{
		switch (ch)
		{
		case 's':
			memset(source,0,IP_LEN);
			strncpy(source, optarg, IP_LEN-1);
			break;
		case 'i':
			memset(ifname,0,NAME_LEN);
			strncpy(ifname, optarg, NAME_LEN - 1);
			break;
		case 'g':
			memset (group, 0, IP_LEN);
			strncpy (group, optarg, IP_LEN - 1);
			break;
		case 'p':
			memset (port, 0, PORT_LEN);
			strncpy (port, optarg, PORT_LEN - 1);
			break;
		case 'h':
			hops = atoi (optarg);
			break;
		case 'l':
			length = atoi(optarg);
			break;
		case 'c':
			count = atoi(optarg);
			break;
		default:
			usage();
			return 0;
		}
	}

	fd = socket (AF_INET6, SOCK_DGRAM, 0 );

	if (fd < 0)
	{
		perror ("socket");
		return -1;
	}

	ifindex = if_nametoindex(ifname);

	/* set up destination address */
	memset (&addr, 0, sizeof (addr));
	addr.sin6_family = AF_INET6;
	inet_pton(AF_INET6,group,&(addr.sin6_addr));
	addr.sin6_port = htons (atoi (port));

	if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex,
		 sizeof (ifindex)))
	{
		perror ("setsockopt if");
		return -1;
	}

	if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hops, sizeof (hops)))
	{
		perror ("setsockopt hops");
		return -1;
	}

	/* now just sendto() our destination! */
	while (1)
	{
		if ( count && ( i > count ) ) {
			break;
		}
		memset(msgbuf,0,BUF_LEN);

		snprintf(msgbuf,length,"Sender %s->%s <>%d", source, group, i++);

		if (sendto(fd, msgbuf, length, 0, (struct sockaddr *) &addr, 
					sizeof (addr)) < 0)
		{
			perror ("sendto");
			return -1;
		}
		else
		{
			printf ("%s\n",msgbuf);
		}
		sleep (1);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x100b8, %rsp          # imm = 0x100B8
movl $0x1, 0xc(%rsp)
cmpl $0x2, %edi
jl 0x153e
movq %rsi, %r14
movl %edi, %r15d
movl $0x0, 0x8(%rsp)
movl $0x100, 0x18(%rsp)      # imm = 0x100
leaq 0xd97(%rip), %r12       # 0x2059
leaq 0xd3b(%rip), %rbp       # 0x2004
movq 0x2d10(%rip), %rbx      # 0x3fe0
leaq 0x60(%rsp), %r13
movl %r15d, %edi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10d0
leal -0x63(%rax), %ecx
cmpl $0x10, %ecx
ja 0x13ce
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x50(%rsp)
movq (%rbx), %rsi
movl $0x27, %edx
leaq 0x30(%rsp), %rdi
callq 0x1030
jmp 0x12d5
movq (%rbx), %rdi
callq 0x10e0
movl %eax, 0xc(%rsp)
jmp 0x12d5
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x80(%rsp)
movq (%rbx), %rsi
movl $0x27, %edx
movq %r13, %rdi
callq 0x1030
jmp 0x12d5
movw $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rbx), %rsi
movl $0x9, %edx
leaq 0x20(%rsp), %rdi
callq 0x1030
jmp 0x12d5
movw $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
movq (%rbx), %rsi
movl $0x5, %edx
leaq 0x10(%rsp), %rdi
callq 0x1030
jmp 0x12d5
movq (%rbx), %rdi
callq 0x10e0
movl %eax, 0x18(%rsp)
jmp 0x12d5
movq (%rbx), %rdi
callq 0x10e0
movl %eax, 0x8(%rsp)
jmp 0x12d5
cmpl $-0x1, %eax
jne 0x153e
movl $0xa, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1100
testl %eax, %eax
js 0x1557
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x10a0
leaq 0x2c(%rsp), %rbx
movl %eax, (%rbx)
xorps %xmm0, %xmm0
leaq 0x98(%rsp), %r15
movaps %xmm0, -0x8(%r15)
movups %xmm0, 0x4(%r15)
movw $0xa, -0x8(%r15)
leaq 0x30(%rsp), %rsi
movl $0xa, %edi
movq %r15, %rdx
callq 0x10b0
leaq 0x10(%rsp), %rdi
callq 0x10e0
rolw $0x8, %ax
movw %ax, -0x6(%r15)
movl %ebp, %edi
movl $0x29, %esi
movl $0x11, %edx
movq %rbx, %rcx
movl $0x4, %r8d
callq 0x1050
testl %eax, %eax
jne 0x1560
leaq 0xc(%rsp), %rcx
movl %ebp, %edi
movl $0x29, %esi
movl $0x12, %edx
movl $0x4, %r8d
callq 0x1050
testl %eax, %eax
jne 0x1569
cmpl $0x0, 0x8(%rsp)
js 0x1543
movslq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x1, %r13d
leaq 0xb0(%rsp), %r15
movl 0x8(%rsp), %r14d
movl $0xffff, %edx           # imm = 0xFFFF
movq %r15, %rdi
xorl %esi, %esi
callq 0x1080
movq %r15, %rdi
movq 0x18(%rsp), %rbx
movq %rbx, %rsi
leaq 0xbba(%rip), %rdx       # 0x208d
leaq 0x60(%rsp), %rcx
leaq 0x30(%rsp), %r8
movl %r13d, %r9d
xorl %eax, %eax
callq 0x1070
movl %ebp, %edi
movq %r15, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
leaq 0x90(%rsp), %r8
movl $0x1c, %r9d
callq 0x1090
testq %rax, %rax
js 0x1572
testl %r14d, %r14d
sete %r12b
movl %ebp, %ebx
leal 0x1(%r13), %ebp
movq %r15, %rdi
callq 0x1040
movl $0x1, %edi
callq 0x10f0
cmpl %r14d, %r13d
setl %al
orb %r12b, %al
movl %ebp, %r13d
movl %ebx, %ebp
jne 0x14b2
jmp 0x1543
callq 0x120c
xorl %eax, %eax
addq $0x100b8, %rsp          # imm = 0x100B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb0a(%rip), %rdi       # 0x2068
jmp 0x1579
leaq 0xb08(%rip), %rdi       # 0x206f
jmp 0x1579
leaq 0xb0d(%rip), %rdi       # 0x207d
jmp 0x1579
leaq 0xb27(%rip), %rdi       # 0x20a0
callq 0x10c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1545