#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 atoi(char *);
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);
int recv(int, char *, int, int /*<<< orphan*/);
int send(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[]) {
  if (argc < 2) {
    fprintf(stderr, "Usage: %s [PORT]\n", argv[0]);
    fflush(stderr);
    exit(1);
  };
  int port = atoi(argv[1]);
  int server_fd, client_fd, err;
  struct sockaddr_in server, client;
  char buf[4048];
  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;
  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, "Colud not bind socket");
    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", 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 etablished new connection\n");
      fflush(stderr);
      exit(1);
    };
    while (1) {
      int read = recv(client_fd, buf, 4048, 0);
      if (!read)
        break;
      if (read < 0) {
        fprintf(stderr, "Client read failed\n");
        fflush(stderr);
        exit(1);
      };
      err = send(client_fd, buf, read, 0);
      if (err < 0) {
        fprintf(stderr, "Client write failed\n");
        fflush(stderr);
        exit(1);
      };
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1239 <main+0x59>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
mov    0x2d67(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    129e <main+0xbe>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
lea    0xd93(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2d3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%edi
mov    0x2d18(%rip),%rax
mov    (%rax),%esi
mov    0x2cdf(%rip),%rax
mov    (%rax),%edx
lea    -0x1014(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    133a <main+0x15a>
mov    0x2cb6(%rip),%rax
mov    (%rax),%edi
lea    0xd10(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x18(%rbp),%edi
mov    $0x80,%esi
call   10b0 <listen@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    1383 <main+0x1a3>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
lea    0xcdd(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x14(%rbp),%esi
lea    0xcd0(%rip),%rdi
call   1070 <printf@plt>
movl   $0xc,-0x1018(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x1018(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    13eb <main+0x20b>
mov    0x2c05(%rip),%rax
mov    (%rax),%edi
lea    0xcab(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    13f0 <main+0x210>
mov    -0x1c(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    $0xfd0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x101c(%rbp)
cmpl   $0x0,-0x101c(%rbp)
jne    141e <main+0x23e>
jmp    14b2 <main+0x2d2>
cmpl   $0x0,-0x101c(%rbp)
jge    145a <main+0x27a>
mov    0x2b96(%rip),%rax
mov    (%rax),%edi
lea    0xc61(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x1c(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    -0x101c(%rbp),%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    14ad <main+0x2cd>
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
lea    0xc22(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b2c(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    13f0 <main+0x210>
jmp    1392 <main+0x1b2>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1000,%rsp
cmp    $0x1,%edi
jg     1213 <main+0x33>
mov    0x2dcd(%rip),%rbx
mov    (%rbx),%edi
mov    (%rsi),%rdx
lea    0xdf9(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    13b2 <main+0x1d2>
mov    0x8(%rsi),%rdi
call   10e0 <atoi@plt>
mov    %eax,%ebp
mov    0x2dbb(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
test   %eax,%eax
jns    1250 <main+0x70>
mov    0x2d86(%rip),%rbx
mov    (%rbx),%edi
lea    0xdc7(%rip),%rsi
jmp    13ab <main+0x1cb>
mov    %eax,%r14d
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    %ebp,%edi
call   1050 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x10(%rsp)
mov    0x2d6b(%rip),%rax
mov    (%rax),%esi
mov    0x2d32(%rip),%rax
mov    (%rax),%edx
lea    0x1c(%rsp),%rcx
mov    %r14d,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xc,%edx
call   10c0 <bind@plt>
test   %eax,%eax
jns    12c6 <main+0xe6>
mov    0x2d10(%rip),%rbx
mov    (%rbx),%edi
lea    0xd6a(%rip),%rsi
jmp    13ab <main+0x1cb>
mov    %r14d,%edi
mov    $0x80,%esi
call   10b0 <listen@plt>
test   %eax,%eax
jns    12ec <main+0x10c>
mov    0x2cea(%rip),%rbx
mov    (%rbx),%edi
lea    0xd5a(%rip),%rsi
jmp    13ab <main+0x1cb>
lea    0xd6a(%rip),%rdi
mov    %ebp,%esi
call   1070 <printf@plt>
movl   $0xc,0xc(%rsp)
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r14d,%edi
call   10d0 <accept@plt>
test   %eax,%eax
jns    132d <main+0x14d>
mov    0x2ca9(%rip),%rbx
mov    (%rbx),%edi
lea    0xd4f(%rip),%rsi
jmp    13ab <main+0x1cb>
mov    %eax,%ebx
lea    0x30(%rsp),%rbp
lea    0x20(%rsp),%r15
lea    0xc(%rsp),%r12
jmp    1360 <main+0x180>
movl   $0xc,0xc(%rsp)
mov    %r14d,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   10d0 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1318 <main+0x138>
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0xfd0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     1340 <main+0x160>
js     139b <main+0x1bb>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
test   %eax,%eax
jns    1360 <main+0x180>
mov    0x2c38(%rip),%rbx
mov    (%rbx),%edi
lea    0xd17(%rip),%rsi
jmp    13ab <main+0x1cb>
mov    0x2c26(%rip),%rbx
mov    (%rbx),%edi
lea    0xcf1(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

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

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