#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_6__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ tm;
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
struct sockaddr {
  int dummy;
};
struct TYPE_6__ {
  int /*<<< orphan*/ member_0;
};
typedef TYPE_1__ fd_set;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EINPROGRESS;
scalar_t__ FD_ISSET(int, TYPE_1__ *);
int /*<<< orphan*/ FD_SET(int, TYPE_1__ *);
int /*<<< orphan*/ FD_ZERO(TYPE_1__ *);
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVTIMEO;
int /*<<< orphan*/ SO_SNDTIMEO;
scalar_t__ connect(int, struct sockaddr *, int);
scalar_t__ errno;
int fcntl(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int select(int, int /*<<< orphan*/ *, TYPE_1__ *, int /*<<< orphan*/ *,
           struct timeval *);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              struct timeval *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int stream_socket_with_timeout(struct sockaddr *addr) {
  int fd = socket(AF_INET, SOCK_STREAM, 0);
  if (fd == -1) {
    fprintf(stderr, "socket error!\n");
    perror("socket");
    return -1;
  }
  int ret = fcntl(fd, F_GETFL, 0);
  fcntl(fd, F_SETFL, ret | O_NONBLOCK);
  if (connect(fd, addr, sizeof(*addr)) != 0 && errno != EINPROGRESS) {
    fprintf(stderr, "connect error!\n");
    perror("connect");
    return -1;
  }
  fcntl(fd, F_SETFL, ret & (~O_NONBLOCK));
  struct timeval tm;
  tm.tv_sec = 3;
  tm.tv_usec = 0;
  fd_set set = {0};
  FD_ZERO(&set);
  FD_SET(fd, &set);
  ret = select(fd + 1, NULL, &set, NULL, &tm);
  if (ret < 0) {
    fprintf(stderr, "select error!\n");
    return -1;
  }
  if (ret == 0) {
    fprintf(stderr, "connect timeout (in 3 seconds).\n");
    return -1;
  }
  if (!(ret == 1 && FD_ISSET(fd, &set))) {
    fprintf(stderr, "connect error!\n");
    return -1;
  }
  tm.tv_sec = 3;
  tm.tv_usec = 0;
  setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tm, sizeof(tm));
  setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tm, sizeof(tm));
  return fd;
}


x86 assembly (clang, -O0):
<stream_socket_with_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
mov    0x2dd4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    120f <stream_socket_with_timeout+0x5f>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
lea    0xe0e(%rip),%rsi
call   1070 <fprintf@plt>
lea    0xe11(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    140b <stream_socket_with_timeout+0x25b>
mov    -0x14(%rbp),%edi
mov    0x2d77(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d79(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
mov    0x2d95(%rip),%rax
or     (%rax),%edx
call   1040 <fcntl@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   10b0 <connect@plt>
cmp    $0x0,%rax
je     12a4 <stream_socket_with_timeout+0xf4>
mov    0x2d34(%rip),%rax
mov    (%rax),%rax
mov    0x2d5a(%rip),%rcx
cmp    (%rcx),%rax
je     12a4 <stream_socket_with_timeout+0xf4>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
call   1070 <fprintf@plt>
lea    0xd93(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    140b <stream_socket_with_timeout+0x25b>
mov    -0x14(%rbp),%edi
mov    0x2cfa(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
mov    0x2d16(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%edx
call   1040 <fcntl@plt>
movl   $0x3,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    -0x30(%rbp),%rdi
call   1080 <FD_ZERO@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x14(%rbp),%edi
add    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x30(%rbp),%rdx
lea    -0x28(%rbp),%r8
mov    %rcx,%rsi
call   1090 <select@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1342 <stream_socket_with_timeout+0x192>
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
lea    0xcfd(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    140b <stream_socket_with_timeout+0x25b>
cmpl   $0x0,-0x18(%rbp)
jne    136d <stream_socket_with_timeout+0x1bd>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
lea    0xce1(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    140b <stream_socket_with_timeout+0x25b>
cmpl   $0x1,-0x18(%rbp)
jne    138d <stream_socket_with_timeout+0x1dd>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
jne    13ae <stream_socket_with_timeout+0x1fe>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xc79(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    140b <stream_socket_with_timeout+0x25b>
movl   $0x3,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2c19(%rip),%rax
mov    (%rax),%esi
mov    0x2c20(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
mov    -0x14(%rbp),%edi
mov    0x2bf5(%rip),%rax
mov    (%rax),%esi
mov    0x2bc4(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stream_socket_with_timeout>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r14
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    0x2de1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
cmp    $0xffffffff,%eax
je     1356 <stream_socket_with_timeout+0x1b6>
mov    %eax,%ebx
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
mov    %eax,%ebp
mov    0x2dba(%rip),%r15
mov    (%r15),%esi
mov    0x2dd8(%rip),%r12
mov    (%r12),%edx
or     %eax,%edx
mov    %ebx,%edi
call   1040 <fcntl@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   10a0 <connect@plt>
test   %rax,%rax
je     1233 <stream_socket_with_timeout+0x93>
mov    0x2d78(%rip),%rax
mov    (%rax),%rax
mov    0x2d9e(%rip),%rcx
cmp    (%rcx),%rax
jne    1374 <stream_socket_with_timeout+0x1d4>
mov    (%r15),%esi
mov    (%r12),%eax
not    %eax
and    %eax,%ebp
mov    %ebx,%edi
mov    %ebp,%edx
call   1040 <fcntl@plt>
movl   $0x3,0x10(%rsp)
movq   $0x0,0x18(%rsp)
movl   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   10b0 <FD_SET@plt>
mov    %ebx,%edi
add    $0x1,%edi
lea    0x10(%rsp),%r8
xor    %esi,%esi
mov    %rbp,%rdx
xor    %ecx,%ecx
call   1080 <select@plt>
test   %eax,%eax
js     12b3 <stream_socket_with_timeout+0x113>
cmp    $0x1,%eax
je     12c5 <stream_socket_with_timeout+0x125>
test   %eax,%eax
jne    132d <stream_socket_with_timeout+0x18d>
mov    0x2d0b(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
jmp    133d <stream_socket_with_timeout+0x19d>
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
lea    0xd6b(%rip),%rsi
jmp    133d <stream_socket_with_timeout+0x19d>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     132d <stream_socket_with_timeout+0x18d>
movl   $0x3,0x10(%rsp)
movq   $0x0,0x18(%rsp)
mov    0x2cf2(%rip),%rbp
mov    0x0(%rbp),%esi
mov    0x2cf8(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
mov    0x0(%rbp),%esi
mov    0x2c9f(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
jmp    1347 <stream_socket_with_timeout+0x1a7>
mov    0x2c7c(%rip),%rax
mov    (%rax),%edi
lea    0xcd9(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c53(%rip),%rax
mov    (%rax),%edi
lea    0xc9a(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xc9d(%rip),%rdi
jmp    1390 <stream_socket_with_timeout+0x1f0>
mov    0x2c35(%rip),%rax
mov    (%rax),%edi
lea    0xc92(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xc96(%rip),%rdi
call   1090 <perror@plt>
jmp    1342 <stream_socket_with_timeout+0x1a2>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.TYPE_6__ = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [15 x i8] c"socket error!\0A\00"
@.str.1 = [7 x i8] c"socket\00"
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@errno = global i64 0
@EINPROGRESS = global i64 0
@.str.2 = [16 x i8] c"connect error!\0A\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.4 = [15 x i8] c"select error!\0A\00"
@.str.5 = [33 x i8] c"connect timeout (in 3 seconds).\0A\00"
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
@SO_RCVTIMEO = global i32 0
define i32 @stream_socket_with_timeout(%struct.sockaddr* %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.timeval
%7 = alloca %struct.TYPE_6__
store %struct.sockaddr* %0, %struct.sockaddr** %3
%8 = load i32, i32* @AF_INET
%9 = load i32, i32* @SOCK_STREAM
%10 = call i32 @socket(i32 %8, i32 %9, i32 0)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %17
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %89
17: ; preds = %1
%18 = load i32, i32* %4
%19 = load i32, i32* @F_GETFL
%20 = call i32 @fcntl(i32 %18, i32 %19, i32 0)
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = load i32, i32* @F_SETFL
%23 = load i32, i32* %5
%24 = load i32, i32* @O_NONBLOCK
%25 = or i32 %23, %24
%26 = call i32 @fcntl(i32 %21, i32 %22, i32 %25)
%27 = load i32, i32* %4
%28 = load %struct.sockaddr*, %struct.sockaddr** %3
%29 = call i64 @connect(i32 %27, %struct.sockaddr* %28, i32 4)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %17
%32 = load i64, i64* @errno
%33 = load i64, i64* @EINPROGRESS
%34 = icmp ne i64 %32, %33
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i32, i32* @stderr
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %2
br label %89
39: ; preds = %31, %17
%40 = load i32, i32* %4
%41 = load i32, i32* @F_SETFL
%42 = load i32, i32* %5
%43 = load i32, i32* @O_NONBLOCK
%44 = xor i32 %43, -1
%45 = and i32 %42, %44
%46 = call i32 @fcntl(i32 %40, i32 %41, i32 %45)
%47 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
store i32 3, i32* %47
%48 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
store i64 0, i64* %48
%49 = bitcast %struct.TYPE_6__* %7 to i8*
%50 = call i32 @FD_ZERO(%struct.TYPE_6__* %7)
%51 = load i32, i32* %4
%52 = call i32 @FD_SET(i32 %51, %struct.TYPE_6__* %7)
%53 = load i32, i32* %4
%54 = add nsw i32 %53, 1
%55 = call i32 @select(i32 %54, i32* null, %struct.TYPE_6__* %7, i32* null, %struct.timeval* %6)
store i32 %55, i32* %5
%56 = load i32, i32* %5
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %39
%59 = load i32, i32* @stderr
%60 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %2
br label %89
61: ; preds = %39
%62 = load i32, i32* %5
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = load i32, i32* @stderr
%66 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %2
br label %89
67: ; preds = %61
%68 = load i32, i32* %5
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %74
70: ; preds = %67
%71 = load i32, i32* %4
%72 = call i64 @FD_ISSET(i32 %71, %struct.TYPE_6__* %7)
%73 = icmp ne i64 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %70, %67
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %2
br label %89
77: ; preds = %70
%78 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
store i32 3, i32* %78
%79 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
store i64 0, i64* %79
%80 = load i32, i32* %4
%81 = load i32, i32* @SOL_SOCKET
%82 = load i32, i32* @SO_SNDTIMEO
%83 = call i32 @setsockopt(i32 %80, i32 %81, i32 %82, %struct.timeval* %6, i32 16)
%84 = load i32, i32* %4
%85 = load i32, i32* @SOL_SOCKET
%86 = load i32, i32* @SO_RCVTIMEO
%87 = call i32 @setsockopt(i32 %84, i32 %85, i32 %86, %struct.timeval* %6, i32 16)
%88 = load i32, i32* %4
store i32 %88, i32* %2
br label %89
89: ; preds = %77, %74, %64, %58, %35, %13
%90 = load i32, i32* %2
ret i32 %90
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.TYPE_6__ = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [15 x i8] c"socket error!\0A\00"
@.str.1 = [7 x i8] c"socket\00"
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@errno = global i64 0
@EINPROGRESS = global i64 0
@.str.2 = [16 x i8] c"connect error!\0A\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.4 = [15 x i8] c"select error!\0A\00"
@.str.5 = [33 x i8] c"connect timeout (in 3 seconds).\0A\00"
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
@SO_RCVTIMEO = global i32 0
define i32 @stream_socket_with_timeout(%struct.sockaddr* %0) {
%2 = alloca %struct.timeval
%3 = alloca %struct.TYPE_6__
%4 = load i32, i32* @AF_INET
%5 = load i32, i32* @SOCK_STREAM
%6 = tail call i32 @socket(i32 %4, i32 %5, i32 0)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %67
12: ; preds = %1
%13 = load i32, i32* @F_GETFL
%14 = tail call i32 @fcntl(i32 %6, i32 %13, i32 0)
%15 = load i32, i32* @F_SETFL
%16 = load i32, i32* @O_NONBLOCK
%17 = or i32 %16, %14
%18 = tail call i32 @fcntl(i32 %6, i32 %15, i32 %17)
%19 = tail call i64 @connect(i32 %6, %struct.sockaddr* %0, i32 4)
%20 = icmp eq i64 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %12
%22 = load i64, i64* @errno
%23 = load i64, i64* @EINPROGRESS
%24 = icmp eq i64 %22, %23
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%28 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %67
29: ; preds = %21, %12
%30 = load i32, i32* @F_SETFL
%31 = load i32, i32* @O_NONBLOCK
%32 = xor i32 %31, -1
%33 = and i32 %14, %32
%34 = tail call i32 @fcntl(i32 %6, i32 %30, i32 %33)
%35 = bitcast %struct.timeval* %2 to i8*
%36 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 3, i32* %36
%37 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i64 0, i64* %37
%38 = bitcast %struct.TYPE_6__* %3 to i8*
%39 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 0
store i32 0, i32* %39
%40 = call i32 @FD_ZERO(%struct.TYPE_6__* %3)
%41 = call i32 @FD_SET(i32 %6, %struct.TYPE_6__* %3)
%42 = add nuw nsw i32 %6, 1
%43 = call i32 @select(i32 %42, i32* null, %struct.TYPE_6__* %3, i32* null, %struct.timeval* %2)
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %29
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %65
48: ; preds = %29
switch i32 %43, label %55 [
i32 0, label %49
i32 1, label %52
]
49: ; preds = %48
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %65
52: ; preds = %48
%53 = call i64 @FD_ISSET(i32 %6, %struct.TYPE_6__* %3)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %48, %52
%56 = load i32, i32* @stderr
%57 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %65
58: ; preds = %52
store i32 3, i32* %36
store i64 0, i64* %37
%59 = load i32, i32* @SOL_SOCKET
%60 = load i32, i32* @SO_SNDTIMEO
%61 = call i32 @setsockopt(i32 %6, i32 %59, i32 %60, %struct.timeval* %2, i32 16)
%62 = load i32, i32* @SOL_SOCKET
%63 = load i32, i32* @SO_RCVTIMEO
%64 = call i32 @setsockopt(i32 %6, i32 %62, i32 %63, %struct.timeval* %2, i32 16)
br label %65
65: ; preds = %58, %55, %49, %45
%66 = phi i32 [ -1, %45 ], [ -1, %49 ], [ %6, %58 ], [ -1, %55 ]
br label %67
67: ; preds = %25, %65, %8
%68 = phi i32 [ -1, %8 ], [ -1, %25 ], [ %66, %65 ]
ret i32 %68
}