#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*/ tv;
struct timeval {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_addr;
};
typedef int /*<<< orphan*/ sin;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ memset(struct timeval *, int /*<<< orphan*/, int);
int read(int, char *, int);
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, struct timeval *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  struct sockaddr_in sin;
  struct hostent *hp;
  int s;
  int res;
  char buf[2048];
  fd_set wfds;
  struct timeval tv;
  if (argc != 3) {
    fprintf(stderr,
            "streamplayer -- A utility for reading from a raw TCP stream.\n");
    fprintf(stderr,
            "Written for use with Asterisk (http://www.asterisk.org)\n");
    fprintf(stderr, "Copyright (C) 2005 -- Russell Bryant -- Digium, Inc.\n\n");
    fprintf(stderr, "Usage: ./streamplayer <ip> <port>\n");
    exit(1);
  }
  hp = gethostbyname(argv[1]);
  if (!hp) {
    fprintf(stderr, "Unable to lookup IP for host '%s'\n", argv[1]);
    exit(1);
  }
  memset(&sin, 0, sizeof(sin));
  sin.sin_family = AF_INET;
  sin.sin_port = htons(atoi(argv[2]));
  memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
  s = socket(AF_INET, SOCK_STREAM, 0);
  if (s < 0) {
    fprintf(stderr, "Unable to allocate socket!\n");
    exit(1);
  }
  res = connect(s, (struct sockaddr *)&sin, sizeof(sin));
  if (res) {
    fprintf(stderr, "Unable to connect to host!\n");
    close(s);
    exit(1);
  }
  while (1) {
    res = read(s, buf, sizeof(buf));
    if (res < 1)
      break;
    memset(&tv, 0, sizeof(tv));
    FD_ZERO(&wfds);
    FD_SET(1, &wfds);
    select(2, NULL, &wfds, NULL, &tv);
    if (FD_ISSET(1, &wfds))
      write(1, buf, res);
  }
  close(s);
  exit(res);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1289 <main+0x89>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xdcd(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12ce <main+0xce>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x2d03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
mov    $0x4,%edx
call   10b0 <memcpy@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
mov    0x2cab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    135c <main+0x15c>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x2c(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     13a3 <main+0x1a3>
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
lea    0xd86(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    13a8 <main+0x1a8>
mov    -0x2c(%rbp),%edi
lea    -0x830(%rbp),%rsi
mov    $0x800,%edx
call   1080 <read@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jge    13ce <main+0x1ce>
jmp    1451 <main+0x251>
lea    -0x840(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
lea    -0x834(%rbp),%rdi
call   10c0 <FD_ZERO@plt>
mov    $0x1,%edi
lea    -0x834(%rbp),%rsi
call   1110 <FD_SET@plt>
mov    $0x2,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x834(%rbp),%rdx
lea    -0x840(%rbp),%r8
mov    %rcx,%rsi
call   10d0 <select@plt>
mov    $0x1,%edi
lea    -0x834(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     144c <main+0x24c>
lea    -0x830(%rbp),%rsi
mov    -0x30(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
jmp    13a8 <main+0x1a8>
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    -0x30(%rbp),%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x820,%rsp
cmp    $0x3,%edi
jne    124a <main+0x4a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
jne    129b <main+0x9b>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe98(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2d87(%rip),%rbx
mov    (%rbx),%edi
lea    0xda6(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdd4(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdfd(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe24(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    %rax,%rbp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x2d31(%rip),%r15
mov    (%r15),%eax
mov    %eax,0x8(%rsp)
mov    0x10(%rbx),%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,0x4(%rsp)
mov    0x0(%rbp),%esi
mov    %r14,%rdi
mov    $0x4,%edx
call   10b0 <memcpy@plt>
mov    (%r15),%edi
mov    0x2ce4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
jns    130e <main+0x10e>
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
lea    0xdeb(%rip),%rsi
jmp    128a <main+0x8a>
mov    %eax,%r14d
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   1100 <connect@plt>
test   %eax,%eax
jne    134b <main+0x14b>
lea    0x20(%rsp),%rsi
mov    %r14d,%edi
mov    $0x800,%edx
call   1080 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     1374 <main+0x174>
mov    %r14d,%edi
call   1070 <close@plt>
mov    %ebp,%edi
call   10f0 <exit@plt>
mov    0x2c86(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r14d,%edi
call   1070 <close@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%rbx
lea    0x20(%rsp),%r12
jmp    13a6 <main+0x1a6>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14d,%edi
mov    %r12,%rsi
mov    $0x800,%edx
call   1080 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    133c <main+0x13c>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
call   10c0 <FD_ZERO@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1110 <FD_SET@plt>
mov    $0x2,%edi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
mov    %r15,%r8
call   10d0 <select@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     1390 <main+0x190>
mov    $0x1,%edi
mov    %r12,%rsi
mov    %ebp,%edx
call   1030 <write@plt>
jmp    1390 <main+0x190>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32 }
%struct.timeval = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [62 x i8] c"streamplayer -- A utility for reading from a raw TCP stream.\0A\00"
@.str.1 = [57 x i8] c"Written for use with Asterisk (http://www.asterisk.org)\0A\00"
@.str.2 = [55 x i8] c"Copyright (C) 2005 -- Russell Bryant -- Digium, Inc.\0A\0A\00"
@.str.3 = [35 x i8] c"Usage: ./streamplayer <ip> <port>\0A\00"
@.str.4 = [35 x i8] c"Unable to lookup IP for host '%s'\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [28 x i8] c"Unable to allocate socket!\0A\00"
@.str.6 = [28 x i8] c"Unable to connect to host!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.hostent*
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2048 x i8]
%11 = alloca i32
%12 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %25
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call %struct.hostent* @gethostbyname(i8* %28)
store %struct.hostent* %29, %struct.hostent** %7
%30 = load %struct.hostent*, %struct.hostent** %7
%31 = icmp ne %struct.hostent* %30, null
br i1 %31, label %39, label %32
32: ; preds = %25
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %25
%40 = bitcast %struct.sockaddr_in* %6 to %struct.timeval*
%41 = call i32 @memset(%struct.timeval* %40, i32 0, i32 12)
%42 = load i32, i32* @AF_INET
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %42, i32* %43
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @atoi(i8* %46)
%48 = call i32 @htons(i32 %47)
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i32 %48, i32* %49
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%51 = load %struct.hostent*, %struct.hostent** %7
%52 = getelementptr inbounds %struct.hostent, %struct.hostent* %51, i32 0, i32 0
%53 = load i32, i32* %52
%54 = call i32 @memcpy(i32* %50, i32 %53, i32 4)
%55 = load i32, i32* @AF_INET
%56 = load i32, i32* @SOCK_STREAM
%57 = call i32 @socket(i32 %55, i32 %56, i32 0)
store i32 %57, i32* %8
%58 = load i32, i32* %8
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %39
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %39
%65 = load i32, i32* %8
%66 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%67 = call i32 @connect(i32 %65, %struct.sockaddr* %66, i32 12)
store i32 %67, i32* %9
%68 = load i32, i32* %9
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %76
70: ; preds = %64
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%73 = load i32, i32* %8
%74 = call i32 @close(i32 %73)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %64
br label %77
77: ; preds = %76, %95
%78 = load i32, i32* %8
%79 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%80 = call i32 @read(i32 %78, i8* %79, i32 2048)
store i32 %80, i32* %9
%81 = load i32, i32* %9
%82 = icmp slt i32 %81, 1
br i1 %82, label %83, label %84
83: ; preds = %77
br label %96
84: ; preds = %77
%85 = call i32 @memset(%struct.timeval* %12, i32 0, i32 12)
%86 = call i32 @FD_ZERO(i32* %11)
%87 = call i32 @FD_SET(i32 1, i32* %11)
%88 = call i32 @select(i32 2, i32* null, i32* %11, i32* null, %struct.timeval* %12)
%89 = call i64 @FD_ISSET(i32 1, i32* %11)
%90 = icmp ne i64 %89, 0
br i1 %90, label %91, label %95
91: ; preds = %84
%92 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%93 = load i32, i32* %9
%94 = call i32 @write(i32 1, i8* %92, i32 %93)
br label %95
95: ; preds = %91, %84
br label %77
96: ; preds = %83
%97 = load i32, i32* %8
%98 = call i32 @close(i32 %97)
%99 = load i32, i32* %9
%100 = call i32 @exit(i32 %99)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.timeval = type { i32, i32, i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [62 x i8] c"streamplayer -- A utility for reading from a raw TCP stream.\0A\00"
@.str.1 = [57 x i8] c"Written for use with Asterisk (http://www.asterisk.org)\0A\00"
@.str.2 = [55 x i8] c"Copyright (C) 2005 -- Russell Bryant -- Digium, Inc.\0A\0A\00"
@.str.3 = [35 x i8] c"Usage: ./streamplayer <ip> <port>\0A\00"
@.str.4 = [35 x i8] c"Unable to lookup IP for host '%s'\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [28 x i8] c"Unable to allocate socket!\0A\00"
@.str.6 = [28 x i8] c"Unable to connect to host!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [2048 x i8]
%5 = alloca i32
%6 = alloca %struct.timeval
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%9 = bitcast i32* %5 to i8*
%10 = bitcast %struct.timeval* %6 to i8*
%11 = icmp eq i32 %0, 3
br i1 %11, label %22, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call %struct.hostent* @gethostbyname(i8* %24)
%26 = icmp eq %struct.hostent* %25, null
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %23
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %29)
%31 = tail call i32 @exit(i32 1)
unreachable
32: ; preds = %22
%33 = bitcast %struct.sockaddr_in* %3 to %struct.timeval*
%34 = call i32 @memset(%struct.timeval* %33, i32 0, i32 12)
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %35, i32* %36
%37 = getelementptr inbounds i8*, i8** %1, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
%40 = call i32 @htons(i32 %39)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %40, i32* %41
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%43 = getelementptr inbounds %struct.hostent, %struct.hostent* %25, i64 0, i32 0
%44 = load i32, i32* %43
%45 = call i32 @memcpy(i32* %42, i32 %44, i32 4)
%46 = load i32, i32* @AF_INET
%47 = load i32, i32* @SOCK_STREAM
%48 = call i32 @socket(i32 %46, i32 %47, i32 0)
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %32
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %32
%55 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%56 = call i32 @connect(i32 %48, %struct.sockaddr* %55, i32 12)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = call i32 @read(i32 %48, i8* %8, i32 2048)
%60 = icmp slt i32 %59, 1
br i1 %60, label %79, label %66
61: ; preds = %54
%62 = load i32, i32* @stderr
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%64 = call i32 @close(i32 %48)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58, %76
%67 = phi i32 [ %77, %76 ], [ %59, %58 ]
%68 = call i32 @memset(%struct.timeval* %6, i32 0, i32 12)
%69 = call i32 @FD_ZERO(i32* %5)
%70 = call i32 @FD_SET(i32 1, i32* %5)
%71 = call i32 @select(i32 2, i32* null, i32* %5, i32* null, %struct.timeval* %6)
%72 = call i64 @FD_ISSET(i32 1, i32* %5)
%73 = icmp eq i64 %72, 0
br i1 %73, label %76, label %74
74: ; preds = %66
%75 = call i32 @write(i32 1, i8* %8, i32 %67)
br label %76
76: ; preds = %74, %66
%77 = call i32 @read(i32 %48, i8* %8, i32 2048)
%78 = icmp slt i32 %77, 1
br i1 %78, label %79, label %66
79: ; preds = %76, %58
%80 = phi i32 [ %59, %58 ], [ %77, %76 ]
%81 = call i32 @close(i32 %48)
%82 = call i32 @exit(i32 %80)
unreachable
}