#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*/ server;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOMAXCONN;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ htons(int);
scalar_t__ listen(int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int recv(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
scalar_t__ strlen(char *);
int /*<<< orphan*/ write(int, char *, scalar_t__);
int loop(void) {
  int socket_desc, client_sock, c, read_size;
  struct sockaddr_in server, client;
  char client_message[2000];
  printf("Press any key to continue...");
  getchar();
  printf("\n");
  socket_desc = socket(AF_INET, SOCK_STREAM, 0);
  if (socket_desc == -1) {
    perror("Could not create socket");
  }
  puts("Socket created");
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = INADDR_ANY;
  server.sin_port = htons(8888);
  if (bind(socket_desc, (struct sockaddr *)&server, sizeof(server)) != 0) {
    perror("bind failed.");
    close(socket_desc);
    return 1;
  }
  puts("bind done");
  if (listen(socket_desc, SOMAXCONN) != 0) {
    perror("listen failed.");
    close(socket_desc);
    return 1;
  }
  while (1) {
    puts("Waiting for incoming connections...");
    c = sizeof(struct sockaddr_in);
    client_sock =
        accept(socket_desc, (struct sockaddr *)&client, (socklen_t *)&c);
    if (client_sock < 0) {
      perror("accept failed.");
      close(socket_desc);
      return 1;
    }
    puts("Connection accepted");
    while ((read_size = recv(client_sock, client_message, 2000, 0)) > 0) {
      printf("recv: %s\n", client_message);
      write(client_sock, client_message, strlen(client_message) + 1);
    }
    if (read_size == 0) {
      puts("Client disconnected");
      fflush(stdout);
      close(client_sock);
    } else if (read_size == -1) {
      perror("recv failed");
      close(client_sock);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
mov    0x2daa(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1240 <loop+0x60>
lea    0xde2(%rip),%rdi
call   10e0 <perror@plt>
lea    0xdee(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x22b8,%edi
call   1070 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0x0,%rax
je     12ac <loop+0xcc>
lea    0xdb1(%rip),%rdi
call   10e0 <perror@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1425 <loop+0x245>
lea    0xd9e(%rip),%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%edi
mov    0x2d0e(%rip),%rax
mov    (%rax),%esi
call   10c0 <listen@plt>
cmp    $0x0,%rax
je     12f3 <loop+0x113>
lea    0xd81(%rip),%rdi
call   10e0 <perror@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1425 <loop+0x245>
jmp    12f8 <loop+0x118>
lea    0xd6b(%rip),%rdi
call   1040 <puts@plt>
movl   $0xc,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   10f0 <accept@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1348 <loop+0x168>
lea    0xd5f(%rip),%rdi
call   10e0 <perror@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1425 <loop+0x245>
lea    0xd4e(%rip),%rdi
call   1040 <puts@plt>
mov    -0xc(%rbp),%edi
lea    -0x800(%rbp),%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    13cc <loop+0x1ec>
lea    -0x800(%rbp),%rsi
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x80c(%rbp)
lea    -0x800(%rbp),%rax
mov    %rax,-0x808(%rbp)
lea    -0x800(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x80c(%rbp),%edi
mov    -0x808(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <write@plt>
jmp    1354 <loop+0x174>
cmpl   $0x0,-0x14(%rbp)
jne    13fd <loop+0x21d>
lea    0xcde(%rip),%rdi
call   1040 <puts@plt>
mov    0x2bd7(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
mov    -0xc(%rbp),%edi
call   1090 <close@plt>
jmp    1420 <loop+0x240>
cmpl   $0xffffffff,-0x14(%rbp)
jne    141b <loop+0x23b>
lea    0xcc1(%rip),%rdi
call   10e0 <perror@plt>
mov    -0xc(%rbp),%edi
call   1090 <close@plt>
jmp    1420 <loop+0x240>
jmp    12f8 <loop+0x118>
mov    -0x4(%rbp),%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
lea    0xdf8(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
call   10b0 <getchar@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x2dc1(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,%r12d
cmp    $0xffffffff,%eax
jne    124d <loop+0x5d>
lea    0xdd5(%rip),%rdi
call   10f0 <perror@plt>
lea    0xde1(%rip),%rdi
call   1050 <puts@plt>
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    $0x22b8,%edi
call   1080 <htons@plt>
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %r12d,%edi
mov    $0xc,%edx
call   10e0 <bind@plt>
test   %rax,%rax
jne    13d5 <loop+0x1e5>
lea    0xdb5(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
mov    %r12d,%edi
call   10d0 <listen@plt>
test   %rax,%rax
jne    13de <loop+0x1ee>
lea    0xda8(%rip),%rdi
call   1050 <puts@plt>
movl   $0xc,0xc(%rsp)
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r12d,%edi
call   1100 <accept@plt>
lea    0xda6(%rip),%rdi
test   %eax,%eax
js     13ee <loop+0x1fe>
mov    %eax,%r14d
lea    0x30(%rsp),%rbx
lea    0xdb2(%rip),%rbp
lea    0x20(%rsp),%r13
lea    0xc(%rsp),%r15
jmp    134e <loop+0x15e>
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
je     13a0 <loop+0x1b0>
cmp    $0xffffffff,%eax
je     13c7 <loop+0x1d7>
lea    0xd42(%rip),%rdi
call   1050 <puts@plt>
movl   $0xc,0xc(%rsp)
mov    %r12d,%edi
mov    %r13,%rsi
mov    %r15,%rdx
call   1100 <accept@plt>
mov    %eax,%r14d
test   %eax,%eax
js     13e7 <loop+0x1f7>
lea    0xd48(%rip),%rdi
call   1050 <puts@plt>
nopw   0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jle    1310 <loop+0x120>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14d,%edi
mov    %rbx,%rsi
call   1060 <write@plt>
jmp    1360 <loop+0x170>
nopl   0x0(%rax)
lea    0xd14(%rip),%rdi
call   1050 <puts@plt>
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    %r14d,%edi
call   10a0 <close@plt>
jmp    1321 <loop+0x131>
lea    0xd01(%rip),%rdi
call   10f0 <perror@plt>
jmp    13ba <loop+0x1ca>
lea    0xc68(%rip),%rdi
jmp    13ee <loop+0x1fe>
lea    0xc76(%rip),%rdi
jmp    13ee <loop+0x1fe>
lea    0xca0(%rip),%rdi
call   10f0 <perror@plt>
mov    %r12d,%edi
call   10a0 <close@plt>
mov    $0x1,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [29 x i8] c"Press any key to continue...\00"
@.str.1 = [2 x i8] c"\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [24 x i8] c"Could not create socket\00"
@.str.3 = [15 x i8] c"Socket created\00"
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind failed.\00"
@.str.5 = [10 x i8] c"bind done\00"
@SOMAXCONN = global i32 0
@.str.6 = [15 x i8] c"listen failed.\00"
@.str.7 = [36 x i8] c"Waiting for incoming connections...\00"
@.str.8 = [15 x i8] c"accept failed.\00"
@.str.9 = [20 x i8] c"Connection accepted\00"
@.str.10 = [10 x i8] c"recv: %s\0A\00"
@.str.11 = [20 x i8] c"Client disconnected\00"
@stdout = global i32 0
@.str.12 = [12 x i8] c"recv failed\00"
define i32 @loop() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in
%8 = alloca [2000 x i8]
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @getchar()
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%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* %2
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %0
%20 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %21, i32* %22
%23 = load i32, i32* @INADDR_ANY
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%25 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %24, i32 0, i32 0
store i32 %23, i32* %25
%26 = call i32 @htons(i32 8888)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
store i32 %26, i32* %27
%28 = load i32, i32* %2
%29 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%30 = call i64 @bind(i32 %28, %struct.sockaddr* %29, i32 12)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %19
%33 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%34 = load i32, i32* %2
%35 = call i32 @close(i32 %34)
store i32 1, i32* %1
br label %92
36: ; preds = %19
%37 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%38 = load i32, i32* %2
%39 = load i32, i32* @SOMAXCONN
%40 = call i64 @listen(i32 %38, i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%44 = load i32, i32* %2
%45 = call i32 @close(i32 %44)
store i32 1, i32* %1
br label %92
46: ; preds = %36
br label %47
47: ; preds = %46, %91
%48 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
store i32 12, i32* %4
%49 = load i32, i32* %2
%50 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%51 = call i32 @accept(i32 %49, %struct.sockaddr* %50, i32* %4)
store i32 %51, i32* %3
%52 = load i32, i32* %3
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %47
%55 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%56 = load i32, i32* %2
%57 = call i32 @close(i32 %56)
store i32 1, i32* %1
br label %92
58: ; preds = %47
%59 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %60
60: ; preds = %65, %58
%61 = load i32, i32* %3
%62 = getelementptr inbounds [2000 x i8], [2000 x i8]* %8, i64 0, i64 0
%63 = call i32 @recv(i32 %61, i8* %62, i32 2000, i32 0)
store i32 %63, i32* %5
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %74
65: ; preds = %60
%66 = getelementptr inbounds [2000 x i8], [2000 x i8]* %8, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %66)
%68 = load i32, i32* %3
%69 = getelementptr inbounds [2000 x i8], [2000 x i8]* %8, i64 0, i64 0
%70 = getelementptr inbounds [2000 x i8], [2000 x i8]* %8, i64 0, i64 0
%71 = call i64 @strlen(i8* %70)
%72 = add nsw i64 %71, 1
%73 = call i32 @write(i32 %68, i8* %69, i64 %72)
br label %60
74: ; preds = %60
%75 = load i32, i32* %5
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %83
77: ; preds = %74
%78 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%79 = load i32, i32* @stdout
%80 = call i32 @fflush(i32 %79)
%81 = load i32, i32* %3
%82 = call i32 @close(i32 %81)
br label %91
83: ; preds = %74
%84 = load i32, i32* %5
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %90
86: ; preds = %83
%87 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%88 = load i32, i32* %3
%89 = call i32 @close(i32 %88)
br label %90
90: ; preds = %86, %83
br label %91
91: ; preds = %90, %77
br label %47
92: ; preds = %54, %42, %32
%93 = load i32, i32* %1
ret i32 %93
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [29 x i8] c"Press any key to continue...\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [24 x i8] c"Could not create socket\00"
@.str.3 = [15 x i8] c"Socket created\00"
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind failed.\00"
@.str.5 = [10 x i8] c"bind done\00"
@SOMAXCONN = global i32 0
@.str.6 = [15 x i8] c"listen failed.\00"
@.str.7 = [36 x i8] c"Waiting for incoming connections...\00"
@.str.8 = [15 x i8] c"accept failed.\00"
@.str.9 = [20 x i8] c"Connection accepted\00"
@.str.10 = [10 x i8] c"recv: %s\0A\00"
@.str.11 = [20 x i8] c"Client disconnected\00"
@stdout = global i32 0
@.str.12 = [12 x i8] c"recv failed\00"
define i32 @loop() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.sockaddr_in
%4 = alloca [2000 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast %struct.sockaddr_in* %2 to i8*
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 (...) @getchar()
%11 = tail call i32 @putchar(i32 10)
%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 eq i32 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %0
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i32 %20, i32* %21
%22 = load i32, i32* @INADDR_ANY
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1, i32 0
store i32 %22, i32* %23
%24 = tail call i32 @htons(i32 8888)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
store i32 %24, i32* %25
%26 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%27 = call i64 @bind(i32 %14, %struct.sockaddr* %26, i32 12)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %65
29: ; preds = %18
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%31 = load i32, i32* @SOMAXCONN
%32 = call i64 @listen(i32 %14, i32 %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %65
34: ; preds = %29
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
store i32 12, i32* %1
%36 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%37 = call i32 @accept(i32 %14, %struct.sockaddr* %36, i32* %1)
%38 = icmp slt i32 %37, 0
br i1 %38, label %65, label %39
39: ; preds = %34, %61
%40 = phi i32 [ %63, %61 ], [ %37, %34 ]
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%42 = call i32 @recv(i32 %40, i8* %8, i32 2000, i32 0)
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %51
44: ; preds = %39, %44
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %8)
%46 = call i64 @strlen(i8* %8)
%47 = add nsw i64 %46, 1
%48 = call i32 @write(i32 %40, i8* %8, i64 %47)
%49 = call i32 @recv(i32 %40, i8* %8, i32 2000, i32 0)
%50 = icmp sgt i32 %49, 0
br i1 %50, label %44, label %51
51: ; preds = %44, %39
%52 = phi i32 [ %42, %39 ], [ %49, %44 ]
switch i32 %52, label %61 [
i32 0, label %53
i32 -1, label %57
]
53: ; preds = %51
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%55 = load i32, i32* @stdout
%56 = call i32 @fflush(i32 %55)
br label %59
57: ; preds = %51
%58 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
br label %59
59: ; preds = %53, %57
%60 = call i32 @close(i32 %40)
br label %61
61: ; preds = %59, %51
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
store i32 12, i32* %1
%63 = call i32 @accept(i32 %14, %struct.sockaddr* %36, i32* %1)
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %39
65: ; preds = %61, %34, %29, %18
%66 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), %18 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %29 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %34 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %61 ]
%67 = call i32 @perror(i8* %66)
%68 = call i32 @close(i32 %14)
ret i32 1
}