#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ time_t;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ *h_addr_list;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
void *atoi(char *);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr const *, int);
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
int read(int, int /*<<< orphan*/ *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int sock = -1;
  int port = 5000;
  char *address = "10.1.1.1";
  long dataLen = 6 * 1024 * 1024;
  time_t dep = time(NULL);
  if (argc >= 2) {
    address = argv[1];
  }
  if (argc >= 3) {
    port = atoi(argv[2]);
  }
  if (argc >= 4) {
    dataLen = atoi(argv[3]);
  }
  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock < 0) {
    fprintf(stderr, "Unable to open socket ? errno %d\n", errno);
    exit(1);
  }
  struct sockaddr_in addr;
  addr.sin_family = AF_INET;
  addr.sin_port = htons(port);
  struct hostent *host = gethostbyname(address);
  if (!host) {
    fprintf(stderr, "gethostbyname error. errno %d\n", errno);
    exit(2);
  }
  memcpy(&addr.sin_addr.s_addr, host->h_addr_list[0], host->h_length);
  int result;
  result = connect(sock, (const struct sockaddr *)&addr, sizeof(addr));
  printf("connect -> %d\n", result);
  if (result) {
    fprintf(stderr, "connect error. errno %d\n", errno);
    exit(3);
  }
  uint8_t buf[1024];
  long l = 0;
  while (sock >= 0) {
    int ret = read(sock, buf, sizeof(buf));
    printf("T:%ld read --> %d\n", (time(NULL) - dep), ret);
    if (ret > 0) {
      l += ret;
      if (l >= dataLen) {
        close(sock);
        sock = -1;
      }
    } else {
      close(sock);
      sock = -1;
    }
  }
  printf("T:%ld Total size %ld\n", (time(NULL) - dep), l);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1060,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x1388,-0x18(%rbp)
lea    0xe12(%rip),%rax
mov    %rax,-0x20(%rbp)
movq   $0x600000,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     121d <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1237 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     1252 <main+0x92>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %rax,-0x28(%rbp)
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    0x2d6e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12a0 <main+0xe0>
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
mov    0x2d40(%rip),%rax
mov    (%rax),%edx
lea    0xd78(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <gethostbyname@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    12f7 <main+0x137>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
mov    0x2ce9(%rip),%rax
mov    (%rax),%edx
lea    0xd43(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
call   1090 <memcpy@plt>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <connect@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x4c(%rbp)
je     1367 <main+0x1a7>
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
mov    0x2c79(%rip),%rax
mov    (%rax),%edx
lea    0xd01(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x3,%edi
call   10c0 <exit@plt>
movq   $0x0,-0x1058(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1414 <main+0x254>
mov    -0x14(%rbp),%edi
lea    -0x1050(%rbp),%rsi
mov    $0x1000,%edx
call   1060 <read@plt>
mov    %eax,-0x105c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
sub    -0x30(%rbp),%rax
mov    %eax,%esi
mov    -0x105c(%rbp),%edx
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x105c(%rbp)
jle    1400 <main+0x240>
movslq -0x105c(%rbp),%rax
add    -0x1058(%rbp),%rax
mov    %rax,-0x1058(%rbp)
mov    -0x1058(%rbp),%rax
cmp    -0x28(%rbp),%rax
jl     13fb <main+0x23b>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    140f <main+0x24f>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1372 <main+0x1b2>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
sub    -0x30(%rbp),%rax
mov    %eax,%esi
mov    -0x1058(%rbp),%rdx
lea    0xc54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1028,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
xor    %edi,%edi
call   10a0 <time@plt>
mov    %rax,0x8(%rsp)
mov    $0x600000,%r12d
mov    $0x1388,%r15d
cmp    $0x2,%ebx
jl     1218 <main+0x58>
mov    0x8(%rbp),%r14
je     121f <main+0x5f>
mov    0x10(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %rax,%r15
cmp    $0x4,%ebx
jb     121f <main+0x5f>
mov    0x18(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %rax,%r12
jmp    121f <main+0x5f>
lea    0xde1(%rip),%r14
mov    0x2dc2(%rip),%rbx
mov    (%rbx),%edi
mov    0x2da1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
test   %eax,%eax
jns    1264 <main+0xa4>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
mov    0x2d7c(%rip),%rax
mov    (%rax),%edx
lea    0xdb4(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    %eax,%r13d
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    %r15d,%edi
call   1030 <htons@plt>
mov    %eax,0x14(%rsp)
mov    %r14,%rdi
call   1070 <gethostbyname@plt>
test   %rax,%rax
jne    12ae <main+0xee>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    0x2d32(%rip),%rax
mov    (%rax),%edx
lea    0xd8c(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    0x8(%rax),%rcx
mov    (%rcx),%esi
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <memcpy@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10d0 <connect@plt>
mov    %eax,%ebx
lea    0xd6e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jne    136a <main+0x1aa>
lea    0x20(%rsp),%r15
lea    0xd79(%rip),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %r15,%rsi
mov    $0x1000,%edx
call   1060 <read@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   10a0 <time@plt>
sub    0x8(%rsp),%eax
mov    %rbp,%rdi
mov    %eax,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    133d <main+0x17d>
mov    %r14d,%eax
add    %rax,%rbx
cmp    %r12,%rbx
jl     1300 <main+0x140>
mov    %r13d,%edi
call   1050 <close@plt>
xor    %edi,%edi
call   10a0 <time@plt>
sub    0x8(%rsp),%eax
lea    0xd2e(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    0x2c67(%rip),%rax
mov    (%rax),%edi
mov    0x2c4e(%rip),%rax
mov    (%rax),%edx
lea    0xcd6(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x3,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@.str = [9 x i8] c"10.1.1.1\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"Unable to open socket ? errno %d\0A\00"
@errno = global i32 0
@.str.2 = [31 x i8] c"gethostbyname error. errno %d\0A\00"
@.str.3 = [15 x i8] c"connect -> %d\0A\00"
@.str.4 = [25 x i8] c"connect error. errno %d\0A\00"
@.str.5 = [19 x i8] c"T:%ld read --> %d\0A\00"
@.str.6 = [22 x i8] c"T:%ld Total size %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.hostent*
%13 = alloca i32
%14 = alloca [1024 x i32]
%15 = alloca i64
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
store i32 5000, i32* %7
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %8
store i64 6291456, i64* %9
%17 = call i64 @time(i32* null)
store i64 %17, i64* %10
%18 = load i32, i32* %4
%19 = icmp sge i32 %18, 2
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %8
br label %24
24: ; preds = %20, %2
%25 = load i32, i32* %4
%26 = icmp sge i32 %25, 3
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i8* @atoi(i8* %30)
%32 = ptrtoint i8* %31 to i32
store i32 %32, i32* %7
br label %33
33: ; preds = %27, %24
%34 = load i32, i32* %4
%35 = icmp sge i32 %34, 4
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call i8* @atoi(i8* %39)
%41 = ptrtoint i8* %40 to i64
store i64 %41, i64* %9
br label %42
42: ; preds = %36, %33
%43 = load i32, i32* @AF_INET
%44 = load i32, i32* @SOCK_STREAM
%45 = call i32 @socket(i32 %43, i32 %44, i32 0)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %42
%49 = load i32, i32* @stderr
%50 = load i32, i32* @errno
%51 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %42
%54 = load i32, i32* @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %54, i32* %55
%56 = load i32, i32* %7
%57 = call i32 @htons(i32 %56)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
store i32 %57, i32* %58
%59 = load i8*, i8** %8
%60 = call %struct.hostent* @gethostbyname(i8* %59)
store %struct.hostent* %60, %struct.hostent** %12
%61 = load %struct.hostent*, %struct.hostent** %12
%62 = icmp ne %struct.hostent* %61, null
br i1 %62, label %68, label %63
63: ; preds = %53
%64 = load i32, i32* @stderr
%65 = load i32, i32* @errno
%66 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%67 = call i32 @exit(i32 2)
unreachable
68: ; preds = %53
%69 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%70 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %69, i32 0, i32 0
%71 = load %struct.hostent*, %struct.hostent** %12
%72 = getelementptr inbounds %struct.hostent, %struct.hostent* %71, i32 0, i32 1
%73 = load i32*, i32** %72
%74 = getelementptr inbounds i32, i32* %73, i64 0
%75 = load i32, i32* %74
%76 = load %struct.hostent*, %struct.hostent** %12
%77 = getelementptr inbounds %struct.hostent, %struct.hostent* %76, i32 0, i32 0
%78 = load i32, i32* %77
%79 = call i32 @memcpy(i32* %70, i32 %75, i32 %78)
%80 = load i32, i32* %6
%81 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%82 = call i32 @connect(i32 %80, %struct.sockaddr* %81, i32 12)
store i32 %82, i32* %13
%83 = load i32, i32* %13
%84 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %83)
%85 = load i32, i32* %13
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %92
87: ; preds = %68
%88 = load i32, i32* @stderr
%89 = load i32, i32* @errno
%90 = call i32 @fprintf(i32 %88, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %89)
%91 = call i32 @exit(i32 3)
unreachable
92: ; preds = %68
store i64 0, i64* %15
br label %93
93: ; preds = %123, %92
%94 = load i32, i32* %6
%95 = icmp sge i32 %94, 0
br i1 %95, label %96, label %124
96: ; preds = %93
%97 = load i32, i32* %6
%98 = getelementptr inbounds [1024 x i32], [1024 x i32]* %14, i64 0, i64 0
%99 = call i32 @read(i32 %97, i32* %98, i32 4096)
store i32 %99, i32* %16
%100 = call i64 @time(i32* null)
%101 = load i64, i64* %10
%102 = sub nsw i64 %100, %101
%103 = trunc i64 %102 to i32
%104 = load i32, i32* %16
%105 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %103, i32 %104)
%106 = load i32, i32* %16
%107 = icmp sgt i32 %106, 0
br i1 %107, label %108, label %120
108: ; preds = %96
%109 = load i32, i32* %16
%110 = sext i32 %109 to i64
%111 = load i64, i64* %15
%112 = add nsw i64 %111, %110
store i64 %112, i64* %15
%113 = load i64, i64* %15
%114 = load i64, i64* %9
%115 = icmp sge i64 %113, %114
br i1 %115, label %116, label %119
116: ; preds = %108
%117 = load i32, i32* %6
%118 = call i32 @close(i32 %117)
store i32 -1, i32* %6
br label %119
119: ; preds = %116, %108
br label %123
120: ; preds = %96
%121 = load i32, i32* %6
%122 = call i32 @close(i32 %121)
store i32 -1, i32* %6
br label %123
123: ; preds = %120, %119
br label %93
124: ; preds = %93
%125 = call i64 @time(i32* null)
%126 = load i64, i64* %10
%127 = sub nsw i64 %125, %126
%128 = trunc i64 %127 to i32
%129 = load i64, i64* %15
%130 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %128, i64 %129)
%131 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@.str = [9 x i8] c"10.1.1.1\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"Unable to open socket ? errno %d\0A\00"
@errno = global i32 0
@.str.2 = [31 x i8] c"gethostbyname error. errno %d\0A\00"
@.str.3 = [15 x i8] c"connect -> %d\0A\00"
@.str.4 = [25 x i8] c"connect error. errno %d\0A\00"
@.str.5 = [19 x i8] c"T:%ld read --> %d\0A\00"
@.str.6 = [22 x i8] c"T:%ld Total size %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1024 x i32]
%5 = tail call i64 @time(i32* null)
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %23
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i32 %0, 2
br i1 %10, label %23, label %11
11: ; preds = %7
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i8* @atoi(i8* %13)
%15 = ptrtoint i8* %14 to i64
%16 = trunc i64 %15 to i32
%17 = icmp ugt i32 %0, 3
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = getelementptr inbounds i8*, i8** %1, i64 3
%20 = load i8*, i8** %19
%21 = tail call i8* @atoi(i8* %20)
%22 = ptrtoint i8* %21 to i64
br label %23
23: ; preds = %2, %7, %18, %11
%24 = phi i32 [ %16, %18 ], [ %16, %11 ], [ 5000, %7 ], [ 5000, %2 ]
%25 = phi i8* [ %9, %18 ], [ %9, %11 ], [ %9, %7 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %2 ]
%26 = phi i64 [ %22, %18 ], [ 6291456, %11 ], [ 6291456, %7 ], [ 6291456, %2 ]
%27 = load i32, i32* @AF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = tail call i32 @socket(i32 %27, i32 %28, i32 0)
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %23
%32 = load i32, i32* @stderr
%33 = load i32, i32* @errno
%34 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = tail call i32 @exit(i32 1)
unreachable
36: ; preds = %23
%37 = bitcast %struct.sockaddr_in* %3 to i8*
%38 = load i32, i32* @AF_INET
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %38, i32* %39
%40 = tail call i32 @htons(i32 %24)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %40, i32* %41
%42 = tail call %struct.hostent* @gethostbyname(i8* %25)
%43 = icmp eq %struct.hostent* %42, null
br i1 %43, label %44, label %49
44: ; preds = %36
%45 = load i32, i32* @stderr
%46 = load i32, i32* @errno
%47 = tail call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%48 = tail call i32 @exit(i32 2)
unreachable
49: ; preds = %36
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
%51 = getelementptr inbounds %struct.hostent, %struct.hostent* %42, i64 0, i32 1
%52 = load i32*, i32** %51
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.hostent, %struct.hostent* %42, i64 0, i32 0
%55 = load i32, i32* %54
%56 = call i32 @memcpy(i32* %50, i32 %53, i32 %55)
%57 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%58 = call i32 @connect(i32 %29, %struct.sockaddr* %57, i32 12)
%59 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %58)
%60 = icmp eq i32 %58, 0
br i1 %60, label %66, label %61
61: ; preds = %49
%62 = load i32, i32* @stderr
%63 = load i32, i32* @errno
%64 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %63)
%65 = call i32 @exit(i32 3)
unreachable
66: ; preds = %49
%67 = bitcast [1024 x i32]* %4 to i8*
%68 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 0
br label %69
69: ; preds = %77, %66
%70 = phi i64 [ 0, %66 ], [ %79, %77 ]
%71 = call i32 @read(i32 %29, i32* %68, i32 4096)
%72 = call i64 @time(i32* null)
%73 = sub nsw i64 %72, %5
%74 = trunc i64 %73 to i32
%75 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %74, i32 %71)
%76 = icmp sgt i32 %71, 0
br i1 %76, label %77, label %81
77: ; preds = %69
%78 = zext i32 %71 to i64
%79 = add nuw nsw i64 %70, %78
%80 = icmp slt i64 %79, %26
br i1 %80, label %69, label %81
81: ; preds = %69, %77
%82 = phi i64 [ %79, %77 ], [ %70, %69 ]
%83 = call i32 @close(i32 %29)
%84 = call i64 @time(i32* null)
%85 = sub nsw i64 %84, %5
%86 = trunc i64 %85 to i32
%87 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %86, i64 %82)
%88 = call i32 @exit(i32 0)
unreachable
}