#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 send(int, char *, int, int /*<<< orphan*/);
int shutdown(int, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  unsigned char buf[100];
  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(1100)};
  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");
  }
  int msgsock = accept(sock, NULL, NULL);
  if (msgsock == -1) {
    perror("accept error");
    close(sock);
    return 1;
  } else {
    printf("accept ok\n");
  }
  int numwrite = send(msgsock, "hello\n", 6, 0);
  if (numwrite == -1) {
    perror("send error");
    close(msgsock);
    close(sock);
    return 1;
  } else {
    printf("send %d bytes ok\n", numwrite);
  }
  int numread = recv(msgsock, buf, 100, 0);
  if (numread == -1) {
    perror("recv error");
    close(msgsock);
    close(sock);
    return 1;
  } else {
    printf("recv %d bytes\n", numread);
    for (int i = 0; i < numread; i++) {
      printf("0x%02X ", buf[i]);
    }
    printf("\n");
  }
  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)
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    0x2df6(%rip),%rax
mov    (%rax),%esi
mov    0x2dfd(%rip),%rax
mov    (%rax),%edx
call   10d0 <socket@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0xffffffff,-0x74(%rbp)
jne    1207 <main+0x57>
lea    0xe0a(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ad <main+0x2fd>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x44c,%edi
call   1050 <htons@plt>
mov    %eax,-0x80(%rbp)
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    -0x74(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0xc,%edx
call   10a0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1274 <main+0xc4>
lea    0xdbd(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x74(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ad <main+0x2fd>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x74(%rbp),%edi
mov    $0xa,%esi
call   1090 <listen@plt>
cmp    $0xffffffff,%eax
jne    12b8 <main+0x108>
lea    0xd8d(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x74(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ad <main+0x2fd>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x74(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10c0 <accept@plt>
mov    %eax,-0x84(%rbp)
cmpl   $0xffffffff,-0x84(%rbp)
jne    1308 <main+0x158>
lea    0xd55(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x74(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ad <main+0x2fd>
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x84(%rbp),%edi
lea    0xd39(%rip),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0x88(%rbp)
cmpl   $0xffffffff,-0x88(%rbp)
jne    136d <main+0x1bd>
lea    0xd1a(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
mov    -0x74(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ad <main+0x2fd>
mov    -0x88(%rbp),%esi
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x84(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0xffffffff,-0x8c(%rbp)
jne    13d5 <main+0x225>
lea    0xccf(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
mov    -0x74(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ad <main+0x2fd>
mov    -0x8c(%rbp),%esi
lea    0xca9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jge    1433 <main+0x283>
movslq -0x90(%rbp),%rax
movzbl -0x70(%rbp,%rax,1),%esi
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    13f3 <main+0x243>
lea    0xbf0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x84(%rbp),%edi
mov    $0x2,%esi
call   1040 <shutdown@plt>
cmp    $0xffffffff,%eax
jne    1485 <main+0x2d5>
lea    0xc41(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
mov    -0x74(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ad <main+0x2fd>
lea    0xc25(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
mov    -0x74(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    0x2e02(%rip),%rbx
mov    (%rbx),%edi
mov    0x2dd9(%rip),%rax
mov    (%rax),%esi
mov    0x2de0(%rip),%rax
mov    (%rax),%edx
call   10f0 <socket@plt>
cmp    $0xffffffff,%eax
je     1374 <main+0x1a4>
mov    %eax,%r14d
lea    0xe75(%rip),%rdi
call   1050 <puts@plt>
mov    $0x44c,%edi
call   1070 <htons@plt>
mov    %eax,(%rsp)
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    (%rbx),%eax
mov    %eax,0x8(%rsp)
mov    %rsp,%rsi
mov    %r14d,%edi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0xffffffff,%eax
je     1387 <main+0x1b7>
lea    0xe3a(%rip),%rdi
call   1050 <puts@plt>
mov    %r14d,%edi
mov    $0xa,%esi
call   10b0 <listen@plt>
cmp    $0xffffffff,%eax
je     1390 <main+0x1c0>
lea    0xe20(%rip),%rdi
call   1050 <puts@plt>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10e0 <accept@plt>
cmp    $0xffffffff,%eax
je     1399 <main+0x1c9>
mov    %eax,%r15d
lea    0xe06(%rip),%rdi
call   1050 <puts@plt>
lea    0xd89(%rip),%rsi
mov    %r15d,%edi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
cmp    $0xffffffff,%eax
je     13ac <main+0x1dc>
lea    0xd7c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     13b5 <main+0x1e5>
mov    %eax,%ebx
lea    0xd6a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
test   %ebx,%ebx
jle    1328 <main+0x158>
mov    %ebx,%ebp
lea    0xd63(%rip),%r12
xor    %ebx,%ebx
nop
movzbl 0x10(%rsp,%rbx,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1310 <main+0x140>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r15d,%edi
mov    $0x2,%esi
call   1060 <shutdown@plt>
cmp    $0xffffffff,%eax
je     13be <main+0x1ee>
lea    0xd62(%rip),%rdi
call   1050 <puts@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
xor    %ebp,%ebp
mov    %r14d,%edi
call   10a0 <close@plt>
mov    %ebp,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc85(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%ebp
jmp    1362 <main+0x192>
lea    0xc7f(%rip),%rdi
jmp    13a0 <main+0x1d0>
lea    0xc81(%rip),%rdi
jmp    13a0 <main+0x1d0>
lea    0xc85(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%ebp
jmp    135a <main+0x18a>
lea    0xc86(%rip),%rdi
jmp    13c5 <main+0x1f5>
lea    0xc9a(%rip),%rdi
jmp    13c5 <main+0x1f5>
lea    0xcb3(%rip),%rdi
call   10d0 <perror@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
mov    $0x1,%ebp
jmp    135a <main+0x18a>

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

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 = [7 x i8] c"hello\0A\00"
@.str.9 = [11 x i8] c"send error\00"
@.str.10 = [18 x i8] c"send %d bytes ok\0A\00"
@.str.11 = [11 x i8] c"recv error\00"
@.str.12 = [15 x i8] c"recv %d bytes\0A\00"
@.str.13 = [8 x i8] c"0x%02X \00"
@.str.15 = [15 x i8] c"shutdown error\00"
@str = [10 x i8] c"socket ok\00"
@str.17 = [8 x i8] c"bind ok\00"
@str.18 = [10 x i8] c"listen ok\00"
@str.19 = [10 x i8] c"accept ok\00"
@str.20 = [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 %77
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 1100)
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 %74
25: ; preds = %11
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.17, 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 %74
31: ; preds = %25
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.18, 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 = %31
%36 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %74
37: ; preds = %31
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.19, i64 0, i64 0))
%39 = call i32 @send(i32 %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 6, i32 0)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%43 = call i32 @close(i32 %33)
br label %74
44: ; preds = %37
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %39)
%46 = call i32 @recv(i32 %33, i8* %3, i32 100, i32 0)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%50 = call i32 @close(i32 %33)
br label %74
51: ; preds = %44
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32 %46)
%53 = icmp sgt i32 %46, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = zext i32 %46 to i64
br label %60
56: ; preds = %60, %51
%57 = call i32 @putchar(i32 10)
%58 = call i32 @shutdown(i32 %33, i32 2)
%59 = icmp eq i32 %58, -1
br i1 %59, label %68, label %71
60: ; preds = %54, %60
%61 = phi i64 [ 0, %54 ], [ %66, %60 ]
%62 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i32 %64)
%66 = add nuw nsw i64 %61, 1
%67 = icmp eq i64 %66, %55
br i1 %67, label %56, label %60
68: ; preds = %56
%69 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0))
%70 = call i32 @close(i32 %33)
br label %74
71: ; preds = %56
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.20, i64 0, i64 0))
%73 = call i32 @close(i32 %33)
br label %74
74: ; preds = %35, %48, %68, %71, %41, %29, %23
%75 = phi i32 [ 1, %23 ], [ 1, %29 ], [ 1, %35 ], [ 1, %41 ], [ 1, %48 ], [ 1, %68 ], [ 0, %71 ]
%76 = call i32 @close(i32 %7)
br label %77
77: ; preds = %74, %9
%78 = phi i32 [ 1, %9 ], [ %75, %74 ]
ret i32 %78
}