#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 {
  void *sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ *h_addr_list;
  int /*<<< orphan*/ h_addrtype;
};
typedef int /*<<< orphan*/ servAddr;
typedef int /*<<< orphan*/ localAddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void *htons(int);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int send(int, char *, scalar_t__, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  int sd, rc, i;
  struct sockaddr_in localAddr, servAddr;
  struct hostent *h;
  if (argc < 3) {
    printf("usage: %s <server> <data1> <data2> ... <dataN>\n", argv[0]);
    exit(1);
  }
  h = gethostbyname(argv[1]);
  if (h == NULL) {
    printf("%s: unknown host '%s'\n", argv[0], argv[1]);
    exit(1);
  }
  servAddr.sin_family = h->h_addrtype;
  memcpy((char *)&servAddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length);
  servAddr.sin_port = htons(1500);
  sd = socket(AF_INET, SOCK_STREAM, 0);
  if (sd < 0) {
    perror("cannot open socket ");
    exit(1);
  }
  localAddr.sin_family = AF_INET;
  localAddr.sin_addr.s_addr = htonl(INADDR_ANY);
  localAddr.sin_port = htons(0);
  rc = bind(sd, (struct sockaddr *)&localAddr, sizeof(localAddr));
  if (rc < 0) {
    printf("%s: cannot bind port TCP %u\n", argv[0], 1500);
    perror("error ");
    exit(1);
  }
  rc = connect(sd, (struct sockaddr *)&servAddr, sizeof(servAddr));
  if (rc < 0) {
    perror("cannot connect ");
    exit(1);
  }
  for (i = 2; i < argc; i++) {
    rc = send(sd, argv[i], strlen(argv[i]) + 1, 0);
    if (rc < 0) {
      perror("cannot send data ");
      close(sd);
      exit(1);
    }
    printf("%s: data%u sent (%s)\n", argv[0], i - 1, argv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    120f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1252 <main+0x82>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x34(%rbp)
lea    -0x40(%rbp),%rdi
add    $0x8,%rdi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
call   10a0 <memcpy@plt>
mov    $0x5dc,%edi
call   1040 <htons@plt>
mov    %rax,-0x40(%rbp)
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
mov    0x2d39(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12c3 <main+0xf3>
lea    0xd93(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2d1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d0a(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x28(%rbp)
xor    %edi,%edi
call   1040 <htons@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   10b0 <bind@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1339 <main+0x169>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd44(%rip),%rdi
mov    $0x5dc,%edx
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd4e(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x10,%edx
call   10e0 <connect@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    136d <main+0x19d>
lea    0xd21(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    141c <main+0x24c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13e7 <main+0x217>
lea    0xcbf(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xc9a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1374 <main+0x1a4>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r13
cmp    $0x2,%edi
jle    1330 <main+0x160>
mov    %edi,%r14d
mov    0x8(%r13),%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
je     134c <main+0x17c>
mov    0x10(%rax),%ecx
mov    %ecx,0x14(%rsp)
lea    0x10(%rsp),%rdi
mov    0x8(%rax),%rcx
mov    (%rcx),%esi
mov    (%rax),%edx
call   10a0 <memcpy@plt>
mov    $0x5dc,%edi
call   1040 <htons@plt>
mov    %rax,0x8(%rsp)
mov    0x2dba(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d99(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
test   %eax,%eax
js     136c <main+0x19c>
mov    %eax,%r15d
mov    (%rbx),%eax
mov    %eax,0x24(%rsp)
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,0x20(%rsp)
xor    %edi,%edi
call   1040 <htons@plt>
mov    %rax,0x18(%rsp)
lea    0x18(%rsp),%rsi
mov    %r15d,%edi
mov    $0x10,%edx
call   10b0 <bind@plt>
test   %eax,%eax
js     1375 <main+0x1a5>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0x10,%edx
call   10e0 <connect@plt>
test   %eax,%eax
js     1395 <main+0x1c5>
mov    %r14d,%r12d
mov    $0x2,%ebx
lea    0xdef(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbx,8),%rbp
mov    %rbp,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r15d,%edi
mov    %rbp,%rsi
xor    %ecx,%ecx
call   1050 <send@plt>
test   %eax,%eax
js     1312 <main+0x142>
mov    0x0(%r13),%rsi
mov    0x0(%r13,%rbx,8),%rcx
lea    -0x1(%rbx),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    12c0 <main+0xf0>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd76(%rip),%rdi
call   10c0 <perror@plt>
mov    %r15d,%edi
call   1080 <close@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x0(%r13),%rsi
lea    0xcc5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x0(%r13),%rsi
mov    0x8(%r13),%rdx
lea    0xcd5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xcd4(%rip),%rdi
jmp    139c <main+0x1cc>
mov    0x0(%r13),%rsi
lea    0xcdb(%rip),%rdi
mov    $0x5dc,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xce5(%rip),%rdi
jmp    139c <main+0x1cc>
lea    0xce3(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i32*, i32 }
%struct.sockaddr = type { i32 }
@.str = [48 x i8] c"usage: %s <server> <data1> <data2> ... <dataN>\0A\00"
@.str.1 = [23 x i8] c"%s: unknown host '%s'\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [20 x i8] c"cannot open socket \00"
@INADDR_ANY = global i32 0
@.str.3 = [29 x i8] c"%s: cannot bind port TCP %u\0A\00"
@.str.4 = [7 x i8] c"error \00"
@.str.5 = [16 x i8] c"cannot connect \00"
@.str.6 = [18 x i8] c"cannot send data \00"
@.str.7 = [22 x i8] c"%s: data%u sent (%s)\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 i32
%9 = alloca %struct.sockaddr_in
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.hostent*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call %struct.hostent* @gethostbyname(i8* %23)
store %struct.hostent* %24, %struct.hostent** %11
%25 = load %struct.hostent*, %struct.hostent** %11
%26 = icmp eq %struct.hostent* %25, null
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %30, i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %20
%37 = load %struct.hostent*, %struct.hostent** %11
%38 = getelementptr inbounds %struct.hostent, %struct.hostent* %37, i32 0, i32 2
%39 = load i32, i32* %38
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %39, i32* %40
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%42 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %41, i32 0, i32 0
%43 = bitcast i32* %42 to i8*
%44 = load %struct.hostent*, %struct.hostent** %11
%45 = getelementptr inbounds %struct.hostent, %struct.hostent* %44, i32 0, i32 1
%46 = load i32*, i32** %45
%47 = getelementptr inbounds i32, i32* %46, i64 0
%48 = load i32, i32* %47
%49 = load %struct.hostent*, %struct.hostent** %11
%50 = getelementptr inbounds %struct.hostent, %struct.hostent* %49, i32 0, i32 0
%51 = load i32, i32* %50
%52 = call i32 @memcpy(i8* %43, i32 %48, i32 %51)
%53 = call i8* @htons(i32 1500)
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
store i8* %53, i8** %54
%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* %6
%58 = load i32, i32* %6
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %36
%61 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %36
%64 = load i32, i32* @AF_INET
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %64, i32* %65
%66 = load i32, i32* @INADDR_ANY
%67 = call i32 @htonl(i32 %66)
%68 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%69 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %68, i32 0, i32 0
store i32 %67, i32* %69
%70 = call i8* @htons(i32 0)
%71 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i8* %70, i8** %71
%72 = load i32, i32* %6
%73 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%74 = call i32 @bind(i32 %72, %struct.sockaddr* %73, i32 16)
store i32 %74, i32* %7
%75 = load i32, i32* %7
%76 = icmp slt i32 %75, 0
br i1 %76, label %77, label %84
77: ; preds = %63
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 0
%80 = load i8*, i8** %79
%81 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %80, i32 1500)
%82 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %63
%85 = load i32, i32* %6
%86 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%87 = call i32 @connect(i32 %85, %struct.sockaddr* %86, i32 16)
store i32 %87, i32* %7
%88 = load i32, i32* %7
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %84
%91 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %84
store i32 2, i32* %8
br label %94
94: ; preds = %132, %93
%95 = load i32, i32* %8
%96 = load i32, i32* %4
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %135
98: ; preds = %94
%99 = load i32, i32* %6
%100 = load i8**, i8*** %5
%101 = load i32, i32* %8
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8*, i8** %100, i64 %102
%104 = load i8*, i8** %103
%105 = load i8**, i8*** %5
%106 = load i32, i32* %8
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8*, i8** %105, i64 %107
%109 = load i8*, i8** %108
%110 = call i64 @strlen(i8* %109)
%111 = add nsw i64 %110, 1
%112 = call i32 @send(i32 %99, i8* %104, i64 %111, i32 0)
store i32 %112, i32* %7
%113 = load i32, i32* %7
%114 = icmp slt i32 %113, 0
br i1 %114, label %115, label %120
115: ; preds = %98
%116 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%117 = load i32, i32* %6
%118 = call i32 @close(i32 %117)
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %98
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 0
%123 = load i8*, i8** %122
%124 = load i32, i32* %8
%125 = sub nsw i32 %124, 1
%126 = load i8**, i8*** %5
%127 = load i32, i32* %8
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8*, i8** %126, i64 %128
%130 = load i8*, i8** %129
%131 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %123, i32 %125, i8* %130)
br label %132
132: ; preds = %120
%133 = load i32, i32* %8
%134 = add nsw i32 %133, 1
store i32 %134, i32* %8
br label %94
135: ; preds = %94
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i32*, i32 }
%struct.sockaddr = type { i32 }
@.str = [48 x i8] c"usage: %s <server> <data1> <data2> ... <dataN>\0A\00"
@.str.1 = [23 x i8] c"%s: unknown host '%s'\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [20 x i8] c"cannot open socket \00"
@INADDR_ANY = global i32 0
@.str.3 = [29 x i8] c"%s: cannot bind port TCP %u\0A\00"
@.str.4 = [7 x i8] c"error \00"
@.str.5 = [16 x i8] c"cannot connect \00"
@.str.6 = [18 x i8] c"cannot send data \00"
@.str.7 = [22 x i8] c"%s: data%u sent (%s)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = bitcast %struct.sockaddr_in* %4 to i8*
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call %struct.hostent* @gethostbyname(i8* %14)
%16 = icmp eq %struct.hostent* %15, null
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i8*, i8** %1
%19 = load i8*, i8** %13
%20 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %18, i8* %19)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %12
%23 = getelementptr inbounds %struct.hostent, %struct.hostent* %15, i64 0, i32 2
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
%27 = bitcast i32* %26 to i8*
%28 = getelementptr inbounds %struct.hostent, %struct.hostent* %15, i64 0, i32 1
%29 = load i32*, i32** %28
%30 = load i32, i32* %29
%31 = getelementptr inbounds %struct.hostent, %struct.hostent* %15, i64 0, i32 0
%32 = load i32, i32* %31
%33 = call i32 @memcpy(i8* %27, i32 %30, i32 %32)
%34 = call i8* @htons(i32 1500)
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i8* %34, i8** %35
%36 = load i32, i32* @AF_INET
%37 = load i32, i32* @SOCK_STREAM
%38 = call i32 @socket(i32 %36, i32 %37, i32 0)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %22
%41 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %22
%44 = load i32, i32* @AF_INET
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %44, i32* %45
%46 = load i32, i32* @INADDR_ANY
%47 = call i32 @htonl(i32 %46)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %47, i32* %48
%49 = call i8* @htons(i32 0)
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i8* %49, i8** %50
%51 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%52 = call i32 @bind(i32 %38, %struct.sockaddr* %51, i32 16)
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %43
%55 = load i8*, i8** %1
%56 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %55, i32 1500)
%57 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %43
%60 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%61 = call i32 @connect(i32 %38, %struct.sockaddr* %60, i32 16)
%62 = icmp slt i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %59
%64 = zext i32 %0 to i64
br label %68
65: ; preds = %59
%66 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %63, %80
%69 = phi i64 [ 2, %63 ], [ %86, %80 ]
%70 = getelementptr inbounds i8*, i8** %1, i64 %69
%71 = load i8*, i8** %70
%72 = call i64 @strlen(i8* dereferenceable(1) %71)
%73 = add nsw i64 %72, 1
%74 = call i32 @send(i32 %38, i8* %71, i64 %73, i32 0)
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %68
%77 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%78 = call i32 @close(i32 %38)
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %68
%81 = load i8*, i8** %1
%82 = load i8*, i8** %70
%83 = trunc i64 %69 to i32
%84 = add i32 %83, -1
%85 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %81, i32 %84, i8* %82)
%86 = add nuw nsw i64 %69, 1
%87 = icmp eq i64 %86, %64
br i1 %87, label %88, label %68
88: ; preds = %80
ret i32 0
}