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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int listen(int, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int port = 5555;
  int server_fd, client_fd, err;
  struct sockaddr_in server, client;
  char buff[1024 * 8];
  server_fd = socket(AF_INET, SOCK_STREAM, 0);
  if (server_fd < 0) {
    fprintf(stderr, "Could not create socket\n");
    fflush(stderr);
    exit(1);
  };
  server.sin_family = AF_INET;
  server.sin_port = htons(port);
  server.sin_addr.s_addr = htonl(INADDR_ANY);
  int opt_val = 1;
  setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt_val, sizeof opt_val);
  err = bind(server_fd, (struct sockaddr *)&server, sizeof(server));
  if (err < 0) {
    fprintf(stderr, "Could not bind socket\n");
    fflush(stderr);
    exit(1);
  };
  err = listen(server_fd, 128);
  if (err < 0) {
    fprintf(stderr, "Could not listen on socket\n");
    fflush(stderr);
    exit(1);
  };
  printf("Server is listening on %d\n", port);
  while (1) {
    socklen_t client_len = sizeof(client);
    client_fd = accept(server_fd, (struct sockaddr *)&client, &client_len);
    if (client_fd < 0) {
      fprintf(stderr, "Could not establish new connection\n");
      fflush(stderr);
      exit(1);
    };
    while (1) {
      int read = recv(client_fd, buff, 1024 * 8, 0);
      if (!read)
        break;
      if (read < 0) {
        fprintf(stderr, "Client read failed\n");
        fflush(stderr);
        exit(1);
      };
      for (int i; i < read; i++)
        printf("%02x ", buff[i]);
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x15b3,-0x14(%rbp)
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1233 <main+0x73>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0xdea(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x30(%rbp)
movl   $0x1,-0x2044(%rbp)
mov    -0x18(%rbp),%edi
mov    0x2d79(%rip),%rax
mov    (%rax),%esi
mov    0x2d40(%rip),%rax
mov    (%rax),%edx
lea    -0x2044(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10b0 <bind@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    12d7 <main+0x117>
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
lea    0xd5f(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x18(%rbp),%edi
mov    $0x80,%esi
call   10a0 <listen@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    131e <main+0x15e>
mov    0x2cd0(%rip),%rax
mov    (%rax),%edi
lea    0xd2f(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%esi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xc,-0x2048(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x2048(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1386 <main+0x1c6>
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
lea    0xcfe(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2c53(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    138b <main+0x1cb>
mov    -0x1c(%rbp),%edi
lea    -0x2040(%rbp),%rsi
mov    $0x2000,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x204c(%rbp)
cmpl   $0x0,-0x204c(%rbp)
jne    13b9 <main+0x1f9>
jmp    144e <main+0x28e>
cmpl   $0x0,-0x204c(%rbp)
jge    13f3 <main+0x233>
mov    0x2bfb(%rip),%rax
mov    (%rax),%edi
lea    0xcb5(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    13f8 <main+0x238>
mov    -0x2050(%rbp),%eax
cmp    -0x204c(%rbp),%eax
jge    143b <main+0x27b>
movslq -0x2050(%rbp),%rax
movsbl -0x2040(%rbp,%rax,1),%esi
ff
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x2050(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2050(%rbp)
jmp    13f8 <main+0x238>
lea    0xc23(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    138b <main+0x1cb>
jmp    132f <main+0x16f>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2038,%rsp
mov    0x2df8(%rip),%rbx
mov    (%rbx),%edi
mov    0x2dcf(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
test   %eax,%eax
jns    1213 <main+0x43>
mov    0x2dc3(%rip),%rbx
mov    (%rbx),%edi
lea    0xdf2(%rip),%rsi
jmp    13d6 <main+0x206>
mov    %eax,%r14d
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    $0x15b3,%edi
call   1060 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x10(%rsp)
movl   $0x1,0xc(%rsp)
mov    0x2d9d(%rip),%rax
mov    (%rax),%esi
mov    0x2d64(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    %r14d,%edi
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xc,%edx
call   10c0 <bind@plt>
test   %eax,%eax
jns    1294 <main+0xc4>
mov    0x2d42(%rip),%rbx
mov    (%rbx),%edi
lea    0xd8a(%rip),%rsi
jmp    13d6 <main+0x206>
mov    %r14d,%edi
mov    $0x80,%esi
call   10b0 <listen@plt>
test   %eax,%eax
jns    12ba <main+0xea>
mov    0x2d1c(%rip),%rbx
mov    (%rbx),%edi
lea    0xd7b(%rip),%rsi
jmp    13d6 <main+0x206>
lea    0xd8b(%rip),%rdi
mov    $0x15b3,%esi
xor    %eax,%eax
call   1070 <printf@plt>
movl   $0xc,(%rsp)
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
mov    %r14d,%edi
call   10d0 <accept@plt>
test   %eax,%eax
jns    12fd <main+0x12d>
mov    0x2cd9(%rip),%rbx
mov    (%rbx),%edi
lea    0xd6f(%rip),%rsi
jmp    13d6 <main+0x206>
mov    %eax,%ebp
lea    0x30(%rsp),%r15
lea    0xd94(%rip),%rbx
mov    %r14d,0x4(%rsp)
jmp    133e <main+0x16e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0xc,(%rsp)
mov    0x4(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
call   10d0 <accept@plt>
mov    %eax,%ebp
test   %eax,%eax
js     12e8 <main+0x118>
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x2000,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%r14d
test   %eax,%eax
mov    %ebp,0x8(%rsp)
jne    1382 <main+0x1b2>
jmp    1320 <main+0x150>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x2000,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%r14d
test   %eax,%eax
je     1320 <main+0x150>
test   %r14d,%r14d
js     13c6 <main+0x1f6>
cmp    %r14d,%r12d
jge    1360 <main+0x190>
movslq %r12d,%rax
lea    (%rsp,%rax,1),%r15
add    $0x30,%r15
mov    %r14d,%r13d
sub    %r12d,%r13d
xor    %ebp,%ebp
nop
movsbl (%r15,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbp
cmp    %ebp,%r13d
jne    13a0 <main+0x1d0>
mov    %r14d,%r12d
lea    0x30(%rsp),%r15
mov    0x8(%rsp),%ebp
jmp    1360 <main+0x190>
mov    0x2bfb(%rip),%rbx
mov    (%rbx),%edi
lea    0xcb5(%rip),%rsi
call   1090 <fprintf@plt>
mov    (%rbx),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [25 x i8] c"Could not create socket\0A\00"
@INADDR_ANY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [23 x i8] c"Could not bind socket\0A\00"
@.str.2 = [28 x i8] c"Could not listen on socket\0A\00"
@.str.3 = [27 x i8] c"Server is listening on %d\0A\00"
@.str.4 = [36 x i8] c"Could not establish new connection\0A\00"
@.str.5 = [20 x i8] c"Client read failed\0A\00"
@.str.6 = [6 x i8] c"%02x \00"
@.str.7 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.sockaddr_in
%12 = alloca [8192 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5555, i32* %6
%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* %7
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = call i32 @fflush(i32 %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
%29 = load i32, i32* @AF_INET
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %29, i32* %30
%31 = load i32, i32* %6
%32 = call i32 @htons(i32 %31)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %32, i32* %33
%34 = load i32, i32* @INADDR_ANY
%35 = call i32 @htonl(i32 %34)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%37 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %36, i32 0, i32 0
store i32 %35, i32* %37
store i32 1, i32* %13
%38 = load i32, i32* %7
%39 = load i32, i32* @SOL_SOCKET
%40 = load i32, i32* @SO_REUSEADDR
%41 = call i32 @setsockopt(i32 %38, i32 %39, i32 %40, i32* %13, i32 4)
%42 = load i32, i32* %7
%43 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%44 = call i32 @bind(i32 %42, %struct.sockaddr* %43, i32 12)
store i32 %44, i32* %9
%45 = load i32, i32* %9
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %28
%48 = load i32, i32* @stderr
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%50 = load i32, i32* @stderr
%51 = call i32 @fflush(i32 %50)
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %28
%54 = load i32, i32* %7
%55 = call i32 @listen(i32 %54, i32 128)
store i32 %55, i32* %9
%56 = load i32, i32* %9
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %64
58: ; preds = %53
%59 = load i32, i32* @stderr
%60 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%61 = load i32, i32* @stderr
%62 = call i32 @fflush(i32 %61)
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %53
%65 = load i32, i32* %6
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %64, %113
store i32 12, i32* %14
%68 = load i32, i32* %7
%69 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%70 = call i32 @accept(i32 %68, %struct.sockaddr* %69, i32* %14)
store i32 %70, i32* %8
%71 = load i32, i32* %8
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %79
73: ; preds = %67
%74 = load i32, i32* @stderr
%75 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%76 = load i32, i32* @stderr
%77 = call i32 @fflush(i32 %76)
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %67
br label %80
80: ; preds = %79, %111
%81 = load i32, i32* %8
%82 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%83 = call i32 @recv(i32 %81, i8* %82, i32 8192, i32 0)
store i32 %83, i32* %15
%84 = load i32, i32* %15
%85 = icmp ne i32 %84, 0
br i1 %85, label %87, label %86
86: ; preds = %80
br label %113
87: ; preds = %80
%88 = load i32, i32* %15
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %96
90: ; preds = %87
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%93 = load i32, i32* @stderr
%94 = call i32 @fflush(i32 %93)
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %87
br label %97
97: ; preds = %108, %96
%98 = load i32, i32* %16
%99 = load i32, i32* %15
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %111
101: ; preds = %97
%102 = load i32, i32* %16
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 %103
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %106)
br label %108
108: ; preds = %101
%109 = load i32, i32* %16
%110 = add nsw i32 %109, 1
store i32 %110, i32* %16
br label %97
111: ; preds = %97
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %80
113: ; preds = %86
br label %67
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [25 x i8] c"Could not create socket\0A\00"
@INADDR_ANY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [23 x i8] c"Could not bind socket\0A\00"
@.str.2 = [28 x i8] c"Could not listen on socket\0A\00"
@.str.3 = [27 x i8] c"Server is listening on %d\0A\00"
@.str.4 = [36 x i8] c"Could not establish new connection\0A\00"
@.str.5 = [20 x i8] c"Client read failed\0A\00"
@.str.6 = [6 x i8] c"%02x \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca [8192 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = bitcast %struct.sockaddr_in* %4 to i8*
%10 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = tail call i32 @fflush(i32 %18)
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%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 5555)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %24, i32* %25
%26 = load i32, i32* @INADDR_ANY
%27 = tail call i32 @htonl(i32 %26)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %27, i32* %28
%29 = bitcast i32* %6 to i8*
store i32 1, i32* %6
%30 = load i32, i32* @SOL_SOCKET
%31 = load i32, i32* @SO_REUSEADDR
%32 = call i32 @setsockopt(i32 %13, i32 %30, i32 %31, i32* %6, i32 4)
%33 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%34 = call i32 @bind(i32 %13, %struct.sockaddr* %33, i32 12)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %42
36: ; preds = %21
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%39 = load i32, i32* @stderr
%40 = call i32 @fflush(i32 %39)
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %21
%43 = call i32 @listen(i32 %13, i32 128)
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%48 = load i32, i32* @stderr
%49 = call i32 @fflush(i32 %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %42
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 5555)
%53 = bitcast i32* %7 to i8*
%54 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
store i32 12, i32* %7
%55 = call i32 @accept(i32 %13, %struct.sockaddr* %54, i32* %7)
%56 = icmp slt i32 %55, 0
br i1 %56, label %62, label %57
57: ; preds = %51, %96
%58 = phi i32 [ %98, %96 ], [ %55, %51 ]
%59 = phi i32 [ %97, %96 ], [ undef, %51 ]
%60 = call i32 @recv(i32 %58, i8* %10, i32 8192, i32 0)
%61 = icmp eq i32 %60, 0
br i1 %61, label %96, label %68
62: ; preds = %96, %51
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%65 = load i32, i32* @stderr
%66 = call i32 @fflush(i32 %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %57, %91
%69 = phi i32 [ %94, %91 ], [ %60, %57 ]
%70 = phi i32 [ %92, %91 ], [ %59, %57 ]
%71 = icmp slt i32 %69, 0
br i1 %71, label %76, label %72
72: ; preds = %68
%73 = icmp slt i32 %70, %69
br i1 %73, label %74, label %91
74: ; preds = %72
%75 = sext i32 %70 to i64
br label %82
76: ; preds = %68
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%79 = load i32, i32* @stderr
%80 = call i32 @fflush(i32 %79)
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %74, %82
%83 = phi i64 [ %75, %74 ], [ %88, %82 ]
%84 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %86)
%88 = add nsw i64 %83, 1
%89 = trunc i64 %88 to i32
%90 = icmp eq i32 %69, %89
br i1 %90, label %91, label %82
91: ; preds = %82, %72
%92 = phi i32 [ %70, %72 ], [ %69, %82 ]
%93 = call i32 @putchar(i32 10)
%94 = call i32 @recv(i32 %58, i8* %10, i32 8192, i32 0)
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %68
96: ; preds = %91, %57
%97 = phi i32 [ %59, %57 ], [ %92, %91 ]
store i32 12, i32* %7
%98 = call i32 @accept(i32 %13, %struct.sockaddr* %54, i32* %7)
%99 = icmp slt i32 %98, 0
br i1 %99, label %62, label %57
}