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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int socketFileDescriptor, portNumber, resultNumber;
  struct sockaddr_in server_address;
  struct hostent *server;
  char buffer[256];
  if (argc < 3) {
    fprintf(stderr, "usage %s hostname port\n", argv[0]);
    exit(0);
  }
  portNumber = atoi(argv[2]);
  server = gethostbyname(argv[1]);
  socketFileDescriptor = socket(AF_INET, SOCK_STREAM, 0);
  if (socketFileDescriptor < 0) {
    perror("ERROR opening socket");
    exit(EXIT_FAILURE);
  }
  if (server == NULL) {
    fprintf(stderr, "ERROR, no such host\n");
    exit(EXIT_FAILURE);
  }
  bzero((char *)&server_address, sizeof(server_address));
  server_address.sin_family = AF_INET;
  bcopy((char *)server->h_addr, (char *)&server_address.sin_addr.s_addr,
        server->h_length);
  server_address.sin_port = htons(portNumber);
  if (connect(socketFileDescriptor, (struct sockaddr *)&server_address,
              sizeof(server_address)) < 0) {
    perror("ERROR connecting");
    exit(EXIT_FAILURE);
  }
  while (1) {
    printf("Please enter the message: ");
    bzero(buffer, 256);
    fgets(buffer, 255, stdin);
    if (strcmp("exit\n", buffer) == 0) {
      resultNumber = write(socketFileDescriptor, "^c\n", strlen(buffer));
      break;
    }
    resultNumber = write(socketFileDescriptor, buffer, strlen(buffer));
    if (resultNumber < 0) {
      perror("ERROR writing to socket");
      exit(EXIT_FAILURE);
    }
    bzero(buffer, 256);
    resultNumber = read(socketFileDescriptor, buffer, 255);
    if (resultNumber < 0) {
      perror("ERROR reading from socket");
      exit(EXIT_FAILURE);
    }
    printf("%s\n", buffer);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1248 <main+0x48>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc6(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
mov    0x2d4f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12a9 <main+0xa9>
lea    0xd82(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
cmpq   $0x0,-0x30(%rbp)
jne    12d9 <main+0xd9>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
lea    0xd69(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    0x2cfa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x28(%rbp),%rsi
add    $0x4,%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
call   10c0 <bcopy@plt>
mov    -0x18(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1110 <connect@plt>
cmp    $0x0,%rax
jge    134e <main+0x14e>
lea    0xd07(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
jmp    1353 <main+0x153>
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    $0x100,%esi
call   10e0 <bzero@plt>
lea    -0x130(%rbp),%rdi
mov    0x2c60(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1080 <fgets@plt>
lea    -0x130(%rbp),%rsi
lea    0xcd4(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    13da <main+0x1da>
mov    -0x14(%rbp),%eax
mov    %eax,-0x134(%rbp)
lea    -0x130(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x134(%rbp),%edi
mov    %eax,%edx
lea    0xca7(%rip),%rsi
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
jmp    149e <main+0x29e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x144(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x140(%rbp)
lea    -0x130(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x144(%rbp),%edi
mov    -0x140(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1438 <main+0x238>
lea    0xc53(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b8f(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    -0x130(%rbp),%rdi
mov    $0x100,%esi
call   10e0 <bzero@plt>
mov    -0x14(%rbp),%edi
lea    -0x130(%rbp),%rsi
mov    $0xff,%edx
call   1070 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1484 <main+0x284>
lea    0xc1f(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    -0x130(%rbp),%rsi
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x110,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jle    13eb <main+0x1db>
mov    0x10(%rbx),%rdi
call   1100 <atoi@plt>
mov    %eax,%r14d
mov    0x8(%rbx),%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,%rbx
mov    0x2d9e(%rip),%r12
mov    (%r12),%edi
mov    0x2d73(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
test   %eax,%eax
js     140c <main+0x1fc>
test   %rbx,%rbx
je     1415 <main+0x205>
mov    %eax,%ebp
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xc,%esi
call   10f0 <bzero@plt>
mov    (%r12),%eax
mov    %eax,0x8(%rsp)
mov    0x8(%rbx),%rsi
lea    0x4(%rsp),%rdi
mov    (%rbx),%edx
call   10d0 <memmove@plt>
mov    %r14d,%edi
call   1060 <htons@plt>
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
js     142e <main+0x21e>
lea    0xd90(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
mov    0x2cfd(%rip),%r12
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1090 <fgets@plt>
lea    0xd73(%rip),%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     139c <main+0x18c>
lea    0x10(%rsp),%rbx
lea    0xd3b(%rip),%r14
lea    0xd4f(%rip),%r15
nop
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %eax,%eax
js     13c8 <main+0x1b8>
mov    %rbx,%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xff,%edx
call   1080 <read@plt>
test   %eax,%eax
js     13d1 <main+0x1c1>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1090 <fgets@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1320 <main+0x110>
lea    0x10(%rsp),%rdi
call   1050 <strlen@plt>
lea    0xcc7(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
call   1040 <write@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xca9(%rip),%rdi
jmp    13d8 <main+0x1c8>
lea    0xcb8(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2bdc(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    0x2bde(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc02(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0xc05(%rip),%rdi
jmp    13d8 <main+0x1c8>
mov    0x2bb4(%rip),%rax
mov    (%rax),%edi
lea    0xc08(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    13dd <main+0x1cd>
lea    0xc0d(%rip),%rdi
jmp    13d8 <main+0x1c8>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"usage %s hostname port\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.3 = [17 x i8] c"ERROR connecting\00"
@.str.4 = [27 x i8] c"Please enter the message: \00"
@stdin = global i32 0
@.str.5 = [6 x i8] c"exit\0A\00"
@.str.6 = [4 x i8] c"^c\0A\00"
@.str.7 = [24 x i8] c"ERROR writing to socket\00"
@.str.8 = [26 x i8] c"ERROR reading from socket\00"
@.str.9 = [4 x i8] c"%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.hostent*
%11 = alloca [256 x i8]
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 %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %7
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call %struct.hostent* @gethostbyname(i8* %28)
store %struct.hostent* %29, %struct.hostent** %10
%30 = load i32, i32* @AF_INET
%31 = load i32, i32* @SOCK_STREAM
%32 = call i32 @socket(i32 %30, i32 %31, i32 0)
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %21
%36 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%37 = load i32, i32* @EXIT_FAILURE
%38 = call i32 @exit(i32 %37)
unreachable
39: ; preds = %21
%40 = load %struct.hostent*, %struct.hostent** %10
%41 = icmp eq %struct.hostent* %40, null
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %39
%48 = bitcast %struct.sockaddr_in* %9 to i8*
%49 = call i32 @bzero(i8* %48, i32 12)
%50 = load i32, i32* @AF_INET
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %50, i32* %51
%52 = load %struct.hostent*, %struct.hostent** %10
%53 = getelementptr inbounds %struct.hostent, %struct.hostent* %52, i32 0, i32 1
%54 = load i64, i64* %53
%55 = inttoptr i64 %54 to i8*
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%57 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %56, i32 0, i32 0
%58 = bitcast i32* %57 to i8*
%59 = load %struct.hostent*, %struct.hostent** %10
%60 = getelementptr inbounds %struct.hostent, %struct.hostent* %59, i32 0, i32 0
%61 = load i32, i32* %60
%62 = call i32 @bcopy(i8* %55, i8* %58, i32 %61)
%63 = load i32, i32* %7
%64 = call i32 @htons(i32 %63)
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i32 %64, i32* %65
%66 = load i32, i32* %6
%67 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%68 = call i64 @connect(i32 %66, %struct.sockaddr* %67, i32 12)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %47
%71 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%72 = load i32, i32* @EXIT_FAILURE
%73 = call i32 @exit(i32 %72)
unreachable
74: ; preds = %47
br label %75
75: ; preds = %74, %114
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%78 = call i32 @bzero(i8* %77, i32 256)
%79 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%80 = load i32, i32* @stdin
%81 = call i32 @fgets(i8* %79, i32 255, i32 %80)
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%83 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %82)
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %90
85: ; preds = %75
%86 = load i32, i32* %6
%87 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%88 = call i32 @strlen(i8* %87)
%89 = call i32 @write(i32 %86, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %88)
store i32 %89, i32* %8
br label %117
90: ; preds = %75
%91 = load i32, i32* %6
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%94 = call i32 @strlen(i8* %93)
%95 = call i32 @write(i32 %91, i8* %92, i32 %94)
store i32 %95, i32* %8
%96 = load i32, i32* %8
%97 = icmp slt i32 %96, 0
br i1 %97, label %98, label %102
98: ; preds = %90
%99 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%100 = load i32, i32* @EXIT_FAILURE
%101 = call i32 @exit(i32 %100)
unreachable
102: ; preds = %90
%103 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%104 = call i32 @bzero(i8* %103, i32 256)
%105 = load i32, i32* %6
%106 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%107 = call i32 @read(i32 %105, i8* %106, i32 255)
store i32 %107, i32* %8
%108 = load i32, i32* %8
%109 = icmp slt i32 %108, 0
br i1 %109, label %110, label %114
110: ; preds = %102
%111 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%112 = load i32, i32* @EXIT_FAILURE
%113 = call i32 @exit(i32 %112)
unreachable
114: ; preds = %102
%115 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %115)
br label %75
117: ; preds = %85
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"usage %s hostname port\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.3 = [17 x i8] c"ERROR connecting\00"
@.str.4 = [27 x i8] c"Please enter the message: \00"
@stdin = global i32 0
@.str.5 = [6 x i8] c"exit\0A\00"
@.str.6 = [4 x i8] c"^c\0A\00"
@.str.7 = [24 x i8] c"ERROR writing to socket\00"
@.str.8 = [26 x i8] c"ERROR reading from socket\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [256 x i8]
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call %struct.hostent* @gethostbyname(i8* %18)
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = tail call i32 @socket(i32 %20, i32 %21, i32 0)
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %13
%25 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @EXIT_FAILURE
%27 = tail call i32 @exit(i32 %26)
unreachable
28: ; preds = %13
%29 = icmp eq %struct.hostent* %19, null
br i1 %29, label %30, label %35
30: ; preds = %28
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = tail call i32 @exit(i32 %33)
unreachable
35: ; preds = %28
%36 = call i32 @bzero(i8* %5, i32 12)
%37 = load i32, i32* @AF_INET
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %37, i32* %38
%39 = getelementptr inbounds %struct.hostent, %struct.hostent* %19, i64 0, i32 1
%40 = load i64, i64* %39
%41 = inttoptr i64 %40 to i8*
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%43 = bitcast i32* %42 to i8*
%44 = getelementptr inbounds %struct.hostent, %struct.hostent* %19, i64 0, i32 0
%45 = load i32, i32* %44
%46 = tail call i32 @htons(i32 %16)
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %46, i32* %47
%48 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%49 = call i64 @connect(i32 %22, %struct.sockaddr* %48, i32 12)
%50 = icmp slt i64 %49, 0
br i1 %50, label %58, label %51
51: ; preds = %35
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%53 = call i32 @bzero(i8* %6, i32 256)
%54 = load i32, i32* @stdin
%55 = call i32 @fgets(i8* %6, i32 255, i32 %54)
%56 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%57 = icmp eq i64 %56, 0
br i1 %57, label %62, label %65
58: ; preds = %35
%59 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%60 = load i32, i32* @EXIT_FAILURE
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %81, %51
%63 = call i32 @strlen(i8* %6)
%64 = call i32 @write(i32 %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %63)
ret i32 0
65: ; preds = %51, %81
%66 = call i32 @strlen(i8* %6)
%67 = call i32 @write(i32 %22, i8* %6, i32 %66)
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %65
%70 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%71 = load i32, i32* @EXIT_FAILURE
%72 = call i32 @exit(i32 %71)
unreachable
73: ; preds = %65
%74 = call i32 @bzero(i8* %6, i32 256)
%75 = call i32 @read(i32 %22, i8* %6, i32 255)
%76 = icmp slt i32 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %73
%78 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%79 = load i32, i32* @EXIT_FAILURE
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %73
%82 = call i32 @puts(i8* %6)
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%84 = call i32 @bzero(i8* %6, i32 256)
%85 = load i32, i32* @stdin
%86 = call i32 @fgets(i8* %6, i32 255, i32 %85)
%87 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%88 = icmp eq i64 %87, 0
br i1 %88, label %62, label %65
}