#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_zero;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ server;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  int sock;
  struct sockaddr_in server;
  char message[1000];
  char server_reply[2000];
  int recvlength;
  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock == -1) {
    printf("could not create socket");
    exit(EXIT_FAILURE);
  }
  puts("created socket");
  server.sin_addr.s_addr = inet_addr("127.0.0.1");
  server.sin_family = AF_INET;
  server.sin_port = htons(8888);
  memset(server.sin_zero, 0, 8);
  if (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) {
    perror("connect failed.error.");
    return 1;
  }
  puts("connected.");
  while (1) {
    printf("enter massage: ");
    if (fgets(message, 1000, stdin) == NULL) {
      puts("could not read from stdin");
    }
    puts("read from stdin.");
    if (strncmp(message, "end_comm", 8) == 0) {
      puts("client terminated.");
      break;
    }
    if (send(sock, message, strlen(message), 0) < 0) {
      puts("send fialed.");
      return 1;
    }
    puts("message sent.");
    puts(message);
    sleep(1);
    fflush(stdin);
    recvlength = recv(sock, server_reply, 2000, 0);
    if (recvlength < 0) {
      puts("recv failed.");
      break;
    } else if (recvlength == 0) {
      puts("server sent no output.");
    } else {
      puts("server reply: ");
      puts(server_reply);
    }
    for (int i = 0; i < 2000; ++i) {
      server_reply[i] = 0;
    }
    fflush(stdout);
  }
  close(sock);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc00,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
mov    0x2d97(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1269 <main+0x59>
lea    0xdaa(%rip),%rdi
call   1090 <printf@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    0xda8(%rip),%rdi
call   1050 <puts@plt>
lea    0xdab(%rip),%rdi
call   10d0 <inet_addr@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    $0x22b8,%edi
call   1070 <htons@plt>
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%edi
xor    %esi,%esi
mov    $0x8,%edx
call   10a0 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1110 <connect@plt>
cmp    $0x0,%rax
jge    12df <main+0xcf>
lea    0xd63(%rip),%rdi
call   10f0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c5 <main+0x2b5>
lea    0xd61(%rip),%rdi
call   1050 <puts@plt>
lea    0xd60(%rip),%rdi
call   1090 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2cdb(%rip),%rax
mov    (%rax),%edx
mov    $0x3e8,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
jne    1327 <main+0x117>
lea    0xd40(%rip),%rdi
call   1050 <puts@plt>
lea    0xd4e(%rip),%rdi
call   1050 <puts@plt>
lea    -0x410(%rbp),%rdi
lea    0xd4c(%rip),%rsi
mov    $0x8,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1366 <main+0x156>
lea    0xd3a(%rip),%rdi
call   1050 <puts@plt>
jmp    14b6 <main+0x2a6>
mov    -0x14(%rbp),%eax
mov    %eax,-0xbf4(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0xbf0(%rbp)
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0xbf4(%rbp),%edi
mov    -0xbf0(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
cmp    $0x0,%rax
jge    13c1 <main+0x1b1>
lea    0xcf9(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c5 <main+0x2b5>
lea    0xcee(%rip),%rdi
call   1050 <puts@plt>
lea    -0x410(%rbp),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
call   10e0 <fflush@plt>
mov    -0x14(%rbp),%edi
lea    -0xbe0(%rbp),%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0xbe4(%rbp)
cmpl   $0x0,-0xbe4(%rbp)
jge    142b <main+0x21b>
lea    0xca3(%rip),%rdi
call   1050 <puts@plt>
jmp    14b6 <main+0x2a6>
cmpl   $0x0,-0xbe4(%rbp)
jne    1449 <main+0x239>
lea    0xc92(%rip),%rdi
call   1050 <puts@plt>
jmp    1461 <main+0x251>
lea    0xc98(%rip),%rdi
call   1050 <puts@plt>
lea    -0xbe0(%rbp),%rdi
call   1050 <puts@plt>
jmp    1466 <main+0x256>
movl   $0x0,-0xbe8(%rbp)
cmpl   $0x7d0,-0xbe8(%rbp)
jge    14a3 <main+0x293>
movslq -0xbe8(%rbp),%rax
movb   $0x0,-0xbe0(%rbp,%rax,1)
mov    -0xbe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbe8(%rbp)
jmp    1470 <main+0x260>
mov    0x2b16(%rip),%rax
mov    (%rax),%edi
call   10e0 <fflush@plt>
jmp    12eb <main+0xdb>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc00,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xbd8,%rsp
mov    0x2dc0(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
cmp    $0xffffffff,%eax
je     1406 <main+0x1f6>
mov    %eax,%ebp
lea    0xdcc(%rip),%rdi
call   1050 <puts@plt>
lea    0xdcf(%rip),%rdi
call   10d0 <inet_addr@plt>
mov    %eax,0xc(%rsp)
mov    (%rbx),%eax
mov    %eax,0x8(%rsp)
mov    $0x22b8,%edi
call   1070 <htons@plt>
mov    %eax,0x4(%rsp)
xor    %esi,%esi
mov    $0x8,%edx
call   10a0 <memset@plt>
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x10,%edx
call   1110 <connect@plt>
test   %rax,%rax
js     13f8 <main+0x1e8>
lea    0xda7(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d34(%rip),%r12
lea    0x10(%rsp),%rbx
lea    0xdc4(%rip),%r13
lea    0xdce(%rip),%r15
lea    0x400(%rsp),%r14
jmp    1301 <main+0xf1>
nopl   0x0(%rax)
lea    0xe11(%rip),%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    $0x7d0,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10a0 <memset@plt>
mov    0x2cc6(%rip),%rax
mov    (%rax),%edi
call   10e0 <fflush@plt>
lea    0xd4a(%rip),%rdi
call   1090 <printf@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   10c0 <fgets@plt>
test   %rax,%rax
jne    132f <main+0x11f>
lea    0xd38(%rip),%rdi
call   1050 <puts@plt>
mov    %r13,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     13b5 <main+0x1a5>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
test   %rax,%rax
js     13be <main+0x1ae>
lea    0xd48(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    (%r12),%edi
call   10e0 <fflush@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     13d1 <main+0x1c1>
jne    12d0 <main+0xc0>
lea    0xd21(%rip),%rdi
jmp    12df <main+0xcf>
lea    0xcda(%rip),%rdi
jmp    13d8 <main+0x1c8>
lea    0xce4(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%eax
jmp    13e6 <main+0x1d6>
lea    0xcec(%rip),%rdi
call   1050 <puts@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
xor    %eax,%eax
add    $0xbd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc32(%rip),%rdi
call   10f0 <perror@plt>
jmp    13ca <main+0x1ba>
lea    0xbf3(%rip),%rdi
call   1090 <printf@plt>
mov    0x2baf(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"could not create socket\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [15 x i8] c"created socket\00"
@.str.2 = [10 x i8] c"127.0.0.1\00"
@.str.3 = [22 x i8] c"connect failed.error.\00"
@.str.4 = [11 x i8] c"connected.\00"
@.str.5 = [16 x i8] c"enter massage: \00"
@stdin = global i32 0
@.str.6 = [26 x i8] c"could not read from stdin\00"
@.str.7 = [17 x i8] c"read from stdin.\00"
@.str.8 = [9 x i8] c"end_comm\00"
@.str.9 = [19 x i8] c"client terminated.\00"
@.str.10 = [13 x i8] c"send fialed.\00"
@.str.11 = [14 x i8] c"message sent.\00"
@.str.12 = [13 x i8] c"recv failed.\00"
@.str.13 = [23 x i8] c"server sent no output.\00"
@.str.14 = [15 x i8] c"server reply: \00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca [1000 x i8]
%9 = alloca [2000 x i8]
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* @AF_INET
%13 = load i32, i32* @SOCK_STREAM
%14 = call i32 @socket(i32 %12, i32 %13, i32 0)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 3
%25 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %24, i32 0, i32 0
store i32 %23, i32* %25
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %26, i32* %27
%28 = call i32 @htons(i32 8888)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 %28, i32* %29
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%31 = load i32, i32* %30
%32 = call i32 @memset(i32 %31, i32 0, i32 8)
%33 = load i32, i32* %6
%34 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%35 = call i64 @connect(i32 %33, %struct.sockaddr* %34, i32 16)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %21
%38 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %106
39: ; preds = %21
%40 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %39, %100
%42 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%43 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%44 = load i32, i32* @stdin
%45 = call i32* @fgets(i8* %43, i32 1000, i32 %44)
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%51 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%52 = call i64 @strncmp(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 8)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %103
56: ; preds = %49
%57 = load i32, i32* %6
%58 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%59 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%60 = call i32 @strlen(i8* %59)
%61 = call i64 @send(i32 %57, i8* %58, i32 %60, i32 0)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %56
%64 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %106
65: ; preds = %56
%66 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%67 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%68 = call i32 @puts(i8* %67)
%69 = call i32 @sleep(i32 1)
%70 = load i32, i32* @stdin
%71 = call i32 @fflush(i32 %70)
%72 = load i32, i32* %6
%73 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%74 = call i32 @recv(i32 %72, i8* %73, i32 2000, i32 0)
store i32 %74, i32* %10
%75 = load i32, i32* %10
%76 = icmp slt i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %65
%78 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0))
br label %103
79: ; preds = %65
%80 = load i32, i32* %10
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %79
%83 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %88
84: ; preds = %79
%85 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0))
%86 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%87 = call i32 @puts(i8* %86)
br label %88
88: ; preds = %84, %82
br label %89
89: ; preds = %88
store i32 0, i32* %11
br label %90
90: ; preds = %97, %89
%91 = load i32, i32* %11
%92 = icmp slt i32 %91, 2000
br i1 %92, label %93, label %100
93: ; preds = %90
%94 = load i32, i32* %11
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 %95
store i8 0, i8* %96
br label %97
97: ; preds = %93
%98 = load i32, i32* %11
%99 = add nsw i32 %98, 1
store i32 %99, i32* %11
br label %90
100: ; preds = %90
%101 = load i32, i32* @stdout
%102 = call i32 @fflush(i32 %101)
br label %41
103: ; preds = %77, %54
%104 = load i32, i32* %6
%105 = call i32 @close(i32 %104)
store i32 0, i32* %3
br label %106
106: ; preds = %103, %63, %37
%107 = load i32, i32* %3
ret i32 %107
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"could not create socket\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [15 x i8] c"created socket\00"
@.str.2 = [10 x i8] c"127.0.0.1\00"
@.str.3 = [22 x i8] c"connect failed.error.\00"
@.str.4 = [11 x i8] c"connected.\00"
@.str.5 = [16 x i8] c"enter massage: \00"
@stdin = global i32 0
@.str.6 = [26 x i8] c"could not read from stdin\00"
@.str.7 = [17 x i8] c"read from stdin.\00"
@.str.8 = [9 x i8] c"end_comm\00"
@.str.9 = [19 x i8] c"client terminated.\00"
@.str.10 = [13 x i8] c"send fialed.\00"
@.str.11 = [14 x i8] c"message sent.\00"
@.str.12 = [13 x i8] c"recv failed.\00"
@.str.13 = [23 x i8] c"server sent no output.\00"
@.str.14 = [15 x i8] c"server reply: \00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1000 x i8]
%5 = alloca [2000 x i8]
%6 = getelementptr inbounds [2000 x i8], [2000 x i8]* %5, i64 0, i64 0
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [2000 x i8], [2000 x i8]* %5, i64 0, i64 0
%10 = load i32, i32* @AF_INET
%11 = load i32, i32* @SOCK_STREAM
%12 = tail call i32 @socket(i32 %10, i32 %11, i32 0)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3, i32 0
store i32 %20, i32* %21
%22 = load i32, i32* @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %22, i32* %23
%24 = tail call i32 @htons(i32 8888)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %24, i32* %25
%26 = tail call i32 @memset(i32 undef, i32 0, i32 8)
%27 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%28 = call i64 @connect(i32 %12, %struct.sockaddr* %27, i32 16)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %18
%31 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %73
32: ; preds = %18
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %66, %32
%35 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* @stdin
%37 = call i32* @fgets(i8* %8, i32 1000, i32 %36)
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%43 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 8)
%44 = icmp eq i64 %43, 0
br i1 %44, label %69, label %45
45: ; preds = %41
%46 = call i32 @strlen(i8* %8)
%47 = call i64 @send(i32 %12, i8* %8, i32 %46, i32 0)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
br label %73
51: ; preds = %45
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%53 = call i32 @puts(i8* %8)
%54 = call i32 @sleep(i32 1)
%55 = load i32, i32* @stdin
%56 = call i32 @fflush(i32 %55)
%57 = call i32 @recv(i32 %12, i8* %9, i32 2000, i32 0)
%58 = icmp slt i32 %57, 0
br i1 %58, label %69, label %59
59: ; preds = %51
%60 = icmp eq i32 %57, 0
br i1 %60, label %61, label %63
61: ; preds = %59
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %66
63: ; preds = %59
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0))
%65 = call i32 @puts(i8* %9)
br label %66
66: ; preds = %61, %63
%67 = load i32, i32* @stdout
%68 = call i32 @fflush(i32 %67)
br label %34
69: ; preds = %51, %41
%70 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %41 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), %51 ]
%71 = call i32 @puts(i8* dereferenceable(1) %70)
%72 = call i32 @close(i32 %12)
br label %73
73: ; preds = %69, %49, %30
%74 = phi i32 [ 1, %30 ], [ 0, %69 ], [ 1, %49 ]
ret i32 %74
}