#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 hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ server_addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
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_in *, int);
int /*<<< orphan*/ error(char *);
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*/ printf(char *, ...);
int /*<<< orphan*/ shutdown(int, 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 /*<<< orphan*/ strtok(char *, char *);
int write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int sockfd, port, n;
  struct sockaddr_in server_addr;
  struct hostent *server;
  char buffer[256];
  if (argc < 3) {
    fprintf(stderr, "Usage: %s hostname port\n", argv[0]);
    exit(0);
  }
  port = atoi(argv[2]);
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd < 0) {
    error("ERROR opening socket");
  }
  server = gethostbyname(argv[1]);
  if (server == NULL) {
    fprintf(stderr, "ERROR, no such host\n");
  }
  bzero((char *)&server_addr, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  bcopy((char *)server->h_addr, (char *)&server_addr.sin_addr.s_addr,
        server->h_length);
  server_addr.sin_port = htons(port);
  if (connect(sockfd, &server_addr, sizeof(server_addr)) < 0) {
    error("ERROR connecting");
  }
  char nickname[256];
  bzero(nickname, 256);
  printf("Nickname = ");
  fgets(nickname, 255, stdin);
  n = write(sockfd, nickname, strlen(nickname));
  strtok(nickname, "\n");
  while (1) {
    bzero(buffer, 256);
    printf("<%s> ", nickname);
    fgets(buffer, 255, stdin);
    if (strcmp(buffer, "--EXIT--\n") == 0) {
      n = write(sockfd, buffer, strlen(buffer));
      break;
    }
    n = write(sockfd, buffer, strlen(buffer));
    if (n < 0) {
      error("ERROR writing to socket");
    }
  }
  shutdown(sockfd, 2);
  printf("Connection closed.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1258 <main+0x48>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
mov    0x2d50(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    129a <main+0x8a>
lea    0xd84(%rip),%rdi
call   10d0 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12cd <main+0xbd>
mov    0x2d13(%rip),%rax
mov    (%rax),%edi
lea    0xd68(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   10f0 <bzero@plt>
mov    0x2d06(%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   1060 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0x0,%rax
jge    1334 <main+0x124>
lea    0xd14(%rip),%rdi
call   10d0 <error@plt>
lea    -0x230(%rbp),%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x230(%rbp),%rdi
mov    0x2c7f(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1080 <fgets@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x23c(%rbp)
lea    -0x230(%rbp),%rax
mov    %rax,-0x238(%rbp)
lea    -0x230(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x23c(%rbp),%edi
mov    -0x238(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x230(%rbp),%rdi
lea    0xcb9(%rip),%rsi
call   10e0 <strtok@plt>
lea    -0x130(%rbp),%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
lea    -0x230(%rbp),%rsi
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    0x2bf2(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1080 <fgets@plt>
lea    -0x130(%rbp),%rdi
lea    0xc5e(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1456 <main+0x246>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24c(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x248(%rbp)
lea    -0x130(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x24c(%rbp),%edi
mov    -0x248(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
jmp    14ab <main+0x29b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x25c(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x258(%rbp)
lea    -0x130(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x25c(%rbp),%edi
mov    -0x258(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    14a6 <main+0x296>
lea    0xbcf(%rip),%rdi
call   10d0 <error@plt>
jmp    13ba <main+0x1aa>
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
call   1040 <shutdown@plt>
lea    0xbc9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jle    1468 <main+0x248>
mov    0x10(%rbx),%rdi
call   1110 <atoi@plt>
mov    %eax,%r14d
mov    0x2d98(%rip),%r12
mov    (%r12),%edi
mov    0x2d6d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    1277 <main+0x57>
lea    0xda7(%rip),%rdi
call   10e0 <error@plt>
mov    0x8(%rbx),%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    129f <main+0x7f>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
lea    0xd96(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0xc,%esi
call   1100 <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   1070 <htons@plt>
mov    %eax,(%rsp)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
test   %rax,%rax
jns    12f3 <main+0xd3>
lea    0xd55(%rip),%rdi
call   10e0 <error@plt>
lea    0x110(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1100 <bzero@plt>
lea    0xd45(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2cc3(%rip),%r14
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1090 <fgets@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xd25(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <strtok@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x100,%esi
call   1100 <bzero@plt>
lea    0xcf6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%r14),%edx
mov    %rbp,%rdi
mov    $0xff,%esi
call   1090 <fgets@plt>
lea    0xcdb(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1421 <main+0x201>
lea    0x10(%rsp),%rbp
lea    0xcb8(%rip),%r12
lea    0x110(%rsp),%r13
lea    0xcaf(%rip),%rbx
jmp    13fa <main+0x1da>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    $0x100,%esi
call   1100 <bzero@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%r14),%edx
mov    %rbp,%rdi
mov    $0xff,%esi
call   1090 <fgets@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1421 <main+0x201>
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %eax,%eax
jns    13c0 <main+0x1a0>
lea    0xc56(%rip),%rdi
call   10e0 <error@plt>
jmp    13c0 <main+0x1a0>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r15d,%edi
mov    $0x2,%esi
call   1050 <shutdown@plt>
lea    0xc39(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b61(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xb85(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
xor    %edi,%edi
call   1120 <exit@plt>

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