#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 */
struct linger {
  int l_onoff;
  int l_linger;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_BROADCAST;
int /*<<< orphan*/ SO_ERROR;
int /*<<< orphan*/ SO_KEEPALIVE;
int /*<<< orphan*/ SO_LINGER;
int /*<<< orphan*/ SO_RCVBUF;
int /*<<< orphan*/ SO_RCVLOWAT;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ SO_SNDBUF;
int /*<<< orphan*/ TCP_CORK;
int /*<<< orphan*/ TCP_KEEPCNT;
int /*<<< orphan*/ TCP_KEEPIDLE;
int /*<<< orphan*/ TCP_KEEPINTVL;
int /*<<< orphan*/ TCP_LINGER2;
int /*<<< orphan*/ TCP_MAXSEG;
int /*<<< orphan*/ TCP_NODELAY;
int /*<<< orphan*/ TCP_SYNCNT;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              char *, int *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int socketHandle;
  if ((socketHandle = socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) < 0) {
    close(socketHandle);
    perror("socket");
  }
  int iSocketOption = 0;
  int iSocketOptionLen = sizeof(int);
  ;
  struct linger SocketOptionLinger;
  int iSocketOptionLingerLen = sizeof(struct linger);
  ;
  getsockopt(socketHandle, IPPROTO_TCP, TCP_NODELAY, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_NODELAY = %d\n", iSocketOption);
  getsockopt(socketHandle, IPPROTO_TCP, TCP_MAXSEG, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_MAXSEG = %d\n", iSocketOption);
  getsockopt(socketHandle, IPPROTO_TCP, TCP_CORK, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_CORK = %d\n", iSocketOption);
  getsockopt(socketHandle, IPPROTO_TCP, TCP_KEEPIDLE, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_KEEPIDLE = %d\n", iSocketOption);
  getsockopt(socketHandle, IPPROTO_TCP, TCP_KEEPINTVL, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_KEEPINTVL = %d\n", iSocketOption);
  getsockopt(socketHandle, IPPROTO_TCP, TCP_KEEPCNT, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_KEEPCNT = %d\n", iSocketOption);
  getsockopt(socketHandle, IPPROTO_TCP, TCP_SYNCNT, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_SYNCNT = %d\n", iSocketOption);
  getsockopt(socketHandle, IPPROTO_TCP, TCP_LINGER2, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket TCP_LINGER2 = %d\n", iSocketOption);
  getsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket SO_REUSEADDR = %d\n", iSocketOption);
  getsockopt(socketHandle, SOL_SOCKET, SO_ERROR, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket SO_ERROR = %d\n", iSocketOption);
  getsockopt(socketHandle, SOL_SOCKET, SO_BROADCAST, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket SO_BROADCAST = %d\n", iSocketOption);
  getsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket SO_KEEPALIVE = %d\n", iSocketOption);
  getsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket SO_SNDBUF = %d\n", iSocketOption);
  getsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket SO_RCVBUF = %d\n", iSocketOption);
  getsockopt(socketHandle, SOL_SOCKET, SO_LINGER, (char *)&SocketOptionLinger,
             &iSocketOptionLingerLen);
  printf("Socket SO_LINGER = %d  time = %d\n", SocketOptionLinger.l_onoff,
         SocketOptionLinger.l_linger);
  getsockopt(socketHandle, SOL_SOCKET, SO_RCVLOWAT, (char *)&iSocketOption,
             &iSocketOptionLen);
  printf("Socket SO_RCVLOWAT = %d\n", iSocketOption);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    0x2df9(%rip),%rax
mov    (%rax),%esi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
call   1070 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    119f <main+0x4f>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
lea    0xe66(%rip),%rdi
call   1060 <perror@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
movl   $0x8,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2dea(%rip),%rax
mov    (%rax),%esi
mov    0x2e19(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
mov    0x2d8e(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2d84(%rip),%rax
mov    (%rax),%esi
mov    0x2d63(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2d51(%rip),%rax
mov    (%rax),%esi
mov    0x2cf8(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2d1e(%rip),%rax
mov    (%rax),%esi
mov    0x2d05(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
mov    0x2cba(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2cb8(%rip),%rax
mov    (%rax),%esi
mov    0x2cd7(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2c85(%rip),%rax
mov    (%rax),%esi
mov    0x2c9c(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2c92(%rip),%rax
mov    (%rax),%esi
mov    0x2be9(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2c5f(%rip),%rax
mov    (%rax),%esi
mov    0x2bce(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2c2c(%rip),%rax
mov    (%rax),%esi
mov    0x2bdb(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2bf9(%rip),%rax
mov    (%rax),%esi
mov    0x2b40(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2bc6(%rip),%rax
mov    (%rax),%esi
mov    0x2b95(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xced(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2b93(%rip),%rax
mov    (%rax),%esi
mov    0x2b12(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2b60(%rip),%rax
mov    (%rax),%esi
mov    0x2b27(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xcb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2b2a(%rip),%rax
mov    (%rax),%esi
mov    0x2a89(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <getsockopt@plt>
mov    -0xc(%rbp),%esi
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    0x2dfd(%rip),%rax
mov    (%rax),%esi
mov    0x2e3c(%rip),%rax
mov    (%rax),%edx
call   1070 <socket@plt>
mov    %eax,%ebx
test   %eax,%eax
js     148b <main+0x33b>
movl   $0x0,0x4(%rsp)
movl   $0x4,0xc(%rsp)
movl   $0x8,0x8(%rsp)
mov    0x2e04(%rip),%r12
mov    (%r12),%esi
mov    0x2e31(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%r14
lea    0xc(%rsp),%r15
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2da3(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xe21(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2d7f(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xe0d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2d1b(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xdf7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2d2f(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xde5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2ceb(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xdd4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2d0f(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xdc1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2cdb(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2cd3(%rip),%r12
mov    (%r12),%esi
mov    0x2c28(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xd93(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2c14(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xd81(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2c28(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xd6b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2b94(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xd59(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2bf0(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xd47(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2b74(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xd32(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2b90(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %ebx,%edi
call   1050 <getsockopt@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0xd15(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12),%esi
mov    0x2af4(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <getsockopt@plt>
mov    0x4(%rsp),%esi
lea    0xd0b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %ebx,%edi
call   1040 <close@plt>
lea    0xb67(%rip),%rdi
call   1060 <perror@plt>
jmp    1185 <main+0x35>

LLVM IR (-O0):
%struct.linger = type { i32, i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_IP = global i32 0
@.str = [7 x i8] c"socket\00"
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
@.str.1 = [25 x i8] c"Socket TCP_NODELAY = %d\0A\00"
@TCP_MAXSEG = global i32 0
@.str.2 = [24 x i8] c"Socket TCP_MAXSEG = %d\0A\00"
@TCP_CORK = global i32 0
@.str.3 = [22 x i8] c"Socket TCP_CORK = %d\0A\00"
@TCP_KEEPIDLE = global i32 0
@.str.4 = [26 x i8] c"Socket TCP_KEEPIDLE = %d\0A\00"
@TCP_KEEPINTVL = global i32 0
@.str.5 = [27 x i8] c"Socket TCP_KEEPINTVL = %d\0A\00"
@TCP_KEEPCNT = global i32 0
@.str.6 = [25 x i8] c"Socket TCP_KEEPCNT = %d\0A\00"
@TCP_SYNCNT = global i32 0
@.str.7 = [24 x i8] c"Socket TCP_SYNCNT = %d\0A\00"
@TCP_LINGER2 = global i32 0
@.str.8 = [25 x i8] c"Socket TCP_LINGER2 = %d\0A\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.9 = [26 x i8] c"Socket SO_REUSEADDR = %d\0A\00"
@SO_ERROR = global i32 0
@.str.10 = [22 x i8] c"Socket SO_ERROR = %d\0A\00"
@SO_BROADCAST = global i32 0
@.str.11 = [26 x i8] c"Socket SO_BROADCAST = %d\0A\00"
@SO_KEEPALIVE = global i32 0
@.str.12 = [26 x i8] c"Socket SO_KEEPALIVE = %d\0A\00"
@SO_SNDBUF = global i32 0
@.str.13 = [23 x i8] c"Socket SO_SNDBUF = %d\0A\00"
@SO_RCVBUF = global i32 0
@.str.14 = [23 x i8] c"Socket SO_RCVBUF = %d\0A\00"
@SO_LINGER = global i32 0
@.str.15 = [34 x i8] c"Socket SO_LINGER = %d time = %d\0A\00"
@SO_RCVLOWAT = global i32 0
@.str.16 = [25 x i8] c"Socket SO_RCVLOWAT = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.linger
%6 = alloca i32
store i32 0, i32* %1
%7 = load i32, i32* @AF_INET
%8 = load i32, i32* @SOCK_STREAM
%9 = load i32, i32* @IPPROTO_IP
%10 = call i32 @socket(i32 %7, i32 %8, i32 %9)
store i32 %10, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call i32 @close(i32 %13)
%15 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %12, %0
store i32 0, i32* %3
store i32 4, i32* %4
store i32 8, i32* %6
%17 = load i32, i32* %2
%18 = load i32, i32* @IPPROTO_TCP
%19 = load i32, i32* @TCP_NODELAY
%20 = bitcast i32* %3 to i8*
%21 = call i32 @getsockopt(i32 %17, i32 %18, i32 %19, i8* %20, i32* %4)
%22 = load i32, i32* %3
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %2
%25 = load i32, i32* @IPPROTO_TCP
%26 = load i32, i32* @TCP_MAXSEG
%27 = bitcast i32* %3 to i8*
%28 = call i32 @getsockopt(i32 %24, i32 %25, i32 %26, i8* %27, i32* %4)
%29 = load i32, i32* %3
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = load i32, i32* @IPPROTO_TCP
%33 = load i32, i32* @TCP_CORK
%34 = bitcast i32* %3 to i8*
%35 = call i32 @getsockopt(i32 %31, i32 %32, i32 %33, i8* %34, i32* %4)
%36 = load i32, i32* %3
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %2
%39 = load i32, i32* @IPPROTO_TCP
%40 = load i32, i32* @TCP_KEEPIDLE
%41 = bitcast i32* %3 to i8*
%42 = call i32 @getsockopt(i32 %38, i32 %39, i32 %40, i8* %41, i32* %4)
%43 = load i32, i32* %3
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %2
%46 = load i32, i32* @IPPROTO_TCP
%47 = load i32, i32* @TCP_KEEPINTVL
%48 = bitcast i32* %3 to i8*
%49 = call i32 @getsockopt(i32 %45, i32 %46, i32 %47, i8* %48, i32* %4)
%50 = load i32, i32* %3
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %2
%53 = load i32, i32* @IPPROTO_TCP
%54 = load i32, i32* @TCP_KEEPCNT
%55 = bitcast i32* %3 to i8*
%56 = call i32 @getsockopt(i32 %52, i32 %53, i32 %54, i8* %55, i32* %4)
%57 = load i32, i32* %3
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %2
%60 = load i32, i32* @IPPROTO_TCP
%61 = load i32, i32* @TCP_SYNCNT
%62 = bitcast i32* %3 to i8*
%63 = call i32 @getsockopt(i32 %59, i32 %60, i32 %61, i8* %62, i32* %4)
%64 = load i32, i32* %3
%65 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %2
%67 = load i32, i32* @IPPROTO_TCP
%68 = load i32, i32* @TCP_LINGER2
%69 = bitcast i32* %3 to i8*
%70 = call i32 @getsockopt(i32 %66, i32 %67, i32 %68, i8* %69, i32* %4)
%71 = load i32, i32* %3
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %2
%74 = load i32, i32* @SOL_SOCKET
%75 = load i32, i32* @SO_REUSEADDR
%76 = bitcast i32* %3 to i8*
%77 = call i32 @getsockopt(i32 %73, i32 %74, i32 %75, i8* %76, i32* %4)
%78 = load i32, i32* %3
%79 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %2
%81 = load i32, i32* @SOL_SOCKET
%82 = load i32, i32* @SO_ERROR
%83 = bitcast i32* %3 to i8*
%84 = call i32 @getsockopt(i32 %80, i32 %81, i32 %82, i8* %83, i32* %4)
%85 = load i32, i32* %3
%86 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %85)
%87 = load i32, i32* %2
%88 = load i32, i32* @SOL_SOCKET
%89 = load i32, i32* @SO_BROADCAST
%90 = bitcast i32* %3 to i8*
%91 = call i32 @getsockopt(i32 %87, i32 %88, i32 %89, i8* %90, i32* %4)
%92 = load i32, i32* %3
%93 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i32 %92)
%94 = load i32, i32* %2
%95 = load i32, i32* @SOL_SOCKET
%96 = load i32, i32* @SO_KEEPALIVE
%97 = bitcast i32* %3 to i8*
%98 = call i32 @getsockopt(i32 %94, i32 %95, i32 %96, i8* %97, i32* %4)
%99 = load i32, i32* %3
%100 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i32 %99)
%101 = load i32, i32* %2
%102 = load i32, i32* @SOL_SOCKET
%103 = load i32, i32* @SO_SNDBUF
%104 = bitcast i32* %3 to i8*
%105 = call i32 @getsockopt(i32 %101, i32 %102, i32 %103, i8* %104, i32* %4)
%106 = load i32, i32* %3
%107 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %106)
%108 = load i32, i32* %2
%109 = load i32, i32* @SOL_SOCKET
%110 = load i32, i32* @SO_RCVBUF
%111 = bitcast i32* %3 to i8*
%112 = call i32 @getsockopt(i32 %108, i32 %109, i32 %110, i8* %111, i32* %4)
%113 = load i32, i32* %3
%114 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %113)
%115 = load i32, i32* %2
%116 = load i32, i32* @SOL_SOCKET
%117 = load i32, i32* @SO_LINGER
%118 = bitcast %struct.linger* %5 to i8*
%119 = call i32 @getsockopt(i32 %115, i32 %116, i32 %117, i8* %118, i32* %6)
%120 = getelementptr inbounds %struct.linger, %struct.linger* %5, i32 0, i32 0
%121 = load i32, i32* %120
%122 = getelementptr inbounds %struct.linger, %struct.linger* %5, i32 0, i32 1
%123 = load i32, i32* %122
%124 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0), i32 %121, i32 %123)
%125 = load i32, i32* %2
%126 = load i32, i32* @SOL_SOCKET
%127 = load i32, i32* @SO_RCVLOWAT
%128 = bitcast i32* %3 to i8*
%129 = call i32 @getsockopt(i32 %125, i32 %126, i32 %127, i8* %128, i32* %4)
%130 = load i32, i32* %3
%131 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), i32 %130)
%132 = load i32, i32* %1
ret i32 %132
}

LLVM IR (-O2):
%struct.linger = type { i32, i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_IP = global i32 0
@.str = [7 x i8] c"socket\00"
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
@.str.1 = [25 x i8] c"Socket TCP_NODELAY = %d\0A\00"
@TCP_MAXSEG = global i32 0
@.str.2 = [24 x i8] c"Socket TCP_MAXSEG = %d\0A\00"
@TCP_CORK = global i32 0
@.str.3 = [22 x i8] c"Socket TCP_CORK = %d\0A\00"
@TCP_KEEPIDLE = global i32 0
@.str.4 = [26 x i8] c"Socket TCP_KEEPIDLE = %d\0A\00"
@TCP_KEEPINTVL = global i32 0
@.str.5 = [27 x i8] c"Socket TCP_KEEPINTVL = %d\0A\00"
@TCP_KEEPCNT = global i32 0
@.str.6 = [25 x i8] c"Socket TCP_KEEPCNT = %d\0A\00"
@TCP_SYNCNT = global i32 0
@.str.7 = [24 x i8] c"Socket TCP_SYNCNT = %d\0A\00"
@TCP_LINGER2 = global i32 0
@.str.8 = [25 x i8] c"Socket TCP_LINGER2 = %d\0A\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.9 = [26 x i8] c"Socket SO_REUSEADDR = %d\0A\00"
@SO_ERROR = global i32 0
@.str.10 = [22 x i8] c"Socket SO_ERROR = %d\0A\00"
@SO_BROADCAST = global i32 0
@.str.11 = [26 x i8] c"Socket SO_BROADCAST = %d\0A\00"
@SO_KEEPALIVE = global i32 0
@.str.12 = [26 x i8] c"Socket SO_KEEPALIVE = %d\0A\00"
@SO_SNDBUF = global i32 0
@.str.13 = [23 x i8] c"Socket SO_SNDBUF = %d\0A\00"
@SO_RCVBUF = global i32 0
@.str.14 = [23 x i8] c"Socket SO_RCVBUF = %d\0A\00"
@SO_LINGER = global i32 0
@.str.15 = [34 x i8] c"Socket SO_LINGER = %d time = %d\0A\00"
@SO_RCVLOWAT = global i32 0
@.str.16 = [25 x i8] c"Socket SO_RCVLOWAT = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.linger
%4 = alloca i32
%5 = load i32, i32* @AF_INET
%6 = load i32, i32* @SOCK_STREAM
%7 = load i32, i32* @IPPROTO_IP
%8 = tail call i32 @socket(i32 %5, i32 %6, i32 %7)
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = tail call i32 @close(i32 %8)
%12 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %0
%14 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%15 = bitcast i32* %2 to i8*
store i32 4, i32* %2
%16 = bitcast %struct.linger* %3 to i8*
%17 = bitcast i32* %4 to i8*
store i32 8, i32* %4
%18 = load i32, i32* @IPPROTO_TCP
%19 = load i32, i32* @TCP_NODELAY
%20 = call i32 @getsockopt(i32 %8, i32 %18, i32 %19, i8* %14, i32* %2)
%21 = load i32, i32* %1
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @IPPROTO_TCP
%24 = load i32, i32* @TCP_MAXSEG
%25 = call i32 @getsockopt(i32 %8, i32 %23, i32 %24, i8* %14, i32* %2)
%26 = load i32, i32* %1
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @IPPROTO_TCP
%29 = load i32, i32* @TCP_CORK
%30 = call i32 @getsockopt(i32 %8, i32 %28, i32 %29, i8* %14, i32* %2)
%31 = load i32, i32* %1
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @IPPROTO_TCP
%34 = load i32, i32* @TCP_KEEPIDLE
%35 = call i32 @getsockopt(i32 %8, i32 %33, i32 %34, i8* %14, i32* %2)
%36 = load i32, i32* %1
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = load i32, i32* @IPPROTO_TCP
%39 = load i32, i32* @TCP_KEEPINTVL
%40 = call i32 @getsockopt(i32 %8, i32 %38, i32 %39, i8* %14, i32* %2)
%41 = load i32, i32* %1
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %41)
%43 = load i32, i32* @IPPROTO_TCP
%44 = load i32, i32* @TCP_KEEPCNT
%45 = call i32 @getsockopt(i32 %8, i32 %43, i32 %44, i8* %14, i32* %2)
%46 = load i32, i32* %1
%47 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %46)
%48 = load i32, i32* @IPPROTO_TCP
%49 = load i32, i32* @TCP_SYNCNT
%50 = call i32 @getsockopt(i32 %8, i32 %48, i32 %49, i8* %14, i32* %2)
%51 = load i32, i32* %1
%52 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 %51)
%53 = load i32, i32* @IPPROTO_TCP
%54 = load i32, i32* @TCP_LINGER2
%55 = call i32 @getsockopt(i32 %8, i32 %53, i32 %54, i8* %14, i32* %2)
%56 = load i32, i32* %1
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %56)
%58 = load i32, i32* @SOL_SOCKET
%59 = load i32, i32* @SO_REUSEADDR
%60 = call i32 @getsockopt(i32 %8, i32 %58, i32 %59, i8* %14, i32* %2)
%61 = load i32, i32* %1
%62 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %61)
%63 = load i32, i32* @SOL_SOCKET
%64 = load i32, i32* @SO_ERROR
%65 = call i32 @getsockopt(i32 %8, i32 %63, i32 %64, i8* %14, i32* %2)
%66 = load i32, i32* %1
%67 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %66)
%68 = load i32, i32* @SOL_SOCKET
%69 = load i32, i32* @SO_BROADCAST
%70 = call i32 @getsockopt(i32 %8, i32 %68, i32 %69, i8* %14, i32* %2)
%71 = load i32, i32* %1
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i32 %71)
%73 = load i32, i32* @SOL_SOCKET
%74 = load i32, i32* @SO_KEEPALIVE
%75 = call i32 @getsockopt(i32 %8, i32 %73, i32 %74, i8* %14, i32* %2)
%76 = load i32, i32* %1
%77 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i32 %76)
%78 = load i32, i32* @SOL_SOCKET
%79 = load i32, i32* @SO_SNDBUF
%80 = call i32 @getsockopt(i32 %8, i32 %78, i32 %79, i8* %14, i32* %2)
%81 = load i32, i32* %1
%82 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %81)
%83 = load i32, i32* @SOL_SOCKET
%84 = load i32, i32* @SO_RCVBUF
%85 = call i32 @getsockopt(i32 %8, i32 %83, i32 %84, i8* %14, i32* %2)
%86 = load i32, i32* %1
%87 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %86)
%88 = load i32, i32* @SOL_SOCKET
%89 = load i32, i32* @SO_LINGER
%90 = call i32 @getsockopt(i32 %8, i32 %88, i32 %89, i8* %16, i32* %4)
%91 = getelementptr inbounds %struct.linger, %struct.linger* %3, i64 0, i32 0
%92 = load i32, i32* %91
%93 = getelementptr inbounds %struct.linger, %struct.linger* %3, i64 0, i32 1
%94 = load i32, i32* %93
%95 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0), i32 %92, i32 %94)
%96 = load i32, i32* @SOL_SOCKET
%97 = load i32, i32* @SO_RCVLOWAT
%98 = call i32 @getsockopt(i32 %8, i32 %96, i32 %97, i8* %14, i32* %2)
%99 = load i32, i32* %1
%100 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), i32 %99)
ret i32 0
}