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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int close(int);
int errno;
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int listen(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
char *strerror(int);
int main() {
  int retval;
  int server_fd;
  struct sockaddr_in server_addr;
  bzero(&server_addr, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  server_addr.sin_port = htons(9988);
  inet_pton(AF_INET, "142.150.238.15", &server_addr.sin_addr);
  server_fd = socket(AF_INET, SOCK_STREAM, 0);
  if (server_fd < 0) {
    printf("socket(): %s, errno = %d\n", strerror(errno), errno);
    return -1;
  }
  retval =
      bind(server_fd, (struct sockaddr *)&server_addr, sizeof(server_addr));
  if (retval < 0) {
    printf("bind(): %s, errno = %d\n", strerror(errno), errno);
    return -1;
  }
  retval = listen(server_fd, 0);
  if (retval < 0) {
    printf("listen(): %s, errno = %d\n", strerror(errno), errno);
    return -1;
  }
  while (1) {
    int client_fd;
    struct sockaddr_in client_addr;
    socklen_t addr_len = sizeof(client_addr);
    client_fd = accept(server_fd, (struct sockaddr *)&client_addr, &addr_len);
    if (client_fd < 0) {
      printf("accept(): %s, errno = %d\n", strerror(errno), errno);
      break;
    }
    printf("conneted.\n");
    char buf[40];
    while (1) {
      retval = recv(client_fd, buf, sizeof(buf) - 1, 0);
      if (retval == 0) {
        break;
      } else if (retval < 0) {
        printf("recv() %s, errno = %d\n", strerror(errno), errno);
        break;
      }
      buf[retval] = 0;
      printf("data: %s\n", buf);
    }
    printf("disconneted.\n");
    close(client_fd);
  }
  retval = close(server_fd);
  if (retval < 0) {
    printf("close(): %s, errno = %d\n", strerror(errno), errno);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0xc,%esi
call   10a0 <bzero@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x2704,%edi
call   1040 <htons@plt>
mov    %eax,-0x14(%rbp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rdx
lea    0xe06(%rip),%rsi
call   1070 <inet_pton@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
mov    0x2dc9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1259 <main+0xa9>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %rax,%rsi
mov    0x2d93(%rip),%rax
mov    (%rax),%edx
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1446 <main+0x296>
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   1090 <bind@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    12ab <main+0xfb>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %rax,%rsi
mov    0x2d41(%rip),%rax
mov    (%rax),%edx
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1446 <main+0x296>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1080 <listen@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    12f6 <main+0x146>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %rax,%rsi
mov    0x2cf6(%rip),%rax
mov    (%rax),%edx
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1446 <main+0x296>
jmp    12fb <main+0x14b>
movl   $0xc,-0x2c(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x28(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   10b0 <accept@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    134c <main+0x19c>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %rax,%rsi
mov    0x2c99(%rip),%rax
mov    (%rax),%edx
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13f6 <main+0x246>
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x27,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    137f <main+0x1cf>
jmp    13db <main+0x22b>
cmpl   $0x0,-0x8(%rbp)
jge    13b6 <main+0x206>
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %rax,%rsi
mov    0x2c2f(%rip),%rax
mov    (%rax),%edx
lea    0xccb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13db <main+0x22b>
jmp    13bb <main+0x20b>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x60(%rbp),%rsi
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    135a <main+0x1aa>
lea    0xcb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
jmp    12fb <main+0x14b>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    143f <main+0x28f>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %rax,%rsi
mov    0x2bad(%rip),%rax
mov    (%rax),%edx
lea    0xc78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1446 <main+0x296>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   10b0 <bzero@plt>
mov    0x2e01(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    $0x2704,%edi
call   1050 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x0(%rbp),%edi
lea    0xdfa(%rip),%rsi
mov    %rbx,%rdx
call   1080 <inet_pton@plt>
mov    0x0(%rbp),%edi
mov    0x2dc0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
test   %eax,%eax
js     1343 <main+0x183>
mov    %eax,%r12d
lea    0x10(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   10a0 <bind@plt>
test   %eax,%eax
js     1384 <main+0x1c4>
mov    %r12d,%edi
xor    %esi,%esi
call   1090 <listen@plt>
test   %eax,%eax
js     138d <main+0x1cd>
movl   $0xc,0xc(%rsp)
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r12d,%edi
call   10c0 <accept@plt>
test   %eax,%eax
js     134c <main+0x18c>
mov    %eax,%ebp
lea    0x30(%rsp),%rbx
lea    0x20(%rsp),%r13
lea    0xc(%rsp),%r14
lea    0xdfb(%rip),%r15
jmp    12f7 <main+0x137>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    0x2d1b(%rip),%rcx
mov    (%rcx),%edx
lea    0xdb7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xde0(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
call   1070 <close@plt>
movl   $0xc,0xc(%rsp)
mov    %r12d,%edi
mov    %r13,%rsi
mov    %r14,%rdx
call   10c0 <accept@plt>
mov    %eax,%ebp
test   %eax,%eax
js     134c <main+0x18c>
lea    0xdb4(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x27,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     12c8 <main+0x108>
test   %eax,%eax
js     12a0 <main+0xe0>
mov    %eax,%eax
movb   $0x0,0x30(%rsp,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1310 <main+0x150>
lea    0xcc5(%rip),%rbx
jmp    1394 <main+0x1d4>
mov    0x2c7d(%rip),%rbx
mov    (%rbx),%edi
call   10d0 <strerror@plt>
mov    (%rbx),%edx
lea    0xcf8(%rip),%rdi
xor    %ebx,%ebx
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
call   1070 <close@plt>
test   %eax,%eax
jns    13b8 <main+0x1f8>
lea    0xd14(%rip),%rbx
jmp    1394 <main+0x1d4>
lea    0xc9e(%rip),%rbx
jmp    1394 <main+0x1d4>
lea    0xcad(%rip),%rbx
mov    0x2c35(%rip),%rbp
mov    0x0(%rbp),%edi
call   10d0 <strerror@plt>
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@.str = [15 x i8] c"142.150.238.15\00"
@SOCK_STREAM = global i32 0
@.str.1 = [26 x i8] c"socket(): %s, errno = %d\0A\00"
@errno = global i32 0
@.str.2 = [24 x i8] c"bind(): %s, errno = %d\0A\00"
@.str.3 = [26 x i8] c"listen(): %s, errno = %d\0A\00"
@.str.4 = [26 x i8] c"accept(): %s, errno = %d\0A\00"
@.str.5 = [11 x i8] c"conneted.\0A\00"
@.str.6 = [23 x i8] c"recv() %s, errno = %d\0A\00"
@.str.7 = [10 x i8] c"data: %s\0A\00"
@.str.8 = [14 x i8] c"disconneted.\0A\00"
@.str.9 = [25 x i8] c"close(): %s, errno = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = alloca [40 x i8]
store i32 0, i32* %1
%9 = call i32 @bzero(%struct.sockaddr_in* %4, i32 12)
%10 = load i32, i32* @AF_INET
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %10, i32* %11
%12 = call i32 @htons(i32 9988)
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
store i32 %12, i32* %13
%14 = load i32, i32* @AF_INET
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%16 = call i32 @inet_pton(i32 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %15)
%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* %3
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %0
%23 = load i32, i32* @errno
%24 = call i8* @strerror(i32 %23)
%25 = load i32, i32* @errno
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %25)
store i32 -1, i32* %1
br label %99
27: ; preds = %0
%28 = load i32, i32* %3
%29 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%30 = call i32 @bind(i32 %28, %struct.sockaddr* %29, i32 12)
store i32 %30, i32* %2
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = load i32, i32* @errno
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %35, i32 %36)
store i32 -1, i32* %1
br label %99
38: ; preds = %27
%39 = load i32, i32* %3
%40 = call i32 @listen(i32 %39, i32 0)
store i32 %40, i32* %2
%41 = load i32, i32* %2
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %38
%44 = load i32, i32* @errno
%45 = call i8* @strerror(i32 %44)
%46 = load i32, i32* @errno
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %45, i32 %46)
store i32 -1, i32* %1
br label %99
48: ; preds = %38
br label %49
49: ; preds = %48, %84
store i32 12, i32* %7
%50 = load i32, i32* %3
%51 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%52 = call i32 @accept(i32 %50, %struct.sockaddr* %51, i32* %7)
store i32 %52, i32* %5
%53 = load i32, i32* %5
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %49
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = load i32, i32* @errno
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %57, i32 %58)
br label %88
60: ; preds = %49
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %62
62: ; preds = %60, %78
%63 = load i32, i32* %5
%64 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%65 = call i32 @recv(i32 %63, i8* %64, i32 39, i32 0)
store i32 %65, i32* %2
%66 = load i32, i32* %2
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %62
br label %84
69: ; preds = %62
%70 = load i32, i32* %2
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %77
72: ; preds = %69
%73 = load i32, i32* @errno
%74 = call i8* @strerror(i32 %73)
%75 = load i32, i32* @errno
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %74, i32 %75)
br label %84
77: ; preds = %69
br label %78
78: ; preds = %77
%79 = load i32, i32* %2
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 %80
store i8 0, i8* %81
%82 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %82)
br label %62
84: ; preds = %72, %68
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%86 = load i32, i32* %5
%87 = call i32 @close(i32 %86)
br label %49
88: ; preds = %55
%89 = load i32, i32* %3
%90 = call i32 @close(i32 %89)
store i32 %90, i32* %2
%91 = load i32, i32* %2
%92 = icmp slt i32 %91, 0
br i1 %92, label %93, label %98
93: ; preds = %88
%94 = load i32, i32* @errno
%95 = call i8* @strerror(i32 %94)
%96 = load i32, i32* @errno
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i8* %95, i32 %96)
store i32 -1, i32* %1
br label %99
98: ; preds = %88
store i32 0, i32* %1
br label %99
99: ; preds = %98, %93, %43, %33, %22
%100 = load i32, i32* %1
ret i32 %100
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@.str = [15 x i8] c"142.150.238.15\00"
@SOCK_STREAM = global i32 0
@.str.1 = [26 x i8] c"socket(): %s, errno = %d\0A\00"
@errno = global i32 0
@.str.2 = [24 x i8] c"bind(): %s, errno = %d\0A\00"
@.str.3 = [26 x i8] c"listen(): %s, errno = %d\0A\00"
@.str.4 = [26 x i8] c"accept(): %s, errno = %d\0A\00"
@.str.6 = [23 x i8] c"recv() %s, errno = %d\0A\00"
@.str.7 = [10 x i8] c"data: %s\0A\00"
@.str.9 = [25 x i8] c"close(): %s, errno = %d\0A\00"
@str = [10 x i8] c"conneted.\00"
@str.10 = [13 x i8] c"disconneted.\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [40 x i8]
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = call i32 @bzero(%struct.sockaddr_in* %1, i32 12)
%7 = load i32, i32* @AF_INET
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %7, i32* %8
%9 = tail call i32 @htons(i32 9988)
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
store i32 %9, i32* %10
%11 = load i32, i32* @AF_INET
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
%13 = call i32 @inet_pton(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = load i32, i32* @AF_INET
%15 = load i32, i32* @SOCK_STREAM
%16 = call i32 @socket(i32 %14, i32 %15, i32 0)
%17 = icmp slt i32 %16, 0
br i1 %17, label %64, label %18
18: ; preds = %0
%19 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%20 = call i32 @bind(i32 %16, %struct.sockaddr* %19, i32 12)
%21 = icmp slt i32 %20, 0
br i1 %21, label %64, label %22
22: ; preds = %18
%23 = call i32 @listen(i32 %16, i32 0)
%24 = icmp slt i32 %23, 0
br i1 %24, label %64, label %25
25: ; preds = %22
%26 = bitcast %struct.sockaddr_in* %2 to i8*
%27 = bitcast i32* %3 to i8*
%28 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
store i32 12, i32* %3
%29 = call i32 @accept(i32 %16, %struct.sockaddr* %28, i32* %3)
%30 = icmp slt i32 %29, 0
br i1 %30, label %57, label %31
31: ; preds = %25
%32 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
br label %33
33: ; preds = %31, %52
%34 = phi i32 [ %29, %31 ], [ %55, %52 ]
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%36 = call i32 @recv(i32 %34, i8* %32, i32 39, i32 0)
%37 = icmp eq i32 %36, 0
br i1 %37, label %52, label %38
38: ; preds = %33, %46
%39 = phi i32 [ %50, %46 ], [ %36, %33 ]
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i32, i32* @errno
%43 = call i8* @strerror(i32 %42)
%44 = load i32, i32* @errno
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %43, i32 %44)
br label %52
46: ; preds = %38
%47 = zext i32 %39 to i64
%48 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 %47
store i8 0, i8* %48
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %32)
%50 = call i32 @recv(i32 %34, i8* %32, i32 39, i32 0)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %38
52: ; preds = %46, %33, %41
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
%54 = call i32 @close(i32 %34)
store i32 12, i32* %3
%55 = call i32 @accept(i32 %16, %struct.sockaddr* %28, i32* %3)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %33
57: ; preds = %52, %25
%58 = load i32, i32* @errno
%59 = call i8* @strerror(i32 %58)
%60 = load i32, i32* @errno
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %59, i32 %60)
%62 = call i32 @close(i32 %16)
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %70
64: ; preds = %57, %22, %18, %0
%65 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), %18 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), %22 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), %57 ]
%66 = load i32, i32* @errno
%67 = call i8* @strerror(i32 %66)
%68 = load i32, i32* @errno
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %65, i8* %67, i32 %68)
br label %70
70: ; preds = %64, %57
%71 = phi i32 [ 0, %57 ], [ -1, %64 ]
ret i32 %71
}