#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  scalar_t__ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ sin1;
typedef int /*<<< orphan*/ sin0;
typedef int /*<<< orphan*/ optval;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int IPPROTO_IP;
int IPPROTO_UDP;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int SOL_SOCKET;
int SO_OOBINLINE;
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ setsockopt(int, int, int, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int sock_stream;
  int fd_null;
  struct sockaddr_in sin0, sin1;
  socklen_t sinlen;
  int optval;
  socklen_t optlen;
  sin0.sin_family = AF_INET;
  sin0.sin_port = 0;
  sin0.sin_addr.s_addr = INADDR_ANY;
  sinlen = sizeof(sin1);
  optlen = sizeof(optval);
  sock_stream = socket(PF_INET, SOCK_STREAM, 0);
  bind(sock_stream, (struct sockaddr *)&sin0, sizeof(sin0));
  fd_null = open("/dev/null", O_WRONLY);
  setsockopt(-1, SOL_SOCKET, SO_OOBINLINE, &optval, optlen);
  setsockopt(fd_null, SOL_SOCKET, SO_OOBINLINE, &optval, optlen);
  setsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, (void *)-1, optlen);
  setsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, &optval, (socklen_t)-1);
  setsockopt(sock_stream, 500, SO_OOBINLINE, &optval, optlen);
  setsockopt(sock_stream, -1, SO_OOBINLINE, &optval, optlen);
  setsockopt(sock_stream, IPPROTO_UDP, SO_OOBINLINE, &optval, optlen);
  setsockopt(sock_stream, IPPROTO_IP, -1, &optval, optlen);
  setsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, &optval, optlen);
  close(sock_stream);
  close(fd_null);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2e56(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movl   $0x18,-0x44(%rbp)
movl   $0x4,-0x4c(%rbp)
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    0x2e23(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1070 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x18,%edx
call   1050 <bind@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%esi
lea    0xe36(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
mov    0x2dd6(%rip),%rax
mov    (%rax),%edx
mov    -0x4c(%rbp),%r8d
mov    $0xffffffff,%edi
lea    -0x48(%rbp),%rcx
call   1030 <setsockopt@plt>
mov    -0xc(%rbp),%edi
mov    0x2de8(%rip),%rax
mov    (%rax),%esi
mov    0x2daf(%rip),%rax
mov    (%rax),%edx
mov    -0x4c(%rbp),%r8d
lea    -0x48(%rbp),%rcx
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
mov    0x2d8d(%rip),%rax
mov    (%rax),%edx
mov    -0x4c(%rbp),%r8d
mov    $0xffffffffffffffff,%rcx
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
mov    0x2da1(%rip),%rax
mov    (%rax),%esi
mov    0x2d68(%rip),%rax
mov    (%rax),%edx
lea    -0x48(%rbp),%rcx
mov    $0xffffffff,%r8d
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
mov    0x2d4d(%rip),%rax
mov    (%rax),%edx
mov    -0x4c(%rbp),%r8d
mov    $0x1f4,%esi
lea    -0x48(%rbp),%rcx
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
mov    0x2d2f(%rip),%rax
mov    (%rax),%edx
mov    -0x4c(%rbp),%r8d
mov    $0xffffffff,%esi
lea    -0x48(%rbp),%rcx
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
mov    0x2cf1(%rip),%rax
mov    (%rax),%esi
mov    0x2d08(%rip),%rax
mov    (%rax),%edx
mov    -0x4c(%rbp),%r8d
lea    -0x48(%rbp),%rcx
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
mov    -0x4c(%rbp),%r8d
mov    $0xffffffff,%edx
lea    -0x48(%rbp),%rcx
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
mov    0x2d01(%rip),%rax
mov    (%rax),%esi
mov    0x2cc8(%rip),%rax
mov    (%rax),%edx
mov    -0x4c(%rbp),%r8d
lea    -0x48(%rbp),%rcx
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2e57(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1070 <socket@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %eax,%edi
mov    $0x18,%edx
call   1050 <bind@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%esi
lea    0xe45(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%r14d
mov    0x2e1e(%rip),%r15
mov    (%r15),%esi
mov    0x2de4(%rip),%r12
mov    (%r12),%edx
lea    0x4(%rsp),%rbp
mov    $0xffffffff,%edi
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    (%r15),%esi
mov    (%r12),%edx
mov    %r14d,%edi
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    (%r15),%esi
mov    (%r12),%edx
mov    %ebx,%edi
mov    $0xffffffffffffffff,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    (%r15),%esi
mov    (%r12),%edx
mov    %ebx,%edi
mov    %rbp,%rcx
mov    $0xffffffff,%r8d
call   1030 <setsockopt@plt>
mov    (%r12),%edx
mov    %ebx,%edi
mov    $0x1f4,%esi
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    (%r12),%edx
mov    %ebx,%edi
mov    $0xffffffff,%esi
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
mov    (%r12),%edx
mov    %ebx,%edi
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0xffffffff,%edx
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    (%r15),%esi
mov    (%r12),%edx
mov    %ebx,%edi
mov    %rbp,%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    %r14d,%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i64, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"/dev/null\00"
@O_WRONLY = global i32 0
@SOL_SOCKET = global i32 0
@SO_OOBINLINE = global i32 0
@IPPROTO_UDP = global i32 0
@IPPROTO_IP = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = load i32, i32* @AF_INET
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %9, i32* %10
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
store i64 0, i64* %11
%12 = load i32, i32* @INADDR_ANY
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%14 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %13, i32 0, i32 0
store i32 %12, i32* %14
store i32 24, i32* %6
store i32 4, i32* %8
%15 = load i32, i32* @PF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = call i32 @socket(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%20 = call i32 @bind(i32 %18, %struct.sockaddr* %19, i32 24)
%21 = load i32, i32* @O_WRONLY
%22 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %21)
store i32 %22, i32* %3
%23 = load i32, i32* @SOL_SOCKET
%24 = load i32, i32* @SO_OOBINLINE
%25 = load i32, i32* %8
%26 = call i32 @setsockopt(i32 -1, i32 %23, i32 %24, i32* %7, i32 %25)
%27 = load i32, i32* %3
%28 = load i32, i32* @SOL_SOCKET
%29 = load i32, i32* @SO_OOBINLINE
%30 = load i32, i32* %8
%31 = call i32 @setsockopt(i32 %27, i32 %28, i32 %29, i32* %7, i32 %30)
%32 = load i32, i32* %2
%33 = load i32, i32* @SOL_SOCKET
%34 = load i32, i32* @SO_OOBINLINE
%35 = load i32, i32* %8
%36 = call i32 @setsockopt(i32 %32, i32 %33, i32 %34, i32* inttoptr (i64 -1 to i32*), i32 %35)
%37 = load i32, i32* %2
%38 = load i32, i32* @SOL_SOCKET
%39 = load i32, i32* @SO_OOBINLINE
%40 = call i32 @setsockopt(i32 %37, i32 %38, i32 %39, i32* %7, i32 -1)
%41 = load i32, i32* %2
%42 = load i32, i32* @SO_OOBINLINE
%43 = load i32, i32* %8
%44 = call i32 @setsockopt(i32 %41, i32 500, i32 %42, i32* %7, i32 %43)
%45 = load i32, i32* %2
%46 = load i32, i32* @SO_OOBINLINE
%47 = load i32, i32* %8
%48 = call i32 @setsockopt(i32 %45, i32 -1, i32 %46, i32* %7, i32 %47)
%49 = load i32, i32* %2
%50 = load i32, i32* @IPPROTO_UDP
%51 = load i32, i32* @SO_OOBINLINE
%52 = load i32, i32* %8
%53 = call i32 @setsockopt(i32 %49, i32 %50, i32 %51, i32* %7, i32 %52)
%54 = load i32, i32* %2
%55 = load i32, i32* @IPPROTO_IP
%56 = load i32, i32* %8
%57 = call i32 @setsockopt(i32 %54, i32 %55, i32 -1, i32* %7, i32 %56)
%58 = load i32, i32* %2
%59 = load i32, i32* @SOL_SOCKET
%60 = load i32, i32* @SO_OOBINLINE
%61 = load i32, i32* %8
%62 = call i32 @setsockopt(i32 %58, i32 %59, i32 %60, i32* %7, i32 %61)
%63 = load i32, i32* %2
%64 = call i32 @close(i32 %63)
%65 = load i32, i32* %3
%66 = call i32 @close(i32 %65)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i64, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"/dev/null\00"
@O_WRONLY = global i32 0
@SOL_SOCKET = global i32 0
@SO_OOBINLINE = global i32 0
@IPPROTO_UDP = global i32 0
@IPPROTO_IP = global i32 0
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca i32
%3 = bitcast %struct.sockaddr_in* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @AF_INET
%6 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %5, i32* %6
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
store i64 0, i64* %7
%8 = load i32, i32* @INADDR_ANY
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0, i32 0
store i32 %8, i32* %9
%10 = load i32, i32* @PF_INET
%11 = load i32, i32* @SOCK_STREAM
%12 = tail call i32 @socket(i32 %10, i32 %11, i32 0)
%13 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%14 = call i32 @bind(i32 %12, %struct.sockaddr* %13, i32 24)
%15 = load i32, i32* @O_WRONLY
%16 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @SOL_SOCKET
%18 = load i32, i32* @SO_OOBINLINE
%19 = call i32 @setsockopt(i32 -1, i32 %17, i32 %18, i32* %2, i32 4)
%20 = load i32, i32* @SOL_SOCKET
%21 = load i32, i32* @SO_OOBINLINE
%22 = call i32 @setsockopt(i32 %16, i32 %20, i32 %21, i32* %2, i32 4)
%23 = load i32, i32* @SOL_SOCKET
%24 = load i32, i32* @SO_OOBINLINE
%25 = call i32 @setsockopt(i32 %12, i32 %23, i32 %24, i32* inttoptr (i64 -1 to i32*), i32 4)
%26 = load i32, i32* @SOL_SOCKET
%27 = load i32, i32* @SO_OOBINLINE
%28 = call i32 @setsockopt(i32 %12, i32 %26, i32 %27, i32* %2, i32 -1)
%29 = load i32, i32* @SO_OOBINLINE
%30 = call i32 @setsockopt(i32 %12, i32 500, i32 %29, i32* %2, i32 4)
%31 = load i32, i32* @SO_OOBINLINE
%32 = call i32 @setsockopt(i32 %12, i32 -1, i32 %31, i32* %2, i32 4)
%33 = load i32, i32* @IPPROTO_UDP
%34 = load i32, i32* @SO_OOBINLINE
%35 = call i32 @setsockopt(i32 %12, i32 %33, i32 %34, i32* %2, i32 4)
%36 = load i32, i32* @IPPROTO_IP
%37 = call i32 @setsockopt(i32 %12, i32 %36, i32 -1, i32* %2, i32 4)
%38 = load i32, i32* @SOL_SOCKET
%39 = load i32, i32* @SO_OOBINLINE
%40 = call i32 @setsockopt(i32 %12, i32 %38, i32 %39, i32* %2, i32 4)
%41 = call i32 @close(i32 %12)
%42 = call i32 @close(i32 %16)
ret i32 0
}