// File: /workspace/github_c_makefile_star2_O2/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, 0x14(%rsp)
cmpl $0x2, %edi
jl 0x14eb
movq %rsi, %r14
movl %edi, %r15d
movl $0x0, 0x10(%rsp)
movl $0x100, 0xc(%rsp)       # imm = 0x100
leaq 0xd97(%rip), %r12       # 0x2059
leaq 0xd3b(%rip), %r13       # 0x2004
movq 0x2d10(%rip), %rbx      # 0x3fe0
pushq $0x27
popq %rbp
movl %r15d, %edi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10d0
leal -0x63(%rax), %ecx
cmpl $0x10, %ecx
ja 0x13ad
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x50(%rsp)
movq (%rbx), %rsi
leaq 0x30(%rsp), %rdi
jmp 0x1340
movq (%rbx), %rdi
callq 0x10e0
movl %eax, 0x14(%rsp)
jmp 0x12d3
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x80(%rsp)
movq (%rbx), %rsi
leaq 0x60(%rsp), %rdi
movq %rbp, %rdx
callq 0x1030
jmp 0x12d3
andw $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
movq (%rbx), %rsi
leaq 0x20(%rsp), %rdi
pushq $0x9
popq %rdx
callq 0x1030
jmp 0x12d3
andw $0x0, 0x1c(%rsp)
andl $0x0, 0x18(%rsp)
movq (%rbx), %rsi
leaq 0x18(%rsp), %rdi
pushq $0x5
popq %rdx
callq 0x1030
jmp 0x12d3
movq (%rbx), %rdi
callq 0x10e0
movl %eax, 0xc(%rsp)
jmp 0x12d3
movq (%rbx), %rdi
callq 0x10e0
movl %eax, 0x10(%rsp)
jmp 0x12d3
cmpl $-0x1, %eax
jne 0x14eb
pushq $0xa
popq %rdi
pushq $0x2
popq %rsi
xorl %edx, %edx
callq 0x1100
testl %eax, %eax
js 0x1504
movl %eax, %r14d
leaq 0x20(%rsp), %rdi
callq 0x10a0
leaq 0x2c(%rsp), %r15
movl %eax, (%r15)
xorps %xmm0, %xmm0
leaq 0x98(%rsp), %r12
movaps %xmm0, -0x8(%r12)
movups %xmm0, 0x4(%r12)
movw $0xa, -0x8(%r12)
pushq $0xa
popq %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
callq 0x10b0
leaq 0x18(%rsp), %rdi
callq 0x10e0
rolw $0x8, %ax
movw %ax, -0x6(%r12)
pushq $0x29
popq %rsi
pushq $0x11
popq %rdx
pushq $0x4
popq %r8
movl %r14d, %edi
movq %r15, %rcx
callq 0x1050
testl %eax, %eax
jne 0x150d
pushq $0x29
popq %rsi
pushq $0x12
popq %rdx
leaq 0x14(%rsp), %rcx
pushq $0x4
popq %r8
movl %r14d, %edi
callq 0x1050
testl %eax, %eax
jne 0x1516
movslq 0xc(%rsp), %r15
pushq $0x1
popq %r12
leaq 0xb0(%rsp), %r13
movl %r12d, %ebp
movl 0x10(%rsp), %ebx
testl %ebx, %ebx
setne %al
cmpl %ebx, %r12d
setg %cl
testb %cl, %al
jne 0x14f0
movl $0xffff, %edx           # imm = 0xFFFF
movq %r13, %rdi
xorl %esi, %esi
callq 0x1080
movq %r13, %rdi
movq %r15, %rsi
leaq 0xbeb(%rip), %rdx       # 0x208d
leaq 0x60(%rsp), %rcx
leaq 0x30(%rsp), %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x1070
movl %r14d, %edi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
leaq 0x90(%rsp), %r8
pushq $0x1c
popq %r9
callq 0x1090
testq %rax, %rax
js 0x151f
incl %r12d
movq %r13, %rdi
callq 0x1040
movl %ebp, %edi
callq 0x10f0
jmp 0x1477
callq 0x120c
xorl %eax, %eax
addq $0x100b8, %rsp          # imm = 0x100B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb5d(%rip), %rdi       # 0x2068
jmp 0x1526
leaq 0xb5b(%rip), %rdi       # 0x206f
jmp 0x1526
leaq 0xb60(%rip), %rdi       # 0x207d
jmp 0x1526
leaq 0xb7a(%rip), %rdi       # 0x20a0
callq 0x10c0
pushq $-0x1
popq %rax
jmp 0x14f2