#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 timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
struct TYPE_2__ {
  void *s_addr;
};
struct sockaddr_in {
  int sin_family;
  TYPE_1__ sin_addr;
  void *sin_port;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ sin1;
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
void *INADDR_ANY;
int MSG_DONTWAIT;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ connect(int, struct sockaddr *, int);
int getpid();
void *htonl(int);
void *htons(int);
int /*<<< orphan*/ kill(scalar_t__, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ recv(int, char *, size_t, int);
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/, struct timeval *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ start_server(struct sockaddr_in *);
int main() {
  int s, fd_null;
  struct sockaddr_in sin1, sin2, sin4;
  pid_t pid = 0;
  char buf[1024];
  fd_set rdfds;
  struct timeval timeout;
  sin1.sin_family = AF_INET;
  sin1.sin_port = htons((getpid() % 32768) + 11000);
  sin1.sin_addr.s_addr = INADDR_ANY;
  pid = start_server(&sin1);
  sin2.sin_family = AF_INET;
  sin2.sin_port = htons((getpid() % 32768) + 10000);
  sin2.sin_addr.s_addr = INADDR_ANY;
  sin4.sin_family = 47;
  sin4.sin_port = 0;
  sin4.sin_addr.s_addr = htonl(0x0AFFFEFD);
  fd_null = open("/dev/null", O_WRONLY);
  recv(-1, buf, sizeof(buf), 0);
  recv(fd_null, buf, sizeof(buf), MSG_DONTWAIT);
  s = socket(PF_INET, SOCK_STREAM, 0);
  connect(s, (struct sockaddr *)&sin1, sizeof(sin1));
  FD_ZERO(&rdfds);
  FD_SET(s, &rdfds);
  timeout.tv_sec = 2;
  timeout.tv_usec = 0;
  select(s + 1, &rdfds, 0, 0, &timeout);
  recv(s, (void *)-1, sizeof(buf), 0);
  recv(s, buf, sizeof(buf), 0);
  close(s);
  s = socket(PF_INET, SOCK_STREAM, 0);
  connect(s, (struct sockaddr *)&sin1, sizeof(sin1));
  FD_ZERO(&rdfds);
  FD_SET(s, &rdfds);
  timeout.tv_sec = 2;
  timeout.tv_usec = 0;
  select(s + 1, &rdfds, 0, 0, &timeout);
  recv(s, buf, sizeof(buf), -1);
  recv(s, buf, (size_t)-1, MSG_DONTWAIT);
  close(s);
  close(fd_null);
  if (pid > 0)
    (void)kill(pid, SIGKILL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x60(%rbp)
mov    0x2df7(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    $0x8000,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x2af8,%edi
call   1050 <htons@plt>
mov    %rax,-0x18(%rbp)
mov    0x2dc2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
lea    -0x28(%rbp),%rdi
call   10e0 <start_server@plt>
mov    %rax,-0x60(%rbp)
mov    0x2daf(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x40(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    $0x8000,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x2710,%edi
call   1050 <htons@plt>
mov    %rax,-0x30(%rbp)
mov    0x2d7a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
movl   $0x2f,-0x58(%rbp)
movq   $0x0,-0x48(%rbp)
mov    $0xafffefd,%edi
call   1060 <htonl@plt>
mov    %rax,-0x50(%rbp)
mov    0x2d17(%rip),%rax
mov    (%rax),%esi
lea    0xd66(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,-0xc(%rbp)
lea    -0x460(%rbp),%rsi
mov    $0xffffffff,%edi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0xc(%rbp),%edi
lea    -0x460(%rbp),%rsi
mov    0x2cf5(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%edx
call   1030 <recv@plt>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
mov    0x2ce9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x18,%edx
call   10c0 <connect@plt>
lea    -0x464(%rbp),%rdi
call   1090 <FD_ZERO@plt>
mov    -0x8(%rbp),%edi
lea    -0x464(%rbp),%rsi
call   10d0 <FD_SET@plt>
movl   $0x2,-0x478(%rbp)
movq   $0x0,-0x470(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
lea    -0x464(%rbp),%rsi
xor    %ecx,%ecx
lea    -0x478(%rbp),%r8
mov    %ecx,%edx
call   10a0 <select@plt>
mov    -0x8(%rbp),%edi
mov    $0xffffffffffffffff,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0x8(%rbp),%edi
lea    -0x460(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
mov    0x2c3b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x18,%edx
call   10c0 <connect@plt>
lea    -0x464(%rbp),%rdi
call   1090 <FD_ZERO@plt>
mov    -0x8(%rbp),%edi
lea    -0x464(%rbp),%rsi
call   10d0 <FD_SET@plt>
movl   $0x2,-0x478(%rbp)
movq   $0x0,-0x470(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
lea    -0x464(%rbp),%rsi
xor    %ecx,%ecx
lea    -0x478(%rbp),%r8
mov    %ecx,%edx
call   10a0 <select@plt>
mov    -0x8(%rbp),%edi
lea    -0x460(%rbp),%rsi
mov    $0x400,%edx
mov    $0xffffffff,%ecx
call   1030 <recv@plt>
mov    -0x8(%rbp),%edi
lea    -0x460(%rbp),%rsi
mov    0x2b97(%rip),%rax
mov    (%rax),%ecx
mov    $0xffffffffffffffff,%rdx
call   1030 <recv@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
cmpq   $0x0,-0x60(%rbp)
jle    1464 <main+0x294>
mov    -0x60(%rbp),%rdi
mov    0x2b5b(%rip),%rax
mov    (%rax),%esi
call   1080 <kill@plt>
xor    %eax,%eax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x448,%rsp
mov    0x2e00(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0x7fff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff8000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x2af8,%edi
call   1050 <htons@plt>
mov    %rax,0x38(%rsp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
lea    0x28(%rsp),%rbp
mov    %rbp,%rdi
call   10e0 <start_server@plt>
mov    %rax,0x18(%rsp)
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0x7fff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff8000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x2710,%edi
call   1050 <htons@plt>
mov    $0xafffefd,%edi
call   1060 <htonl@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%esi
lea    0xd82(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,%r12d
lea    0x40(%rsp),%r15
mov    $0x400,%edx
mov    $0xffffffff,%edi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%edx
mov    %r12d,%edi
mov    %r15,%rsi
call   1030 <recv@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
mov    0x2d08(%rip),%rbx
mov    (%rbx),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,%r14d
mov    %eax,%edi
mov    %rbp,%rsi
mov    $0x18,%edx
call   10c0 <connect@plt>
lea    0x24(%rsp),%rbp
mov    %rbp,%rdi
call   1090 <FD_ZERO@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
call   10d0 <FD_SET@plt>
movl   $0x2,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x1(%r14),%edi
lea    0x8(%rsp),%r13
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r13,%r8
call   10a0 <select@plt>
mov    $0x400,%edx
mov    %r14d,%edi
mov    $0xffffffffffffffff,%rsi
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    $0x400,%edx
mov    %r14d,%edi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %r14d,%edi
call   1070 <close@plt>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,%ebx
mov    %eax,%edi
lea    0x28(%rsp),%rsi
mov    $0x18,%edx
call   10c0 <connect@plt>
mov    %rbp,%rdi
call   1090 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   10d0 <FD_SET@plt>
movl   $0x2,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x1(%rbx),%edi
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r13,%r8
call   10a0 <select@plt>
mov    $0x400,%edx
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0xffffffff,%ecx
call   1030 <recv@plt>
mov    0x2bf7(%rip),%rax
mov    (%rax),%ecx
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0xffffffffffffffff,%rdx
call   1030 <recv@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    %r12d,%edi
call   1070 <close@plt>
mov    0x18(%rsp),%rdi
test   %rdi,%rdi
jle    1403 <main+0x233>
mov    0x2bbc(%rip),%rax
mov    (%rax),%esi
call   1080 <kill@plt>
xor    %eax,%eax
add    $0x448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i8* null
@INADDR_ANY = global i8* null
@.str = [10 x i8] c"/dev/null\00"
@O_WRONLY = global i32 0
@MSG_DONTWAIT = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SIGKILL = 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 %struct.sockaddr_in
%7 = alloca i64
%8 = alloca [1024 x i8]
%9 = alloca i32
%10 = alloca %struct.timeval
store i32 0, i32* %1
store i64 0, i64* %7
%11 = load i8*, i8** @AF_INET
%12 = ptrtoint i8* %11 to i32
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
store i32 %12, i32* %13
%14 = call i32 (...) @getpid()
%15 = srem i32 %14, 32768
%16 = add nsw i32 %15, 11000
%17 = call i8* @htons(i32 %16)
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i8* %17, i8** %18
%19 = load i8*, i8** @INADDR_ANY
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
%21 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %20, i32 0, i32 0
store i8* %19, i8** %21
%22 = call i64 @start_server(%struct.sockaddr_in* %4)
store i64 %22, i64* %7
%23 = load i8*, i8** @AF_INET
%24 = ptrtoint i8* %23 to i32
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 0
store i32 %24, i32* %25
%26 = call i32 (...) @getpid()
%27 = srem i32 %26, 32768
%28 = add nsw i32 %27, 10000
%29 = call i8* @htons(i32 %28)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 2
store i8* %29, i8** %30
%31 = load i8*, i8** @INADDR_ANY
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 1
%33 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %32, i32 0, i32 0
store i8* %31, i8** %33
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
store i32 47, i32* %34
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i8* null, i8** %35
%36 = call i8* @htonl(i32 184549117)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%38 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %37, i32 0, i32 0
store i8* %36, i8** %38
%39 = load i32, i32* @O_WRONLY
%40 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %39)
store i32 %40, i32* %3
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%42 = call i32 @recv(i32 -1, i8* %41, i64 1024, i32 0)
%43 = load i32, i32* %3
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%45 = load i32, i32* @MSG_DONTWAIT
%46 = call i32 @recv(i32 %43, i8* %44, i64 1024, i32 %45)
%47 = load i32, i32* @PF_INET
%48 = load i32, i32* @SOCK_STREAM
%49 = call i32 @socket(i32 %47, i32 %48, i32 0)
store i32 %49, i32* %2
%50 = load i32, i32* %2
%51 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%52 = call i32 @connect(i32 %50, %struct.sockaddr* %51, i32 24)
%53 = call i32 @FD_ZERO(i32* %9)
%54 = load i32, i32* %2
%55 = call i32 @FD_SET(i32 %54, i32* %9)
%56 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
store i32 2, i32* %56
%57 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
store i64 0, i64* %57
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
%60 = call i32 @select(i32 %59, i32* %9, i32 0, i32 0, %struct.timeval* %10)
%61 = load i32, i32* %2
%62 = call i32 @recv(i32 %61, i8* inttoptr (i64 -1 to i8*), i64 1024, i32 0)
%63 = load i32, i32* %2
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%65 = call i32 @recv(i32 %63, i8* %64, i64 1024, i32 0)
%66 = load i32, i32* %2
%67 = call i32 @close(i32 %66)
%68 = load i32, i32* @PF_INET
%69 = load i32, i32* @SOCK_STREAM
%70 = call i32 @socket(i32 %68, i32 %69, i32 0)
store i32 %70, i32* %2
%71 = load i32, i32* %2
%72 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%73 = call i32 @connect(i32 %71, %struct.sockaddr* %72, i32 24)
%74 = call i32 @FD_ZERO(i32* %9)
%75 = load i32, i32* %2
%76 = call i32 @FD_SET(i32 %75, i32* %9)
%77 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
store i32 2, i32* %77
%78 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
store i64 0, i64* %78
%79 = load i32, i32* %2
%80 = add nsw i32 %79, 1
%81 = call i32 @select(i32 %80, i32* %9, i32 0, i32 0, %struct.timeval* %10)
%82 = load i32, i32* %2
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%84 = call i32 @recv(i32 %82, i8* %83, i64 1024, i32 -1)
%85 = load i32, i32* %2
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%87 = load i32, i32* @MSG_DONTWAIT
%88 = call i32 @recv(i32 %85, i8* %86, i64 -1, i32 %87)
%89 = load i32, i32* %2
%90 = call i32 @close(i32 %89)
%91 = load i32, i32* %3
%92 = call i32 @close(i32 %91)
%93 = load i64, i64* %7
%94 = icmp sgt i64 %93, 0
br i1 %94, label %95, label %99
95: ; preds = %0
%96 = load i64, i64* %7
%97 = load i32, i32* @SIGKILL
%98 = call i32 @kill(i64 %96, i32 %97)
br label %99
99: ; preds = %95, %0
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i8* null
@INADDR_ANY = global i8* null
@.str = [10 x i8] c"/dev/null\00"
@O_WRONLY = global i32 0
@MSG_DONTWAIT = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SIGKILL = global i32 0
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca [1024 x i8]
%3 = alloca i32
%4 = alloca %struct.timeval
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%7 = bitcast i32* %3 to i8*
%8 = bitcast %struct.timeval* %4 to i8*
%9 = load i8*, i8** @AF_INET
%10 = ptrtoint i8* %9 to i64
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i32 %11, i32* %12
%13 = tail call i32 (...) @getpid()
%14 = srem i32 %13, 32768
%15 = add nsw i32 %14, 11000
%16 = tail call i8* @htons(i32 %15)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i8* %16, i8** %17
%18 = load i8*, i8** @INADDR_ANY
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i8* %18, i8** %19
%20 = call i64 @start_server(%struct.sockaddr_in* %1)
%21 = call i32 (...) @getpid()
%22 = srem i32 %21, 32768
%23 = add nsw i32 %22, 10000
%24 = call i8* @htons(i32 %23)
%25 = call i8* @htonl(i32 184549117)
%26 = load i32, i32* @O_WRONLY
%27 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = call i32 @recv(i32 -1, i8* %6, i64 1024, i32 0)
%29 = load i32, i32* @MSG_DONTWAIT
%30 = call i32 @recv(i32 %27, i8* %6, i64 1024, i32 %29)
%31 = load i32, i32* @PF_INET
%32 = load i32, i32* @SOCK_STREAM
%33 = call i32 @socket(i32 %31, i32 %32, i32 0)
%34 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%35 = call i32 @connect(i32 %33, %struct.sockaddr* %34, i32 24)
%36 = call i32 @FD_ZERO(i32* %3)
%37 = call i32 @FD_SET(i32 %33, i32* %3)
%38 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
store i32 2, i32* %38
%39 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
store i64 0, i64* %39
%40 = add nsw i32 %33, 1
%41 = call i32 @select(i32 %40, i32* %3, i32 0, i32 0, %struct.timeval* %4)
%42 = call i32 @recv(i32 %33, i8* inttoptr (i64 -1 to i8*), i64 1024, i32 0)
%43 = call i32 @recv(i32 %33, i8* %6, i64 1024, i32 0)
%44 = call i32 @close(i32 %33)
%45 = load i32, i32* @PF_INET
%46 = load i32, i32* @SOCK_STREAM
%47 = call i32 @socket(i32 %45, i32 %46, i32 0)
%48 = call i32 @connect(i32 %47, %struct.sockaddr* %34, i32 24)
%49 = call i32 @FD_ZERO(i32* %3)
%50 = call i32 @FD_SET(i32 %47, i32* %3)
store i32 2, i32* %38
store i64 0, i64* %39
%51 = add nsw i32 %47, 1
%52 = call i32 @select(i32 %51, i32* %3, i32 0, i32 0, %struct.timeval* %4)
%53 = call i32 @recv(i32 %47, i8* %6, i64 1024, i32 -1)
%54 = load i32, i32* @MSG_DONTWAIT
%55 = call i32 @recv(i32 %47, i8* %6, i64 -1, i32 %54)
%56 = call i32 @close(i32 %47)
%57 = call i32 @close(i32 %27)
%58 = icmp sgt i64 %20, 0
br i1 %58, label %59, label %62
59: ; preds = %0
%60 = load i32, i32* @SIGKILL
%61 = call i32 @kill(i64 %20, i32 %60)
br label %62
62: ; preds = %59, %0
ret i32 0
}