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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ Readline(int, char *, int);
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ Writeline(int, char *, int /*<<< orphan*/);
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
scalar_t__ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(short);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
short strtol(char *, char **, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int list_s;
  int conn_s;
  short int port;
  struct sockaddr_in servaddr;
  char buffer[(1000)];
  char *endptr;
  if (argc == 2) {
    port = strtol(argv[1], &endptr, 0);
    if (*endptr) {
      fprintf(stderr, "ECHOSERV: Invalid port number.\n");
      exit(EXIT_FAILURE);
    }
  } else if (argc < 2) {
    port = (2002);
  } else {
    fprintf(stderr, "ECHOSERV: Invalid arguments.\n");
    exit(EXIT_FAILURE);
  }
  if ((list_s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    fprintf(stderr, "ECHOSERV: Error creating listening socket.\n");
    exit(EXIT_FAILURE);
  }
  memset(&servaddr, 0, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  servaddr.sin_port = htons(port);
  if (bind(list_s, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0) {
    fprintf(stderr, "ECHOSERV: Error calling bind()\n");
    exit(EXIT_FAILURE);
  }
  if (listen(list_s, (1024)) < 0) {
    fprintf(stderr, "ECHOSERV: Error calling listen()\n");
    exit(EXIT_FAILURE);
  }
  while (1) {
    if ((conn_s = accept(list_s, NULL, NULL)) < 0) {
      fprintf(stderr, "ECHOSERV: Error calling accept()\n");
      exit(EXIT_FAILURE);
    }
    Readline(conn_s, buffer, (1000) - 1);
    Writeline(conn_s, buffer, strlen(buffer));
    printf("%s", buffer);
    if (close(conn_s) < 0) {
      fprintf(stderr, "ECHOSERV: Error calling close()\n");
      exit(EXIT_FAILURE);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1265 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x418(%rbp),%rsi
xor    %edx,%edx
call   10b0 <strtol@plt>
mov    %ax,-0x1a(%rbp)
mov    -0x418(%rbp),%rax
cmpb   $0x0,(%rax)
je     1260 <main+0x70>
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
lea    0xdb3(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
jmp    12a2 <main+0xb2>
cmpl   $0x2,-0x8(%rbp)
jge    127a <main+0x8a>
movw   $0x7d2,-0x1a(%rbp)
jmp    129d <main+0xad>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
lea    0xd96(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
jmp    12a2 <main+0xb2>
mov    0x2d3f(%rip),%rax
mov    (%rax),%edi
mov    0x2d16(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12ea <main+0xfa>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
lea    0xd67(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2ce7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x24(%rbp)
movswl -0x1a(%rbp),%edi
call   1040 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0x0,%rax
jge    1361 <main+0x171>
mov    0x2c8b(%rip),%rax
mov    (%rax),%edi
lea    0xd1c(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x400,%esi
call   10d0 <listen@plt>
cmp    $0x0,%rax
jge    139b <main+0x1ab>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
lea    0xd02(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2c2c(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
jmp    13a0 <main+0x1b0>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10f0 <accept@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    13de <main+0x1ee>
mov    0x2c0e(%rip),%rax
mov    (%rax),%edi
lea    0xce1(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2be9(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x3e7,%edx
call   10c0 <Readline@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x424(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x420(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x424(%rbp),%edi
mov    -0x420(%rbp),%rsi
mov    %eax,%edx
call   1070 <Writeline@plt>
lea    -0x410(%rbp),%rsi
lea    0xc97(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
cmp    $0x0,%rax
jge    1471 <main+0x281>
mov    0x2b7b(%rip),%rax
mov    (%rax),%edi
lea    0xc73(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2b56(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
jmp    13a0 <main+0x1b0>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
cmp    $0x2,%edi
jne    1233 <main+0x43>
mov    0x8(%rsi),%rdi
lea    0x18(%rsp),%rsi
xor    %edx,%edx
call   10b0 <strtol@plt>
mov    %eax,%ebp
mov    0x18(%rsp),%rax
cmpb   $0x0,(%rax)
je     1239 <main+0x49>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
lea    0xdd2(%rip),%rsi
jmp    138e <main+0x19e>
mov    $0x7d2,%bp
jge    126b <main+0x7b>
mov    0x2da8(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
jns    1280 <main+0x90>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
jmp    138e <main+0x19e>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
lea    0xda5(%rip),%rsi
jmp    138e <main+0x19e>
mov    %eax,%r15d
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,0xc(%rsp)
movswl %bp,%edi
call   1040 <htons@plt>
mov    %eax,0x8(%rsp)
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
test   %rax,%rax
jns    12e5 <main+0xf5>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
lea    0xd8a(%rip),%rsi
jmp    138e <main+0x19e>
mov    %r15d,%edi
mov    $0x400,%esi
call   10d0 <listen@plt>
test   %rax,%rax
jns    130c <main+0x11c>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
lea    0xd83(%rip),%rsi
jmp    138e <main+0x19e>
lea    0x20(%rsp),%rbp
lea    0xdb6(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <accept@plt>
test   %eax,%eax
js     137e <main+0x18e>
mov    %eax,%ebx
mov    %eax,%edi
mov    %rbp,%rsi
mov    $0x3e7,%edx
call   10c0 <Readline@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1070 <Writeline@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <printf@plt>
mov    %ebx,%edi
call   1090 <close@plt>
test   %rax,%rax
jns    1320 <main+0x130>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
lea    0xd55(%rip),%rsi
jmp    138e <main+0x19e>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
lea    0xd1e(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2c26(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"ECHOSERV: Invalid port number.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [30 x i8] c"ECHOSERV: Invalid arguments.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [44 x i8] c"ECHOSERV: Error creating listening socket.\0A\00"
@INADDR_ANY = global i32 0
@.str.3 = [32 x i8] c"ECHOSERV: Error calling bind()\0A\00"
@.str.4 = [34 x i8] c"ECHOSERV: Error calling listen()\0A\00"
@.str.5 = [34 x i8] c"ECHOSERV: Error calling accept()\0A\00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [33 x i8] c"ECHOSERV: Error calling close()\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 i16
%9 = alloca %struct.sockaddr_in
%10 = alloca [1000 x i8]
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %28
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call signext i16 @strtol(i8* %17, i8** %11, i32 0)
store i16 %18, i16* %8
%19 = load i8*, i8** %11
%20 = load i8, i8* %19
%21 = icmp ne i8 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %14
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %14
br label %38
28: ; preds = %2
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 2
br i1 %30, label %31, label %32
31: ; preds = %28
store i16 2002, i16* %8
br label %37
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %31
br label %38
38: ; preds = %37, %27
%39 = load i32, i32* @AF_INET
%40 = load i32, i32* @SOCK_STREAM
%41 = call i32 @socket(i32 %39, i32 %40, i32 0)
store i32 %41, i32* %6
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%46 = load i32, i32* @EXIT_FAILURE
%47 = call i32 @exit(i32 %46)
unreachable
48: ; preds = %38
%49 = call i32 @memset(%struct.sockaddr_in* %9, i32 0, i32 12)
%50 = load i32, i32* @AF_INET
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %50, i32* %51
%52 = load i32, i32* @INADDR_ANY
%53 = call i32 @htonl(i32 %52)
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%55 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %54, i32 0, i32 0
store i32 %53, i32* %55
%56 = load i16, i16* %8
%57 = call i32 @htons(i16 signext %56)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i32 %57, i32* %58
%59 = load i32, i32* %6
%60 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%61 = call i64 @bind(i32 %59, %struct.sockaddr* %60, i32 12)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %68
63: ; preds = %48
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %48
%69 = load i32, i32* %6
%70 = call i64 @listen(i32 %69, i32 1024)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %77
72: ; preds = %68
%73 = load i32, i32* @stderr
%74 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%75 = load i32, i32* @EXIT_FAILURE
%76 = call i32 @exit(i32 %75)
unreachable
77: ; preds = %68
br label %78
78: ; preds = %77, %106
%79 = load i32, i32* %6
%80 = call i32 @accept(i32 %79, i32* null, i32* null)
store i32 %80, i32* %7
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %87
82: ; preds = %78
%83 = load i32, i32* @stderr
%84 = call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%85 = load i32, i32* @EXIT_FAILURE
%86 = call i32 @exit(i32 %85)
unreachable
87: ; preds = %78
%88 = load i32, i32* %7
%89 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%90 = call i32 @Readline(i32 %88, i8* %89, i32 999)
%91 = load i32, i32* %7
%92 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%93 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%94 = call i32 @strlen(i8* %93)
%95 = call i32 @Writeline(i32 %91, i8* %92, i32 %94)
%96 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%97 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %96)
%98 = load i32, i32* %7
%99 = call i64 @close(i32 %98)
%100 = icmp slt i64 %99, 0
br i1 %100, label %101, label %106
101: ; preds = %87
%102 = load i32, i32* @stderr
%103 = call i32 @fprintf(i32 %102, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%104 = load i32, i32* @EXIT_FAILURE
%105 = call i32 @exit(i32 %104)
unreachable
106: ; preds = %87
br label %78
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"ECHOSERV: Invalid port number.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [30 x i8] c"ECHOSERV: Invalid arguments.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [44 x i8] c"ECHOSERV: Error creating listening socket.\0A\00"
@INADDR_ANY = global i32 0
@.str.3 = [32 x i8] c"ECHOSERV: Error calling bind()\0A\00"
@.str.4 = [34 x i8] c"ECHOSERV: Error calling listen()\0A\00"
@.str.5 = [34 x i8] c"ECHOSERV: Error calling accept()\0A\00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [33 x i8] c"ECHOSERV: Error calling close()\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1000 x i8]
%5 = alloca i8*
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%8 = bitcast i8** %5 to i8*
%9 = icmp eq i32 %0, 2
br i1 %9, label %10, label %22
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call signext i16 @strtol(i8* %12, i8** %5, i32 0)
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %10
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
%23 = icmp slt i32 %0, 2
br i1 %23, label %29, label %24
24: ; preds = %22
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = tail call i32 @exit(i32 %27)
unreachable
29: ; preds = %22, %10
%30 = phi i16 [ %13, %10 ], [ 2002, %22 ]
%31 = load i32, i32* @AF_INET
%32 = load i32, i32* @SOCK_STREAM
%33 = tail call i32 @socket(i32 %31, i32 %32, i32 0)
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %29
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = tail call i32 @exit(i32 %38)
unreachable
40: ; preds = %29
%41 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%42 = load i32, i32* @AF_INET
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %42, i32* %43
%44 = load i32, i32* @INADDR_ANY
%45 = call i32 @htonl(i32 %44)
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %45, i32* %46
%47 = call i32 @htons(i16 signext %30)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %47, i32* %48
%49 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%50 = call i64 @bind(i32 %33, %struct.sockaddr* %49, i32 12)
%51 = icmp slt i64 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %40
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%55 = load i32, i32* @EXIT_FAILURE
%56 = call i32 @exit(i32 %55)
unreachable
57: ; preds = %40
%58 = call i64 @listen(i32 %33, i32 1024)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %57
%61 = load i32, i32* @stderr
%62 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%63 = load i32, i32* @EXIT_FAILURE
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %57, %73
%66 = call i32 @accept(i32 %33, i32* null, i32* null)
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%71 = load i32, i32* @EXIT_FAILURE
%72 = call i32 @exit(i32 %71)
unreachable
73: ; preds = %65
%74 = call i32 @Readline(i32 %66, i8* %7, i32 999)
%75 = call i32 @strlen(i8* %7)
%76 = call i32 @Writeline(i32 %66, i8* %7, i32 %75)
%77 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %7)
%78 = call i64 @close(i32 %66)
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %65
80: ; preds = %73
%81 = load i32, i32* @stderr
%82 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%83 = load i32, i32* @EXIT_FAILURE
%84 = call i32 @exit(i32 %83)
unreachable
}