#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;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ send(int, char *, scalar_t__, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  struct sockaddr_in addr;
  socklen_t addrlen;
  int sk;
  char buf[512];
  int len;
  if (argc != 2) {
    printf("Usage: echoc <ip>\nEx.:   echoc 10.30.0.2\n");
    exit(0);
  }
  if ((sk = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("socket");
    exit(1);
  }
  memset(&addr, 0, sizeof(addr));
  addr.sin_family = AF_INET;
  addr.sin_addr.s_addr = inet_addr(argv[1]);
  addr.sin_port = htons(1996);
  if (connect(sk, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
    perror("connect");
    exit(1);
  }
  printf("Connected to Echo server. Type /q to quit.\n");
  while (1) {
    printf("> ");
    fgets(buf, 512, stdin);
    if (strlen(buf) == 0)
      continue;
    if (strcmp(buf, "/q") == 0)
      break;
    if (send(sk, buf, strlen(buf), 0) < 0) {
      perror("send");
      exit(1);
    }
    len = recv(sk, buf, 512, 0);
    if (len < 0) {
      perror("recv");
      exit(1);
    } else if (len == 0) {
      printf("Remote host has closed the connection\n");
      exit(1);
    }
    buf[len] = '\0';
    printf("<< %s\n", buf);
  }
  sprintf(buf, "/q");
  if (send(sk, buf, strlen(buf), 0) < 0) {
    perror("send");
    exit(1);
  }
  close(sk);
  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   $0x2,-0x8(%rbp)
je     1228 <main+0x38>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jge    1263 <main+0x73>
lea    0xdd6(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <inet_addr@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x7cc,%edi
call   1050 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
cmp    $0x0,%rax
jge    12cd <main+0xdd>
lea    0xd73(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x230(%rbp),%rdi
mov    0x2ce9(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   10a0 <fgets@plt>
lea    -0x230(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jne    131e <main+0x12e>
jmp    12db <main+0xeb>
lea    -0x230(%rbp),%rdi
lea    0xd3c(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1340 <main+0x150>
jmp    142c <main+0x23c>
mov    -0x28(%rbp),%eax
mov    %eax,-0x244(%rbp)
lea    -0x230(%rbp),%rax
mov    %rax,-0x240(%rbp)
lea    -0x230(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x244(%rbp),%edi
mov    -0x240(%rbp),%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    139a <main+0x1aa>
lea    0xce0(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%edi
lea    -0x230(%rbp),%rsi
mov    $0x200,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x234(%rbp)
cmpl   $0x0,-0x234(%rbp)
jge    13d9 <main+0x1e9>
lea    0xca6(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpl   $0x0,-0x234(%rbp)
jne    13fe <main+0x20e>
lea    0xc88(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    1403 <main+0x213>
movslq -0x234(%rbp),%rax
movb   $0x0,-0x230(%rbp,%rax,1)
lea    -0x230(%rbp),%rsi
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12db <main+0xeb>
lea    -0x230(%rbp),%rdi
lea    0xc2e(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x254(%rbp)
lea    -0x230(%rbp),%rax
mov    %rax,-0x250(%rbp)
lea    -0x230(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x254(%rbp),%edi
mov    -0x250(%rbp),%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    1499 <main+0x2a9>
lea    0xbe1(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@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
cmp    $0x2,%edi
jne    13a8 <main+0x1b8>
mov    %rsi,%rbx
mov    0x2dd4(%rip),%r15
mov    (%r15),%edi
mov    0x2db2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     13bb <main+0x1cb>
mov    %eax,%ebp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    (%r15),%eax
mov    %eax,0x8(%rsp)
mov    0x8(%rbx),%rdi
call   10c0 <inet_addr@plt>
mov    %eax,0x4(%rsp)
mov    $0x7cc,%edi
call   1060 <htons@plt>
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
test   %rax,%rax
js     13c4 <main+0x1d4>
lea    0xda3(%rip),%rdi
call   1040 <puts@plt>
lea    0xd80(%rip),%r14
mov    0x2d4a(%rip),%r13
lea    0x10(%rsp),%rbx
lea    0xd70(%rip),%r15
lea    0xd76(%rip),%r12
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x200,%esi
call   10b0 <fgets@plt>
cmpb   $0x0,0x10(%rsp)
je     12b0 <main+0xc0>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     132b <main+0x13b>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %rax,%rax
js     1373 <main+0x183>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x200,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     137c <main+0x18c>
je     1392 <main+0x1a2>
mov    %eax,%eax
movb   $0x0,0x10(%rsp,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    12b0 <main+0xc0>
movb   $0x0,0x12(%rsp)
movw   $0x712f,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %rax,%rax
js     1373 <main+0x183>
mov    %ebp,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc9b(%rip),%rdi
jmp    1383 <main+0x193>
lea    0xc97(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xcb8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xcc8(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
lea    0xc3e(%rip),%rdi
jmp    1383 <main+0x193>
lea    0xc3c(%rip),%rdi
jmp    1383 <main+0x193>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [42 x i8] c"Usage: echoc <ip>\0AEx.: echoc 10.30.0.2\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@.str.2 = [8 x i8] c"connect\00"
@.str.3 = [44 x i8] c"Connected to Echo server. Type /q to quit.\0A\00"
@.str.4 = [3 x i8] c"> \00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"/q\00"
@.str.6 = [5 x i8] c"send\00"
@.str.7 = [5 x i8] c"recv\00"
@.str.8 = [39 x i8] c"Remote host has closed the connection\0A\00"
@.str.9 = [7 x i8] c"<< %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = alloca i32
%9 = alloca [512 x i8]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %2
%17 = load i32, i32* @AF_INET
%18 = load i32, i32* @SOCK_STREAM
%19 = call i32 @socket(i32 %17, i32 %18, i32 0)
store i32 %19, i32* %8
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %16
%25 = call i32 @memset(%struct.sockaddr_in* %6, i32 0, i32 12)
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %26, i32* %27
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @inet_addr(i8* %30)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%33 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %32, i32 0, i32 0
store i32 %31, i32* %33
%34 = call i32 @htons(i32 1996)
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
store i32 %34, i32* %35
%36 = load i32, i32* %8
%37 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%38 = call i64 @connect(i32 %36, %struct.sockaddr* %37, i32 12)
%39 = icmp slt i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %24
%41 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %24
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %43, %53, %85
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%48 = load i32, i32* @stdin
%49 = call i32 @fgets(i8* %47, i32 512, i32 %48)
%50 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%51 = call i64 @strlen(i8* %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %45
br label %45
54: ; preds = %45
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %54
br label %91
59: ; preds = %54
%60 = load i32, i32* %8
%61 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%62 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%63 = call i64 @strlen(i8* %62)
%64 = call i64 @send(i32 %60, i8* %61, i64 %63, i32 0)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %59
%67 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %59
%70 = load i32, i32* %8
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%72 = call i32 @recv(i32 %70, i8* %71, i32 512, i32 0)
store i32 %72, i32* %10
%73 = load i32, i32* %10
%74 = icmp slt i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %69
%76 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %69
%79 = load i32, i32* %10
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %78
br label %85
85: ; preds = %84
%86 = load i32, i32* %10
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %87
store i8 0, i8* %88
%89 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %89)
br label %45
91: ; preds = %58
%92 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%93 = call i32 @sprintf(i8* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%94 = load i32, i32* %8
%95 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%96 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%97 = call i64 @strlen(i8* %96)
%98 = call i64 @send(i32 %94, i8* %95, i64 %97, i32 0)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %91
%101 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %91
%104 = load i32, i32* %8
%105 = call i32 @close(i32 %104)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@.str.2 = [8 x i8] c"connect\00"
@.str.4 = [3 x i8] c"> \00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"/q\00"
@.str.6 = [5 x i8] c"send\00"
@.str.7 = [5 x i8] c"recv\00"
@.str.9 = [7 x i8] c"<< %s\0A\00"
@str = [43 x i8] c"Connected to Echo server. Type /q to quit.\00"
@str.10 = [38 x i8] c"Remote host has closed the connection\00"
@str.11 = [41 x i8] c"Usage: echoc <ip>\0AEx.: echoc 10.30.0.2\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [512 x i8]
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.11, i64 0, i64 0))
%10 = tail call i32 @exit(i32 0)
unreachable
11: ; preds = %2
%12 = load i32, i32* @AF_INET
%13 = load i32, i32* @SOCK_STREAM
%14 = tail call i32 @socket(i32 %12, i32 %13, i32 0)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %11
%20 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %21, i32* %22
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @inet_addr(i8* %24)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %25, i32* %26
%27 = call i32 @htons(i32 1996)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %27, i32* %28
%29 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%30 = call i64 @connect(i32 %14, %struct.sockaddr* %29, i32 12)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %19
%33 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %19
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
br label %37
37: ; preds = %68, %35
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%39 = load i32, i32* @stdin
%40 = call i32 @fgets(i8* %6, i32 512, i32 %39)
%41 = load i8, i8* %6
%42 = icmp eq i8 %41, 0
br i1 %42, label %68, label %43
43: ; preds = %37
%44 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %69, label %46
46: ; preds = %43
%47 = call i64 @strlen(i8* %6)
%48 = call i64 @send(i32 %14, i8* %6, i64 %47, i32 0)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %46
%54 = call i32 @recv(i32 %14, i8* %6, i32 512, i32 0)
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %53
%60 = icmp eq i32 %54, 0
br i1 %60, label %61, label %64
61: ; preds = %59
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.10, i64 0, i64 0))
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %59
%65 = zext i32 %54 to i64
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %65
store i8 0, i8* %66
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %6)
br label %68
68: ; preds = %64, %37
br label %37
69: ; preds = %43
%70 = call i64 @strlen(i8* %6)
%71 = call i64 @send(i32 %14, i8* %6, i64 %70, i32 0)
%72 = icmp slt i64 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %69
%74 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %69
%77 = call i32 @close(i32 %14)
ret i32 0
}