LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/rhfunc.c
// Function: rh_list_add_item
struct rh_item *
rh_list_add_item(struct rh_list *rh_list, struct ai_item *addr, int dup_buf_items,
    int rate_limit_time)
{
	struct rh_item *rh_item;
	struct rh_item_ci *ci;
	int i;

	rh_item = (struct rh_item *)malloc(sizeof(struct rh_item));
	if (rh_item == NULL) {
		return (NULL);
	}

	memset(rh_item, 0, sizeof(struct rh_item));

	rh_item->addr = addr;
	ci = &rh_item->client_info;

	if (dup_buf_items > 0) {
		ci->dup_buf_items = dup_buf_items;

		for (i = 0; i < 2; i++) {
			ci->dup_buffer[i] = (uint32_t *)malloc(dup_buf_items * sizeof(uint32_t));

			if (ci->dup_buffer[i] == NULL) {
				goto malloc_error;
			}

			memset(ci->dup_buffer[i], 0, dup_buf_items * sizeof(uint32_t));
		}
	}

	if (rate_limit_time > 0) {
		gcra_init(&rh_item->server_info.gcra, rate_limit_time, GCRA_BURST);
	}

	TAILQ_INSERT_TAIL(rh_list, rh_item, entries);

	return (rh_item);

malloc_error:
	for (i = 0; i < 2; i++) {
		free(rh_item->client_info.dup_buffer[i]);
	}
	free(rh_item);

	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x148, %esi            # imm = 0x148
callq 0x2190
testq %rax, %rax
je 0x6e49
movq %rax, %rbx
movq %r12, (%rax)
testl %r15d, %r15d
jle 0x6e07
movl %r15d, 0xf4(%rbx)
movl %r15d, %r15d
shlq $0x2, %r15
pushq $0xb
popq %r13
pushq $0x1
popq %r12
cmpq $0xd, %r13
je 0x6e07
movq %r12, %rdi
movq %r15, %rsi
callq 0x2190
movq %rax, (%rbx,%r13,8)
incq %r13
testq %rax, %rax
jne 0x6dd2
pushq $0xb
popq %r14
cmpq $0xd, %r14
je 0x6e41
movq (%rbx,%r14,8), %rdi
callq 0x2040
incq %r14
jmp 0x6df3
testl %ebp, %ebp
jle 0x6e1c
leaq 0x118(%rbx), %rdi
pushq $0x5
popq %rdx
movl %ebp, %esi
callq 0x480c
movq %rbx, %rax
addq $0x138, %rax            # imm = 0x138
andq $0x0, 0x138(%rbx)
movq 0x8(%r14), %rcx
movq %rcx, 0x140(%rbx)
movq %rbx, (%rcx)
movq %rax, 0x8(%r14)
jmp 0x6e4b
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/rhfunc.c
// Function: rh_list_create
void
rh_list_create(struct rh_list *rh_list, struct aii_list *remote_addrs, int dup_buf_items,
    int rate_limit_time)
{
	struct ai_item *addr;
	struct rh_item *rh_item;

	TAILQ_INIT(rh_list);

	if (remote_addrs != NULL) {
		TAILQ_FOREACH(addr, remote_addrs, entries) {
			rh_item = rh_list_add_item(rh_list, addr, dup_buf_items, rate_limit_time);
			if (rh_item == NULL) {
				errx(1, "Can't alloc memory");
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
andq $0x0, (%rdi)
movq %rdi, 0x8(%rdi)
testq %rsi, %rsi
je 0x6eaf
movl %ecx, %ebx
movq %rdi, %r14
movl %edx, %ebp
movq %rsi, %r15
movq (%r15), %r15
testq %r15, %r15
je 0x6eaf
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x6d85
addq $0x88, %r15
testq %rax, %rax
jne 0x6e7b
leaq 0x234b(%rip), %rsi      # 0x91f0
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x20f0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/rhfunc.c
// Function: rh_list_free
void
rh_list_free(struct rh_list *rh_list)
{
	struct rh_item *rh_item;
	struct rh_item *rh_item_next;
	int i;

	rh_item = TAILQ_FIRST(rh_list);

	while (rh_item != NULL) {
		rh_item_next = TAILQ_NEXT(rh_item, entries);

		free(rh_item->client_info.server_info);
		free(rh_item->client_info.ses_id);

		for (i = 0; i < 2; i++) {
			free(rh_item->client_info.dup_buffer[i]);
		}

		free(rh_item);

		rh_item = rh_item_next;
	}

	TAILQ_INIT(rh_list);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
pushq $0xb
popq %r15
testq %r14, %r14
je 0x6f44
movq 0x48(%r14), %rdi
movq 0x138(%r14), %r12
callq 0x2040
movq 0x50(%r14), %rdi
callq 0x2040
movq %r15, %r13
cmpq $0xd, %r13
je 0x6f37
movq (%r14,%r13,8), %rdi
callq 0x2040
incq %r13
jmp 0x6f23
movq %r14, %rdi
callq 0x2040
movq %r12, %r14
jmp 0x6f02
andq $0x0, (%rbx)
movq %rbx, 0x8(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/rhfunc.c
// Function: rh_list_hn_max_len
int
rh_list_hn_max_len(struct rh_list *rh_list)
{
	struct rh_item *rh_item;
	size_t max_len;

	max_len = 0;
	TAILQ_FOREACH(rh_item, rh_list, entries) {
		if (strlen(rh_item->addr->host_name) > max_len) {
			max_len = strlen(rh_item->addr->host_name);
		}
	}

	return (max_len > INT_MAX ? INT_MAX : (int)max_len);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x6fb6
movq (%rbx), %rax
movq 0x80(%rax), %rdi
callq 0x20e0
cmpq %r14, %rax
cmovaq %rax, %r14
addq $0x138, %rbx            # imm = 0x138
jmp 0x6f8f
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r14
cmovbq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/rhfunc.c
// Function: rh_list_put_to_finish_state
void
rh_list_put_to_finish_state(struct rh_list *rh_list, enum rh_list_finish_state fs)
{
	struct rh_item *rh_item;

	TAILQ_FOREACH(rh_item, rh_list, entries) {
		if (fs == RH_LFS_SERVER || fs == RH_LFS_BOTH) {
			rh_item->server_info.state = RH_SS_FINISHING;
		}
		if (fs == RH_LFS_CLIENT || fs == RH_LFS_BOTH) {
			rh_item->client_info.state = RH_CS_STOP;
		}
	}
}

// Assembly:
leal -0x1(%rsi), %eax
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x7012
cmpl $0x1, %eax
ja 0x6ffa
movl $0x2, 0x100(%rdi)
testl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
jne 0x7009
movl $0x2, 0x8(%rdi)
addq $0x138, %rdi            # imm = 0x138
jmp 0x6fe3
retq
nop
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/rsfunc.c
// Function: rs_sendto
ssize_t
rs_sendto(int sock, const char *msg, size_t msg_size, const struct sockaddr_storage *to)
{
	ssize_t sent;

	sent = sendto(sock, msg, msg_size, 0, (struct sockaddr *)to, af_sas_len(to));

	if (sent == -1) {
		if (errno == EINTR) {
			DEBUG2_PRINTF("sendto error - EINTR");
			return (-2);
		}

		if (errno == EHOSTUNREACH || errno == EHOSTDOWN || errno == ENETDOWN ||
		    errno == ENOBUFS) {
			DEBUG2_PRINTF("sendto error - EHOSTUNREACH || EHOSTDOWN || ENETDOWN ||"
			    "ENOBUFS");
			return (-3);
		}

		DEBUG2_PRINTF("sendto error - errno = %d", errno);
		return (-1);
	}

	if ((size_t)sent != msg_size) {
		DEBUG2_PRINTF("sendto error - sent != msg_size");

		return (-1);
	}

	return (sent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r15
movl %edi, %ebp
movq %rcx, %rdi
callq 0x2cc2
movl %ebp, %edi
movq %r15, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
movq %r14, %r8
movl %eax, %r9d
callq 0x2160
cmpq $-0x1, %rax
je 0x73a1
cmpq %rbx, %rax
je 0x7403
leaq 0x3274(%rip), %rdi      # 0xa5fb
leaq 0x33ed(%rip), %rcx      # 0xa77b
pushq $0x3
popq %rdx
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
callq 0x4998
pushq $-0x1
jmp 0x7402
callq 0x2060
movl (%rax), %r8d
leal -0x64(%r8), %eax
cmpl $0xd, %eax
ja 0x73dd
movl $0x3021, %ecx           # imm = 0x3021
btl %eax, %ecx
jae 0x73dd
leaq 0x3238(%rip), %rdi      # 0xa5fb
leaq 0x3358(%rip), %rcx      # 0xa722
pushq $0x3
popq %rdx
movl $0xf7, %esi
xorl %eax, %eax
callq 0x4998
pushq $-0x3
jmp 0x7402
leaq 0x3217(%rip), %rdi      # 0xa5fb
cmpl $0x4, %r8d
jne 0x7411
leaq 0x331c(%rip), %rcx      # 0xa70d
pushq $0x3
popq %rdx
movl $0xf0, %esi
xorl %eax, %eax
callq 0x4998
pushq $-0x2
popq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3349(%rip), %rcx      # 0xa761
pushq $0x3
popq %rdx
movl $0xfb, %esi
xorl %eax, %eax
callq 0x4998
jmp 0x739d
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sfset.c
// Function: sfset_buf_size
int
sfset_buf_size(int sock, int snd_buf, int buf_size, int *new_buf_size, int force_buf_size)
{
	const char *opt_name_s;
	socklen_t optlen;
	int opt_name;
	int res;
	int tmp_buf_size;

	if (snd_buf) {
		opt_name = SO_SNDBUF;
		opt_name_s = "SO_SNDBUF";
	} else {
		opt_name = SO_RCVBUF;
		opt_name_s = "SO_RCVBUF";
	}

	if (buf_size > 0) {
		res = setsockopt(sock, SOL_SOCKET, opt_name, &buf_size, sizeof(buf_size));

		if (res == -1) {
			DEBUG_PRINTF("setsockopt %s failed", opt_name_s);

			return (-1);
		}
	}

	if (new_buf_size == NULL && !force_buf_size) {
		return (0);
	}

	optlen = sizeof(tmp_buf_size);
	res = getsockopt(sock, SOL_SOCKET, opt_name, &tmp_buf_size, &optlen);

	if (res == -1) {
		DEBUG_PRINTF("getsockopt %s failed", opt_name_s);

		return (-1);
	}

	if (force_buf_size && tmp_buf_size < buf_size) {
		VERBOSE_PRINTF("Buffer size request was %u bytes, but only %u"
		    " bytes was allocated", buf_size, tmp_buf_size);
		errno = ENOBUFS;
		return (-1);
	}

	if (new_buf_size != NULL) {
		*new_buf_size = tmp_buf_size;
	}

	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rcx, %r14
movl %edi, %r13d
movl %edx, 0x10(%rsp)
xorl %r12d, %r12d
testl %esi, %esi
sete %r12b
leaq 0x334e(%rip), %rax      # 0xa7a5
leaq 0x333d(%rip), %rbx      # 0xa79b
cmoveq %rax, %rbx
addl $0x7, %r12d
testl %edx, %edx
jle 0x7486
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rcx
pushq $0x4
popq %r8
movl %r13d, %edi
movl %r12d, %edx
callq 0x20c0
cmpl $-0x1, %eax
je 0x74fb
testq %r14, %r14
sete %al
testl %ebp, %ebp
sete %cl
xorl %r15d, %r15d
testb %cl, %al
jne 0x753d
leaq 0x14(%rsp), %r8
movl $0x4, (%r8)
pushq $0x1
popq %rsi
leaq 0xc(%rsp), %rcx
movl %r13d, %edi
movl %r12d, %edx
callq 0x2180
cmpl $-0x1, %eax
je 0x751b
testl %ebp, %ebp
je 0x750d
movl 0xc(%rsp), %r9d
movl 0x10(%rsp), %r8d
cmpl %r8d, %r9d
jge 0x750d
leaq 0x32d5(%rip), %rdi      # 0xa7af
leaq 0x3300(%rip), %rcx      # 0xa7e1
pushq $0x58
popq %rsi
pushq $0x1
popq %rdx
xorl %eax, %eax
callq 0x4998
callq 0x2060
movl $0x69, (%rax)
jmp 0x7539
leaq 0x32ad(%rip), %rdi      # 0xa7af
leaq 0x32ae(%rip), %rcx      # 0xa7b7
pushq $0x43
jmp 0x752b
testq %r14, %r14
je 0x753d
movl 0xc(%rsp), %eax
movl %eax, (%r14)
jmp 0x753d
leaq 0x328d(%rip), %rdi      # 0xa7af
leaq 0x32a3(%rip), %rcx      # 0xa7cc
pushq $0x51
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %r8
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sfset.c
// Function: sfset_ipv6only
int
sfset_ipv6only(const struct sockaddr *sa, int sock)
{
	int opt;

	opt = 1;

	if (sa->sa_family != AF_INET6) {
		return (-1);
	}

#ifdef IPV6_V6ONLY
	if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt)) == -1) {
		DEBUG_PRINTF("setsockopt IPV6_V6ONLY failed");

		return (-1);
	}
#endif

	return (0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl $0x1, 0xc(%rsp)
pushq $-0x1
popq %rbx
cmpw $0xa, (%rdi)
jne 0x75ea
pushq $0x29
popq %rax
pushq $0x1a
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %esi, %edi
movl %eax, %esi
callq 0x20c0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x75ec
leaq 0x31db(%rip), %rdi      # 0xa7af
leaq 0x3267(%rip), %rcx      # 0xa842
pushq $0x2
popq %rdx
movl $0x89, %esi
xorl %eax, %eax
callq 0x4998
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sfset.c
// Function: sfset_mcast_if
int
sfset_mcast_if(const struct sockaddr *local_addr, int sock, const char *local_ifname)
{
	int iface_index;

	switch (local_addr->sa_family) {
	case AF_INET:
		if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF,
		    &((struct sockaddr_in *)local_addr)->sin_addr, sizeof(struct in_addr)) == -1) {
			DEBUG_PRINTF("setsockopt IP_MULTICAST_IF failed");

			return (-1);
		}
		break;
	case AF_INET6:
		iface_index = if_nametoindex(local_ifname);
		if (iface_index == 0) {
			DEBUG_PRINTF("if_nametoindex cannot convert iface name %s to index",
			    local_ifname);

			return (-1);
		}

		if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, &iface_index,
		    sizeof(iface_index)) == -1) {
			DEBUG_PRINTF("setsockopt IPV6_MULTICAST_IF failed");

			return (-1);
		}
		break;

	default:
		DEBUG_PRINTF("Unknown sockaddr family");
		errx(1, "Unknown sockaddr family");
	}

	return (0);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movzwl (%rdi), %eax
cmpl $0xa, %eax
je 0x7647
cmpl $0x2, %eax
jne 0x76c4
movq %rdi, %rcx
addq $0x4, %rcx
xorl %ebp, %ebp
pushq $0x20
popq %rdx
pushq $0x4
popq %r8
movl %ebx, %edi
xorl %esi, %esi
callq 0x20c0
cmpl $-0x1, %eax
jne 0x76b9
leaq 0x3179(%rip), %rdi      # 0xa7af
leaq 0x3223(%rip), %rcx      # 0xa860
pushq $0x2
popq %rdx
movl $0xa1, %esi
jmp 0x768d
movq %rdx, %r14
movq %rdx, %rdi
callq 0x21e0
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x7696
pushq $0x29
popq %rsi
pushq $0x11
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
callq 0x20c0
xorl %ebp, %ebp
cmpl $-0x1, %eax
jne 0x76b9
leaq 0x3131(%rip), %rdi      # 0xa7af
leaq 0x3232(%rip), %rcx      # 0xa8b7
pushq $0x2
popq %rdx
movl $0xb1, %esi
xorl %eax, %eax
callq 0x4998
jmp 0x76b6
leaq 0x3112(%rip), %rdi      # 0xa7af
leaq 0x31de(%rip), %rcx      # 0xa882
pushq $0x2
popq %rdx
movl $0xaa, %esi
movq %r14, %r8
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x30e4(%rip), %rdi      # 0xa7af
leaq 0x1a0b(%rip), %rbx      # 0x90dd
pushq $0x2
popq %rdx
movl $0xb8, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4998
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sfset.c
// Function: sfset_mcast_loop
int
sfset_mcast_loop(const struct sockaddr *mcast_addr, int sock, int enable)
{
	uint8_t val;
	int ival;

	val = (enable ? 1 : 0);
	ival = val;

	switch (mcast_addr->sa_family) {
	case AF_INET:
		if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP, &val, sizeof(val)) == -1) {
			DEBUG_PRINTF("setsockopt IP_MULTICAST_LOOP failed");

			return (-1);
		}
		break;
	case AF_INET6:
		if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &ival,
		    sizeof(ival)) == -1) {
			DEBUG_PRINTF("setsockopt IPV6_MULTICAST_LOOP failed");

			return (-1);
		}
		break;
	default:
		DEBUG_PRINTF("Unknown sockaddr family");
		errx(1, "Unknown sockaddr family");
	}

	return (0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
xorl %eax, %eax
testl %edx, %edx
setne 0xb(%rsp)
setne %al
movl %eax, 0xc(%rsp)
movzwl (%rdi), %eax
cmpl $0xa, %eax
je 0x7747
cmpl $0x2, %eax
jne 0x778e
xorl %ebx, %ebx
pushq $0x22
popq %rdx
leaq 0xb(%rsp), %rcx
pushq $0x1
popq %r8
movl %esi, %edi
xorl %esi, %esi
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7786
leaq 0x3079(%rip), %rdi      # 0xa7af
leaq 0x319e(%rip), %rcx      # 0xa8db
pushq $0x2
popq %rdx
movl $0xd1, %esi
jmp 0x777c
pushq $0x29
popq %rax
pushq $0x13
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %esi, %edi
movl %eax, %esi
callq 0x20c0
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x7786
leaq 0x3042(%rip), %rdi      # 0xa7af
leaq 0x318b(%rip), %rcx      # 0xa8ff
pushq $0x2
popq %rdx
movl $0xd9, %esi
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x301a(%rip), %rdi      # 0xa7af
leaq 0x1941(%rip), %rbx      # 0x90dd
pushq $0x2
popq %rdx
movl $0xdf, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4998
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sfset.c
// Function: sfset_recvttl
int
sfset_recvttl(const struct sockaddr *sa, int sock)
{
	int opt;

	opt = 1;

	switch (sa->sa_family) {
	case AF_INET:
#ifdef IP_RECVTTL
		if (setsockopt(sock, IPPROTO_IP, IP_RECVTTL, &opt, sizeof(opt)) == -1) {
			DEBUG_PRINTF("setsockopt IP_RECVTTL failed");

			return (-1);
		}
#else
		return (-2);
#endif
		break;
	case AF_INET6:
#ifdef IPV6_RECVHOPLIMIT
		if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &opt, sizeof(opt)) == -1) {
			DEBUG_PRINTF("setsockopt IPV6_RECVHOPLIMIT failed");

			return (-1);
		}
#else
		if (setsockopt(sock, IPPROTO_IPV6, IPV6_HOPLIMIT, &opt, sizeof(opt)) == -1) {
			DEBUG_PRINTF("setsockopt IPV6_HOPLIMIT failed");

			return (-1);
		}
#endif
		break;
	default:
		DEBUG_PRINTF("Unknown sockaddr family");
		errx(1, "Unknown sockaddr family");
	}


	return (0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl $0x1, 0xc(%rsp)
movzwl (%rdi), %eax
cmpl $0xa, %eax
je 0x7809
cmpl $0x2, %eax
jne 0x7850
xorl %ebx, %ebx
pushq $0xc
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %esi, %edi
xorl %esi, %esi
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7848
leaq 0x2fb7(%rip), %rdi      # 0xa7af
leaq 0x3126(%rip), %rcx      # 0xa925
pushq $0x2
popq %rdx
movl $0xf7, %esi
jmp 0x783e
pushq $0x29
popq %rax
pushq $0x33
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %esi, %edi
movl %eax, %esi
callq 0x20c0
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x7848
leaq 0x2f80(%rip), %rdi      # 0xa7af
leaq 0x310c(%rip), %rcx      # 0xa942
pushq $0x2
popq %rdx
movl $0x102, %esi            # imm = 0x102
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x2f58(%rip), %rdi      # 0xa7af
leaq 0x187f(%rip), %rbx      # 0x90dd
pushq $0x2
popq %rdx
movl $0x10f, %esi            # imm = 0x10F
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4998
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sfset.c
// Function: sfset_reuse
int
sfset_reuse(int sock)
{
	int opt;

	opt = 1;

	if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1) {
		DEBUG_PRINTF("setsockopt SO_REUSEADDR failed");

		return (-1);
	}

#ifdef SO_REUSEPORT
	if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) == -1) {
		DEBUG_PRINTF("setsockopt SO_REUSEPORT failed");

		return (-1);
	}
#endif

	return (0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0xc(%rsp), %rcx
movl $0x1, (%rcx)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
callq 0x20c0
cmpl $-0x1, %eax
je 0x78da
pushq $0x1
popq %rsi
pushq $0xf
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
callq 0x20c0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x78fa
leaq 0x2ee6(%rip), %rdi      # 0xa7af
leaq 0x30b5(%rip), %rcx      # 0xa985
pushq $0x2
popq %rdx
movl $0x12a, %esi            # imm = 0x12A
jmp 0x78f0
leaq 0x2ece(%rip), %rdi      # 0xa7af
leaq 0x307e(%rip), %rcx      # 0xa966
pushq $0x2
popq %rdx
movl $0x123, %esi            # imm = 0x123
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sfset.c
// Function: sfset_ttl
int
sfset_ttl(const struct sockaddr *sa, enum sf_cast_type cast_type, int sock, uint8_t ttl)
{
	int ittl;
	int res;

	ittl = ttl;

	switch (sa->sa_family) {
	case AF_INET:
		if (cast_type == SF_CT_MULTI) {
			res = setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
			if (res == -1) {
				DEBUG_PRINTF("setsockopt IP_MULTICAST_TTL failed");
				return (-1);
			}
		} else {
			res = setsockopt(sock, IPPROTO_IP, IP_TTL, &ittl, sizeof(ittl));
			if (res == -1) {
				DEBUG_PRINTF("setsockopt IP_TTL failed");
				return (-1);
			}
		}
		break;
	case AF_INET6:
		if (cast_type == SF_CT_MULTI) {
			res = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ittl,
			    sizeof(ittl));

			if (res == -1) {
				DEBUG_PRINTF("setsockopt IPV6_MULTICAST_HOPS failed");

				return (-1);
			}
		} else {
			res = setsockopt(sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ittl,
			    sizeof(ittl));

			if (res == -1) {
				DEBUG_PRINTF("setsockopt IPV6_UNICAST_HOPS failed");

				return (-1);
			}
		}
		break;
	default:
		DEBUG_PRINTF("Unknown sockaddr family");
		errx(1, "Unknown sockaddr family");
	}

	return (0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movb %cl, 0xb(%rsp)
movl %ecx, 0xc(%rsp)
movzwl (%rdi), %eax
cmpl $0xa, %eax
je 0x79aa
cmpl $0x2, %eax
jne 0x7a61
xorl %ebx, %ebx
cmpl $0x1, %esi
jne 0x7a05
pushq $0x21
popq %rax
leaq 0xb(%rsp), %rcx
pushq $0x1
popq %r8
movl %edx, %edi
xorl %esi, %esi
movl %eax, %edx
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7a59
leaq 0x2e19(%rip), %rdi      # 0xa7af
leaq 0x3026(%rip), %rcx      # 0xa9c3
pushq $0x2
popq %rdx
movl $0x15c, %esi            # imm = 0x15C
jmp 0x7a4f
cmpl $0x1, %esi
jne 0x79e4
pushq $0x29
popq %rsi
pushq $0x12
popq %rax
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %edx, %edi
movl %eax, %edx
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7a01
leaq 0x2ddc(%rip), %rdi      # 0xa7af
leaq 0x3025(%rip), %rcx      # 0xa9ff
pushq $0x2
popq %rdx
movl $0x16d, %esi            # imm = 0x16D
jmp 0x7a4f
pushq $0x29
popq %rsi
pushq $0x10
popq %rax
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %edx, %edi
movl %eax, %edx
callq 0x20c0
cmpl $-0x1, %eax
je 0x7a39
xorl %ebx, %ebx
jmp 0x7a59
pushq $0x2
popq %rax
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %edx, %edi
xorl %esi, %esi
movl %eax, %edx
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7a59
leaq 0x2d87(%rip), %rdi      # 0xa7af
leaq 0x2fb7(%rip), %rcx      # 0xa9e6
pushq $0x2
popq %rdx
movl $0x162, %esi            # imm = 0x162
jmp 0x7a4f
leaq 0x2d6f(%rip), %rdi      # 0xa7af
leaq 0x2fde(%rip), %rcx      # 0xaa25
pushq $0x2
popq %rdx
movl $0x176, %esi            # imm = 0x176
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x2d47(%rip), %rdi      # 0xa7af
leaq 0x166e(%rip), %rbx      # 0x90dd
pushq $0x2
popq %rdx
movl $0x17d, %esi            # imm = 0x17D
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4998
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
nop
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sockfunc.c
// Function: sf_cast_type_to_str
const char *
sf_cast_type_to_str(enum sf_cast_type cast_type)
{
	const char *res;

	switch (cast_type) {
	case SF_CT_UNI:
		res = "uni";
		break;
	case SF_CT_MULTI:
		res = "multi";
		break;
	case SF_CT_BROAD:
		res = "broad";
		break;
	default:
		DEBUG_PRINTF("Internal error - unknown transport method");
		errx(1, "Internal error - unknown transport method");
		/* NOTREACHED */
	}

	return (res);
}

// Assembly:
cmpl $0x3, %edi
jae 0x7aef
movl %edi, %eax
leaq 0x30ed(%rip), %rcx      # 0xabd4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
retq
pushq %rbx
leaq 0x2f52(%rip), %rdi      # 0xaa49
leaq 0x1ff3(%rip), %rbx      # 0x9af1
pushq $0x4d
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4998
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sockfunc.c
// Function: sf_create_udp_socket
int
sf_create_udp_socket(const struct sockaddr *sa)
{
	int sock;

	sock = socket(sa->sa_family, SOCK_DGRAM, 0);
	if (sock == -1) {
		DEBUG_PRINTF("Can't create socket");
		return (-1);
	}

	return (sock);
}

// Assembly:
pushq %rbx
movzwl (%rdi), %edi
pushq $0x2
popq %rsi
xorl %edx, %edx
callq 0x2340
movl %eax, %ebx
cmpl $-0x1, %eax
jne 0x7cbe
leaq 0x2da1(%rip), %rdi      # 0xaa49
leaq 0x2dc7(%rip), %rcx      # 0xaa76
pushq $0x2
popq %rdx
movl $0xcc, %esi
xorl %eax, %eax
callq 0x4998
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sockfunc.c
// Function: sf_set_socket_common_options
static int
sf_set_socket_common_options(int sock, const struct sockaddr *addr, enum sf_cast_type cast_type,
    uint8_t ttl, int force_recvttl, int receive_timestamp, int sndbuf_size, int rcvbuf_size,
    int force_buf_size)
{
	const char *cast_str;
	int new_buf_size;
	int res;

	cast_str = sf_cast_type_to_str(cast_type);

	if (sfset_buf_size(sock, 1, sndbuf_size, &new_buf_size, force_buf_size) == -1) {
		return (-1);
	}

	DEBUG_PRINTF("Send buffer (%scast socket) allocated %u bytes", cast_str, new_buf_size);

	if (sfset_buf_size(sock, 0, rcvbuf_size, &new_buf_size, force_buf_size) == -1) {
		return (-1);
	}

	DEBUG_PRINTF("Receive buffer (%scast socket) allocated %u bytes", cast_str, new_buf_size);

	if (addr->sa_family == AF_INET6) {
		if (sfset_ipv6only(addr, sock) == -1) {
			return (-1);
		}
	}

	if (sfset_ttl(addr, cast_type, sock, ttl) == -1) {
		return (-1);
	}

	res = sfset_recvttl(addr, sock);
	if (res == -1 || (res == -2 && force_recvttl)) {
		return (-1);
	}

	if (receive_timestamp) {
		if (sfset_timestamp(sock) == -1) {
			return (-1);
		}
	}

	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r14d
movl %r8d, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, %r13d
movq %rsi, %r12
movl %edi, %ebp
movl 0x50(%rsp), %ebx
movl %edx, %edi
callq 0x7ad9
movq %rax, %r15
leaq 0x8(%rsp), %rcx
pushq $0x1
popq %rsi
movl %ebp, %edi
movl %ebx, %edx
movl %esi, %r8d
callq 0x742c
pushq $-0x1
popq %rbx
cmpl $-0x1, %eax
je 0x7de5
movl %r14d, 0xc(%rsp)
leaq 0x8(%rsp), %r14
movl (%r14), %r9d
leaq 0x2d23(%rip), %rdi      # 0xaa49
leaq 0x2e43(%rip), %rcx      # 0xab70
pushq $0x2
popq %rdx
movl $0x1fc, %esi            # imm = 0x1FC
movq %r15, %r8
xorl %eax, %eax
callq 0x4998
pushq $0x1
popq %r8
movl %ebp, %edi
xorl %esi, %esi
movl 0x58(%rsp), %edx
movq %r14, %rcx
callq 0x742c
cmpl $-0x1, %eax
je 0x7de5
movl 0x8(%rsp), %r9d
leaq 0x2ce1(%rip), %rdi      # 0xaa49
leaq 0x2e30(%rip), %rcx      # 0xab9f
pushq $0x2
popq %rdx
movl $0x202, %esi            # imm = 0x202
movq %r15, %r8
xorl %eax, %eax
callq 0x4998
cmpw $0xa, (%r12)
jne 0x7d98
movq %r12, %rdi
movl %ebp, %esi
callq 0x7596
cmpl $-0x1, %eax
je 0x7de5
movzbl 0x14(%rsp), %ecx
movq %r12, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x7946
cmpl $-0x1, %eax
je 0x7de5
movq %r12, %rdi
movl %ebp, %esi
callq 0x77bb
cmpl $-0x1, %eax
je 0x7de5
cmpl $-0x2, %eax
sete %al
cmpl $0x0, 0x10(%rsp)
setne %cl
testb %al, %cl
jne 0x7de5
cmpl $0x0, 0xc(%rsp)
je 0x7de3
movl %ebp, %edi
callq 0x7900
cmpl $-0x1, %eax
je 0x7de5
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sockfunc.c
// Function: sf_mcast_join_asm_group
int
sf_mcast_join_asm_group(const struct sockaddr *mcast_addr, const struct sockaddr *local_addr,
    const char *local_ifname, int sock)
{
	struct ip_mreq mreq4;
	struct ipv6_mreq mreq6;
	int iface_index;

	switch (mcast_addr->sa_family) {
	case AF_INET:
		memset(&mreq4, 0, sizeof(mreq4));

		mreq4.imr_multiaddr = ((struct sockaddr_in *)mcast_addr)->sin_addr;
		mreq4.imr_interface = ((struct sockaddr_in *)local_addr)->sin_addr;
		if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq4, sizeof(mreq4)) == -1) {
			DEBUG_PRINTF("setsockopt IP_ADD_MEMBERSHIP failed");

			return (-1);
		}
		break;
	case AF_INET6:
		iface_index = if_nametoindex(local_ifname);
		if (iface_index == 0) {
			DEBUG_PRINTF("if_nametoindex cannot convert iface name %s to index",
			    local_ifname);

			return (-1);
		}
		memset(&mreq6, 0, sizeof(mreq6));

		mreq6.ipv6mr_multiaddr = ((struct sockaddr_in6 *)mcast_addr)->sin6_addr;
		mreq6.ipv6mr_interface = iface_index;
		if (setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq6, sizeof(mreq6)) == -1) {
			DEBUG_PRINTF("setsockopt IPV6_JOIN_GROUP failed");

			return (-1);
		}
		break;
	default:
		DEBUG_PRINTF("Unknown sockaddr family");
		errx(1, "Unknown sockaddr family");
	}

	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdi, %r15
movzwl (%rdi), %eax
cmpl $0xa, %eax
je 0x7e58
cmpl $0x2, %eax
jne 0x7edb
movl 0x4(%r15), %eax
movq %rsp, %rcx
movl %eax, (%rcx)
movl 0x4(%rsi), %eax
movl %eax, 0x4(%rcx)
xorl %ebp, %ebp
pushq $0x23
popq %rdx
pushq $0x8
popq %r8
movl %ebx, %edi
xorl %esi, %esi
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7ece
leaq 0x2c02(%rip), %rdi      # 0xaa49
leaq 0x2c3c(%rip), %rcx      # 0xaa8a
pushq $0x2
popq %rdx
movl $0x157, %esi            # imm = 0x157
jmp 0x7ea2
movq %rdx, %r14
movq %rdx, %rdi
callq 0x21e0
testl %eax, %eax
je 0x7eab
movups 0x8(%r15), %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
movl %eax, 0x10(%rcx)
pushq $0x29
popq %rsi
pushq $0x14
popq %rdx
movl %ebx, %edi
movl %edx, %r8d
callq 0x20c0
xorl %ebp, %ebp
cmpl $-0x1, %eax
jne 0x7ece
leaq 0x2bb6(%rip), %rdi      # 0xaa49
leaq 0x2c14(%rip), %rcx      # 0xaaae
pushq $0x2
popq %rdx
movl $0x169, %esi            # imm = 0x169
xorl %eax, %eax
callq 0x4998
jmp 0x7ecb
leaq 0x2b97(%rip), %rdi      # 0xaa49
leaq 0x29c9(%rip), %rcx      # 0xa882
pushq $0x2
popq %rdx
movl $0x160, %esi            # imm = 0x160
movq %r14, %r8
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2b67(%rip), %rdi      # 0xaa49
leaq 0x11f4(%rip), %rbx      # 0x90dd
pushq $0x2
popq %rdx
movl $0x16f, %esi            # imm = 0x16F
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4998
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/sockfunc.c
// Function: sf_mcast_join_ssm_group_list
int
sf_mcast_join_ssm_group_list(const struct sockaddr *mcast_addr, const struct sockaddr *local_addr,
    const struct aii_list *remote_addrs, const char *local_ifname, int sock)
{
	struct ai_item *ai_item_i;

	TAILQ_FOREACH(ai_item_i, remote_addrs, entries) {
		if (sf_mcast_join_ssm_group(mcast_addr, local_addr,
		    (const struct sockaddr *)&ai_item_i->sas, local_ifname, sock) == -1) {
			return (-1);
		}
	}

	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
pushq $-0x1
popq %rbx
movq (%r15), %r15
testq %r15, %r15
je 0x7f4f
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movl %ebp, %r8d
callq 0x80dc
addq $0x88, %r15
cmpl $-0x1, %eax
jne 0x7f25
jmp 0x7f51
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/tlv.c
// Function: tlv_add
int
tlv_add(char *msg, size_t msg_len, size_t *pos, enum tlv_opt_type opt_type, uint16_t opt_len,
    const void *value)
{
	uint16_t nlen;
	uint16_t nopt_type;

	DEBUG2_PRINTF("Add option %"PRIu16" with len %"PRIu16" pos %zu", opt_type, opt_len, *pos);

	if (*pos + sizeof(nopt_type) + sizeof(nlen) + opt_len > msg_len) {
		DEBUG2_PRINTF("Can't store option. msg_len too small.");
		return (-1);
	}

	nopt_type = ntohs((uint16_t)opt_type);
	memcpy(msg + *pos, &nopt_type, sizeof(nopt_type));
	*pos += sizeof(nopt_type);

	nlen = htons(opt_len);

	memcpy(msg + *pos, &nlen, sizeof(nlen));
	*pos += sizeof(nlen);

	memcpy(msg + *pos, value, opt_len);

	*pos += opt_len;

	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movl %r8d, %r12d
movl %ecx, %r13d
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r15
movq (%rdx), %rax
movq %rax, (%rsp)
leaq 0x2934(%rip), %rdi      # 0xabec
leaq 0x2933(%rip), %rcx      # 0xabf2
pushq $0x40
popq %rsi
pushq $0x3
popq %rdx
movl %r13d, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x4998
movq (%rbx), %rax
movl %r12d, %r14d
leaq (%r14,%rax), %rcx
addq $0x4, %rcx
cmpq %rbp, %rcx
jbe 0x8305
leaq 0x2900(%rip), %rdi      # 0xabec
leaq 0x2921(%rip), %rcx      # 0xac14
pushq $0x43
popq %rsi
pushq $0x3
popq %rdx
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rax
jmp 0x8348
rolw $0x8, %r13w
movw %r13w, (%r15,%rax)
movq (%rbx), %rax
leaq 0x2(%rax), %rcx
movq %rcx, (%rbx)
rolw $0x8, %r12w
movw %r12w, 0x2(%r15,%rax)
movq (%rbx), %rax
leaq 0x2(%rax), %rcx
movq %rcx, (%rbx)
leaq (%r15,%rax), %rdi
addq $0x2, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x2200
addq %r14, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/tlv.c
// Function: tlv_add_sas
static int
tlv_add_sas(char *msg, size_t msg_len, size_t *pos, enum tlv_opt_type opt,
    const struct sockaddr_storage *sas, int store_prefix_len)
{
	char *value;
	void *addr_pointer;
	size_t addr_len;
	size_t opt_len;
	uint16_t af;
	uint8_t pref_len_val;

	switch (sas->ss_family) {
	case AF_INET:
		af = AF_IANA_IP;
		addr_len = sizeof(struct in_addr);
		addr_pointer = &((struct sockaddr_in *)sas)->sin_addr;
		break;
	case AF_INET6:
		af = AF_IANA_IP6;
		addr_len = sizeof(struct in6_addr);
		addr_pointer = &((struct sockaddr_in6 *)sas)->sin6_addr;
		break;
	default:
		DEBUG_PRINTF("Unknown sas family %d", sas->ss_family);
		errx(1, "Unknown sas family %d", sas->ss_family);
	}

	pref_len_val = addr_len * 8;

	opt_len = sizeof(af) + addr_len;

	if (store_prefix_len)
		opt_len += sizeof(pref_len_val);

	value = (char *)alloca(opt_len);

	af = htons(af);

	memcpy(value, &af, sizeof(af));
	if (store_prefix_len)
		memcpy(value + sizeof(af), &pref_len_val, sizeof(pref_len_val));

	memcpy(value + sizeof(af) + (store_prefix_len ? sizeof(pref_len_val) : 0), addr_pointer,
	    addr_len);

	return (tlv_add(msg, msg_len, pos, opt, opt_len, value));

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movl %ecx, %r12d
movq %rdx, %r13
movzwl (%r8), %r8d
cmpl $0x2, %r8d
movq %rsi, -0x38(%rbp)
je 0x83eb
cmpl $0xa, %r8d
jne 0x8470
movw $0x200, %cx             # imm = 0x200
pushq $0x10
popq %rdx
pushq $0x8
popq %rax
jmp 0x83f5
movw $0x100, %cx             # imm = 0x100
pushq $0x4
popq %rax
movq %rax, %rdx
movq %rdi, -0x30(%rbp)
xorl %r14d, %r14d
testl %r9d, %r9d
setne %r14b
orq %rdx, %r14
orq $0x2, %r14
leal 0xf(%r14), %esi
andl $-0x10, %esi
movq %rsp, %r15
subq %rsi, %r15
movq %r15, %rsp
movw %cx, (%r15)
testl %r9d, %r9d
je 0x842e
leal (,%rdx,8), %ecx
movb %cl, 0x2(%r15)
addq %rax, %rbx
cmpl $0x1, %r9d
movq %r15, %rdi
sbbq $-0x1, %rdi
addq $0x2, %rdi
movq %rbx, %rsi
callq 0x2200
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r13, %rdx
movl %r12d, %ecx
movl %r14d, %r8d
movq %r15, %r9
callq 0x8288
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2775(%rip), %rdi      # 0xabec
leaq 0xbf1(%rip), %r14       # 0x906f
pushq $0x2
popq %rdx
movl $0xb5, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x4998
movzwl (%rbx), %edx
pushq $0x1
popq %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/tlv.c
// Function: tlv_add_opt_request
int
tlv_add_opt_request(char *msg, size_t msg_len, size_t *pos, uint16_t *opts, size_t opts_len)
{
	char *value;
	size_t val_len;
	unsigned int i;
	uint16_t opt;

	if (opts_len == 0)
		return (-1);

	val_len = opts_len * sizeof(uint16_t);

	value = (char *)alloca(val_len);

	for (i = 0; i < opts_len; i++) {
		opt = htons(opts[i]);

		memcpy(value + i * sizeof(opt), &opt, sizeof(opt));
	}

	return (tlv_add(msg, msg_len, pos, TLV_OPT_TYPE_OPT_REQUEST, val_len, value));
}

// Assembly:
testq %r8, %r8
je 0x8501
pushq %rbp
movq %rsp, %rbp
leaq (%r8,%r8), %rax
movq %rsp, %r9
leaq 0xf(,%r8,2), %r10
andq $-0x10, %r10
subq %r10, %r9
movq %r9, %rsp
xorl %r10d, %r10d
movl %r10d, %r10d
cmpq %r8, %r10
jae 0x84f0
movzwl (%rcx,%r10,2), %r11d
rolw $0x8, %r11w
movw %r11w, (%r9,%r10,2)
incl %r10d
jmp 0x84d4
movzwl %ax, %r8d
pushq $0x5
popq %rcx
callq 0x8288
movq %rbp, %rsp
popq %rbp
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/tlv.c
// Function: tlv_iter_item_copy
int
tlv_iter_item_copy(const struct tlv_iterator *tlv_iter, char *new_msg, size_t new_msg_len,
    size_t *pos)
{
	size_t item_size;

	DEBUG2_PRINTF("Copy option %"PRIu16" with len %"PRIu16" pos %zu",
	    tlv_iter_get_type(tlv_iter), tlv_iter_get_len(tlv_iter), *pos);

	item_size = tlv_iter_get_len(tlv_iter) + 2 * sizeof(uint16_t);

	if (*pos + item_size > new_msg_len) {
		DEBUG2_PRINTF("Can't copy option. new_msg_len too small.");

		return (-1);
	}

	memcpy(new_msg + *pos, tlv_iter->msg + tlv_iter->pos, item_size);

	*pos += item_size;

	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
movzwl (%rax,%rcx), %edx
movzwl 0x2(%rax,%rcx), %eax
rolw $0x8, %dx
movzwl %dx, %r8d
rolw $0x8, %ax
movzwl %ax, %r9d
movq (%rbx), %rax
movq %rax, (%rsp)
leaq 0x25c9(%rip), %rdi      # 0xabec
leaq 0x2611(%rip), %rcx      # 0xac3b
xorl %ebp, %ebp
pushq $0x3
popq %rdx
movl $0x160, %esi            # imm = 0x160
xorl %eax, %eax
callq 0x4998
movq (%r12), %rsi
movq 0x10(%r12), %rax
movzwl 0x2(%rsi,%rax), %ecx
rolw $0x8, %cx
movzwl %cx, %r12d
movq (%rbx), %rcx
leaq (%r12,%rcx), %rdx
addq $0x4, %rdx
cmpq %r15, %rdx
jbe 0x8683
leaq 0x2584(%rip), %rdi      # 0xabec
leaq 0x25ef(%rip), %rcx      # 0xac5e
pushq $0x3
popq %rdx
movl $0x165, %esi            # imm = 0x165
xorl %eax, %eax
callq 0x4998
pushq $-0x1
popq %rbp
jmp 0x869b
addq %rax, %rsi
addq $0x4, %r12
addq %rcx, %r14
movq %r14, %rdi
movq %r12, %rdx
callq 0x2200
addq %r12, (%rbx)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/tlv.c
// Function: tlv_pref_eq
int
tlv_pref_eq(const struct sockaddr_storage *sas, uint16_t iana_af, uint8_t prefix, const char *addr)
{
	char sas_addr[32];
	size_t sas_addr_len;
	uint16_t sas_iana_af;
	unsigned char cb1, cb2;
	uint8_t plen_max, plen_min;

	memset(sas_addr, 0, sizeof(sas_addr));

	switch (sas->ss_family) {
	case AF_INET:
		sas_iana_af = AF_IANA_IP;

		plen_min = 4;
		plen_max = 32;

		sas_addr_len = sizeof(struct in_addr);
		memcpy(sas_addr, &((struct sockaddr_in *)sas)->sin_addr, sas_addr_len);
		break;
	case AF_INET6:
		sas_iana_af = AF_IANA_IP6;

		plen_min = 8;
		plen_max = 128;

		sas_addr_len = sizeof(struct in6_addr);
		memcpy(sas_addr, &((struct sockaddr_in6 *)sas)->sin6_addr, sas_addr_len);
		break;
	default:
		DEBUG_PRINTF("Unknown ss family %d", sas->ss_family);
		errx(1, "Unknown ss family %d", sas->ss_family);
	}

	if (iana_af != sas_iana_af) {
		return (0);
	}

	if (prefix == 0) {
		/*
		 * Wildcard
		 */
		return (1);
	}

	if (prefix < plen_min || prefix > plen_max) {
		return (0);
	}

	/*
	 * Full bytes comparation
	 */
	if (memcmp(sas_addr, addr, prefix / 8) != 0) {
		return (0);
	}


	/*
	 * Rest bit comparation
	 */
	if (prefix % 8 != 0 && prefix / 8 < sizeof(sas_addr_len)) {
		cb1 = (unsigned char)(sas_addr[prefix / 8] & (0xff << (8 - (prefix % 8))));
		cb2 = (unsigned char)(addr[prefix / 8] & (0xff << (8 - (prefix % 8))));
		if (cb1 != cb2) {
			return (0);
		}
	}

	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movl %edx, %ebp
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movzwl (%rdi), %r8d
cmpl $0xa, %r8d
je 0x8796
cmpl $0x2, %r8d
jne 0x8829
movl 0x4(%r14), %eax
movl %eax, (%rsp)
pushq $0x4
popq %rcx
pushq $0x20
popq %rax
pushq $0x1
jmp 0x87a9
movups 0x8(%r14), %xmm0
movaps %xmm0, (%rsp)
pushq $0x8
popq %rcx
movl $0x80, %eax
pushq $0x2
popq %rdx
movzwl %si, %esi
xorl %r14d, %r14d
cmpl %esi, %edx
jne 0x8817
pushq $0x1
popq %r12
testb %bpl, %bpl
je 0x8814
movzbl %bpl, %r13d
cmpl %r13d, %ecx
seta %cl
cmpl %r13d, %eax
setb %al
orb %cl, %al
jne 0x8817
movl %r13d, %r15d
shrl $0x3, %r15d
movq %rsp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2270
testl %eax, %eax
jne 0x8817
andl $0x7, %r13d
sete %al
cmpb $0x40, %bpl
setae %cl
orb %al, %cl
jne 0x8814
movb $0x8, %cl
subb %r13b, %cl
movl $0xff, %eax
shll %cl, %eax
movb (%rbx,%r15), %cl
xorb (%rsp,%r15), %cl
testb %al, %cl
jne 0x8817
movl %r12d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23bc(%rip), %rdi      # 0xabec
leaq 0x24f6(%rip), %rbx      # 0xad2d
pushq $0x2
popq %rdx
movl $0x20d, %esi            # imm = 0x20D
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4998
movzwl (%r14), %edx
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/tlv.c
// Function: tlv_mcast_grp_eq
int
tlv_mcast_grp_eq(const struct sockaddr_storage *sas, const char *mcast_grp, size_t mcast_grp_len)
{
	uint16_t u16;

	memcpy(&u16, mcast_grp, sizeof(u16));
	u16 = ntohs(u16);

	if (!((u16 == AF_IANA_IP && mcast_grp_len == 6) ||
	    (u16 == AF_IANA_IP6 && mcast_grp_len == 18))) {
		return (0);
	}

	if (u16 == AF_IANA_IP && sas->ss_family != AF_INET) {
		return (0);
	}

	if (u16 == AF_IANA_IP6 && sas->ss_family != AF_INET6) {
		return (0);
	}

	return (tlv_pref_eq(sas, u16, (mcast_grp_len - 2) * 8, mcast_grp + 2));
}

// Assembly:
movq %rsi, %rcx
movzwl (%rsi), %eax
cmpw $0x100, %ax             # imm = 0x100
sete %sil
cmpq $0x6, %rdx
sete %r8b
testb %sil, %r8b
je 0x887d
cmpw $0x2, (%rdi)
je 0x8898
jmp 0x88b1
cmpw $0x200, %ax             # imm = 0x200
sete %sil
cmpq $0x12, %rdx
sete %r8b
testb %sil, %r8b
je 0x88b1
cmpw $0xa, (%rdi)
jne 0x88b1
rolw $0x8, %ax
shlb $0x3, %dl
addb $-0x10, %dl
addq $0x2, %rcx
movzwl %ax, %esi
movzbl %dl, %edx
jmp 0x874f
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/util.c
// Function: util_gen_id
static void
util_gen_id(char *id, size_t len, const struct ai_item *ai_item,
    const struct sockaddr_storage *sas)
{
	pid_t pid;
	size_t pos;

	/*
	 * First fill item with some random data
	 */
	for (pos = 0; pos < len; pos++) {
#if defined(__FreeBSD__) || defined(__OPENBSD__)
		id[pos] = (unsigned char)arc4random_uniform(UCHAR_MAX);
#else
		id[pos] = (unsigned char)random();
#endif
	}

	pos = 0;

	if (pos + sizeof(pid) < len) {
		/*
		 * Add PID
		 */
		pid = getpid();
		memcpy(id, &pid, sizeof(pid));

		pos += sizeof(pid);
	}

	/*
	 * Add sas from ai_item
	 */
	if (ai_item != NULL) {
		util_gen_id_add_sas(id, len, &pos, &ai_item->sas);
	}

	if (sas != NULL) {
		util_gen_id_add_sas(id, len, &pos, sas);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x894e
callq 0x2230
movb %al, (%r14,%r12)
incq %r12
jmp 0x893b
callq 0x20d0
movl %eax, (%r14)
testq %rbx, %rbx
je 0x899f
movzwl (%rbx), %r8d
cmpl $0x2, %r8d
je 0x8973
cmpl $0xa, %r8d
jne 0x89ab
pushq $0x10
popq %rdx
pushq $0x8
popq %rax
jmp 0x8979
pushq $0x4
popq %rax
movq %rax, %rdx
leaq 0x4(%rdx), %rcx
cmpq %r15, %rcx
jae 0x899f
addq %rax, %rbx
addq $0x4, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2200
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x240e(%rip), %rdi      # 0xadc0
leaq 0x2374(%rip), %r14      # 0xad2d
pushq $0x2
popq %rdx
movl $0xc9, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x4998
movzwl (%rbx), %edx
pushq $0x1
popq %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/util.c
// Function: util_random_init
void
util_random_init(const struct sockaddr_storage *local_addr)
{
	unsigned int seed;
	unsigned int i;

	seed = time(NULL) + getpid();

	for (i = 0; i < af_sas_len(local_addr); i++) {
		seed += ((uint8_t *)local_addr)[i];
	}

	srandom(seed);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x2220
movq %rax, %r14
callq 0x20d0
addl %eax, %r14d
movq %rbx, %rdi
callq 0x2cc2
movl %eax, %eax
cmpq %rax, %r15
jae 0x8a70
movzbl (%rbx,%r15), %eax
addl %eax, %r14d
incq %r15
jmp 0x8a54
movl %r14d, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x2070
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/util.c
// Function: util_time_double_absdiff
double
util_time_double_absdiff_us(struct timeval t1, struct timeval t2)
{
	double dt1, dt2, tmp;

	dt1 = t1.tv_usec + t1.tv_sec * UTIL_NSINMS;
	dt2 = t2.tv_usec + t2.tv_sec * UTIL_NSINMS;

	if (dt2 > dt1) {
		tmp = dt1;
		dt1 = dt2;
		dt2 = tmp;
	}

	return (dt1 - dt2);
}

// Assembly:
cvtsi2sd %rsi, %xmm0
cvtsi2sd %rdi, %xmm1
movsd 0xf24(%rip), %xmm2      # 0x99f0
mulsd %xmm2, %xmm1
cvtsi2sd %rcx, %xmm3
addsd %xmm0, %xmm1
cvtsi2sd %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
movapd %xmm1, %xmm2
minsd %xmm0, %xmm2
maxsd %xmm1, %xmm0
subsd %xmm2, %xmm0
divsd 0xa72(%rip), %xmm0      # 0x9570
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/util.c
// Function: util_u64sqrt
uint32_t
util_u64sqrt(uint64_t n)
{
	double x, x2;

	if (n == 0) {
		return (0);
	}

	x = n;

	while (util_fabs((x2 = (x + n / x) / 2) - x) >= 0.5) {
		x = x2;
	}

	return ((uint32_t)x2);
}

// Assembly:
testq %rdi, %rdi
je 0x8c53
movq %rdi, %xmm1
punpckldq 0x2199(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x21a1(%rip), %xmm1     # 0xada0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x219d(%rip), %xmm1     # 0xadb0
movapd 0x2165(%rip), %xmm2     # 0xad80
movapd %xmm0, %xmm3
movapd %xmm3, %xmm4
movapd %xmm0, %xmm3
divsd %xmm4, %xmm3
addsd %xmm4, %xmm3
mulsd %xmm1, %xmm3
movapd %xmm3, %xmm5
subsd %xmm4, %xmm5
movapd %xmm5, %xmm4
xorpd %xmm2, %xmm4
maxsd %xmm5, %xmm4
ucomisd %xmm1, %xmm4
jae 0x8c1f
cvttsd2si %xmm3, %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/util.c
// Function: util_packet_loss_percent
int
util_packet_loss_percent(uint64_t packet_sent, uint64_t packet_received)
{
	int loss;

	if (packet_received > packet_sent) {
		DEBUG_PRINTF("packet_received > packet_sent");
		loss = 0;
	} else {
		loss = (int)((1.0 - (double)packet_received / (double)packet_sent) * 100.0);
	}

	return (loss);
}

// Assembly:
pushq %rbx
cmpq %rdi, %rsi
jbe 0x8cfe
leaq 0x20dc(%rip), %rdi      # 0xadc0
leaq 0x20fe(%rip), %rcx      # 0xade9
xorl %ebx, %ebx
pushq $0x2
popq %rdx
movl $0x170, %esi            # imm = 0x170
xorl %eax, %eax
callq 0x4998
jmp 0x8d5c
movq %rsi, %xmm0
movq 0x2085(%rip), %xmm1     # 0xad90
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x2089(%rip), %xmm2     # 0xada0
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq %rdi, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm3
movsd 0x83c(%rip), %xmm0      # 0x9588
subsd %xmm3, %xmm0
mulsd 0x2060(%rip), %xmm0     # 0xadb8
cvttsd2si %xmm0, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/antonblanchard[P]will-it-scale/tests/poll2.c
// Function: testcase_prepare
void testcase_prepare(unsigned long nr_tasks)
{
	struct rlimit rlim;
	int nr_procs = sysconf(_SC_NPROCESSORS_CONF);
	rlim_t new_lim = (NR_FILES + 10) * nr_procs;

	getrlimit(RLIMIT_NOFILE, &rlim);
	if (rlim.rlim_max < new_lim) {
		rlim.rlim_cur = new_lim;
		rlim.rlim_max = new_lim;
	}
	if (rlim.rlim_cur < new_lim) {
		rlim.rlim_cur = new_lim;
	}
	assert(setrlimit(RLIMIT_NOFILE, &rlim) == 0);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
pushq $0x53
popq %rdi
callq 0x2220
movabsq $0x8a00000000, %r14     # imm = 0x8A00000000
imulq %rax, %r14
sarq $0x20, %r14
pushq $0x7
popq %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x22a0
cmpq %r14, 0x8(%rbx)
jae 0x2b93
movq %r14, 0x8(%rsp)
movq %r14, 0x10(%rsp)
jmp 0x2b9f
cmpq %r14, 0x8(%rsp)
jae 0x2b9f
movq %r14, 0x8(%rsp)
pushq $0x7
popq %rdi
leaq 0x8(%rsp), %rsi
callq 0x21d0
testl %eax, %eax
jne 0x2bb8
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x6b9(%rip), %rdi       # 0x3278
leaq 0x6d7(%rip), %rsi       # 0x329d
leaq 0x6de(%rip), %rcx       # 0x32ab
pushq $0x1d
popq %rdx
callq 0x2120