#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 sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_addrtype;
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ h_addr;
};
typedef int /*<<< orphan*/ server;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bcopy(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int sock, port;
  char *s, *key;
  struct hostent *hp;
  struct sockaddr_in server;
  int errors = 0;
  if (argc < 3) {
    fprintf(stderr, "Usage: sentclient host[:port[:key]] command [args ...]\n");
    exit(1);
  }
  s = strchr(argv[1], ':');
  key = NULL;
  if (s == NULL) {
    port = 50000;
  } else {
    *s = '\0';
    s += 1;
    key = strchr(s, ':');
    if (key != NULL) {
      *key = '\0';
      key += 1;
    }
    port = atoi(s);
  }
  sock = socket(AF_INET, SOCK_STREAM, 0);
  hp = gethostbyname(argv[1]);
  if (hp == NULL) {
    fprintf(stderr, "unknown host %s\n", argv[1]);
    exit(1);
  }
  bzero((char *)&server, sizeof(server));
  bcopy(hp->h_addr, (char *)&server.sin_addr, hp->h_length);
  server.sin_family = hp->h_addrtype;
  server.sin_port = htons(port);
  fprintf(stderr, "connecting to %s:%d\n", argv[1], port);
  fflush(stderr);
  while (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) {
    perror("connect()");
    sleep(1);
    errors++;
    if (errors > 5)
      exit(1);
  }
  close(0);
  close(1);
  dup2(sock, 0);
  dup2(sock, 1);
  if (key != NULL) {
    write(1, key, strlen(key));
    write(1, "\n", 1);
  }
  execvp(argv[2], argv + 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1268 <main+0x48>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    129d <main+0x7d>
movl   $0xc350,-0x18(%rbp)
jmp    12ec <main+0xcc>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12e0 <main+0xc0>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    0x2cf5(%rip),%rax
mov    (%rax),%edi
mov    0x2cd4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    134d <main+0x12d>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xcfc(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x40(%rbp),%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%edi
lea    -0x40(%rbp),%rsi
add    $0x8,%rsi
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%edx
call   10c0 <bcopy@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x40(%rbp)
mov    0x2c47(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x18(%rbp),%ecx
lea    0xca4(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0x0,%rax
jge    140d <main+0x1ed>
lea    0xc82(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1130 <sleep@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x5,-0x44(%rbp)
jle    1408 <main+0x1e8>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    13ba <main+0x19a>
xor    %edi,%edi
call   1080 <close@plt>
mov    $0x1,%edi
call   1080 <close@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <dup2@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1060 <dup2@plt>
cmpq   $0x0,-0x28(%rbp)
je     1474 <main+0x254>
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edx
lea    0xbc9(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   10f0 <execvp@plt>
xor    %eax,%eax
add    $0x50,%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    $0x2,%edi
jle    14b9 <main+0x299>
mov    %rsi,%r13
mov    0x8(%rsi),%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     1275 <main+0x55>
mov    %rax,%rbp
movb   $0x0,(%rax)
add    $0x1,%rbp
mov    %rbp,%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     127f <main+0x5f>
mov    %rax,%r14
movb   $0x0,(%rax)
add    $0x1,%r14
jmp    1282 <main+0x62>
mov    $0xc350,%ebp
xor    %r14d,%r14d
jmp    128c <main+0x6c>
xor    %r14d,%r14d
mov    %rbp,%rdi
call   1100 <atoi@plt>
mov    %eax,%ebp
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
mov    0x2d34(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r15d
mov    0x8(%r13),%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
je     14da <main+0x2ba>
mov    %rax,%rbx
lea    0x8(%rsp),%r12
mov    %r12,%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    0x4(%rbx),%edx
mov    0x8(%rbx),%edi
lea    0x10(%rsp),%rsi
call   10c0 <bcopy@plt>
mov    (%rbx),%eax
mov    %eax,0xc(%rsp)
mov    %ebp,%edi
call   1050 <htons@plt>
mov    %eax,0x8(%rsp)
mov    0x2ce1(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%r13),%rdx
lea    0xd45(%rip),%rsi
mov    %ebp,%ecx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
call   10b0 <fflush@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
js     13a4 <main+0x184>
xor    %edi,%edi
call   1080 <close@plt>
mov    $0x1,%edi
call   1080 <close@plt>
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <dup2@plt>
mov    %r15d,%edi
mov    $0x1,%esi
call   1060 <dup2@plt>
test   %r14,%r14
je     1383 <main+0x163>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xcc2(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
mov    0x10(%r13),%rdi
add    $0x10,%r13
mov    %r13,%rsi
call   10f0 <execvp@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcb3(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1130 <sleep@plt>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
jns    1329 <main+0x109>
lea    0xc82(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1130 <sleep@plt>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
jns    1329 <main+0x109>
lea    0xc51(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1130 <sleep@plt>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
jns    1329 <main+0x109>
lea    0xc20(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1130 <sleep@plt>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
jns    1329 <main+0x109>
lea    0xbef(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1130 <sleep@plt>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
jns    1329 <main+0x109>
lea    0xbbe(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1130 <sleep@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2b18(%rip),%rax
mov    (%rax),%edi
lea    0xb37(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2af7(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r13),%rdx
lea    0xb4a(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.hostent = type { i32, i32, i32 }
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [56 x i8] c"Usage: sentclient host[:port[:key]] command [args ...]\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [17 x i8] c"unknown host %s\0A\00"
@.str.2 = [21 x i8] c"connecting to %s:%d\0A\00"
@.str.3 = [10 x i8] c"connect()\00"
@.str.4 = [2 x i8] c"\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 i8*
%10 = alloca %struct.hostent*
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %12
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i8* @strchr(i8* %22, i8 signext 58)
store i8* %23, i8** %8
store i8* null, i8** %9
%24 = load i8*, i8** %8
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %27
26: ; preds = %19
store i32 50000, i32* %7
br label %42
27: ; preds = %19
%28 = load i8*, i8** %8
store i8 0, i8* %28
%29 = load i8*, i8** %8
%30 = getelementptr inbounds i8, i8* %29, i64 1
store i8* %30, i8** %8
%31 = load i8*, i8** %8
%32 = call i8* @strchr(i8* %31, i8 signext 58)
store i8* %32, i8** %9
%33 = load i8*, i8** %9
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %39
35: ; preds = %27
%36 = load i8*, i8** %9
store i8 0, i8* %36
%37 = load i8*, i8** %9
%38 = getelementptr inbounds i8, i8* %37, i64 1
store i8* %38, i8** %9
br label %39
39: ; preds = %35, %27
%40 = load i8*, i8** %8
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %7
br label %42
42: ; preds = %39, %26
%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 i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call %struct.hostent* @gethostbyname(i8* %48)
store %struct.hostent* %49, %struct.hostent** %10
%50 = load %struct.hostent*, %struct.hostent** %10
%51 = icmp eq %struct.hostent* %50, null
br i1 %51, label %52, label %59
52: ; preds = %42
%53 = load i32, i32* @stderr
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = load i8*, i8** %55
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %42
%60 = bitcast %struct.sockaddr_in* %11 to i8*
%61 = call i32 @bzero(i8* %60, i32 12)
%62 = load %struct.hostent*, %struct.hostent** %10
%63 = getelementptr inbounds %struct.hostent, %struct.hostent* %62, i32 0, i32 2
%64 = load i32, i32* %63
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
%66 = bitcast i32* %65 to i8*
%67 = load %struct.hostent*, %struct.hostent** %10
%68 = getelementptr inbounds %struct.hostent, %struct.hostent* %67, i32 0, i32 1
%69 = load i32, i32* %68
%70 = call i32 @bcopy(i32 %64, i8* %66, i32 %69)
%71 = load %struct.hostent*, %struct.hostent** %10
%72 = getelementptr inbounds %struct.hostent, %struct.hostent* %71, i32 0, i32 0
%73 = load i32, i32* %72
%74 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
store i32 %73, i32* %74
%75 = load i32, i32* %7
%76 = call i32 @htons(i32 %75)
%77 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %76, i32* %77
%78 = load i32, i32* @stderr
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 1
%81 = load i8*, i8** %80
%82 = load i32, i32* %7
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %81, i32 %82)
%84 = load i32, i32* @stderr
%85 = call i32 @fflush(i32 %84)
br label %86
86: ; preds = %100, %59
%87 = load i32, i32* %6
%88 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%89 = call i64 @connect(i32 %87, %struct.sockaddr* %88, i32 12)
%90 = icmp slt i64 %89, 0
br i1 %90, label %91, label %101
91: ; preds = %86
%92 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%93 = call i32 @sleep(i32 1)
%94 = load i32, i32* %12
%95 = add nsw i32 %94, 1
store i32 %95, i32* %12
%96 = load i32, i32* %12
%97 = icmp sgt i32 %96, 5
br i1 %97, label %98, label %100
98: ; preds = %91
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %91
br label %86
101: ; preds = %86
%102 = call i32 @close(i32 0)
%103 = call i32 @close(i32 1)
%104 = load i32, i32* %6
%105 = call i32 @dup2(i32 %104, i32 0)
%106 = load i32, i32* %6
%107 = call i32 @dup2(i32 %106, i32 1)
%108 = load i8*, i8** %9
%109 = icmp ne i8* %108, null
br i1 %109, label %110, label %116
110: ; preds = %101
%111 = load i8*, i8** %9
%112 = load i8*, i8** %9
%113 = call i32 @strlen(i8* %112)
%114 = call i32 @write(i32 1, i8* %111, i32 %113)
%115 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %116
116: ; preds = %110, %101
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 2
%119 = load i8*, i8** %118
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 2
%122 = call i32 @execvp(i8* %119, i8** %121)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [56 x i8] c"Usage: sentclient host[:port[:key]] command [args ...]\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [17 x i8] c"unknown host %s\0A\00"
@.str.2 = [21 x i8] c"connecting to %s:%d\0A\00"
@.str.3 = [10 x i8] c"connect()\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.sockaddr_in
%4 = bitcast %struct.sockaddr_in* %3 to i8*
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i8* @strchr(i8* dereferenceable(1) %12, i8 signext 58)
%14 = icmp eq i8* %13, null
br i1 %14, label %24, label %15
15: ; preds = %10
store i8 0, i8* %13
%16 = getelementptr inbounds i8, i8* %13, i64 1
%17 = tail call i8* @strchr(i8* %16, i8 signext 58)
%18 = icmp eq i8* %17, null
br i1 %18, label %21, label %19
19: ; preds = %15
store i8 0, i8* %17
%20 = getelementptr inbounds i8, i8* %17, i64 1
br label %21
21: ; preds = %19, %15
%22 = phi i8* [ %20, %19 ], [ null, %15 ]
%23 = tail call i32 @atoi(i8* %16)
br label %24
24: ; preds = %10, %21
%25 = phi i8* [ %22, %21 ], [ null, %10 ]
%26 = phi i32 [ %23, %21 ], [ 50000, %10 ]
%27 = load i32, i32* @AF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = tail call i32 @socket(i32 %27, i32 %28, i32 0)
%30 = load i8*, i8** %11
%31 = tail call %struct.hostent* @gethostbyname(i8* %30)
%32 = icmp eq %struct.hostent* %31, null
br i1 %32, label %33, label %38
33: ; preds = %24
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %11
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = tail call i32 @exit(i32 1)
unreachable
38: ; preds = %24
%39 = call i32 @bzero(i8* %4, i32 12)
%40 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 2
%41 = load i32, i32* %40
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
%43 = bitcast i32* %42 to i8*
%44 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 1
%45 = load i32, i32* %44
%46 = call i32 @bcopy(i32 %41, i8* %43, i32 %45)
%47 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 0
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %48, i32* %49
%50 = call i32 @htons(i32 %26)
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %50, i32* %51
%52 = load i32, i32* @stderr
%53 = load i8*, i8** %11
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %53, i32 %26)
%55 = load i32, i32* @stderr
%56 = call i32 @fflush(i32 %55)
%57 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%58 = call i64 @connect(i32 %29, %struct.sockaddr* %57, i32 12)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %89
60: ; preds = %38
%61 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%62 = call i32 @sleep(i32 1)
%63 = call i64 @connect(i32 %29, %struct.sockaddr* %57, i32 12)
%64 = icmp slt i64 %63, 0
br i1 %64, label %65, label %89
65: ; preds = %60
%66 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%67 = call i32 @sleep(i32 1)
%68 = call i64 @connect(i32 %29, %struct.sockaddr* %57, i32 12)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %89
70: ; preds = %65
%71 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%72 = call i32 @sleep(i32 1)
%73 = call i64 @connect(i32 %29, %struct.sockaddr* %57, i32 12)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %89
75: ; preds = %70
%76 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%77 = call i32 @sleep(i32 1)
%78 = call i64 @connect(i32 %29, %struct.sockaddr* %57, i32 12)
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %89
80: ; preds = %75
%81 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%82 = call i32 @sleep(i32 1)
%83 = call i64 @connect(i32 %29, %struct.sockaddr* %57, i32 12)
%84 = icmp slt i64 %83, 0
br i1 %84, label %85, label %89
85: ; preds = %80
%86 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%87 = call i32 @sleep(i32 1)
%88 = call i32 @exit(i32 1)
unreachable
89: ; preds = %80, %75, %70, %65, %60, %38
%90 = call i32 @close(i32 0)
%91 = call i32 @close(i32 1)
%92 = call i32 @dup2(i32 %29, i32 0)
%93 = call i32 @dup2(i32 %29, i32 1)
%94 = icmp eq i8* %25, null
br i1 %94, label %99, label %95
95: ; preds = %89
%96 = call i32 @strlen(i8* %25)
%97 = call i32 @write(i32 1, i8* %25, i32 %96)
%98 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %99
99: ; preds = %95, %89
%100 = getelementptr inbounds i8*, i8** %1, i64 2
%101 = load i8*, i8** %100
%102 = call i32 @execvp(i8* %101, i8** %100)
ret i32 0
}