// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movb %cl, %al
movl 0x20(%rbp), %ecx
movl 0x18(%rbp), %ecx
movl 0x10(%rbp), %ecx
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb %al, -0x15(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movl -0x14(%rbp), %edi
callq 0xaf50
movq %rax, -0x28(%rbp)
movl -0x8(%rbp), %edi
movl 0x10(%rbp), %edx
movl 0x20(%rbp), %r8d
movl $0x1, %esi
leaq -0x2c(%rbp), %rcx
callq 0xa5a0
cmpl $-0x1, %eax
jne 0xb30d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb419
movq -0x28(%rbp), %r8
movl -0x2c(%rbp), %r9d
leaq 0x479e(%rip), %rdi      # 0xfaba
movl $0x1fc, %esi            # imm = 0x1FC
movl $0x2, %edx
leaq 0x48b4(%rip), %rcx      # 0xfbe1
movb $0x0, %al
callq 0x5dc0
movl -0x8(%rbp), %edi
movl 0x18(%rbp), %edx
movl 0x20(%rbp), %r8d
xorl %esi, %esi
leaq -0x2c(%rbp), %rcx
callq 0xa5a0
cmpl $-0x1, %eax
jne 0xb35a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb419
movq -0x28(%rbp), %r8
movl -0x2c(%rbp), %r9d
leaq 0x4751(%rip), %rdi      # 0xfaba
movl $0x202, %esi            # imm = 0x202
movl $0x2, %edx
leaq 0x4896(%rip), %rcx      # 0xfc10
movb $0x0, %al
callq 0x5dc0
movq -0x10(%rbp), %rax
movzwl (%rax), %eax
cmpl $0xa, %eax
jne 0xb3a9
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0xa7a0
cmpl $-0x1, %eax
jne 0xb3a7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb419
jmp 0xb3a9
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x8(%rbp), %edx
movzbl -0x15(%rbp), %ecx
callq 0xacf0
cmpl $-0x1, %eax
jne 0xb3ca
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb419
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0xaab0
movl %eax, -0x30(%rbp)
cmpl $-0x1, -0x30(%rbp)
je 0xb3eb
cmpl $-0x2, -0x30(%rbp)
jne 0xb3f4
cmpl $0x0, -0x1c(%rbp)
je 0xb3f4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb419
cmpl $0x0, -0x20(%rbp)
je 0xb412
movl -0x8(%rbp), %edi
callq 0xac80
cmpl $-0x1, %eax
jne 0xb410
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb419
jmp 0xb412
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)