#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 {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct linger {
  int l_linger;
  int l_onoff;
};
struct in_addr {
  int dummy;
};
struct hostent {
  scalar_t__ h_addr;
};
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_LINGER;
int atoi(char *);
scalar_t__ clock();
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ herror(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
char *inet_ntoa(struct in_addr);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int read(int /*<<< orphan*/, char *, int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                      struct linger *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int write(int, char *, int);
int main(int argc, char **argv) {
  char *hostname;
  int port, sd;
  struct linger so_linger;
  so_linger.l_linger = 5;
  so_linger.l_onoff = 1;
  hostname = argv[1];
  port = atoi(argv[2]);
  printf("%s\n", hostname);
  if (!isdigit(hostname[0])) {
    struct hostent *addr;
    if (!(addr = gethostbyname(hostname))) {
      herror(" ");
      return -1;
    }
    hostname = inet_ntoa(*((struct in_addr *)addr->h_addr));
  }
  printf("%s\n", hostname);
  sd = socket(PF_INET, SOCK_STREAM, 0);
  if (sd < 0) {
    perror("socket error");
    return -1;
  }
  if (setsockopt(sd, SOL_SOCKET, SO_LINGER, &so_linger, sizeof so_linger) < 0) {
    perror("so linger error");
    return -1;
  }
  struct sockaddr_in sockaddr;
  sockaddr.sin_family = PF_INET;
  sockaddr.sin_addr.s_addr = inet_addr(hostname);
  sockaddr.sin_port = htons(port);
  if (connect(sd, (struct sockaddr *)&sockaddr, sizeof sockaddr) < 0) {
    perror("connect error");
    close(sd);
    return -1;
  }
  int rc, wc, totalc = 0;
  char rb[1024];
  clock_t start = clock();
  while ((rc = read(0, rb, 1024)) > 0) {
    wc = write(sd, rb, rc);
    totalc = totalc + rc;
    if (wc < 0)
      perror("write error");
  }
  clock_t end = clock();
  if (rc < 0)
    perror("read error");
  close(sd);
  fprintf(stderr,
          "\n\n--------------------------------------------------------\nTotal "
          "bytes sent: %i B\nThroughput is %f MB/S",
          totalc,
          ((totalc) / (((double)end - (double)start) / CLOCKS_PER_SEC)) /
              1000000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x28(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xdaa(%rip),%rdi
call   1090 <printf@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    12b9 <main+0xa9>
mov    -0x18(%rbp),%rdi
call   10d0 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    12a7 <main+0x97>
lea    0xd76(%rip),%rdi
call   10f0 <herror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149d <main+0x28d>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xd44(%rip),%rdi
call   1090 <printf@plt>
mov    0x2ce8(%rip),%rax
mov    (%rax),%edi
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    1307 <main+0xf7>
lea    0xd18(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149d <main+0x28d>
mov    -0x20(%rbp),%edi
mov    0x2cd7(%rip),%rax
mov    (%rax),%esi
mov    0x2cc6(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%rcx
mov    $0x8,%r8d
call   1040 <setsockopt@plt>
cmp    $0x0,%rax
jge    134d <main+0x13d>
lea    0xcdf(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149d <main+0x28d>
mov    0x2c64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <inet_addr@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x1c(%rbp),%edi
call   1080 <htons@plt>
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0x0,%rax
jge    13ab <main+0x19b>
lea    0xc99(%rip),%rdi
call   1100 <perror@plt>
mov    -0x20(%rbp),%edi
call   10a0 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149d <main+0x28d>
movl   $0x0,-0x4c(%rbp)
mov    $0x0,%al
call   1070 <clock@plt>
mov    %rax,-0x458(%rbp)
lea    -0x450(%rbp),%rsi
xor    %edi,%edi
mov    $0x400,%edx
call   10b0 <read@plt>
mov    %eax,-0x44(%rbp)
cmp    $0x0,%eax
jle    1418 <main+0x208>
mov    -0x20(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   1050 <write@plt>
mov    %eax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    1413 <main+0x203>
lea    0xc2b(%rip),%rdi
call   1100 <perror@plt>
jmp    13c0 <main+0x1b0>
mov    $0x0,%al
call   1070 <clock@plt>
mov    %rax,-0x460(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    143c <main+0x22c>
lea    0xc0e(%rip),%rdi
call   1100 <perror@plt>
mov    -0x20(%rbp),%edi
call   10a0 <close@plt>
mov    0x2b7d(%rip),%rax
mov    (%rax),%edi
mov    -0x4c(%rbp),%edx
cvtsi2sdl -0x4c(%rbp),%xmm0
cvtsi2sdq -0x460(%rbp),%xmm1
ff ff
cvtsi2sdq -0x458(%rbp),%xmm2
ff ff
subsd  %xmm2,%xmm1
mov    0x2b66(%rip),%rax
divsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  0xb7e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
lea    0xbbf(%rip),%rsi
call   10e0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
movabs $0x100000005,%rax
mov    %rax,0x18(%rsp)
mov    0x8(%rsi),%rbp
mov    0x10(%rsi),%rdi
call   1110 <atoi@plt>
mov    %eax,%r14d
lea    0xdc1(%rip),%rdi
mov    %rbp,%rsi
call   1090 <printf@plt>
movsbl 0x0(%rbp),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    127a <main+0x6a>
mov    %rbp,%rdi
call   10d0 <gethostbyname@plt>
test   %rax,%rax
je     13f8 <main+0x1e8>
mov    (%rax),%rax
mov    (%rax),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,%rbp
lea    0xd87(%rip),%rdi
mov    %rbp,%rsi
call   1090 <printf@plt>
mov    0x2d28(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d27(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
test   %eax,%eax
js     140c <main+0x1fc>
mov    %eax,%r12d
mov    0x2d34(%rip),%rax
mov    (%rax),%esi
mov    0x2d23(%rip),%rax
mov    (%rax),%edx
lea    0x18(%rsp),%rcx
mov    %r12d,%edi
mov    $0x8,%r8d
call   1040 <setsockopt@plt>
test   %rax,%rax
js     1415 <main+0x205>
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
mov    %rbp,%rdi
call   10c0 <inet_addr@plt>
mov    %eax,0xc(%rsp)
mov    %r14d,%edi
call   1080 <htons@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %r12d,%edi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
js     1429 <main+0x219>
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <clock@plt>
mov    %rax,%r14
lea    0x20(%rsp),%rsi
xor    %edi,%edi
mov    $0x400,%edx
call   10b0 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1382 <main+0x172>
xor    %ebp,%ebp
lea    0x20(%rsp),%r15
lea    0xcf4(%rip),%r13
jmp    1367 <main+0x157>
nopw   0x0(%rax,%rax,1)
add    %ebx,%ebp
xor    %edi,%edi
mov    %r15,%rsi
mov    $0x400,%edx
call   10b0 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1382 <main+0x172>
mov    %r12d,%edi
mov    %r15,%rsi
mov    %ebx,%edx
call   1050 <write@plt>
test   %eax,%eax
jns    1350 <main+0x140>
mov    %r13,%rdi
call   1100 <perror@plt>
jmp    1350 <main+0x140>
xor    %r15d,%r15d
xor    %eax,%eax
call   1070 <clock@plt>
mov    %rax,%r13
test   %ebx,%ebx
js     1445 <main+0x235>
mov    %r12d,%edi
call   10a0 <close@plt>
mov    0x2c22(%rip),%rax
cvtsi2sd %ebp,%xmm0
cvtsi2sd %r13,%xmm1
mov    (%rax),%edi
cvtsi2sd %r14,%xmm2
subsd  %xmm2,%xmm1
mov    0x2c17(%rip),%rax
divsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
divsd  0xc2f(%rip),%xmm0
cvttsd2si %xmm0,%ecx
lea    0xc74(%rip),%rsi
mov    %ebp,%edx
call   10e0 <fprintf@plt>
mov    %r15d,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc0d(%rip),%rdi
call   10f0 <herror@plt>
mov    $0xffffffff,%r15d
jmp    13e3 <main+0x1d3>
lea    0xbfb(%rip),%rdi
jmp    141c <main+0x20c>
lea    0xbff(%rip),%rdi
call   1100 <perror@plt>
mov    $0xffffffff,%r15d
jmp    13e3 <main+0x1d3>
lea    0xbfb(%rip),%rdi
call   1100 <perror@plt>
mov    %r12d,%edi
call   10a0 <close@plt>
mov    $0xffffffff,%r15d
jmp    13e3 <main+0x1d3>
lea    0xbf9(%rip),%rdi
call   1100 <perror@plt>
jmp    1397 <main+0x187>

LLVM IR (-O0):
%struct.linger = type { i32, i32 }
%struct.hostent = type { i64 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [2 x i8] c" \00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [13 x i8] c"socket error\00"
@SOL_SOCKET = global i32 0
@SO_LINGER = global i32 0
@.str.3 = [16 x i8] c"so linger error\00"
@.str.4 = [14 x i8] c"connect error\00"
@.str.5 = [12 x i8] c"write error\00"
@.str.6 = [11 x i8] c"read error\00"
@stderr = global i32 0
@.str.7 = [104 x i8] c"\0A\0A--------------------------------------------------------\0ATotal bytes sent: %i B\0AThroughput is %f MB/S\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.linger
%10 = alloca %struct.hostent*
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [1024 x i8]
%16 = alloca i64
%17 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = getelementptr inbounds %struct.linger, %struct.linger* %9, i32 0, i32 0
store i32 5, i32* %18
%19 = getelementptr inbounds %struct.linger, %struct.linger* %9, i32 0, i32 1
store i32 1, i32* %19
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
store i8* %22, i8** %6
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %7
%27 = load i8*, i8** %6
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = load i8, i8* %30
%32 = call i32 @isdigit(i8 signext %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %48, label %34
34: ; preds = %2
%35 = load i8*, i8** %6
%36 = call %struct.hostent* @gethostbyname(i8* %35)
store %struct.hostent* %36, %struct.hostent** %10
%37 = icmp ne %struct.hostent* %36, null
br i1 %37, label %40, label %38
38: ; preds = %34
%39 = call i32 @herror(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %127
40: ; preds = %34
%41 = load %struct.hostent*, %struct.hostent** %10
%42 = getelementptr inbounds %struct.hostent, %struct.hostent* %41, i32 0, i32 0
%43 = load i64, i64* %42
%44 = inttoptr i64 %43 to %struct.in_addr*
%45 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %44, i32 0, i32 0
%46 = load i32, i32* %45
%47 = call i8* @inet_ntoa(i32 %46)
store i8* %47, i8** %6
br label %48
48: ; preds = %40, %2
%49 = load i8*, i8** %6
%50 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @PF_INET
%52 = load i32, i32* @SOCK_STREAM
%53 = call i32 @socket(i32 %51, i32 %52, i32 0)
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %127
58: ; preds = %48
%59 = load i32, i32* %8
%60 = load i32, i32* @SOL_SOCKET
%61 = load i32, i32* @SO_LINGER
%62 = call i64 @setsockopt(i32 %59, i32 %60, i32 %61, %struct.linger* %9, i32 8)
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %58
%65 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %127
66: ; preds = %58
%67 = load i32, i32* @PF_INET
%68 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %67, i32* %68
%69 = load i8*, i8** %6
%70 = call i32 @inet_addr(i8* %69)
%71 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%72 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %71, i32 0, i32 0
store i32 %70, i32* %72
%73 = load i32, i32* %7
%74 = call i32 @htons(i32 %73)
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %74, i32* %75
%76 = load i32, i32* %8
%77 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%78 = call i64 @connect(i32 %76, %struct.sockaddr* %77, i32 12)
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %84
80: ; preds = %66
%81 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%82 = load i32, i32* %8
%83 = call i32 @close(i32 %82)
store i32 -1, i32* %3
br label %127
84: ; preds = %66
store i32 0, i32* %14
%85 = call i64 (...) @clock()
store i64 %85, i64* %16
br label %86
86: ; preds = %102, %84
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%88 = call i32 @read(i32 0, i8* %87, i32 1024)
store i32 %88, i32* %12
%89 = icmp sgt i32 %88, 0
br i1 %89, label %90, label %103
90: ; preds = %86
%91 = load i32, i32* %8
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%93 = load i32, i32* %12
%94 = call i32 @write(i32 %91, i8* %92, i32 %93)
store i32 %94, i32* %13
%95 = load i32, i32* %14
%96 = load i32, i32* %12
%97 = add nsw i32 %95, %96
store i32 %97, i32* %14
%98 = load i32, i32* %13
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %90
%101 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %102
102: ; preds = %100, %90
br label %86
103: ; preds = %86
%104 = call i64 (...) @clock()
store i64 %104, i64* %17
%105 = load i32, i32* %12
%106 = icmp slt i32 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %103
%108 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %109
109: ; preds = %107, %103
%110 = load i32, i32* %8
%111 = call i32 @close(i32 %110)
%112 = load i32, i32* @stderr
%113 = load i32, i32* %14
%114 = load i32, i32* %14
%115 = sitofp i32 %114 to double
%116 = load i64, i64* %17
%117 = sitofp i64 %116 to double
%118 = load i64, i64* %16
%119 = sitofp i64 %118 to double
%120 = fsub double %117, %119
%121 = load double, double* @CLOCKS_PER_SEC
%122 = fdiv double %120, %121
%123 = fdiv double %115, %122
%124 = fdiv double %123, 1.000000e+06
%125 = fptosi double %124 to i32
%126 = call i32 @fprintf(i32 %112, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.7, i64 0, i64 0), i32 %113, i32 %125)
store i32 0, i32* %3
br label %127
127: ; preds = %109, %80, %64, %56, %38
%128 = load i32, i32* %3
ret i32 %128
}

LLVM IR (-O2):
%struct.linger = type { i32, i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i64 }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [2 x i8] c" \00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [13 x i8] c"socket error\00"
@SOL_SOCKET = global i32 0
@SO_LINGER = global i32 0
@.str.3 = [16 x i8] c"so linger error\00"
@.str.4 = [14 x i8] c"connect error\00"
@.str.5 = [12 x i8] c"write error\00"
@.str.6 = [11 x i8] c"read error\00"
@stderr = global i32 0
@.str.7 = [104 x i8] c"\0A\0A--------------------------------------------------------\0ATotal bytes sent: %i B\0AThroughput is %f MB/S\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.linger
%4 = alloca %struct.sockaddr_in
%5 = alloca [1024 x i8]
%6 = bitcast %struct.linger* %3 to i8*
%7 = getelementptr inbounds %struct.linger, %struct.linger* %3, i64 0, i32 0
store i32 5, i32* %7
%8 = getelementptr inbounds %struct.linger, %struct.linger* %3, i64 0, i32 1
store i32 1, i32* %8
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%15 = load i8, i8* %10
%16 = tail call i32 @isdigit(i8 signext %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %30
18: ; preds = %2
%19 = tail call %struct.hostent* @gethostbyname(i8* %10)
%20 = icmp eq %struct.hostent* %19, null
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @herror(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %98
23: ; preds = %18
%24 = getelementptr inbounds %struct.hostent, %struct.hostent* %19, i64 0, i32 0
%25 = load i64, i64* %24
%26 = inttoptr i64 %25 to %struct.in_addr*
%27 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %26, i64 0, i32 0
%28 = load i32, i32* %27
%29 = tail call i8* @inet_ntoa(i32 %28)
br label %30
30: ; preds = %23, %2
%31 = phi i8* [ %10, %2 ], [ %29, %23 ]
%32 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @PF_INET
%34 = load i32, i32* @SOCK_STREAM
%35 = tail call i32 @socket(i32 %33, i32 %34, i32 0)
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %98
39: ; preds = %30
%40 = load i32, i32* @SOL_SOCKET
%41 = load i32, i32* @SO_LINGER
%42 = call i64 @setsockopt(i32 %35, i32 %40, i32 %41, %struct.linger* %3, i32 8)
%43 = icmp slt i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %98
46: ; preds = %39
%47 = bitcast %struct.sockaddr_in* %4 to i8*
%48 = load i32, i32* @PF_INET
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %48, i32* %49
%50 = call i32 @inet_addr(i8* %31)
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %50, i32* %51
%52 = call i32 @htons(i32 %13)
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %52, i32* %53
%54 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%55 = call i64 @connect(i32 %35, %struct.sockaddr* %54, i32 12)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %46
%58 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%59 = call i32 @close(i32 %35)
br label %96
60: ; preds = %46
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%62 = call i64 (...) @clock()
%63 = call i32 @read(i32 0, i8* %61, i32 1024)
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %76
65: ; preds = %60, %73
%66 = phi i32 [ %74, %73 ], [ %63, %60 ]
%67 = phi i32 [ %69, %73 ], [ 0, %60 ]
%68 = call i32 @write(i32 %35, i8* %61, i32 %66)
%69 = add nsw i32 %66, %67
%70 = icmp slt i32 %68, 0
br i1 %70, label %71, label %73
71: ; preds = %65
%72 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %73
73: ; preds = %71, %65
%74 = call i32 @read(i32 0, i8* %61, i32 1024)
%75 = icmp sgt i32 %74, 0
br i1 %75, label %65, label %76
76: ; preds = %73, %60
%77 = phi i32 [ 0, %60 ], [ %69, %73 ]
%78 = phi i32 [ %63, %60 ], [ %74, %73 ]
%79 = call i64 (...) @clock()
%80 = icmp slt i32 %78, 0
br i1 %80, label %81, label %83
81: ; preds = %76
%82 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %83
83: ; preds = %81, %76
%84 = call i32 @close(i32 %35)
%85 = load i32, i32* @stderr
%86 = sitofp i32 %77 to double
%87 = sitofp i64 %79 to double
%88 = sitofp i64 %62 to double
%89 = fsub double %87, %88
%90 = load double, double* @CLOCKS_PER_SEC
%91 = fdiv double %89, %90
%92 = fdiv double %86, %91
%93 = fdiv double %92, 1.000000e+06
%94 = fptosi double %93 to i32
%95 = call i32 @fprintf(i32 %85, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.7, i64 0, i64 0), i32 %77, i32 %94)
br label %96
96: ; preds = %83, %57
%97 = phi i32 [ -1, %57 ], [ 0, %83 ]
br label %98
98: ; preds = %21, %96, %44, %37
%99 = phi i32 [ -1, %37 ], [ -1, %44 ], [ %97, %96 ], [ -1, %21 ]
ret i32 %99
}