#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 */
struct timespec {
  int tv_nsec;
  int /*<<< orphan*/ tv_sec;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct protoent {
  int /*<<< orphan*/ p_proto;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ h_addr;
};
typedef int /*<<< orphan*/ socketaddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct hostent *gethostbyname(char *);
struct protoent *getprotobyname(char *);
char *hstrerror(int);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  if (argc != 4) {
    fprintf(stderr, "Wrong number of arguments: %d instead of 3\n", argc - 1);
    return EXIT_FAILURE;
  }
  struct protoent *protocol;
  protocol = getprotobyname("tcp");
  if (!protocol) {
    perror("getprotobyname()");
    return (errno);
  }
  int sd;
  sd = socket(PF_INET, SOCK_STREAM, protocol->p_proto);
  if (!sd) {
    perror("socket()");
    return (errno);
  }
  struct sockaddr_in socketaddr;
  memset(&socketaddr, 0, sizeof(socketaddr));
  socketaddr.sin_family = AF_INET;
  socketaddr.sin_port = htons(atoi(argv[2]));
  extern int h_errno;
  struct hostent *hostaddr;
  hostaddr = gethostbyname(argv[1]);
  if (!hostaddr) {
    fprintf(stderr, "gethostbyname(): %s\n", hstrerror(h_errno));
    return (h_errno);
  }
  memcpy(&socketaddr.sin_addr, hostaddr->h_addr, hostaddr->h_length);
  int rval;
  int attempts = 0;
  struct timespec ts = {.tv_sec = 0, .tv_nsec = 50000000};
  do {
    rval = connect(sd, (struct sockaddr *)&socketaddr, sizeof(socketaddr));
    attempts += 1;
    nanosleep(&ts, NULL);
  } while (rval == -1 && attempts < 400);
  if (rval == -1) {
    perror("connect()");
    return (errno);
  }
  rval = send(sd, argv[3], strlen(argv[3]), NULL);
  if (rval == -1) {
    perror("send()");
    return (errno);
  }
  close(sd);
  return EXIT_SUCCESS;
}


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   $0x4,-0x8(%rbp)
je     123e <main+0x4e>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
lea    0xdda(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2d7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145a <main+0x26a>
lea    0xde7(%rip),%rdi
call   10c0 <getprotobyname@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1276 <main+0x86>
lea    0xdd0(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d54(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145a <main+0x26a>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
mov    0x2d42(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
call   1110 <socket@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12bd <main+0xcd>
lea    0xd9a(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145a <main+0x26a>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
call   1040 <htons@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    134b <main+0x15b>
mov    0x2cbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
call   10e0 <hstrerror@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rdx
lea    0xd17(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145a <main+0x26a>
lea    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
call   10b0 <memcpy@plt>
movl   $0x0,-0x38(%rbp)
mov    0xd01(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <nanosleep@plt>
xor    %eax,%eax
cmpl   $0xffffffff,-0x34(%rbp)
mov    %al,-0x45(%rbp)
jne    13b9 <main+0x1c9>
cmpl   $0x190,-0x38(%rbp)
setl   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    1373 <main+0x183>
cmpl   $0xffffffff,-0x34(%rbp)
jne    13eb <main+0x1fb>
lea    0xc8a(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2bdf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145a <main+0x26a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <strlen@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <send@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1446 <main+0x256>
lea    0xc39(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145a <main+0x26a>
mov    -0x1c(%rbp),%edi
call   1080 <close@plt>
mov    0x2b53(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%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    $0x18,%rsp
cmp    $0x4,%edi
jne    131c <main+0x12c>
mov    %rsi,%r14
lea    0xe1b(%rip),%rdi
call   10c0 <getprotobyname@plt>
test   %rax,%rax
je     1380 <main+0x190>
mov    0x2d92(%rip),%rcx
mov    (%rcx),%edi
mov    0x2d99(%rip),%rcx
mov    (%rcx),%esi
mov    (%rax),%edx
call   1110 <socket@plt>
test   %eax,%eax
je     1389 <main+0x199>
mov    %eax,%r12d
mov    %rsp,%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x10(%r14),%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
call   1040 <htons@plt>
mov    %eax,0x4(%rsp)
mov    0x8(%r14),%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
je     1350 <main+0x160>
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %rsp,%r15
mov    %r15,%rdi
call   10b0 <memcpy@plt>
movq   $0x2faf080,0x10(%rsp)
fa 02
lea    0x10(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12d,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
mov    %eax,%ebp
mov    %r13,%rdi
xor    %esi,%esi
call   1060 <nanosleep@plt>
cmp    $0xffffffff,%ebp
jne    12de <main+0xee>
lea    0x1(%rbx),%eax
cmp    $0x18f,%ebx
mov    %eax,%ebx
jb     12b0 <main+0xc0>
cmp    $0xffffffff,%ebp
je     1392 <main+0x1a2>
mov    0x18(%r14),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
cmp    $0xffffffff,%eax
je     139b <main+0x1ab>
mov    %r12d,%edi
call   1080 <close@plt>
mov    0x2c8e(%rip),%rax
jmp    133f <main+0x14f>
mov    %edi,%edx
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
add    $0xffffffff,%edx
lea    0xccf(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2c71(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c79(%rip),%rax
mov    (%rax),%ebx
mov    0x2c80(%rip),%rbp
mov    0x0(%rbp),%edi
call   10e0 <hstrerror@plt>
lea    0xcdb(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x0(%rbp),%eax
jmp    1341 <main+0x151>
lea    0xca9(%rip),%rdi
jmp    13a2 <main+0x1b2>
lea    0xcb1(%rip),%rdi
jmp    13a2 <main+0x1b2>
lea    0xcc6(%rip),%rdi
jmp    13a2 <main+0x1b2>
lea    0xcc7(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c12(%rip),%rax
jmp    133f <main+0x14f>

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
%struct.protoent = type { i32 }
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [44 x i8] c"Wrong number of arguments: %d instead of 3\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"tcp\00"
@.str.2 = [17 x i8] c"getprotobyname()\00"
@errno = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [9 x i8] c"socket()\00"
@AF_INET = global i32 0
@.str.4 = [21 x i8] c"gethostbyname(): %s\0A\00"
@h_errno = external global i32
@__const.main.ts = %struct.timespec { i32 50000000, i32 0 }
@.str.5 = [10 x i8] c"connect()\00"
@.str.6 = [7 x i8] c"send()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.protoent*
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.hostent*
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.timespec
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, 4
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %112
21: ; preds = %2
%22 = call %struct.protoent* @getprotobyname(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store %struct.protoent* %22, %struct.protoent** %6
%23 = load %struct.protoent*, %struct.protoent** %6
%24 = icmp ne %struct.protoent* %23, null
br i1 %24, label %28, label %25
25: ; preds = %21
%26 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* @errno
store i32 %27, i32* %3
br label %112
28: ; preds = %21
%29 = load i32, i32* @PF_INET
%30 = load i32, i32* @SOCK_STREAM
%31 = load %struct.protoent*, %struct.protoent** %6
%32 = getelementptr inbounds %struct.protoent, %struct.protoent* %31, i32 0, i32 0
%33 = load i32, i32* %32
%34 = call i32 @socket(i32 %29, i32 %30, i32 %33)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp ne i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %28
%38 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%39 = load i32, i32* @errno
store i32 %39, i32* %3
br label %112
40: ; preds = %28
%41 = call i32 @memset(%struct.sockaddr_in* %8, i32 0, i32 12)
%42 = load i32, i32* @AF_INET
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, 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* %8, i32 0, i32 1
store i32 %48, i32* %49
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call %struct.hostent* @gethostbyname(i8* %52)
store %struct.hostent* %53, %struct.hostent** %9
%54 = load %struct.hostent*, %struct.hostent** %9
%55 = icmp ne %struct.hostent* %54, null
br i1 %55, label %62, label %56
56: ; preds = %40
%57 = load i32, i32* @stderr
%58 = load i32, i32* @h_errno
%59 = call i8* @hstrerror(i32 %58)
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %59)
%61 = load i32, i32* @h_errno
store i32 %61, i32* %3
br label %112
62: ; preds = %40
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%64 = load %struct.hostent*, %struct.hostent** %9
%65 = getelementptr inbounds %struct.hostent, %struct.hostent* %64, i32 0, i32 1
%66 = load i32, i32* %65
%67 = load %struct.hostent*, %struct.hostent** %9
%68 = getelementptr inbounds %struct.hostent, %struct.hostent* %67, i32 0, i32 0
%69 = load i32, i32* %68
%70 = call i32 @memcpy(i32* %63, i32 %66, i32 %69)
store i32 0, i32* %11
%71 = bitcast %struct.timespec* %12 to i8*
br label %72
72: ; preds = %85, %62
%73 = load i32, i32* %7
%74 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%75 = call i32 @connect(i32 %73, %struct.sockaddr* %74, i32 12)
store i32 %75, i32* %10
%76 = load i32, i32* %11
%77 = add nsw i32 %76, 1
store i32 %77, i32* %11
%78 = call i32 @nanosleep(%struct.timespec* %12, i32* null)
br label %79
79: ; preds = %72
%80 = load i32, i32* %10
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %85
82: ; preds = %79
%83 = load i32, i32* %11
%84 = icmp slt i32 %83, 400
br label %85
85: ; preds = %82, %79
%86 = phi i1 [ false, %79 ], [ %84, %82 ]
br i1 %86, label %72, label %87
87: ; preds = %85
%88 = load i32, i32* %10
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%92 = load i32, i32* @errno
store i32 %92, i32* %3
br label %112
93: ; preds = %87
%94 = load i32, i32* %7
%95 = load i8**, i8*** %5
%96 = getelementptr inbounds i8*, i8** %95, i64 3
%97 = load i8*, i8** %96
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 3
%100 = load i8*, i8** %99
%101 = call i32 @strlen(i8* %100)
%102 = call i32 @send(i32 %94, i8* %97, i32 %101, i32* null)
store i32 %102, i32* %10
%103 = load i32, i32* %10
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %108
105: ; preds = %93
%106 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%107 = load i32, i32* @errno
store i32 %107, i32* %3
br label %112
108: ; preds = %93
%109 = load i32, i32* %7
%110 = call i32 @close(i32 %109)
%111 = load i32, i32* @EXIT_SUCCESS
store i32 %111, i32* %3
br label %112
112: ; preds = %108, %105, %90, %56, %37, %25, %15
%113 = load i32, i32* %3
ret i32 %113
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.timespec = type { i32, i32 }
%struct.protoent = type { i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [44 x i8] c"Wrong number of arguments: %d instead of 3\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"tcp\00"
@.str.2 = [17 x i8] c"getprotobyname()\00"
@errno = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [9 x i8] c"socket()\00"
@AF_INET = global i32 0
@.str.4 = [21 x i8] c"gethostbyname(): %s\0A\00"
@h_errno = external global i32
@.str.5 = [10 x i8] c"connect()\00"
@.str.6 = [7 x i8] c"send()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i64
%5 = bitcast i64* %4 to %struct.timespec*
%6 = icmp eq i32 %0, 4
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = add nsw i32 %0, -1
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @EXIT_FAILURE
br label %83
12: ; preds = %2
%13 = tail call %struct.protoent* @getprotobyname(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq %struct.protoent* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @errno
br label %83
18: ; preds = %12
%19 = load i32, i32* @PF_INET
%20 = load i32, i32* @SOCK_STREAM
%21 = getelementptr inbounds %struct.protoent, %struct.protoent* %13, i64 0, i32 0
%22 = load i32, i32* %21
%23 = tail call i32 @socket(i32 %19, i32 %20, i32 %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %18
%26 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* @errno
br label %83
28: ; preds = %18
%29 = bitcast %struct.sockaddr_in* %3 to i8*
%30 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%31 = load i32, i32* @AF_INET
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %31, i32* %32
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
%36 = call i32 @htons(i32 %35)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %36, i32* %37
%38 = getelementptr inbounds i8*, i8** %1, i64 1
%39 = load i8*, i8** %38
%40 = call %struct.hostent* @gethostbyname(i8* %39)
%41 = icmp eq %struct.hostent* %40, null
br i1 %41, label %42, label %48
42: ; preds = %28
%43 = load i32, i32* @stderr
%44 = load i32, i32* @h_errno
%45 = call i8* @hstrerror(i32 %44)
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = load i32, i32* @h_errno
br label %81
48: ; preds = %28
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%50 = getelementptr inbounds %struct.hostent, %struct.hostent* %40, i64 0, i32 1
%51 = load i32, i32* %50
%52 = getelementptr inbounds %struct.hostent, %struct.hostent* %40, i64 0, i32 0
%53 = load i32, i32* %52
%54 = call i32 @memcpy(i32* %49, i32 %51, i32 %53)
%55 = bitcast i64* %4 to i8*
store i64 50000000, i64* %4
%56 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
br label %57
57: ; preds = %57, %48
%58 = phi i32 [ 0, %48 ], [ %60, %57 ]
%59 = call i32 @connect(i32 %23, %struct.sockaddr* %56, i32 12)
%60 = add nuw nsw i32 %58, 1
%61 = call i32 @nanosleep(%struct.timespec* %5, i32* null)
%62 = icmp eq i32 %59, -1
%63 = icmp ult i32 %58, 399
%64 = select i1 %62, i1 %63, i1 false
br i1 %64, label %57, label %65
65: ; preds = %57
br i1 %62, label %66, label %68
66: ; preds = %65
%67 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %78
68: ; preds = %65
%69 = getelementptr inbounds i8*, i8** %1, i64 3
%70 = load i8*, i8** %69
%71 = call i32 @strlen(i8* %70)
%72 = call i32 @send(i32 %23, i8* %70, i32 %71, i32* null)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %76
74: ; preds = %68
%75 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %78
76: ; preds = %68
%77 = call i32 @close(i32 %23)
br label %78
78: ; preds = %76, %74, %66
%79 = phi i32* [ @errno, %66 ], [ @errno, %74 ], [ @EXIT_SUCCESS, %76 ]
%80 = load i32, i32* %79
br label %81
81: ; preds = %78, %42
%82 = phi i32 [ %80, %78 ], [ %47, %42 ]
br label %83
83: ; preds = %15, %81, %25, %7
%84 = phi i32 [ %11, %7 ], [ %17, %15 ], [ %82, %81 ], [ %27, %25 ]
ret i32 %84
}