#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ t;
struct timeval {
  int member_0;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVTIMEO;
int /*<<< orphan*/ SO_SNDTIMEO;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              struct timeval *, int);
void setup_socket(int sockfd) {
  struct timeval t = {1, 0};
  setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &t, sizeof(t));
  setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(t));
}


x86 assembly (clang, -O0):
<setup_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
mov    -0x4(%rbp),%edi
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_socket>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movq   $0x1,0x8(%rsp)
mov    0x2eb5(%rip),%r15
mov    (%r15),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%r14
mov    %r14,%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
mov    (%r15),%esi
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@__const.setup_socket.t = %struct.timeval { i32 1, i32 0 }
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
@SO_RCVTIMEO = global i32 0
define void @setup_socket(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = bitcast %struct.timeval* %3 to i8*
%5 = load i32, i32* %2
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_SNDTIMEO
%8 = call i32 @setsockopt(i32 %5, i32 %6, i32 %7, %struct.timeval* %3, i32 8)
%9 = load i32, i32* %2
%10 = load i32, i32* @SOL_SOCKET
%11 = load i32, i32* @SO_RCVTIMEO
%12 = call i32 @setsockopt(i32 %9, i32 %10, i32 %11, %struct.timeval* %3, i32 8)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
@SO_RCVTIMEO = global i32 0
define void @setup_socket(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to %struct.timeval*
%4 = bitcast i64* %2 to i8*
store i64 1, i64* %2
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_SNDTIMEO
%7 = call i32 @setsockopt(i32 %0, i32 %5, i32 %6, %struct.timeval* %3, i32 8)
%8 = load i32, i32* @SOL_SOCKET
%9 = load i32, i32* @SO_RCVTIMEO
%10 = call i32 @setsockopt(i32 %0, i32 %8, i32 %9, %struct.timeval* %3, i32 8)
ret void
}