#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 timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  scalar_t__ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
typedef int /*<<< orphan*/ server;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EchoServe(int, int *);
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ bind(int, struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
scalar_t__ getsockname(int, struct sockaddr_in *, int *);
int /*<<< orphan*/ listen(int, int);
int ntohs(scalar_t__);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int select(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
main() {
  fd_set read_template;
  struct timeval wait;
  struct sockaddr_in server;
  char buf[102];
  int sock, length, s1, s2, nb, cc, ready, eof1, eof2;
  sock = socket(PF_INET, SOCK_STREAM, 0);
  if (sock < 0) {
    perror("Erro na execucao da chamada socket()");
    exit(0);
  }
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = INADDR_ANY;
  server.sin_port = 0;
  if (bind(sock, &server, sizeof(server))) {
    perror("Erro na execucao da chamada bind()");
  }
  length = sizeof(server);
  if (getsockname(sock, &server, &length)) {
    perror("Erro na execucao da chamada getsockname()");
    exit(0);
  }
  printf("SERVIDOR EXECUTANDO: aguardando conexoes dos clientes\n");
  printf("Numero da porta usada pelo servidor: #%d\n", ntohs(server.sin_port));
  listen(sock, 5);
  s1 = accept(sock, 0, 0);
  eof1 = 0;
  printf("Cliente 1 conectado\n");
  s2 = accept(sock, 0, 0);
  eof2 = 0;
  printf("Cliente 2 conectado\n");
  wait.tv_sec = 1;
  wait.tv_usec = 0;
  do {
    FD_ZERO(&read_template);
    if (!eof1)
      FD_SET(s1, &read_template);
    if (!eof2)
      FD_SET(s2, &read_template);
    nb = select(FD_SETSIZE, &read_template, (fd_set *)0, (fd_set *)0, &wait);
    if (nb < 0) {
      perror("Erro na chamada select()");
      exit(1);
    }
    if (nb != 0) {
      if (FD_ISSET(s1, &read_template)) {
        EchoServe(s1, &eof1);
      }
      if (FD_ISSET(s2, &read_template)) {
        EchoServe(s2, &eof2);
      }
    }
  } while (!eof1 || !eof2);
  printf("Exit : finalizando programa\n");
  close(s1);
  close(s2);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
mov    0x2dbe(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0x0,-0x94(%rbp)
jge    1241 <main+0x51>
lea    0xdcb(%rip),%rdi
call   10c0 <perror@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x94(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   10b0 <bind@plt>
cmp    $0x0,%rax
je     128b <main+0x9b>
lea    0xd9f(%rip),%rdi
call   10c0 <perror@plt>
movl   $0x10,-0x98(%rbp)
mov    -0x94(%rbp),%edi
lea    -0x28(%rbp),%rsi
lea    -0x98(%rbp),%rdx
call   10e0 <getsockname@plt>
cmp    $0x0,%rax
je     12c8 <main+0xd8>
lea    0xd8c(%rip),%rdi
call   10c0 <perror@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   10a0 <ntohs@plt>
mov    %eax,%esi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x94(%rbp),%edi
mov    $0x5,%esi
call   1090 <listen@plt>
mov    -0x94(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   10d0 <accept@plt>
mov    %eax,-0x9c(%rbp)
movl   $0x0,-0xb0(%rbp)
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x94(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   10d0 <accept@plt>
mov    %eax,-0xa0(%rbp)
movl   $0x0,-0xb4(%rbp)
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
call   1070 <FD_ZERO@plt>
cmpl   $0x0,-0xb0(%rbp)
jne    138d <main+0x19d>
mov    -0x9c(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1100 <FD_SET@plt>
cmpl   $0x0,-0xb4(%rbp)
jne    13a9 <main+0x1b9>
mov    -0xa0(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1100 <FD_SET@plt>
mov    0x2c18(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rdx
call   1080 <select@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0x0,-0xa4(%rbp)
jge    13ef <main+0x1ff>
lea    0xd1d(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpl   $0x0,-0xa4(%rbp)
je     1457 <main+0x267>
mov    -0x9c(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1427 <main+0x237>
mov    -0x9c(%rbp),%edi
lea    -0xb0(%rbp),%rsi
call   1060 <EchoServe@plt>
mov    -0xa0(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1452 <main+0x262>
mov    -0xa0(%rbp),%edi
lea    -0xb4(%rbp),%rsi
call   1060 <EchoServe@plt>
jmp    1457 <main+0x267>
jmp    145c <main+0x26c>
mov    $0x1,%al
cmpl   $0x0,-0xb0(%rbp)
mov    %al,-0xb5(%rbp)
je     1483 <main+0x293>
cmpl   $0x0,-0xb4(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0xb5(%rbp)
mov    -0xb5(%rbp),%al
test   $0x1,%al
jne    1368 <main+0x178>
lea    0xc7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x9c(%rbp),%edi
call   1050 <close@plt>
mov    -0xa0(%rbp),%edi
call   1050 <close@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
mov    0x2db2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
jns    1237 <main+0x37>
lea    0xdce(%rip),%rdi
jmp    13e8 <main+0x1e8>
mov    %eax,%ebp
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x10,%edx
call   10c0 <bind@plt>
test   %rax,%rax
je     127e <main+0x7e>
lea    0xdac(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x10,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %ebp,%edi
call   10f0 <getsockname@plt>
test   %rax,%rax
jne    13e1 <main+0x1e1>
lea    0xe0e(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rdi
call   10b0 <ntohs@plt>
lea    0xdb5(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   10a0 <listen@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10e0 <accept@plt>
mov    %eax,%r14d
movl   $0x0,0x8(%rsp)
lea    0xdfc(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10e0 <accept@plt>
mov    %eax,%ebp
movl   $0x0,0x4(%rsp)
lea    0xdef(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,0x28(%rsp)
movq   $0x0,0x30(%rsp)
lea    0x24(%rsp),%rbx
mov    0x2c96(%rip),%r12
lea    0x28(%rsp),%r15
lea    0x8(%rsp),%r13
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1080 <FD_ZERO@plt>
cmpl   $0x0,0x8(%rsp)
je     13c0 <main+0x1c0>
cmpl   $0x0,0x4(%rsp)
je     13d2 <main+0x1d2>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r15,%r8
call   1090 <select@plt>
test   %eax,%eax
js     13f4 <main+0x1f4>
je     13a9 <main+0x1a9>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     138e <main+0x18e>
mov    %r14d,%edi
mov    %r13,%rsi
call   1070 <EchoServe@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     13a9 <main+0x1a9>
mov    %ebp,%edi
lea    0x4(%rsp),%rsi
call   1070 <EchoServe@plt>
cmpl   $0x0,0x8(%rsp)
je     1340 <main+0x140>
cmpl   $0x0,0x4(%rsp)
je     1340 <main+0x140>
jmp    140a <main+0x20a>
nopl   0x0(%rax)
mov    %r14d,%edi
mov    %rbx,%rsi
call   1110 <FD_SET@plt>
cmpl   $0x0,0x4(%rsp)
jne    1356 <main+0x156>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1110 <FD_SET@plt>
jmp    1356 <main+0x156>
lea    0xc60(%rip),%rdi
call   10d0 <perror@plt>
xor    %edi,%edi
call   1100 <exit@plt>
lea    0xca1(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xd02(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %ebp,%edi
call   1060 <close@plt>
xor    %edi,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
%struct.sockaddr_in = type { i64, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [37 x i8] c"Erro na execucao da chamada socket()\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.1 = [35 x i8] c"Erro na execucao da chamada bind()\00"
@.str.2 = [42 x i8] c"Erro na execucao da chamada getsockname()\00"
@.str.3 = [55 x i8] c"SERVIDOR EXECUTANDO: aguardando conexoes dos clientes\0A\00"
@.str.4 = [42 x i8] c"Numero da porta usada pelo servidor: #%d\0A\00"
@.str.5 = [21 x i8] c"Cliente 1 conectado\0A\00"
@.str.6 = [21 x i8] c"Cliente 2 conectado\0A\00"
@FD_SETSIZE = global i32 0
@.str.7 = [25 x i8] c"Erro na chamada select()\00"
@.str.8 = [29 x i8] c"Exit : finalizando programa\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.timeval
%4 = alloca %struct.sockaddr_in
%5 = alloca [102 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %1
%15 = load i32, i32* @PF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = call i32 @socket(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %0
%21 = call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %0
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %24, i32* %25
%26 = load i32, i32* @INADDR_ANY
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
%28 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %27, i32 0, i32 0
store i32 %26, i32* %28
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
store i64 0, i64* %29
%30 = load i32, i32* %6
%31 = call i64 @bind(i32 %30, %struct.sockaddr_in* %4, i32 16)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %23
%34 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %23
store i32 16, i32* %7
%36 = load i32, i32* %6
%37 = call i64 @getsockname(i32 %36, %struct.sockaddr_in* %4, i32* %7)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 @exit(i32 0)
unreachable
42: ; preds = %35
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%45 = load i64, i64* %44
%46 = call i32 @ntohs(i64 %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %6
%49 = call i32 @listen(i32 %48, i32 5)
%50 = load i32, i32* %6
%51 = call i32 @accept(i32 %50, i32 0, i32 0)
store i32 %51, i32* %8
store i32 0, i32* %13
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%53 = load i32, i32* %6
%54 = call i32 @accept(i32 %53, i32 0, i32 0)
store i32 %54, i32* %9
store i32 0, i32* %14
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%56 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 1, i32* %56
%57 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i64 0, i64* %57
br label %58
58: ; preds = %105, %42
%59 = call i32 @FD_ZERO(i32* %2)
%60 = load i32, i32* %13
%61 = icmp ne i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %58
%63 = load i32, i32* %8
%64 = call i32 @FD_SET(i32 %63, i32* %2)
br label %65
65: ; preds = %62, %58
%66 = load i32, i32* %14
%67 = icmp ne i32 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = load i32, i32* %9
%70 = call i32 @FD_SET(i32 %69, i32* %2)
br label %71
71: ; preds = %68, %65
%72 = load i32, i32* @FD_SETSIZE
%73 = call i32 @select(i32 %72, i32* %2, i32* null, i32* null, %struct.timeval* %3)
store i32 %73, i32* %10
%74 = load i32, i32* %10
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %71
%80 = load i32, i32* %10
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %97
82: ; preds = %79
%83 = load i32, i32* %8
%84 = call i64 @FD_ISSET(i32 %83, i32* %2)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %82
%87 = load i32, i32* %8
%88 = call i32 @EchoServe(i32 %87, i32* %13)
br label %89
89: ; preds = %86, %82
%90 = load i32, i32* %9
%91 = call i64 @FD_ISSET(i32 %90, i32* %2)
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %89
%94 = load i32, i32* %9
%95 = call i32 @EchoServe(i32 %94, i32* %14)
br label %96
96: ; preds = %93, %89
br label %97
97: ; preds = %96, %79
br label %98
98: ; preds = %97
%99 = load i32, i32* %13
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %105
101: ; preds = %98
%102 = load i32, i32* %14
%103 = icmp ne i32 %102, 0
%104 = xor i1 %103, true
br label %105
105: ; preds = %101, %98
%106 = phi i1 [ true, %98 ], [ %104, %101 ]
br i1 %106, label %58, label %107
107: ; preds = %105
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
%109 = load i32, i32* %8
%110 = call i32 @close(i32 %109)
%111 = load i32, i32* %9
%112 = call i32 @close(i32 %111)
%113 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
%struct.sockaddr_in = type { i64, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [37 x i8] c"Erro na execucao da chamada socket()\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.1 = [35 x i8] c"Erro na execucao da chamada bind()\00"
@.str.2 = [42 x i8] c"Erro na execucao da chamada getsockname()\00"
@.str.4 = [42 x i8] c"Numero da porta usada pelo servidor: #%d\0A\00"
@FD_SETSIZE = global i32 0
@.str.7 = [25 x i8] c"Erro na chamada select()\00"
@str = [54 x i8] c"SERVIDOR EXECUTANDO: aguardando conexoes dos clientes\00"
@str.9 = [20 x i8] c"Cliente 1 conectado\00"
@str.10 = [20 x i8] c"Cliente 2 conectado\00"
@str.11 = [28 x i8] c"Exit : finalizando programa\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast %struct.timeval* %2 to i8*
%9 = bitcast %struct.sockaddr_in* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = load i32, i32* @PF_INET
%14 = load i32, i32* @SOCK_STREAM
%15 = tail call i32 @socket(i32 %13, i32 %14, i32 0)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = tail call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %0
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %21, i32* %22
%23 = load i32, i32* @INADDR_ANY
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %23, i32* %24
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i64 0, i64* %25
%26 = call i64 @bind(i32 %15, %struct.sockaddr_in* %3, i32 16)
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %20
%29 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %20
store i32 16, i32* %4
%31 = call i64 @getsockname(i32 %15, %struct.sockaddr_in* %3, i32* %4)
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 @exit(i32 0)
unreachable
36: ; preds = %30
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%38 = load i64, i64* %25
%39 = call i32 @ntohs(i64 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = call i32 @listen(i32 %15, i32 5)
%42 = call i32 @accept(i32 %15, i32 0, i32 0)
store i32 0, i32* %5
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.9, i64 0, i64 0))
%44 = call i32 @accept(i32 %15, i32 0, i32 0)
store i32 0, i32* %6
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.10, i64 0, i64 0))
%46 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 1, i32* %46
%47 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i64 0, i64* %47
br label %48
48: ; preds = %78, %36
%49 = call i32 @FD_ZERO(i32* %1)
%50 = load i32, i32* %5
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = call i32 @FD_SET(i32 %42, i32* %1)
br label %54
54: ; preds = %52, %48
%55 = load i32, i32* %6
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 @FD_SET(i32 %44, i32* %1)
br label %59
59: ; preds = %57, %54
%60 = load i32, i32* @FD_SETSIZE
%61 = call i32 @select(i32 %60, i32* %1, i32* null, i32* null, %struct.timeval* %2)
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %59
%67 = icmp eq i32 %61, 0
br i1 %67, label %78, label %68
68: ; preds = %66
%69 = call i64 @FD_ISSET(i32 %42, i32* %1)
%70 = icmp eq i64 %69, 0
br i1 %70, label %73, label %71
71: ; preds = %68
%72 = call i32 @EchoServe(i32 %42, i32* %5)
br label %73
73: ; preds = %71, %68
%74 = call i64 @FD_ISSET(i32 %44, i32* %1)
%75 = icmp eq i64 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %73
%77 = call i32 @EchoServe(i32 %44, i32* %6)
br label %78
78: ; preds = %66, %76, %73
%79 = load i32, i32* %5
%80 = icmp eq i32 %79, 0
%81 = load i32, i32* %6
%82 = icmp eq i32 %81, 0
%83 = select i1 %80, i1 true, i1 %82
br i1 %83, label %48, label %84
84: ; preds = %78
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
%86 = call i32 @close(i32 %42)
%87 = call i32 @close(i32 %44)
%88 = call i32 @exit(i32 0)
unreachable
}