LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/msgsend.c
// Function: ms_init
int
ms_init(int ucast_socket, const struct sockaddr_storage *remote_addr,
    const struct sockaddr_storage *mcast_addr, const char *client_id, int req_si)
{
	char addr_str[INET6_ADDRSTRLEN];
	char msg[MAX_MSG_SIZE];
	size_t msg_len;
	ssize_t sent;

	af_sa_to_str(AF_CAST_SA(remote_addr), addr_str);
	DEBUG_PRINTF("Sending init msg to %s", addr_str);

	msg_len = msg_init_create(msg, sizeof(msg), req_si, mcast_addr, client_id, CLIENTID_LEN);

	if (msg_len == 0) {
		return (-4);
	}

	sent = rs_sendto(ucast_socket, msg, msg_len, remote_addr);

	return (sent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10038, %rsp          # imm = 0x10038
movl %r8d, %r15d
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %rbx
movl %edi, %ebp
movq %rsp, %r13
movq %rsi, %rdi
movq %r13, %rsi
callq 0x2d0c
leaq 0x56b8(%rip), %rdi      # 0xae50
leaq 0x56ff(%rip), %rcx      # 0xae9e
movl $0x71, %esi
movl $0x2, %edx
movq %r13, %r8
xorl %eax, %eax
callq 0x4ad6
leaq 0x30(%rsp), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
movl $0x18, %r9d
movl %r15d, %edx
movq %r12, %rcx
movq %r14, %r8
callq 0x5273
testq %rax, %rax
je 0x57ea
leaq 0x30(%rsp), %rsi
movl %ebp, %edi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x761a
jmp 0x57ef
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addq $0x10038, %rsp          # imm = 0x10038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/msgsend.c
// Function: ms_query
int
ms_query(int ucast_socket, const struct sockaddr_storage *remote_addr,
    const struct sockaddr_storage *mcast_addr, uint32_t seq_num, const char *client_id,
    const char *ses_id, size_t ses_id_len)
{
	char addr_str[INET6_ADDRSTRLEN];
	char msg[MAX_MSG_SIZE];
	size_t msg_len;
	ssize_t sent;

	af_sa_to_str(AF_CAST_SA(remote_addr), addr_str);
	DEBUG_PRINTF("Sending query msg to %s", addr_str);

	msg_len = msg_query_create(msg, sizeof(msg), mcast_addr, seq_num, 0, client_id,
	    CLIENTID_LEN, ses_id, SESSIONID_LEN);

	if (msg_len == 0) {
		return (-4);
	}

	sent = rs_sendto(ucast_socket, msg, msg_len, remote_addr);

	return (sent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10048, %rsp          # imm = 0x10048
movq %r9, %r14
movq %r8, %r15
movl %ecx, %r12d
movq %rdx, %r13
movq %rsi, %rbx
movl %edi, 0xc(%rsp)
leaq 0x10(%rsp), %rbp
movq %rsi, %rdi
movq %rbp, %rsi
callq 0x2d0c
leaq 0x5614(%rip), %rdi      # 0xae50
leaq 0x5672(%rip), %rcx      # 0xaeb5
movl $0x91, %esi
movl $0x2, %edx
movq %rbp, %r8
xorl %eax, %eax
callq 0x4ad6
subq $0x8, %rsp
leaq 0x48(%rsp), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
movq %r13, %rdx
movl %r12d, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq $0x10
pushq %r14
pushq $0x18
callq 0x5331
addq $0x20, %rsp
testq %rax, %rax
je 0x589b
leaq 0x40(%rsp), %rsi
movl 0xc(%rsp), %edi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x761a
jmp 0x58a0
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addq $0x10048, %rsp          # imm = 0x10048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/msgsend.c
// Function: ms_response
int
ms_response(int ucast_socket, const struct sockaddr_storage *mcast_addr,
    const struct msg_decoded *decoded, const struct sockaddr_storage *to, int mcast_grp,
    int mcast_prefix, const char *session_id, size_t session_id_len)
{
	char addr_str[INET6_ADDRSTRLEN];
	char msg[MAX_MSG_SIZE];
	size_t msg_len;
	ssize_t sent;

	af_sa_to_str((struct sockaddr *)to, addr_str);
	DEBUG_PRINTF("Sending response msg to %s", addr_str);

	msg_len = msg_response_create(msg, sizeof(msg), decoded, mcast_grp, mcast_prefix,
	    mcast_addr, session_id, session_id_len);

	if (msg_len == 0) {
		return (-4);
	}

	sent = rs_sendto(ucast_socket, msg, msg_len, to);

	return (sent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10058, %rsp          # imm = 0x10058
movl %r9d, %r14d
movl %r8d, %r15d
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r12
movl %edi, 0x1c(%rsp)
leaq 0x20(%rsp), %rbp
movq %rcx, %rdi
movq %rbp, %rsi
callq 0x2d0c
leaq 0x5563(%rip), %rdi      # 0xae50
leaq 0x55d9(%rip), %rcx      # 0xaecd
movl $0xb2, %esi
movl $0x2, %edx
movq %rbp, %r8
xorl %eax, %eax
callq 0x4ad6
movaps 0x10090(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x50(%rsp), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
movq %r13, %rdx
movl %r15d, %ecx
movl %r14d, %r8d
movq %r12, %r9
callq 0x544f
testq %rax, %rax
je 0x594a
leaq 0x50(%rsp), %rsi
movl 0x1c(%rsp), %edi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x761a
jmp 0x594f
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addq $0x10058, %rsp          # imm = 0x10058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/omping.c
// Function: omping_send_client_query
static int
omping_send_client_query(struct omping_instance *instance, struct rh_item *ri, int increase)
{
	struct rh_item_ci *ci;
	int send_res;

	ci = &ri->client_info;

	if (increase) {
		if (ci->no_sent + 1 == ((uint64_t)~0)) {
			omping_client_move_to_stop(instance, ri, RH_CSR_SEND_MAXIMUM);
			DEBUG_PRINTF("Maximum number of sent messages for %s exhausted. "
			    "Moving to stop state.", ri->addr->host_name);

			return (0);
		}

		if (instance->send_count_queries > 0 &&
		    ci->no_sent + 1 > instance->send_count_queries) {
			omping_client_move_to_stop(instance, ri, RH_CSR_TO_SEND_EXHAUSTED);
			DEBUG_PRINTF("Number of messages to be sent by %s exhausted. "
			    "Moving to stop state.", ri->addr->host_name);

			return (0);
		}

		ci->seq_num++;
		ci->no_sent++;

		if (ci->seq_num == 0) {
			ci->seq_num_overflow = 1;
			ci->seq_num++;
		}
	}

	send_res = ms_query(instance->ucast_socket, &ri->addr->sas, &instance->mcast_addr.sas,
	    ci->seq_num, ci->client_id, ci->ses_id, ci->ses_id_len);

	return (send_res);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %rax
testl %edx, %edx
je 0x6f08
movq 0xe0(%rbx), %rdx
incq %rdx
cmpq $-0x1, %rdx
je 0x6f10
movq 0x160(%rax), %rcx
testq %rcx, %rcx
sete %sil
cmpq %rcx, %rdx
setbe %cl
orb %sil, %cl
jne 0x6f4d
movq %rax, %rdi
movq %rbx, %rsi
movl $0x2, %edx
callq 0x6fab
movq (%rbx), %rax
movq 0x80(%rax), %r8
leaq 0x4076(%rip), %rdi      # 0xaf70
leaq 0x41cc(%rip), %rcx      # 0xb0cd
movl $0x3a5, %esi            # imm = 0x3A5
jmp 0x6f3d
movl 0xf0(%rbx), %ecx
jmp 0x6f7e
movq %rax, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x6fab
movq (%rbx), %rax
movq 0x80(%rax), %r8
leaq 0x403f(%rip), %rdi      # 0xaf70
leaq 0x414d(%rip), %rcx      # 0xb085
movl $0x39c, %esi            # imm = 0x39C
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
xorl %eax, %eax
jmp 0x6fa5
movl 0xf0(%rbx), %esi
movl %esi, %ecx
incl %ecx
movl %ecx, 0xf0(%rbx)
movq %rdx, 0xe0(%rbx)
jne 0x6f7e
movl $0x1, 0xf8(%rbx)
addl $0x2, %esi
movl %esi, 0xf0(%rbx)
movl $0x1, %ecx
movl 0x198(%rax), %edi
addq $0x98, %rax
leaq 0xc(%rbx), %r8
movq (%rbx), %rsi
movq 0x50(%rbx), %r9
movq 0x70(%rbx), %rdx
movq %rdx, (%rsp)
movq %rax, %rdx
callq 0x5801
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/omping.c
// Function: omping_client_move_to_stop
static void
omping_client_move_to_stop(struct omping_instance *instance, struct rh_item *ri,
    enum rh_client_stop_reason stop_reason)
{
	ri->client_info.state = RH_CS_STOP;
	instance->rh_no_active--;

	if (instance->quiet < 2) {
		cliprint_client_state(ri->addr->host_name, instance->hn_max_len,
		    instance->transport_method, NULL, &ri->addr->sas,
		    RH_CS_STOP, stop_reason);
	}
}

// Assembly:
movl $0x2, 0x8(%rsi)
decl 0x1a4(%rdi)
cmpl $0x1, 0x180(%rdi)
jg 0x6fee
pushq %rax
movq (%rsi), %r8
movq 0x80(%r8), %rax
movl 0x154(%rdi), %ecx
movl 0x174(%rdi), %esi
movl %edx, (%rsp)
movq %rax, %rdi
movl %ecx, %edx
xorl %ecx, %ecx
movl $0x2, %r9d
callq 0x41bc
popq %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %edi
movl $0x148, %esi            # imm = 0x148
callq 0x2190
testq %rax, %rax
je 0x70e1
movq %rax, %rbx
movq %r12, (%rax)
testl %r15d, %r15d
jle 0x7088
movl %r15d, 0xf4(%rbx)
movl %r15d, %r15d
shlq $0x2, %r15
movb $0x1, %r12b
xorl %r13d, %r13d
movl $0x1, %edi
movq %r15, %rsi
callq 0x2190
movq %rax, 0x58(%rbx,%r13,8)
testq %rax, %rax
je 0x70c7
movl $0x1, %r13d
testb $0x1, %r12b
movl $0x0, %r12d
jne 0x705f
testl %ebp, %ebp
jle 0x709f
leaq 0x118(%rbx), %rdi
movl %ebp, %esi
movl $0x5, %edx
callq 0x4938
movq %rbx, %rax
addq $0x138, %rax            # imm = 0x138
movq $0x0, 0x138(%rbx)
movq 0x8(%r14), %rcx
movq %rcx, 0x140(%rbx)
movq %rbx, (%rcx)
movq %rax, 0x8(%r14)
jmp 0x70e3
movq 0x58(%rbx), %rdi
callq 0x2040
movq 0x60(%rbx), %rdi
callq 0x2040
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_O3/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
movq $0x0, (%rdi)
movq %rdi, 0x8(%rdi)
testq %rsi, %rsi
je 0x713b
movq (%rsi), %r15
testq %r15, %r15
je 0x713b
movl %ecx, %ebx
movl %edx, %ebp
movq %rdi, %r14
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x7012
testq %rax, %rax
je 0x7146
movq 0x88(%r15), %r15
testq %r15, %r15
jne 0x711b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30a3(%rip), %rsi      # 0xa1f0
movl $0x1, %edi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x71db
movq 0x48(%r14), %rdi
movq 0x138(%r14), %r15
callq 0x2040
movq 0x50(%r14), %rdi
callq 0x2040
movq 0x58(%r14), %rdi
callq 0x2040
movq 0x60(%r14), %rdi
callq 0x2040
movq %r14, %rdi
callq 0x2040
movq %r15, %r14
testq %r15, %r15
jne 0x71a0
movq $0x0, (%rbx)
movq %rbx, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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), %r14
xorl %ebx, %ebx
testq %r14, %r14
je 0x7248
movq (%r14), %rax
movq 0x80(%rax), %rdi
callq 0x20e0
cmpq %rbx, %rax
cmovaq %rax, %rbx
movq 0x138(%r14), %r14
jmp 0x7224
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %rbx
cmovbq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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:
movq (%rdi), %rax
testq %rax, %rax
je 0x72a7
leal -0x1(%rsi), %ecx
cmpl $0x1, %ecx
ja 0x728c
movl $0x2, 0x100(%rax)
testl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
jne 0x729b
movl $0x2, 0x8(%rax)
movq 0x138(%rax), %rax
testq %rax, %rax
jne 0x727d
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2d4d
movl %ebp, %edi
movq %r15, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
movq %r14, %r8
movl %eax, %r9d
callq 0x2160
cmpq $-0x1, %rax
je 0x7680
cmpq %rbx, %rax
je 0x76ef
leaq 0x3f9c(%rip), %rdi      # 0xb5fb
leaq 0x4115(%rip), %rcx      # 0xb77b
movl $0x100, %esi            # imm = 0x100
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
movq $-0x1, %rbx
jmp 0x76ef
callq 0x2060
movl (%rax), %r8d
leal -0x64(%r8), %eax
cmpl $0xd, %eax
ja 0x76c3
movl $0x3021, %ecx           # imm = 0x3021
btl %eax, %ecx
jae 0x76c3
leaq 0x3f59(%rip), %rdi      # 0xb5fb
leaq 0x4079(%rip), %rcx      # 0xb722
movl $0xf7, %esi
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
movq $-0x3, %rbx
jmp 0x76ef
leaq 0x3f31(%rip), %rdi      # 0xb5fb
cmpl $0x4, %r8d
jne 0x76fd
leaq 0x4036(%rip), %rcx      # 0xb70d
movl $0xf0, %esi
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
movq $-0x2, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x405d(%rip), %rcx      # 0xb761
movl $0xfb, %esi
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
jmp 0x7677
nop
// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movl %edi, %r13d
movl %edx, 0x10(%rsp)
xorl %r12d, %r12d
testl %esi, %esi
sete %r12b
leaq 0x405e(%rip), %rax      # 0xb7a5
leaq 0x404d(%rip), %r14      # 0xb79b
cmoveq %rax, %r14
addl $0x7, %r12d
testl %edx, %edx
jle 0x777a
leaq 0x10(%rsp), %rcx
movl %r13d, %edi
movl $0x1, %esi
movl %r12d, %edx
movl $0x4, %r8d
callq 0x20c0
cmpl $-0x1, %eax
je 0x77f5
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
sete %cl
xorl %r15d, %r15d
testb %cl, %al
jne 0x783f
leaq 0x14(%rsp), %r8
movl $0x4, (%r8)
leaq 0xc(%rsp), %rcx
movl %r13d, %edi
movl $0x1, %esi
movl %r12d, %edx
callq 0x2180
cmpl $-0x1, %eax
je 0x7817
testl %ebp, %ebp
je 0x780a
movl 0xc(%rsp), %r9d
movl 0x10(%rsp), %r8d
cmpl %r8d, %r9d
jge 0x780a
leaq 0x3fdf(%rip), %rdi      # 0xb7af
leaq 0x400a(%rip), %rcx      # 0xb7e1
movl $0x58, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x4ad6
callq 0x2060
movl $0x69, (%rax)
jmp 0x7839
leaq 0x3fb3(%rip), %rdi      # 0xb7af
leaq 0x3fb4(%rip), %rcx      # 0xb7b7
movl $0x43, %esi
jmp 0x782a
testq %rbx, %rbx
je 0x783f
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
jmp 0x783f
leaq 0x3f91(%rip), %rdi      # 0xb7af
leaq 0x3fa7(%rip), %rcx      # 0xb7cc
movl $0x51, %esi
movl $0x2, %edx
movq %r14, %r8
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
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_O3/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 %rax
movl $0x1, 0x4(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpw $0xa, (%rdi)
jne 0x7901
leaq 0x4(%rsp), %rcx
movl %esi, %edi
movl $0x29, %esi
movl $0x1a, %edx
movl $0x4, %r8d
callq 0x20c0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x7901
leaq 0x3ecb(%rip), %rdi      # 0xb7af
leaq 0x3f57(%rip), %rcx      # 0xb842
movl $0x89, %esi
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
pushq %rax
movl %esi, %ebp
movzwl (%rdi), %eax
cmpl $0xa, %eax
je 0x7954
cmpl $0x2, %eax
jne 0x79db
movq %rdi, %rcx
addq $0x4, %rcx
xorl %ebx, %ebx
movl %ebp, %edi
xorl %esi, %esi
movl $0x20, %edx
movl $0x4, %r8d
callq 0x20c0
cmpl $-0x1, %eax
jne 0x79d2
leaq 0x3e69(%rip), %rdi      # 0xb7af
leaq 0x3f13(%rip), %rcx      # 0xb860
movl $0xa1, %esi
jmp 0x799d
movq %rdx, %rbx
movq %rdx, %rdi
callq 0x21e0
movl %eax, 0x4(%rsp)
testl %eax, %eax
je 0x79ab
leaq 0x4(%rsp), %rcx
movl %ebp, %edi
movl $0x29, %esi
movl $0x11, %edx
movl $0x4, %r8d
callq 0x20c0
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x79d2
leaq 0x3e1e(%rip), %rdi      # 0xb7af
leaq 0x3f1f(%rip), %rcx      # 0xb8b7
movl $0xb1, %esi
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
jmp 0x79cd
leaq 0x3dfd(%rip), %rdi      # 0xb7af
leaq 0x3ec9(%rip), %rcx      # 0xb882
movl $0xaa, %esi
movl $0x2, %edx
movq %rbx, %r8
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x3dcd(%rip), %rdi      # 0xb7af
leaq 0x26f4(%rip), %rbx      # 0xa0dd
movl $0xb8, %esi
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ad6
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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 0x7a67
cmpl $0x2, %eax
jne 0x7ab6
xorl %ebx, %ebx
leaq 0xb(%rsp), %rcx
movl %esi, %edi
xorl %esi, %esi
movl $0x22, %edx
movl $0x1, %r8d
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7aae
leaq 0x3d56(%rip), %rdi      # 0xb7af
leaq 0x3e7b(%rip), %rcx      # 0xb8db
movl $0xd1, %esi
jmp 0x7a9d
leaq 0xc(%rsp), %rcx
movl %esi, %edi
movl $0x29, %esi
movl $0x13, %edx
movl $0x4, %r8d
callq 0x20c0
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x7aae
leaq 0x3d1e(%rip), %rdi      # 0xb7af
leaq 0x3e67(%rip), %rcx      # 0xb8ff
movl $0xd9, %esi
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x3cf2(%rip), %rdi      # 0xb7af
leaq 0x2619(%rip), %rbx      # 0xa0dd
movl $0xdf, %esi
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ad6
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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 0x7b3a
cmpl $0x2, %eax
jne 0x7b89
xorl %ebx, %ebx
leaq 0xc(%rsp), %rcx
movl %esi, %edi
xorl %esi, %esi
movl $0xc, %edx
movl $0x4, %r8d
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7b81
leaq 0x3c83(%rip), %rdi      # 0xb7af
leaq 0x3df2(%rip), %rcx      # 0xb925
movl $0xf7, %esi
jmp 0x7b70
leaq 0xc(%rsp), %rcx
movl %esi, %edi
movl $0x29, %esi
movl $0x33, %edx
movl $0x4, %r8d
callq 0x20c0
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x7b81
leaq 0x3c4b(%rip), %rdi      # 0xb7af
leaq 0x3dd7(%rip), %rcx      # 0xb942
movl $0x102, %esi            # imm = 0x102
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x3c1f(%rip), %rdi      # 0xb7af
leaq 0x2546(%rip), %rbx      # 0xa0dd
movl $0x10f, %esi            # imm = 0x10F
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ad6
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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)
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20c0
cmpl $-0x1, %eax
je 0x7c20
leaq 0xc(%rsp), %rcx
movl %ebx, %edi
movl $0x1, %esi
movl $0xf, %edx
movl $0x4, %r8d
callq 0x20c0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x7c44
leaq 0x3b9d(%rip), %rdi      # 0xb7af
leaq 0x3d6c(%rip), %rcx      # 0xb985
movl $0x12a, %esi            # imm = 0x12A
jmp 0x7c33
leaq 0x3b88(%rip), %rdi      # 0xb7af
leaq 0x3d38(%rip), %rcx      # 0xb966
movl $0x123, %esi            # imm = 0x123
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7cfd
cmpl $0x2, %eax
jne 0x7db5
xorl %ebx, %ebx
cmpl $0x1, %esi
jne 0x7d56
leaq 0xb(%rsp), %rcx
movl %edx, %edi
xorl %esi, %esi
movl $0x21, %edx
movl $0x1, %r8d
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7dad
leaq 0x3ac3(%rip), %rdi      # 0xb7af
leaq 0x3cd0(%rip), %rcx      # 0xb9c3
movl $0x15c, %esi            # imm = 0x15C
jmp 0x7d9c
leaq 0xc(%rsp), %rcx
movl %edx, %edi
cmpl $0x1, %esi
jne 0x7d38
movl $0x29, %esi
movl $0x12, %edx
movl $0x4, %r8d
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7d52
leaq 0x3a85(%rip), %rdi      # 0xb7af
leaq 0x3cce(%rip), %rcx      # 0xb9ff
movl $0x16d, %esi            # imm = 0x16D
jmp 0x7d9c
movl $0x29, %esi
movl $0x10, %edx
movl $0x4, %r8d
callq 0x20c0
cmpl $-0x1, %eax
je 0x7d89
xorl %ebx, %ebx
jmp 0x7dad
leaq 0xc(%rsp), %rcx
movl %edx, %edi
xorl %esi, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20c0
cmpl $-0x1, %eax
jne 0x7dad
leaq 0x3a34(%rip), %rdi      # 0xb7af
leaq 0x3c64(%rip), %rcx      # 0xb9e6
movl $0x162, %esi            # imm = 0x162
jmp 0x7d9c
leaq 0x3a1f(%rip), %rdi      # 0xb7af
leaq 0x3c8e(%rip), %rcx      # 0xba25
movl $0x176, %esi            # imm = 0x176
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x39f3(%rip), %rdi      # 0xb7af
leaq 0x231a(%rip), %rbx      # 0xa0dd
movl $0x17d, %esi            # imm = 0x17D
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ad6
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x7e37
movq %rax, %r15
leaq 0x8(%rsp), %rcx
movl %ebp, %edi
movl $0x1, %esi
movl %ebx, %edx
movl $0x1, %r8d
callq 0x771c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x8199
movl %r14d, 0xc(%rsp)
movl 0x58(%rsp), %r14d
leaq 0x8(%rsp), %rbx
movl (%rbx), %r9d
leaq 0x3980(%rip), %rdi      # 0xba49
leaq 0x3aa0(%rip), %rcx      # 0xbb70
movl $0x1fc, %esi            # imm = 0x1FC
movl $0x2, %edx
movq %r15, %r8
xorl %eax, %eax
callq 0x4ad6
movl %ebp, %edi
xorl %esi, %esi
movl %r14d, %edx
movq %rbx, %rcx
movl $0x1, %r8d
callq 0x771c
cmpl $-0x1, %eax
je 0x8194
movl 0x8(%rsp), %r9d
leaq 0x393b(%rip), %rdi      # 0xba49
leaq 0x3a8a(%rip), %rcx      # 0xbb9f
movl $0x202, %esi            # imm = 0x202
movl $0x2, %edx
movq %r15, %r8
xorl %eax, %eax
callq 0x4ad6
cmpw $0xa, (%r12)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jne 0x8145
movq %r12, %rdi
movl %ebp, %esi
callq 0x78a4
cmpl $-0x1, %eax
je 0x8199
movzbl 0x14(%rsp), %ecx
movq %r12, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x7c9a
cmpl $-0x1, %eax
je 0x8199
movq %r12, %rdi
movl %ebp, %esi
callq 0x7ae7
cmpl $-0x1, %eax
je 0x8199
cmpl $-0x2, %eax
sete %al
cmpl $0x0, 0x10(%rsp)
setne %cl
testb %al, %cl
jne 0x8199
cmpl $0x0, 0xc(%rsp)
je 0x8190
movl %ebp, %edi
callq 0x7c4a
cmpl $-0x1, %eax
je 0x8199
xorl %ebx, %ebx
jmp 0x8199
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
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_O3/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 0x820d
cmpl $0x2, %eax
jne 0x829d
movl 0x4(%r15), %eax
movq %rsp, %rcx
movl %eax, (%rcx)
movl 0x4(%rsi), %eax
movl %eax, 0x4(%rcx)
xorl %ebp, %ebp
movl %ebx, %edi
xorl %esi, %esi
movl $0x23, %edx
movl $0x8, %r8d
callq 0x20c0
cmpl $-0x1, %eax
jne 0x8290
leaq 0x384a(%rip), %rdi      # 0xba49
leaq 0x3884(%rip), %rcx      # 0xba8a
movl $0x157, %esi            # imm = 0x157
jmp 0x825b
movq %rdx, %r14
movq %rdx, %rdi
callq 0x21e0
testl %eax, %eax
je 0x8269
movups 0x8(%r15), %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
movl %eax, 0x10(%rcx)
movl %ebx, %edi
movl $0x29, %esi
movl $0x14, %edx
movl $0x14, %r8d
callq 0x20c0
xorl %ebp, %ebp
cmpl $-0x1, %eax
jne 0x8290
leaq 0x37fa(%rip), %rdi      # 0xba49
leaq 0x3858(%rip), %rcx      # 0xbaae
movl $0x169, %esi            # imm = 0x169
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
jmp 0x828b
leaq 0x37d9(%rip), %rdi      # 0xba49
leaq 0x360b(%rip), %rcx      # 0xb882
movl $0x160, %esi            # imm = 0x160
movl $0x2, %edx
movq %r14, %r8
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x37a5(%rip), %rdi      # 0xba49
leaq 0x1e32(%rip), %rbx      # 0xa0dd
movl $0x16f, %esi            # imm = 0x16F
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ad6
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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
movq (%rdx), %r13
xorl %ebx, %ebx
testq %r13, %r13
je 0x831b
movl %r8d, %ebp
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
movl %ebp, %r8d
callq 0x84b1
cmpl $-0x1, %eax
je 0x8316
movq 0x88(%r13), %r13
testq %r13, %r13
jne 0x82ef
jmp 0x831b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
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_O3/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 0x3558(%rip), %rdi      # 0xbbec
leaq 0x3557(%rip), %rcx      # 0xbbf2
movl $0x40, %esi
movl $0x3, %edx
movl %r13d, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x4ad6
movq (%rbx), %rax
movl %r12d, %r14d
leaq (%r14,%rax), %rcx
addq $0x4, %rcx
cmpq %rbp, %rcx
jbe 0x86eb
leaq 0x3520(%rip), %rdi      # 0xbbec
leaq 0x3541(%rip), %rcx      # 0xbc14
movl $0x43, %esi
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x872e
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_O3/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 0x87d6
cmpl $0xa, %r8d
jne 0x885f
movw $0x200, %cx             # imm = 0x200
movl $0x10, %edx
movl $0x8, %eax
jmp 0x87e4
movw $0x100, %cx             # imm = 0x100
movl $0x4, %eax
movl $0x4, %edx
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 0x881d
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 0x8664
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3386(%rip), %rdi      # 0xbbec
leaq 0x1802(%rip), %r14      # 0xa06f
movl $0xb5, %esi
movl $0x2, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x4ad6
movzwl (%rbx), %edx
movl $0x1, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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 0x88f8
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
movzwl (%rcx,%r10,2), %r11d
rolw $0x8, %r11w
movw %r11w, (%r9,%r10,2)
incq %r10
movl %r10d, %r11d
cmpq %r8, %r11
jb 0x88cb
movzwl %ax, %r8d
movl $0x5, %ecx
callq 0x8664
movq %rbp, %rsp
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x3173(%rip), %rdi      # 0xbbec
leaq 0x31bb(%rip), %rcx      # 0xbc3b
xorl %ebp, %ebp
movl $0x160, %esi            # imm = 0x160
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
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 0x8adf
leaq 0x312c(%rip), %rdi      # 0xbbec
leaq 0x3197(%rip), %rcx      # 0xbc5e
movl $0x165, %esi            # imm = 0x165
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x8af7
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_O3/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 %r12
pushq %rbx
subq $0x20, %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 0x8bfb
cmpl $0x2, %r8d
jne 0x8c8f
movl 0x4(%r14), %eax
movl %eax, (%rsp)
movl $0x4, %ecx
movl $0x20, %eax
movl $0x1, %edx
jmp 0x8c13
movups 0x8(%r14), %xmm0
movaps %xmm0, (%rsp)
movl $0x8, %ecx
movl $0x80, %eax
movl $0x2, %edx
movzwl %si, %esi
xorl %r14d, %r14d
cmpl %esi, %edx
jne 0x8c7f
testb %bpl, %bpl
je 0x8c79
movzbl %bpl, %r12d
cmpl %r12d, %ecx
seta %cl
cmpl %r12d, %eax
setb %al
orb %cl, %al
jne 0x8c7f
movl %r12d, %r15d
shrl $0x3, %r15d
movq %rsp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2270
testl %eax, %eax
jne 0x8c7f
andl $0x7, %r12d
sete %al
cmpb $0x40, %bpl
setae %cl
orb %al, %cl
jne 0x8c79
movb $0x8, %cl
subb %r12b, %cl
movl $0xff, %eax
shll %cl, %eax
movb (%rbx,%r15), %cl
xorb (%rsp,%r15), %cl
testb %al, %cl
jne 0x8c7f
movl $0x1, %r14d
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2f56(%rip), %rdi      # 0xbbec
leaq 0x3090(%rip), %rbx      # 0xbd2d
movl $0x20d, %esi            # imm = 0x20D
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ad6
movzwl (%r14), %edx
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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
cmpl $0x100, %eax            # imm = 0x100
sete %sil
cmpq $0x6, %rdx
sete %r8b
testb %sil, %r8b
je 0x8ce8
cmpw $0x2, (%rdi)
je 0x8d08
jmp 0x8d21
movzwl %ax, %esi
cmpl $0x200, %esi            # imm = 0x200
sete %sil
cmpq $0x12, %rdx
sete %r8b
testb %sil, %r8b
je 0x8d21
cmpw $0xa, (%rdi)
jne 0x8d21
rolw $0x8, %ax
shlb $0x3, %dl
addb $-0x10, %dl
addq $0x2, %rcx
movzwl %ax, %esi
movzbl %dl, %edx
jmp 0x8baf
xorl %eax, %eax
retq