#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_FAILURE;
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*/);
int /*<<< orphan*/ fgets(char *, int, 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*/ stdin;
int strlen(int /*<<< orphan*/);
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 < 2) {
    printf("USAGE: %s host\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if ((sd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
    perror(" Can't open a socket");
    exit(errno);
  };
  printf("Opened the socket just fine\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(7);
  memcpy(&addr.sin_addr, hostent->h_addr, hostent->h_length);
  if (connect(sd, (struct sockaddr *)&addr, sizeof(addr))) {
    perror("Can't connect to host");
    exit(errno);
  };
  printf("Connected to the host just fine\n");
  printf("\nType in a message to send to %s\n\n", argv[1]);
  msg_len = strlen(fgets(message, 1024, stdin));
  if (write(sd, message, msg_len) < 0) {
    perror("Failed writing to the socket");
    exit(errno);
  };
  memset(message, 0, 1024);
  printf("\nCleared the message, am going to read it back from the socket\n\n");
  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(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1226 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1265 <main+0x85>
lea    0xdbe(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
jne    12ab <main+0xcb>
lea    0xdaa(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x428(%rbp)
mov    $0x7,%edi
call   1050 <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    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
cmp    $0x0,%rax
je     132f <main+0x14f>
lea    0xd4d(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x420(%rbp),%rdi
mov    0x2c77(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   10a0 <fgets@plt>
mov    %eax,%edi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jge    13ad <main+0x1cd>
lea    0xd29(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
lea    0xd19(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1090 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1409 <main+0x229>
lea    0xd2b(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2be0(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x410,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1222 <main+0x32>
mov    (%rbx),%rsi
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    0x2d96(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
jns    124b <main+0x5b>
lea    0xdca(%rip),%rdi
jmp    1363 <main+0x173>
mov    %eax,%r14d
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
call   10c0 <gethostbyname@plt>
test   %rax,%rax
jne    1274 <main+0x84>
lea    0xdb6(%rip),%rdi
jmp    1363 <main+0x173>
mov    %rax,%rbp
lea    0xe47(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d56(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    $0x7,%edi
call   1060 <htons@plt>
mov    %eax,0x4(%rsp)
mov    0x0(%rbp),%edx
mov    0x4(%rbp),%esi
mov    %rsp,%rbp
mov    %rbp,%rdi
call   10d0 <memcpy@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
test   %rax,%rax
jne    131f <main+0x12f>
lea    0xe11(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rsi
lea    0xd6f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   10b0 <fgets@plt>
mov    %eax,%edi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %rax,%rax
jns    1328 <main+0x138>
lea    0xd50(%rip),%rdi
jmp    1363 <main+0x173>
lea    0xd0e(%rip),%rdi
jmp    1363 <main+0x173>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    0xdb9(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   10a0 <read@plt>
test   %eax,%eax
jns    1376 <main+0x186>
lea    0xd27(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    0x2c73(%rip),%rcx
mov    (%rcx),%edi
lea    0x10(%rsp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r14d,%edi
call   1090 <close@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [16 x i8] c"USAGE: %s host\0A\00"
@EXIT_FAILURE = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c" Can't open a socket\00"
@errno = global i32 0
@.str.2 = [29 x i8] c"Opened the socket just fine\0A\00"
@.str.3 = [15 x i8] c"Can't get host\00"
@.str.4 = [24 x i8] c"Got the host just fine\0A\00"
@AF_INET = global i32 0
@.str.5 = [22 x i8] c"Can't connect to host\00"
@.str.6 = [33 x i8] c"Connected to the host just fine\0A\00"
@.str.7 = [35 x i8] c"\0AType in a message to send to %s\0A\0A\00"
@stdin = global i32 0
@.str.8 = [29 x i8] c"Failed writing to the socket\00"
@.str.9 = [65 x i8] c"\0ACleared the message, am going to read it back from the socket\0A\0A\00"
@.str.10 = [31 x i8] c"Failed reading from the socket\00"
@STDOUT_FILENO = 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*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
%21 = load i32, i32* @PF_INET
%22 = load i32, i32* @SOCK_STREAM
%23 = call i32 @socket(i32 %21, i32 %22, i32 0)
store i32 %23, i32* %6
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* @errno
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %20
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call %struct.hostent* @gethostbyname(i8* %33)
store %struct.hostent* %34, %struct.hostent** %10
%35 = icmp ne %struct.hostent* %34, null
br i1 %35, label %40, label %36
36: ; preds = %29
%37 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%38 = load i32, i32* @errno
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %29
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%42 = load i32, i32* @AF_INET
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %42, i32* %43
%44 = call i32 @htons(i32 7)
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
store i32 %44, i32* %45
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%47 = load %struct.hostent*, %struct.hostent** %10
%48 = getelementptr inbounds %struct.hostent, %struct.hostent* %47, i32 0, i32 1
%49 = load i32, i32* %48
%50 = load %struct.hostent*, %struct.hostent** %10
%51 = getelementptr inbounds %struct.hostent, %struct.hostent* %50, i32 0, i32 0
%52 = load i32, i32* %51
%53 = call i32 @memcpy(i32* %46, i32 %49, i32 %52)
%54 = load i32, i32* %6
%55 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%56 = call i64 @connect(i32 %54, %struct.sockaddr* %55, i32 12)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %40
%59 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%60 = load i32, i32* @errno
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %40
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %66)
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%69 = load i32, i32* @stdin
%70 = call i32 @fgets(i8* %68, i32 1024, i32 %69)
%71 = call i32 @strlen(i32 %70)
store i32 %71, i32* %7
%72 = load i32, i32* %6
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%74 = load i32, i32* %7
%75 = call i64 @write(i32 %72, i8* %73, i32 %74)
%76 = icmp slt i64 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %62
%78 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
%79 = load i32, i32* @errno
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %62
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%83 = call i32 @memset(i8* %82, i32 0, i32 1024)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
%85 = load i32, i32* %6
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%87 = call i32 @read(i32 %85, i8* %86, i32 1024)
store i32 %87, i32* %7
%88 = load i32, i32* %7
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %81
%91 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%92 = load i32, i32* @errno
%93 = call i32 @exit(i32 %92)
unreachable
94: ; preds = %81
%95 = load i32, i32* @STDOUT_FILENO
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%97 = load i32, i32* %7
%98 = call i64 @write(i32 %95, i8* %96, i32 %97)
%99 = load i32, i32* %6
%100 = call i32 @close(i32 %99)
%101 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [16 x i8] c"USAGE: %s host\0A\00"
@EXIT_FAILURE = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c" Can't open a socket\00"
@errno = global i32 0
@.str.3 = [15 x i8] c"Can't get host\00"
@AF_INET = global i32 0
@.str.5 = [22 x i8] c"Can't connect to host\00"
@.str.7 = [35 x i8] c"\0AType in a message to send to %s\0A\0A\00"
@stdin = global i32 0
@.str.8 = [29 x i8] c"Failed writing to the socket\00"
@.str.10 = [31 x i8] c"Failed reading from the socket\00"
@STDOUT_FILENO = global i32 0
@str = [28 x i8] c"Opened the socket just fine\00"
@str.11 = [23 x i8] c"Got the host just fine\00"
@str.12 = [32 x i8] c"Connected to the host just fine\00"
@str.13 = [64 x i8] c"\0ACleared the message, am going to read it back from the socket\0A\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 %13
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* @PF_INET
%15 = load i32, i32* @SOCK_STREAM
%16 = tail call i32 @socket(i32 %14, i32 %15, i32 0)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @errno
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %13
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = load i8*, i8** %24
%26 = tail call %struct.hostent* @gethostbyname(i8* %25)
%27 = icmp eq %struct.hostent* %26, null
br i1 %27, label %28, label %32
28: ; preds = %22
%29 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* @errno
%31 = tail call i32 @exit(i32 %30)
unreachable
32: ; preds = %22
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
%34 = load i32, i32* @AF_INET
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %34, i32* %35
%36 = tail call i32 @htons(i32 7)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %36, i32* %37
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%39 = getelementptr inbounds %struct.hostent, %struct.hostent* %26, i64 0, i32 1
%40 = load i32, i32* %39
%41 = getelementptr inbounds %struct.hostent, %struct.hostent* %26, i64 0, i32 0
%42 = load i32, i32* %41
%43 = call i32 @memcpy(i32* %38, i32 %40, i32 %42)
%44 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%45 = call i64 @connect(i32 %16, %struct.sockaddr* %44, i32 12)
%46 = icmp eq i64 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %32
%48 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%49 = load i32, i32* @errno
%50 = call i32 @exit(i32 %49)
unreachable
51: ; preds = %32
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.12, i64 0, i64 0))
%53 = load i8*, i8** %24
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %53)
%55 = load i32, i32* @stdin
%56 = call i32 @fgets(i8* %5, i32 1024, i32 %55)
%57 = call i32 @strlen(i32 %56)
%58 = call i64 @write(i32 %16, i8* %5, i32 %57)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %51
%61 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
%62 = load i32, i32* @errno
%63 = call i32 @exit(i32 %62)
unreachable
64: ; preds = %51
%65 = call i32 @memset(i8* %5, i32 0, i32 1024)
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.13, i64 0, i64 0))
%67 = call i32 @read(i32 %16, i8* %5, i32 1024)
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %64
%70 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%71 = load i32, i32* @errno
%72 = call i32 @exit(i32 %71)
unreachable
73: ; preds = %64
%74 = load i32, i32* @STDOUT_FILENO
%75 = call i64 @write(i32 %74, i8* %5, i32 %67)
%76 = call i32 @close(i32 %16)
%77 = call i32 @exit(i32 0)
unreachable
}