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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ htons(int);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, unsigned char *, int, int /*<<< orphan*/);
int shutdown(int, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  unsigned char buf[100];
  int numread = 0;
  int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (sock == -1) {
    perror("socket error");
    return 1;
  } else {
    printf("socket ok\n");
  }
  struct sockaddr_in server = {.sin_family = AF_INET,
                               .sin_addr.s_addr = INADDR_ANY,
                               .sin_port = htons(502)};
  if (bind(sock, (struct sockaddr *)&server, sizeof(server)) == -1) {
    perror("bind error");
    close(sock);
    return 1;
  } else {
    printf("bind ok\n");
  }
  if (listen(sock, 10) == -1) {
    perror("listen error");
    close(sock);
    return 1;
  } else {
    printf("listen ok\n");
  }
  while (1) {
    int msgsock = accept(sock, NULL, NULL);
    if (msgsock == -1) {
      perror("accept error");
      close(sock);
      return 1;
    } else {
      printf("accept ok\n");
    }
    do {
      numread = recv(msgsock, buf, 100, 0);
      if (numread == -1) {
        perror("recv error");
      } else {
        printf("recv %d bytes\n", numread);
        for (int i = 0; i < numread; i++)
          printf("0x%02X ", buf[i]);
        printf("\n");
      }
    } while (numread > 0);
    if (shutdown(msgsock, 2) == -1) {
      perror("shutdown error");
      close(msgsock);
      close(sock);
      return 1;
    } else {
      printf("shutdown ok\n");
    }
    close(msgsock);
  }
  close(sock);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
mov    0x2e06(%rip),%rax
mov    (%rax),%edx
call   10c0 <socket@plt>
mov    %eax,-0x78(%rbp)
cmpl   $0xffffffff,-0x78(%rbp)
jne    11fe <main+0x5e>
lea    0xe13(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    142b <main+0x28b>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1f6,%edi
call   1050 <htons@plt>
mov    %eax,-0x88(%rbp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    -0x78(%rbp),%edi
lea    -0x88(%rbp),%rsi
mov    $0xc,%edx
call   1090 <bind@plt>
cmp    $0xffffffff,%eax
jne    1274 <main+0xd4>
lea    0xdbd(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x78(%rbp),%edi
call   1070 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    142b <main+0x28b>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x78(%rbp),%edi
mov    $0xa,%esi
call   1080 <listen@plt>
cmp    $0xffffffff,%eax
jne    12b8 <main+0x118>
lea    0xd8d(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x78(%rbp),%edi
call   1070 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    142b <main+0x28b>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12cb <main+0x12b>
mov    -0x78(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10b0 <accept@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0xffffffff,-0x8c(%rbp)
jne    130d <main+0x16d>
lea    0xd50(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x78(%rbp),%edi
call   1070 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    142b <main+0x28b>
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1320 <main+0x180>
mov    -0x8c(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0xffffffff,-0x74(%rbp)
jne    1354 <main+0x1b4>
lea    0xd12(%rip),%rdi
call   10a0 <perror@plt>
jmp    13ba <main+0x21a>
mov    -0x74(%rbp),%esi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    13ac <main+0x20c>
movslq -0x90(%rbp),%rax
movzbl -0x70(%rbp,%rax,1),%esi
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    136f <main+0x1cf>
lea    0xc77(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13bf <main+0x21f>
cmpl   $0x0,-0x74(%rbp)
jg     1320 <main+0x180>
mov    -0x8c(%rbp),%edi
mov    $0x2,%esi
call   1040 <shutdown@plt>
cmp    $0xffffffff,%eax
jne    140d <main+0x26d>
lea    0xc95(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x8c(%rbp),%edi
call   1070 <close@plt>
mov    -0x78(%rbp),%edi
call   1070 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    142b <main+0x28b>
lea    0xc79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8c(%rbp),%edi
call   1070 <close@plt>
jmp    12cb <main+0x12b>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    0x2e10(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
mov    0x2ded(%rip),%rax
mov    (%rax),%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
jne    1208 <main+0x48>
lea    0xe02(%rip),%rdi
call   10c0 <perror@plt>
jmp    12ac <main+0xec>
mov    %eax,%ebx
lea    0xe52(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1f6,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1257 <main+0x97>
lea    0xdb8(%rip),%rdi
jmp    12a0 <main+0xe0>
lea    0xe0f(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
mov    $0xa,%esi
call   10a0 <listen@plt>
cmp    $0xffffffff,%eax
jne    127d <main+0xbd>
lea    0xd9d(%rip),%rdi
jmp    12a0 <main+0xe0>
lea    0xdf1(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <accept@plt>
cmp    $0xffffffff,%eax
jne    12c3 <main+0x103>
lea    0xd85(%rip),%rdi
call   10c0 <perror@plt>
mov    %ebx,%edi
call   1090 <close@plt>
mov    $0x1,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
lea    0xd71(%rip),%r12
lea    0xd79(%rip),%r14
mov    %ebx,0xc(%rsp)
nopw   0x0(%rax,%rax,1)
lea    0xd98(%rip),%rdi
call   1050 <puts@plt>
nopl   0x0(%rax)
mov    %ebp,%edi
lea    0x20(%rsp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     13ad <main+0x1ed>
mov    %eax,%r13d
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r13d,%r13d
jle    1360 <main+0x1a0>
mov    %r13d,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0x20(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1330 <main+0x170>
mov    $0xa,%edi
call   1040 <putchar@plt>
test   %r13d,%r13d
jg     12f0 <main+0x130>
jmp    136a <main+0x1aa>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1060 <shutdown@plt>
cmp    $0xffffffff,%eax
je     13bb <main+0x1fb>
lea    0xd07(%rip),%rdi
call   1050 <puts@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <accept@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    12e0 <main+0x120>
jmp    1299 <main+0xd9>
lea    0xc7e(%rip),%rdi
call   10c0 <perror@plt>
jmp    136a <main+0x1aa>
lea    0xc92(%rip),%rdi
call   10c0 <perror@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    0xc(%rsp),%ebx
jmp    12a5 <main+0xe5>

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

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
@IPPROTO_TCP = global i32 0
@.str = [13 x i8] c"socket error\00"
@INADDR_ANY = global i32 0
@.str.2 = [11 x i8] c"bind error\00"
@.str.4 = [13 x i8] c"listen error\00"
@.str.6 = [13 x i8] c"accept error\00"
@.str.8 = [11 x i8] c"recv error\00"
@.str.9 = [15 x i8] c"recv %d bytes\0A\00"
@.str.10 = [8 x i8] c"0x%02X \00"
@.str.12 = [15 x i8] c"shutdown error\00"
@str = [10 x i8] c"socket ok\00"
@str.14 = [8 x i8] c"bind ok\00"
@str.15 = [10 x i8] c"listen ok\00"
@str.16 = [10 x i8] c"accept ok\00"
@str.17 = [12 x i8] c"shutdown ok\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca %struct.sockaddr_in
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @AF_INET
%5 = load i32, i32* @SOCK_STREAM
%6 = load i32, i32* @IPPROTO_TCP
%7 = tail call i32 @socket(i32 %4, i32 %5, i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %75
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%13 = bitcast %struct.sockaddr_in* %2 to i8*
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%15 = tail call i32 @htons(i32 502)
store i32 %15, i32* %14
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1, i32 0
%17 = load i32, i32* @INADDR_ANY
store i32 %17, i32* %16
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
%19 = load i32, i32* @AF_INET
store i32 %19, i32* %18
%20 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%21 = call i32 @bind(i32 %7, %struct.sockaddr* %20, i32 12)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %11
%24 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %73
25: ; preds = %11
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.14, i64 0, i64 0))
%27 = call i32 @listen(i32 %7, i32 10)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %73
31: ; preds = %25
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
%33 = call i32 @accept(i32 %7, i32* null, i32* null)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %37
35: ; preds = %68, %31
%36 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %73
37: ; preds = %31, %68
%38 = phi i32 [ %71, %68 ], [ %33, %31 ]
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.16, i64 0, i64 0))
br label %40
40: ; preds = %60, %37
%41 = call i32 @recv(i32 %38, i8* %3, i32 100, i32 0)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %62
45: ; preds = %40
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i32 %41)
%47 = icmp sgt i32 %41, 0
br i1 %47, label %50, label %48
48: ; preds = %45
%49 = call i32 @putchar(i32 10)
br label %62
50: ; preds = %45
%51 = zext i32 %41 to i64
br label %52
52: ; preds = %50, %52
%53 = phi i64 [ 0, %50 ], [ %58, %52 ]
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32 %56)
%58 = add nuw nsw i64 %53, 1
%59 = icmp eq i64 %58, %51
br i1 %59, label %60, label %52
60: ; preds = %52
%61 = call i32 @putchar(i32 10)
br i1 %47, label %40, label %62
62: ; preds = %60, %48, %43
%63 = call i32 @shutdown(i32 %38, i32 2)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%67 = call i32 @close(i32 %38)
br label %73
68: ; preds = %62
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.17, i64 0, i64 0))
%70 = call i32 @close(i32 %38)
%71 = call i32 @accept(i32 %7, i32* null, i32* null)
%72 = icmp eq i32 %71, -1
br i1 %72, label %35, label %37
73: ; preds = %35, %65, %29, %23
%74 = call i32 @close(i32 %7)
br label %75
75: ; preds = %73, %9
ret i32 1
}