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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int STDOUT_FILENO;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ write(int, char *, int);
int main(int argc, char **argv) {
  int sd, msg_len;
  char message[1024] = "";
  struct sockaddr_in addr;
  struct hostent *hostent;
  if (argc <= 1) {
    printf("Usage: %s hostname <user1 user2 ...> \n", argv[0]);
    exit(0);
  }
  if (argc == 2) {
    strcpy(message, "\n");
  } else {
    int i;
    for (i = 2; i < argc; i++) {
      strcat(message, argv[i]);
      strcat(message, " ");
    }
    strcat(message, "\n");
  }
  if (!(hostent = gethostbyname(argv[1]))) {
    perror("Can't get host");
    exit(errno);
  };
  printf("Got the host just fine\n");
  addr.sin_family = AF_INET;
  addr.sin_port = htons(79);
  memcpy(&addr.sin_addr, hostent->h_addr, hostent->h_length);
  if ((sd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
    perror(" Can't open a socket");
    exit(errno);
  };
  if (connect(sd, (struct sockaddr *)&addr, sizeof(addr))) {
    perror("Can't connect to host");
    exit(errno);
  };
  printf("Successfully Connected to: %s\n", argv[1]);
  if (write(sd, message, strlen(message)) < 0) {
    perror("Failed writing to the socket");
    exit(errno);
  };
  memset(message, 0, 1024);
  msg_len = read(sd, message, 1024);
  if (msg_len < 0) {
    perror("Failed reading from the socket");
    exit(errno);
  };
  write(STDOUT_FILENO, message, msg_len);
  close(sd);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
cmpl   $0x1,-0x8(%rbp)
jg     1242 <main+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1264 <main+0x74>
lea    -0x420(%rbp),%rdi
lea    0xdcb(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12d2 <main+0xe2>
movl   $0x2,-0x43c(%rbp)
mov    -0x43c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12bf <main+0xcf>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x43c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10e0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    0xd81(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x43c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x43c(%rbp)
jmp    126e <main+0x7e>
lea    -0x420(%rbp),%rdi
lea    0xd58(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
jne    130a <main+0x11a>
lea    0xd32(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x428(%rbp)
mov    $0x4f,%edi
call   1060 <htons@plt>
mov    %eax,-0x42c(%rbp)
lea    -0x430(%rbp),%rdi
mov    -0x438(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x438(%rbp),%rax
mov    (%rax),%edx
call   10c0 <memcpy@plt>
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
mov    0x2c6a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1395 <main+0x1a5>
lea    0xcce(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c3a(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
cmp    $0x0,%rax
je     13cd <main+0x1dd>
lea    0xcab(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x44c(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x448(%rbp)
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x44c(%rbp),%edi
mov    -0x448(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
cmp    $0x0,%rax
jge    143e <main+0x24e>
lea    0xc6f(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b91(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   10a0 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    148c <main+0x29c>
lea    0xc3e(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    0x2b5d(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1040 <write@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x2b05(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x410,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0x10(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1090 <memset@plt>
cmp    $0x1,%ebx
jg     1242 <main+0x42>
mov    (%r14),%rsi
lea    0xdcc(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
cmp    $0x2,%ebx
jne    125a <main+0x5a>
lea    0xdd7(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    12a1 <main+0xa1>
mov    %ebx,%r12d
mov    $0x2,%ebx
lea    0x10(%rsp),%rbp
lea    0xdb9(%rip),%r15
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rsi
mov    %rbp,%rdi
call   10f0 <strcat@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   10f0 <strcat@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1270 <main+0x70>
lea    0xd8e(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10f0 <strcat@plt>
mov    0x8(%r14),%rdi
call   10c0 <gethostbyname@plt>
test   %rax,%rax
jne    12bb <main+0xbb>
lea    0xd73(%rip),%rdi
jmp    13a2 <main+0x1a2>
mov    %rax,%rbp
lea    0xdf9(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    $0x4f,%edi
call   1070 <htons@plt>
mov    %eax,0x4(%rsp)
mov    0x0(%rbp),%edx
mov    0x4(%rbp),%esi
mov    %rsp,%rdi
call   10d0 <memcpy@plt>
mov    0x2cc6(%rip),%rax
mov    (%rax),%edi
mov    0x2ccd(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
jns    131c <main+0x11c>
lea    0xd21(%rip),%rdi
jmp    13a2 <main+0x1a2>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   1110 <connect@plt>
test   %rax,%rax
jne    136b <main+0x16b>
mov    0x8(%r14),%rsi
lea    0xd26(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <write@plt>
test   %rax,%rax
jns    1374 <main+0x174>
lea    0xd19(%rip),%rdi
jmp    13a2 <main+0x1a2>
lea    0xcdb(%rip),%rdi
jmp    13a2 <main+0x1a2>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   10b0 <read@plt>
test   %eax,%eax
jns    13b5 <main+0x1b5>
lea    0xcfd(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    0x2c34(%rip),%rcx
mov    (%rcx),%edi
lea    0x10(%rsp),%rsi
mov    %eax,%edx
call   1050 <write@plt>
mov    %ebp,%edi
call   10a0 <close@plt>
mov    0x2be0(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [39 x i8] c"Usage: %s hostname <user1 user2 ...> \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [15 x i8] c"Can't get host\00"
@errno = global i32 0
@.str.4 = [24 x i8] c"Got the host just fine\0A\00"
@AF_INET = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [21 x i8] c" Can't open a socket\00"
@.str.6 = [22 x i8] c"Can't connect to host\00"
@.str.7 = [31 x i8] c"Successfully Connected to: %s\0A\00"
@.str.8 = [29 x i8] c"Failed writing to the socket\00"
@.str.9 = [31 x i8] c"Failed reading from the socket\00"
@STDOUT_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1024 x i8]
%9 = alloca %struct.sockaddr_in
%10 = alloca %struct.hostent*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [1024 x i8]* %8 to i8*
%13 = load i32, i32* %4
%14 = icmp sle i32 %13, 1
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %48
27: ; preds = %21
store i32 2, i32* %11
br label %28
28: ; preds = %42, %27
%29 = load i32, i32* %11
%30 = load i32, i32* %4
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %45
32: ; preds = %28
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%34 = load i8**, i8*** %5
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @strcat(i8* %33, i8* %38)
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%41 = call i32 @strcat(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %32
%43 = load i32, i32* %11
%44 = add nsw i32 %43, 1
store i32 %44, i32* %11
br label %28
45: ; preds = %28
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%47 = call i32 @strcat(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %48
48: ; preds = %45, %24
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call %struct.hostent* @gethostbyname(i8* %51)
store %struct.hostent* %52, %struct.hostent** %10
%53 = icmp ne %struct.hostent* %52, null
br i1 %53, label %58, label %54
54: ; preds = %48
%55 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%56 = load i32, i32* @errno
%57 = call i32 @exit(i32 %56)
unreachable
58: ; preds = %48
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%60 = load i32, i32* @AF_INET
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %60, i32* %61
%62 = call i32 @htons(i32 79)
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
store i32 %62, i32* %63
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%65 = load %struct.hostent*, %struct.hostent** %10
%66 = getelementptr inbounds %struct.hostent, %struct.hostent* %65, i32 0, i32 1
%67 = load i32, i32* %66
%68 = load %struct.hostent*, %struct.hostent** %10
%69 = getelementptr inbounds %struct.hostent, %struct.hostent* %68, i32 0, i32 0
%70 = load i32, i32* %69
%71 = call i32 @memcpy(i32* %64, i32 %67, i32 %70)
%72 = load i32, i32* @PF_INET
%73 = load i32, i32* @SOCK_STREAM
%74 = call i32 @socket(i32 %72, i32 %73, i32 0)
store i32 %74, i32* %6
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %58
%77 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%78 = load i32, i32* @errno
%79 = call i32 @exit(i32 %78)
unreachable
80: ; preds = %58
%81 = load i32, i32* %6
%82 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%83 = call i64 @connect(i32 %81, %struct.sockaddr* %82, i32 12)
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %89
85: ; preds = %80
%86 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%87 = load i32, i32* @errno
%88 = call i32 @exit(i32 %87)
unreachable
89: ; preds = %80
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 1
%92 = load i8*, i8** %91
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %92)
%94 = load i32, i32* %6
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%97 = call i32 @strlen(i8* %96)
%98 = call i64 @write(i32 %94, i8* %95, i32 %97)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %104
100: ; preds = %89
%101 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
%102 = load i32, i32* @errno
%103 = call i32 @exit(i32 %102)
unreachable
104: ; preds = %89
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%106 = call i32 @memset(i8* %105, i32 0, i32 1024)
%107 = load i32, i32* %6
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%109 = call i32 @read(i32 %107, i8* %108, i32 1024)
store i32 %109, i32* %7
%110 = load i32, i32* %7
%111 = icmp slt i32 %110, 0
br i1 %111, label %112, label %116
112: ; preds = %104
%113 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%114 = load i32, i32* @errno
%115 = call i32 @exit(i32 %114)
unreachable
116: ; preds = %104
%117 = load i32, i32* @STDOUT_FILENO
%118 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%119 = load i32, i32* %7
%120 = call i64 @write(i32 %117, i8* %118, i32 %119)
%121 = load i32, i32* %6
%122 = call i32 @close(i32 %121)
%123 = load i32, i32* @EXIT_SUCCESS
%124 = call i32 @exit(i32 %123)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [39 x i8] c"Usage: %s hostname <user1 user2 ...> \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [15 x i8] c"Can't get host\00"
@errno = global i32 0
@AF_INET = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [21 x i8] c" Can't open a socket\00"
@.str.6 = [22 x i8] c"Can't connect to host\00"
@.str.7 = [31 x i8] c"Successfully Connected to: %s\0A\00"
@.str.8 = [29 x i8] c"Failed writing to the socket\00"
@.str.9 = [31 x i8] c"Failed reading from the socket\00"
@STDOUT_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [23 x i8] c"Got the host just fine\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.sockaddr_in
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = bitcast %struct.sockaddr_in* %4 to i8*
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = icmp eq i32 %0, 2
br i1 %13, label %16, label %14
14: ; preds = %12
%15 = zext i32 %0 to i64
br label %18
16: ; preds = %12
%17 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %28
18: ; preds = %14, %18
%19 = phi i64 [ 2, %14 ], [ %24, %18 ]
%20 = getelementptr inbounds i8*, i8** %1, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @strcat(i8* %5, i8* %21)
%23 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = add nuw nsw i64 %19, 1
%25 = icmp eq i64 %24, %15
br i1 %25, label %26, label %18
26: ; preds = %18
%27 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %26, %16
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = call %struct.hostent* @gethostbyname(i8* %30)
%32 = icmp eq %struct.hostent* %31, null
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%35 = load i32, i32* @errno
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %28
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%39 = load i32, i32* @AF_INET
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %39, i32* %40
%41 = call i32 @htons(i32 79)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %41, i32* %42
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%44 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 1
%45 = load i32, i32* %44
%46 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 0
%47 = load i32, i32* %46
%48 = call i32 @memcpy(i32* %43, i32 %45, i32 %47)
%49 = load i32, i32* @PF_INET
%50 = load i32, i32* @SOCK_STREAM
%51 = call i32 @socket(i32 %49, i32 %50, i32 0)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %37
%54 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%55 = load i32, i32* @errno
%56 = call i32 @exit(i32 %55)
unreachable
57: ; preds = %37
%58 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%59 = call i64 @connect(i32 %51, %struct.sockaddr* %58, i32 12)
%60 = icmp eq i64 %59, 0
br i1 %60, label %65, label %61
61: ; preds = %57
%62 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%63 = load i32, i32* @errno
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %57
%66 = load i8*, i8** %29
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %66)
%68 = call i32 @strlen(i8* %5)
%69 = call i64 @write(i32 %51, i8* %5, i32 %68)
%70 = icmp slt i64 %69, 0
br i1 %70, label %71, label %75
71: ; preds = %65
%72 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
%73 = load i32, i32* @errno
%74 = call i32 @exit(i32 %73)
unreachable
75: ; preds = %65
%76 = call i32 @memset(i8* %5, i32 0, i32 1024)
%77 = call i32 @read(i32 %51, i8* %5, i32 1024)
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %83
79: ; preds = %75
%80 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%81 = load i32, i32* @errno
%82 = call i32 @exit(i32 %81)
unreachable
83: ; preds = %75
%84 = load i32, i32* @STDOUT_FILENO
%85 = call i64 @write(i32 %84, i8* %5, i32 %77)
%86 = call i32 @close(i32 %51)
%87 = load i32, i32* @EXIT_SUCCESS
%88 = call i32 @exit(i32 %87)
unreachable
}