#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;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_aton(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char *argv[]) {
  int BUF_SIZE = 1024;
  char *ip_addr;
  int port;
  int sockfd;
  struct sockaddr_in server_addr;
  int recv_size, read_size, sent_size;
  char buffer[BUF_SIZE + 1];
  if (argc != 3) {
    fprintf(stderr, "usage: tcp_client ip port\n");
    exit(1);
  }
  ip_addr = argv[1];
  port = atoi(argv[2]);
  if (port <= 0) {
    fprintf(stderr, "error: invalid port\n");
    exit(1);
  }
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("socket");
    exit(1);
  }
  server_addr.sin_family = AF_INET;
  server_addr.sin_port = htons(port);
  inet_aton(ip_addr, &server_addr.sin_addr);
  if (connect(sockfd, (struct sockaddr *)&server_addr,
              sizeof(struct sockaddr)) == -1) {
    perror("connect");
    exit(1);
  }
  while (1) {
    printf("Data to send (Ctrl+D quits): ");
    if (fgets(buffer, BUF_SIZE, stdin) == NULL) {
      close(sockfd);
      if (errno != 0) {
        perror("fgets");
      }
      exit(1);
    }
    read_size = strlen(buffer);
    if ((sent_size = send(sockfd, buffer, read_size, 0)) == -1) {
      close(sockfd);
      perror("send");
      exit(1);
    }
    if ((recv_size = recv(sockfd, buffer, BUF_SIZE, 0)) == 0) {
      close(sockfd);
      if (errno != 0) {
        perror("recv");
        exit(1);
      }
      break;
    }
    buffer[recv_size] = '\0';
    printf("Answer: %s", buffer);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x400,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     124f <main+0x6f>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
lea    0xdc0(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     1294 <main+0xb4>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
lea    0xd96(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
mov    0x2d24(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
jne    12cf <main+0xef>
lea    0xd70(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   10b0 <inet_aton@plt>
mov    -0x28(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   10f0 <connect@plt>
cmp    $0xffffffff,%eax
jne    1323 <main+0x143>
lea    0xd23(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    1328 <main+0x148>
jmp    132d <main+0x14d>
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x60(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2c97(%rip),%rax
mov    (%rax),%edx
call   1090 <fgets@plt>
cmp    $0x0,%rax
jne    1389 <main+0x1a9>
mov    -0x28(%rbp),%edi
call   1080 <close@plt>
mov    0x2c57(%rip),%rax
cmpq   $0x0,(%rax)
je     137f <main+0x19f>
lea    0xce3(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x60(%rbp),%rsi
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x40(%rbp),%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0x44(%rbp)
cmp    $0xffffffff,%eax
jne    13d0 <main+0x1f0>
mov    -0x28(%rbp),%edi
call   1080 <close@plt>
lea    0xca2(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x60(%rbp),%rsi
mov    -0x28(%rbp),%edi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jne    1421 <main+0x241>
mov    -0x28(%rbp),%edi
call   1080 <close@plt>
mov    0x2bc4(%rip),%rax
cmpq   $0x0,(%rax)
je     141c <main+0x23c>
lea    0xc5b(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    1440 <main+0x260>
mov    -0x60(%rbp),%rsi
movslq -0x3c(%rbp),%rax
movb   $0x0,(%rsi,%rax,1)
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1328 <main+0x148>
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
cmp    $0x3,%edi
jne    139a <main+0x1ba>
mov    %rsp,%r12
mov    0x8(%rsi),%r14
mov    0x10(%rsi),%rdi
call   10d0 <atoi@plt>
test   %eax,%eax
jle    13ac <main+0x1cc>
mov    %eax,%ebx
mov    0x2dcd(%rip),%r15
mov    (%r15),%edi
mov    0x2da3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     13cb <main+0x1eb>
mov    %eax,%ebp
mov    (%r15),%eax
mov    %eax,0x8(%rsp)
mov    %ebx,%edi
call   1050 <htons@plt>
mov    %eax,0x4(%rsp)
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   10b0 <inet_aton@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   10f0 <connect@plt>
cmp    $0xffffffff,%eax
je     13d4 <main+0x1f4>
lea    0xdc7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d5a(%rip),%r13
mov    0x0(%r13),%edx
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1328 <main+0x148>
lea    0x10(%rsp),%rbx
lea    0xdbf(%rip),%r14
lea    0xd8a(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
je     137d <main+0x19d>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     1352 <main+0x172>
cltq
movb   $0x0,0x10(%rsp,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1090 <fgets@plt>
test   %rax,%rax
jne    12c0 <main+0xe0>
mov    %ebp,%edi
call   1080 <close@plt>
mov    0x2c8a(%rip),%rax
cmpq   $0x0,(%rax)
je     1348 <main+0x168>
lea    0xd1a(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    %ebp,%edi
call   1080 <close@plt>
mov    0x2c60(%rip),%rax
cmpq   $0x0,(%rax)
jne    13dd <main+0x1fd>
mov    %r12,%rsp
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%edi
call   1080 <close@plt>
lea    0xcd8(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
lea    0xc56(%rip),%rsi
jmp    13bc <main+0x1dc>
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
lea    0xc5f(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xc5e(%rip),%rdi
jmp    138b <main+0x1ab>
lea    0xc5c(%rip),%rdi
jmp    138b <main+0x1ab>
lea    0xc84(%rip),%rdi
jmp    138b <main+0x1ab>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [27 x i8] c"usage: tcp_client ip port\0A\00"
@.str.1 = [21 x i8] c"error: invalid port\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.4 = [30 x i8] c"Data to send (Ctrl+D quits): \00"
@stdin = global i32 0
@errno = global i64 0
@.str.5 = [6 x i8] c"fgets\00"
@.str.6 = [5 x i8] c"send\00"
@.str.7 = [5 x i8] c"recv\00"
@.str.8 = [11 x i8] c"Answer: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1024, i32* %6
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %14
%20 = alloca i8, i64 %18
store i64 %18, i64* %15
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 3
br i1 %22, label %23, label %27
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
store i8* %30, i8** %7
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = icmp sle i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %27
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %27
%42 = load i32, i32* @AF_INET
%43 = load i32, i32* @SOCK_STREAM
%44 = call i32 @socket(i32 %42, i32 %43, i32 0)
store i32 %44, i32* %9
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %41
%50 = load i32, i32* @AF_INET
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %50, i32* %51
%52 = load i32, i32* %8
%53 = call i32 @htons(i32 %52)
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %53, i32* %54
%55 = load i8*, i8** %7
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%57 = call i32 @inet_aton(i8* %55, i32* %56)
%58 = load i32, i32* %9
%59 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%60 = call i32 @connect(i32 %58, %struct.sockaddr* %59, i32 4)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %65
62: ; preds = %49
%63 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %49
br label %66
66: ; preds = %107, %65
br label %67
67: ; preds = %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%69 = load i32, i32* %6
%70 = load i32, i32* @stdin
%71 = call i32* @fgets(i8* %20, i32 %69, i32 %70)
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %82
73: ; preds = %67
%74 = load i32, i32* %9
%75 = call i32 @close(i32 %74)
%76 = load i64, i64* @errno
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %73
%79 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %80
80: ; preds = %78, %73
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %67
%83 = call i32 @strlen(i8* %20)
store i32 %83, i32* %12
%84 = load i32, i32* %9
%85 = load i32, i32* %12
%86 = call i32 @send(i32 %84, i8* %20, i32 %85, i32 0)
store i32 %86, i32* %13
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %93
88: ; preds = %82
%89 = load i32, i32* %9
%90 = call i32 @close(i32 %89)
%91 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %82
%94 = load i32, i32* %9
%95 = load i32, i32* %6
%96 = call i32 @recv(i32 %94, i8* %20, i32 %95, i32 0)
store i32 %96, i32* %11
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %107
98: ; preds = %93
%99 = load i32, i32* %9
%100 = call i32 @close(i32 %99)
%101 = load i64, i64* @errno
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %98
%104 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%105 = call i32 @exit(i32 1)
unreachable
106: ; preds = %98
br label %112
107: ; preds = %93
%108 = load i32, i32* %11
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %20, i64 %109
store i8 0, i8* %110
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %20)
br label %66
112: ; preds = %106
%113 = load i8*, i8** %14
%114 = load i32, i32* %3
ret i32 %114
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [27 x i8] c"usage: tcp_client ip port\0A\00"
@.str.1 = [21 x i8] c"error: invalid port\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.4 = [30 x i8] c"Data to send (Ctrl+D quits): \00"
@stdin = global i32 0
@errno = global i64 0
@.str.5 = [6 x i8] c"fgets\00"
@.str.6 = [5 x i8] c"send\00"
@.str.7 = [5 x i8] c"recv\00"
@.str.8 = [11 x i8] c"Answer: %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = bitcast %struct.sockaddr_in* %3 to i8*
%5 = tail call i8* @llvm.stacksave()
%6 = alloca [1025 x i8]
%7 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 0
%8 = icmp eq i32 %0, 3
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = icmp slt i32 %18, 1
br i1 %19, label %20, label %24
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %13
%25 = load i32, i32* @AF_INET
%26 = load i32, i32* @SOCK_STREAM
%27 = tail call i32 @socket(i32 %25, i32 %26, i32 0)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%31 = tail call i32 @exit(i32 1)
unreachable
32: ; preds = %24
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %33, i32* %34
%35 = tail call i32 @htons(i32 %18)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %35, i32* %36
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%38 = call i32 @inet_aton(i8* %15, i32* %37)
%39 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%40 = call i32 @connect(i32 %27, %struct.sockaddr* %39, i32 4)
%41 = icmp eq i32 %40, -1
br i1 %41, label %47, label %42
42: ; preds = %32
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%44 = load i32, i32* @stdin
%45 = call i32* @fgets(i8* %7, i32 1024, i32 %44)
%46 = icmp eq i32* %45, null
br i1 %46, label %50, label %58
47: ; preds = %32
%48 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %76, %42
%51 = call i32 @close(i32 %27)
%52 = load i64, i64* @errno
%53 = icmp eq i64 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %50
%55 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %42, %76
%59 = call i32 @strlen(i8* %7)
%60 = call i32 @send(i32 %27, i8* %7, i32 %59, i32 0)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %66
62: ; preds = %58
%63 = call i32 @close(i32 %27)
%64 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58
%67 = call i32 @recv(i32 %27, i8* %7, i32 1024, i32 0)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %66
%70 = call i32 @close(i32 %27)
%71 = load i64, i64* @errno
%72 = icmp eq i64 %71, 0
br i1 %72, label %84, label %73
73: ; preds = %69
%74 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %66
%77 = sext i32 %67 to i64
%78 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 %77
store i8 0, i8* %78
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %7)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%81 = load i32, i32* @stdin
%82 = call i32* @fgets(i8* %7, i32 1024, i32 %81)
%83 = icmp eq i32* %82, null
br i1 %83, label %50, label %58
84: ; preds = %69
ret i32 0
}