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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ FD_CLR(int, int /*<<< orphan*/ *);
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int htons(int);
int /*<<< orphan*/ inet_addr(char *);
char *inet_ntoa(TYPE_1__);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int recv(int, char *, int, int /*<<< orphan*/);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char *argv[]) {
  struct sockaddr_in server_addr, client_addr;
  int listenfd, connfd, sockfd;
  socklen_t client_addr_len = sizeof(struct sockaddr);
  char buf[1024 + 1], sbuf[1024];
  int n, i, maxi;
  int se_ready;
  int client[FD_SETSIZE];
  fd_set sets, initsets;
  int maxfd;
  listenfd = socket(AF_INET, SOCK_STREAM, 0);
  if (listenfd == -1) {
    perror("****Create TCP socket");
    exit(1);
  }
  bzero(&server_addr, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  server_addr.sin_addr.s_addr = inet_addr("0.0.0.0");
  server_addr.sin_port = htons(8880);
  if (bind(listenfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) ==
      -1) {
    perror("Bind the IP and PORT");
    exit(1);
  }
  listen(listenfd, 20);
  for (i = 0; i < FD_SETSIZE; i++)
    client[i] = -1;
  FD_ZERO(&initsets);
  FD_SET(0, &initsets);
  FD_SET(listenfd, &initsets);
  maxfd = listenfd;
  maxi = -1;
  while (1) {
    sets = initsets;
    se_ready = select(maxfd + 1, &sets, NULL, NULL, NULL);
    if (se_ready <= 0) {
      perror("Select Error.\n");
      continue;
    }
    if (FD_ISSET(0, &sets)) {
      memset(buf, 0, 1024 + 1);
      fgets(buf, sizeof(buf), stdin);
      if (strcmp(buf, "exit\n") == 0) {
        break;
      }
    }
    if (FD_ISSET(listenfd, &sets)) {
      connfd =
          accept(listenfd, (struct sockaddr *)&client_addr, &client_addr_len);
      if (connfd < 0) {
        perror("Accept the connection");
        continue;
      }
      sprintf(sbuf, "Accept from client %s:%d\n",
              inet_ntoa(client_addr.sin_addr), client_addr.sin_port);
      printf(sbuf, "");
      for (i = 0; i < FD_SETSIZE; i++) {
        if (client[i] < 0) {
          client[i] = connfd;
          FD_SET(client[i], &initsets);
          break;
        }
      }
      if (connfd > maxfd) {
        maxfd = connfd;
      }
      if (i > maxi) {
        maxi = i;
      }
    }
    for (i = 0; i <= maxi; i++) {
      sockfd = client[i];
      if (sockfd < 0) {
        continue;
      }
      if (FD_ISSET(sockfd, &sets)) {
        memset(buf, 0, 1024 + 1);
        n = recv(sockfd, buf, 1024, 0);
        if (n == -1) {
          perror("Receive ");
          exit(1);
        }
        if (strcmp(buf, "exit\n") == 0) {
          close(sockfd);
          FD_CLR(sockfd, &initsets);
          client[i] = -1;
          break;
        } else {
          buf[n] = '\0';
          printf("Client 【%d】 says : %s", i, buf);
          n = send(sockfd, buf, strlen(buf), 0);
          if (n == -1) {
            perror("Reply sent");
            exit(1);
          }
        }
      }
    }
  }
  if (close(listenfd) == -1) {
    perror("Close");
    exit(1);
  }
  puts("You have input the end command.\n");
  puts("TCP Server has been closed");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x40(%rbp)
mov    0x2d11(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x868(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x888(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x870(%rbp)
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
mov    0x2cda(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1322 <main+0x92>
lea    0xced(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
lea    -0x20(%rbp),%rdi
mov    $0xc,%esi
call   1150 <bzero@plt>
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
lea    0xcd3(%rip),%rdi
call   10e0 <inet_addr@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x22b0,%edi
call   1080 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1130 <bind@plt>
cmp    $0xffffffff,%eax
jne    1388 <main+0xf8>
lea    0xca5(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
mov    -0x34(%rbp),%edi
mov    $0x14,%esi
call   1120 <listen@plt>
movl   $0x0,-0x858(%rbp)
mov    -0x858(%rbp),%eax
mov    0x2c1c(%rip),%rcx
cmp    (%rcx),%eax
jge    13dd <main+0x14d>
mov    -0x888(%rbp),%rax
movslq -0x858(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x858(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x858(%rbp)
jmp    139f <main+0x10f>
lea    -0x878(%rbp),%rdi
call   1100 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0x878(%rbp),%rsi
call   11a0 <FD_SET@plt>
mov    -0x34(%rbp),%edi
lea    -0x878(%rbp),%rsi
call   11a0 <FD_SET@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x87c(%rbp)
movl   $0xffffffff,-0x85c(%rbp)
ff ff ff
jmp    141e <main+0x18e>
mov    -0x878(%rbp),%eax
mov    %eax,-0x874(%rbp)
mov    -0x87c(%rbp),%edi
add    $0x1,%edi
lea    -0x874(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   1110 <select@plt>
mov    %eax,-0x860(%rbp)
cmpl   $0x0,-0x860(%rbp)
jg     146e <main+0x1de>
lea    0xbcf(%rip),%rdi
call   1140 <perror@plt>
jmp    1419 <main+0x189>
xor    %edi,%edi
lea    -0x874(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     14da <main+0x24a>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x401,%edx
call   10b0 <memset@plt>
lea    -0x450(%rbp),%rdi
mov    0x2b39(%rip),%rax
mov    (%rax),%edx
mov    $0x401,%esi
call   10d0 <fgets@plt>
lea    -0x450(%rbp),%rdi
lea    0xb81(%rip),%rsi
call   10f0 <strcmp@plt>
cmp    $0x0,%rax
jne    14d5 <main+0x245>
jmp    17cb <main+0x53b>
jmp    14da <main+0x24a>
mov    -0x34(%rbp),%edi
lea    -0x874(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     161f <main+0x38f>
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1160 <accept@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jge    1521 <main+0x291>
lea    0xb31(%rip),%rdi
call   1140 <perror@plt>
jmp    1419 <main+0x189>
lea    -0x850(%rbp),%rax
mov    %rax,-0x890(%rbp)
mov    -0x2c(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    -0x890(%rbp),%rdi
mov    %rax,%rdx
mov    -0x30(%rbp),%ecx
lea    0xb13(%rip),%rsi
call   1180 <sprintf@plt>
lea    -0x850(%rbp),%rdi
lea    0xb6e(%rip),%rsi
mov    $0x0,%al
call   10a0 <printf@plt>
movl   $0x0,-0x858(%rbp)
mov    -0x858(%rbp),%eax
mov    0x2a4c(%rip),%rcx
cmp    (%rcx),%eax
jge    15e4 <main+0x354>
mov    -0x888(%rbp),%rax
movslq -0x858(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    15cb <main+0x33b>
mov    -0x888(%rbp),%rax
mov    -0x38(%rbp),%edx
movslq -0x858(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
movslq -0x858(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x878(%rbp),%rsi
call   11a0 <FD_SET@plt>
jmp    15e4 <main+0x354>
jmp    15d0 <main+0x340>
mov    -0x858(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x858(%rbp)
jmp    156f <main+0x2df>
mov    -0x38(%rbp),%eax
cmp    -0x87c(%rbp),%eax
jle    15fc <main+0x36c>
mov    -0x38(%rbp),%eax
mov    %eax,-0x87c(%rbp)
mov    -0x858(%rbp),%eax
cmp    -0x85c(%rbp),%eax
jle    161a <main+0x38a>
mov    -0x858(%rbp),%eax
mov    %eax,-0x85c(%rbp)
jmp    161f <main+0x38f>
movl   $0x0,-0x858(%rbp)
mov    -0x858(%rbp),%eax
cmp    -0x85c(%rbp),%eax
jg     17c6 <main+0x536>
mov    -0x888(%rbp),%rax
movslq -0x858(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    165e <main+0x3ce>
jmp    17b2 <main+0x522>
mov    -0x3c(%rbp),%edi
lea    -0x874(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     17ad <main+0x51d>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x401,%edx
call   10b0 <memset@plt>
mov    -0x3c(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x854(%rbp)
cmpl   $0xffffffff,-0x854(%rbp)
jne    16c9 <main+0x439>
lea    0x9be(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
lea    -0x450(%rbp),%rdi
lea    0x96b(%rip),%rsi
call   10f0 <strcmp@plt>
cmp    $0x0,%rax
jne    1717 <main+0x487>
mov    -0x3c(%rbp),%edi
call   10c0 <close@plt>
mov    -0x3c(%rbp),%edi
lea    -0x878(%rbp),%rsi
call   1170 <FD_CLR@plt>
mov    -0x888(%rbp),%rax
movslq -0x858(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
jmp    17c6 <main+0x536>
movslq -0x854(%rbp),%rax
movb   $0x0,-0x450(%rbp,%rax,1)
mov    -0x858(%rbp),%esi
lea    -0x450(%rbp),%rdx
lea    0x947(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x89c(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x898(%rbp)
lea    -0x450(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x89c(%rbp),%edi
mov    -0x898(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %eax,-0x854(%rbp)
cmpl   $0xffffffff,-0x854(%rbp)
jne    17a3 <main+0x513>
lea    0x907(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
jmp    17a8 <main+0x518>
jmp    17ad <main+0x51d>
jmp    17b2 <main+0x522>
mov    -0x858(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x858(%rbp)
jmp    1629 <main+0x399>
jmp    1419 <main+0x189>
mov    -0x34(%rbp),%edi
call   10c0 <close@plt>
cmp    $0xffffffff,%eax
jne    17f2 <main+0x562>
lea    0x8c3(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
lea    0x8b3(%rip),%rdi
call   1040 <puts@plt>
lea    0x8c8(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x868(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x858,%rsp
mov    %rsp,%r15
movl   $0x4,-0x54(%rbp)
mov    0x2d13(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    0x2d11(%rip),%r14
mov    (%r14),%edi
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
cmp    $0xffffffff,%eax
je     167d <main+0x3ed>
mov    %eax,%r13d
lea    -0x60(%rbp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1150 <bzero@plt>
mov    (%r14),%eax
mov    %eax,-0x58(%rbp)
lea    0xd02(%rip),%rdi
call   10e0 <inet_addr@plt>
mov    %eax,-0x5c(%rbp)
mov    $0x22b0,%edi
call   1080 <htons@plt>
mov    %eax,-0x60(%rbp)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1130 <bind@plt>
cmp    $0xffffffff,%eax
je     1686 <main+0x3f6>
mov    %r15,-0x68(%rbp)
mov    %r13d,%edi
mov    $0x14,%esi
call   1120 <listen@plt>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edx
test   %edx,%edx
jle    1372 <main+0xe2>
shl    $0x2,%rdx
mov    -0x40(%rbp),%rdi
mov    $0xff,%esi
call   10b0 <memset@plt>
lea    -0x30(%rbp),%rbx
mov    %rbx,%rdi
call   1100 <FD_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   11a0 <FD_SET@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
call   11a0 <FD_SET@plt>
mov    $0xffffffff,%eax
lea    -0x2c(%rbp),%rbx
lea    -0x480(%rbp),%r12
mov    %r13d,%ecx
mov    %rcx,-0x50(%rbp)
mov    %r13d,-0x44(%rbp)
jmp    13b8 <main+0x128>
mov    -0x44(%rbp),%r13d
mov    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x50(%rbp),%rax
lea    0x1(%rax),%r15d
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    %r15d,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1110 <select@plt>
lea    0xc50(%rip),%rdi
test   %eax,%eax
jle    1462 <main+0x1d2>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1433 <main+0x1a3>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x401,%edx
call   10b0 <memset@plt>
mov    0x2bd4(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    $0x401,%esi
call   10d0 <fgets@plt>
mov    %r12,%rdi
lea    0xc1d(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1624 <main+0x394>
mov    %r13d,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1613 <main+0x383>
mov    %r13d,%edi
lea    -0x78(%rbp),%rsi
lea    -0x54(%rbp),%rdx
call   1160 <accept@plt>
lea    0xbea(%rip),%rdi
test   %eax,%eax
jns    1470 <main+0x1e0>
call   1140 <perror@plt>
jmp    13c4 <main+0x134>
nopl   0x0(%rax)
mov    %eax,%r14d
mov    -0x74(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    -0x78(%rbp),%ecx
lea    -0x880(%rbp),%r15
mov    %r15,%rdi
lea    0xbcf(%rip),%rsi
mov    %rax,%rdx
call   1180 <sprintf@plt>
xor    %ebx,%ebx
mov    %r15,%rdi
lea    0xc29(%rip),%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x2b17(%rip),%rax
mov    (%rax),%eax
test   %eax,%eax
jle    14f4 <main+0x264>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    -0x40(%rbp),%rcx
cmpl   $0x0,(%rcx,%rbx,4)
js     14e0 <main+0x250>
add    $0x1,%rbx
cmp    %rbx,%rax
jne    14c0 <main+0x230>
mov    %eax,%ebx
jmp    14f4 <main+0x264>
nopw   0x0(%rax,%rax,1)
mov    -0x40(%rbp),%rax
mov    %r14d,(%rax,%rbx,4)
mov    %r14d,%edi
lea    -0x30(%rbp),%rsi
call   11a0 <FD_SET@plt>
mov    -0x50(%rbp),%rax
cmp    %eax,%r14d
cmovg  %r14d,%eax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
cmp    %eax,%ebx
cmovg  %ebx,%eax
lea    -0x2c(%rbp),%rbx
test   %eax,%eax
js     13b8 <main+0x128>
mov    %rax,-0x38(%rbp)
lea    0x1(%rax),%r13d
xor    %r15d,%r15d
jmp    153d <main+0x2ad>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15
cmp    %r15,%r13
je     13b0 <main+0x120>
mov    -0x40(%rbp),%rax
mov    (%rax,%r15,4),%r14d
test   %r14d,%r14d
js     1530 <main+0x2a0>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1530 <main+0x2a0>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x401,%edx
call   10b0 <memset@plt>
mov    %r14d,%edi
mov    %r12,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     165e <main+0x3ce>
mov    %eax,%ebx
mov    %r12,%rdi
lea    0xab2(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     15e2 <main+0x352>
movslq %ebx,%rax
movb   $0x0,-0x480(%rbp,%rax,1)
lea    0xad5(%rip),%rdi
mov    %r15d,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %r14d,%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
cmp    $0xffffffff,%eax
lea    -0x2c(%rbp),%rbx
jne    1530 <main+0x2a0>
jmp    1667 <main+0x3d7>
mov    %r14d,%edi
call   10c0 <close@plt>
mov    %r14d,%edi
lea    -0x30(%rbp),%rsi
call   1170 <FD_CLR@plt>
mov    -0x40(%rbp),%rax
movl   $0xffffffff,(%rax,%r15,4)
ff
mov    -0x44(%rbp),%r13d
mov    -0x38(%rbp),%rax
lea    -0x2c(%rbp),%rbx
jmp    13b8 <main+0x128>
mov    -0x38(%rbp),%rax
test   %eax,%eax
jns    1518 <main+0x288>
jmp    13b8 <main+0x128>
mov    %r13d,%edi
call   10c0 <close@plt>
cmp    $0xffffffff,%eax
je     168f <main+0x3ff>
lea    0xa74(%rip),%rdi
call   1040 <puts@plt>
lea    0xa89(%rip),%rdi
call   1040 <puts@plt>
mov    -0x68(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa13(%rip),%rdi
jmp    166e <main+0x3de>
lea    0xa2d(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
lea    0x97c(%rip),%rdi
jmp    166e <main+0x3de>
lea    0x991(%rip),%rdi
jmp    166e <main+0x3de>
lea    0xa10(%rip),%rdi
jmp    166e <main+0x3de>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@FD_SETSIZE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"****Create TCP socket\00"
@.str.1 = [8 x i8] c"0.0.0.0\00"
@.str.2 = [21 x i8] c"Bind the IP and PORT\00"
@.str.3 = [15 x i8] c"Select Error.\0A\00"
@stdin = global i32 0
@.str.4 = [6 x i8] c"exit\0A\00"
@.str.5 = [22 x i8] c"Accept the connection\00"
@.str.6 = [26 x i8] c"Accept from client %s:%d\0A\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [9 x i8] c"Receive \00"
@.str.9 = [26 x i8] c"Client \E3\80\90%d\E3\80\91 says : %s\00"
@.str.10 = [11 x i8] c"Reply sent\00"
@.str.11 = [6 x i8] c"Close\00"
@.str.12 = [33 x i8] c"You have input the end command.\0A\00"
@.str.13 = [27 x i8] c"TCP Server has been closed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1025 x i8]
%13 = alloca [1024 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i64
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4, i32* %11
%23 = load i32, i32* @FD_SETSIZE
%24 = zext i32 %23 to i64
%25 = call i8* @llvm.stacksave()
store i8* %25, i8** %18
%26 = alloca i32, i64 %24
store i64 %24, i64* %19
%27 = load i32, i32* @AF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = call i32 @socket(i32 %27, i32 %28, i32 0)
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %35
32: ; preds = %2
%33 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %2
%36 = call i32 @bzero(%struct.sockaddr_in* %6, i32 12)
%37 = load i32, i32* @AF_INET
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %37, i32* %38
%39 = call i32 @inet_addr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%41 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %40, i32 0, i32 0
store i32 %39, i32* %41
%42 = call i32 @htons(i32 8880)
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
store i32 %42, i32* %43
%44 = load i32, i32* %8
%45 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%46 = call i32 @bind(i32 %44, %struct.sockaddr* %45, i32 12)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %51
48: ; preds = %35
%49 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %35
%52 = load i32, i32* %8
%53 = call i32 @listen(i32 %52, i32 20)
store i32 0, i32* %15
br label %54
54: ; preds = %62, %51
%55 = load i32, i32* %15
%56 = load i32, i32* @FD_SETSIZE
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %65
58: ; preds = %54
%59 = load i32, i32* %15
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %26, i64 %60
store i32 -1, i32* %61
br label %62
62: ; preds = %58
%63 = load i32, i32* %15
%64 = add nsw i32 %63, 1
store i32 %64, i32* %15
br label %54
65: ; preds = %54
%66 = call i32 @FD_ZERO(i32* %21)
%67 = call i32 @FD_SET(i32 0, i32* %21)
%68 = load i32, i32* %8
%69 = call i32 @FD_SET(i32 %68, i32* %21)
%70 = load i32, i32* %8
store i32 %70, i32* %22
store i32 -1, i32* %16
br label %71
71: ; preds = %218, %105, %79, %65
br label %72
72: ; preds = %71
%73 = load i32, i32* %21
store i32 %73, i32* %20
%74 = load i32, i32* %22
%75 = add nsw i32 %74, 1
%76 = call i32 @select(i32 %75, i32* %20, i32* null, i32* null, i32* null)
store i32 %76, i32* %17
%77 = load i32, i32* %17
%78 = icmp sle i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %72
%80 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %71
81: ; preds = %72
%82 = call i64 @FD_ISSET(i32 0, i32* %20)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %95
84: ; preds = %81
%85 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%86 = call i32 @memset(i8* %85, i32 0, i32 1025)
%87 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%88 = load i32, i32* @stdin
%89 = call i32 @fgets(i8* %87, i32 1025, i32 %88)
%90 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %84
br label %219
94: ; preds = %84
br label %95
95: ; preds = %94, %81
%96 = load i32, i32* %8
%97 = call i64 @FD_ISSET(i32 %96, i32* %20)
%98 = icmp ne i64 %97, 0
br i1 %98, label %99, label %155
99: ; preds = %95
%100 = load i32, i32* %8
%101 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%102 = call i32 @accept(i32 %100, %struct.sockaddr* %101, i32* %11)
store i32 %102, i32* %9
%103 = load i32, i32* %9
%104 = icmp slt i32 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %99
%106 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %71
107: ; preds = %99
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%109 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%110 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %109, i32 0, i32 0
%111 = load i32, i32* %110
%112 = call i8* @inet_ntoa(i32 %111)
%113 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%114 = load i32, i32* %113
%115 = call i32 @sprintf(i8* %108, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %112, i32 %114)
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%117 = call i32 (i8*, ...) @printf(i8* %116, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %15
br label %118
118: ; preds = %139, %107
%119 = load i32, i32* %15
%120 = load i32, i32* @FD_SETSIZE
%121 = icmp slt i32 %119, %120
br i1 %121, label %122, label %142
122: ; preds = %118
%123 = load i32, i32* %15
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %26, i64 %124
%126 = load i32, i32* %125
%127 = icmp slt i32 %126, 0
br i1 %127, label %128, label %138
128: ; preds = %122
%129 = load i32, i32* %9
%130 = load i32, i32* %15
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i32, i32* %26, i64 %131
store i32 %129, i32* %132
%133 = load i32, i32* %15
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i32, i32* %26, i64 %134
%136 = load i32, i32* %135
%137 = call i32 @FD_SET(i32 %136, i32* %21)
br label %142
138: ; preds = %122
br label %139
139: ; preds = %138
%140 = load i32, i32* %15
%141 = add nsw i32 %140, 1
store i32 %141, i32* %15
br label %118
142: ; preds = %128, %118
%143 = load i32, i32* %9
%144 = load i32, i32* %22
%145 = icmp sgt i32 %143, %144
br i1 %145, label %146, label %148
146: ; preds = %142
%147 = load i32, i32* %9
store i32 %147, i32* %22
br label %148
148: ; preds = %146, %142
%149 = load i32, i32* %15
%150 = load i32, i32* %16
%151 = icmp sgt i32 %149, %150
br i1 %151, label %152, label %154
152: ; preds = %148
%153 = load i32, i32* %15
store i32 %153, i32* %16
br label %154
154: ; preds = %152, %148
br label %155
155: ; preds = %154, %95
store i32 0, i32* %15
br label %156
156: ; preds = %215, %155
%157 = load i32, i32* %15
%158 = load i32, i32* %16
%159 = icmp sle i32 %157, %158
br i1 %159, label %160, label %218
160: ; preds = %156
%161 = load i32, i32* %15
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i32, i32* %26, i64 %162
%164 = load i32, i32* %163
store i32 %164, i32* %10
%165 = load i32, i32* %10
%166 = icmp slt i32 %165, 0
br i1 %166, label %167, label %168
167: ; preds = %160
br label %215
168: ; preds = %160
%169 = load i32, i32* %10
%170 = call i64 @FD_ISSET(i32 %169, i32* %20)
%171 = icmp ne i64 %170, 0
br i1 %171, label %172, label %214
172: ; preds = %168
%173 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%174 = call i32 @memset(i8* %173, i32 0, i32 1025)
%175 = load i32, i32* %10
%176 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%177 = call i32 @recv(i32 %175, i8* %176, i32 1024, i32 0)
store i32 %177, i32* %14
%178 = load i32, i32* %14
%179 = icmp eq i32 %178, -1
br i1 %179, label %180, label %183
180: ; preds = %172
%181 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%182 = call i32 @exit(i32 1)
unreachable
183: ; preds = %172
%184 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%185 = call i64 @strcmp(i8* %184, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%186 = icmp eq i64 %185, 0
br i1 %186, label %187, label %195
187: ; preds = %183
%188 = load i32, i32* %10
%189 = call i32 @close(i32 %188)
%190 = load i32, i32* %10
%191 = call i32 @FD_CLR(i32 %190, i32* %21)
%192 = load i32, i32* %15
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i32, i32* %26, i64 %193
store i32 -1, i32* %194
br label %218
195: ; preds = %183
%196 = load i32, i32* %14
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 %197
store i8 0, i8* %198
%199 = load i32, i32* %15
%200 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %199, i8* %200)
%202 = load i32, i32* %10
%203 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%204 = getelementptr inbounds [1025 x i8], [1025 x i8]* %12, i64 0, i64 0
%205 = call i32 @strlen(i8* %204)
%206 = call i32 @send(i32 %202, i8* %203, i32 %205, i32 0)
store i32 %206, i32* %14
%207 = load i32, i32* %14
%208 = icmp eq i32 %207, -1
br i1 %208, label %209, label %212
209: ; preds = %195
%210 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%211 = call i32 @exit(i32 1)
unreachable
212: ; preds = %195
br label %213
213: ; preds = %212
br label %214
214: ; preds = %213, %168
br label %215
215: ; preds = %214, %167
%216 = load i32, i32* %15
%217 = add nsw i32 %216, 1
store i32 %217, i32* %15
br label %156
218: ; preds = %187, %156
br label %71
219: ; preds = %93
%220 = load i32, i32* %8
%221 = call i32 @close(i32 %220)
%222 = icmp eq i32 %221, -1
br i1 %222, label %223, label %226
223: ; preds = %219
%224 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%225 = call i32 @exit(i32 1)
unreachable
226: ; preds = %219
%227 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%228 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %3
%229 = load i8*, i8** %18
%230 = load i32, i32* %3
ret i32 %230
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@FD_SETSIZE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"****Create TCP socket\00"
@.str.1 = [8 x i8] c"0.0.0.0\00"
@.str.2 = [21 x i8] c"Bind the IP and PORT\00"
@.str.3 = [15 x i8] c"Select Error.\0A\00"
@stdin = global i32 0
@.str.4 = [6 x i8] c"exit\0A\00"
@.str.5 = [22 x i8] c"Accept the connection\00"
@.str.6 = [26 x i8] c"Accept from client %s:%d\0A\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [9 x i8] c"Receive \00"
@.str.9 = [26 x i8] c"Client \E3\80\90%d\E3\80\91 says : %s\00"
@.str.10 = [11 x i8] c"Reply sent\00"
@.str.11 = [6 x i8] c"Close\00"
@.str.12 = [33 x i8] c"You have input the end command.\0A\00"
@.str.13 = [27 x i8] c"TCP Server has been closed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [1025 x i8]
%7 = alloca [1024 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = bitcast %struct.sockaddr_in* %3 to i8*
%11 = bitcast %struct.sockaddr_in* %4 to i8*
%12 = bitcast i32* %5 to i8*
store i32 4, i32* %5
%13 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* @FD_SETSIZE
%16 = zext i32 %15 to i64
%17 = tail call i8* @llvm.stacksave()
%18 = alloca i32, i64 %16
%19 = bitcast i32* %18 to i8*
%20 = bitcast i32* %8 to i8*
%21 = bitcast i32* %9 to i8*
%22 = load i32, i32* @AF_INET
%23 = load i32, i32* @SOCK_STREAM
%24 = tail call i32 @socket(i32 %22, i32 %23, i32 0)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %29
26: ; preds = %2
%27 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%28 = tail call i32 @exit(i32 1)
unreachable
29: ; preds = %2
%30 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%31 = load i32, i32* @AF_INET
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %31, i32* %32
%33 = tail call i32 @inet_addr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %33, i32* %34
%35 = tail call i32 @htons(i32 8880)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %35, i32* %36
%37 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%38 = call i32 @bind(i32 %24, %struct.sockaddr* %37, i32 12)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %43
40: ; preds = %29
%41 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %29
%44 = call i32 @listen(i32 %24, i32 20)
%45 = load i32, i32* @FD_SETSIZE
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = zext i32 %45 to i64
%49 = shl nuw nsw i64 %48, 2
br label %50
50: ; preds = %47, %43
%51 = call i32 @FD_ZERO(i32* %9)
%52 = call i32 @FD_SET(i32 0, i32* %9)
%53 = call i32 @FD_SET(i32 %24, i32* %9)
%54 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
br label %57
57: ; preds = %116, %50
%58 = phi i32 [ -1, %50 ], [ %113, %116 ]
%59 = phi i32 [ %24, %50 ], [ %114, %116 ]
%60 = add nsw i32 %59, 1
br label %61
61: ; preds = %65, %57
%62 = load i32, i32* %9
store i32 %62, i32* %8
%63 = call i32 @select(i32 %60, i32* %8, i32* null, i32* null, i32* null)
%64 = icmp slt i32 %63, 1
br i1 %64, label %65, label %68
65: ; preds = %61, %80
%66 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), %80 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %61 ]
%67 = call i32 @perror(i8* %66)
br label %61
68: ; preds = %61
%69 = call i64 @FD_ISSET(i32 0, i32* %8)
%70 = icmp eq i64 %69, 0
br i1 %70, label %77, label %71
71: ; preds = %68
%72 = call i32 @memset(i8* %13, i32 0, i32 1025)
%73 = load i32, i32* @stdin
%74 = call i32 @fgets(i8* %13, i32 1025, i32 %73)
%75 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %157, label %77
77: ; preds = %71, %68
%78 = call i64 @FD_ISSET(i32 %24, i32* %8)
%79 = icmp eq i64 %78, 0
br i1 %79, label %112, label %80
80: ; preds = %77
%81 = call i32 @accept(i32 %24, %struct.sockaddr* %54, i32* %5)
%82 = icmp slt i32 %81, 0
br i1 %82, label %65, label %83
83: ; preds = %80
%84 = load i32, i32* %55
%85 = call i8* @inet_ntoa(i32 %84)
%86 = load i32, i32* %56
%87 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %85, i32 %86)
%88 = call i32 (i8*, ...) @printf(i8* %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0))
%89 = load i32, i32* @FD_SETSIZE
%90 = icmp sgt i32 %89, 0
br i1 %90, label %91, label %106
91: ; preds = %83
%92 = zext i32 %89 to i64
br label %93
93: ; preds = %91, %103
%94 = phi i64 [ 0, %91 ], [ %104, %103 ]
%95 = getelementptr inbounds i32, i32* %18, i64 %94
%96 = load i32, i32* %95
%97 = icmp slt i32 %96, 0
br i1 %97, label %98, label %103
98: ; preds = %93
%99 = trunc i64 %94 to i32
%100 = and i64 %94, 4294967295
%101 = getelementptr inbounds i32, i32* %18, i64 %100
store i32 %81, i32* %101
%102 = call i32 @FD_SET(i32 %81, i32* %9)
br label %106
103: ; preds = %93
%104 = add nuw nsw i64 %94, 1
%105 = icmp eq i64 %104, %92
br i1 %105, label %106, label %93
106: ; preds = %103, %83, %98
%107 = phi i32 [ %99, %98 ], [ 0, %83 ], [ %89, %103 ]
%108 = icmp sgt i32 %81, %59
%109 = select i1 %108, i32 %81, i32 %59
%110 = icmp sgt i32 %107, %58
%111 = select i1 %110, i32 %107, i32 %58
br label %112
112: ; preds = %77, %106
%113 = phi i32 [ %111, %106 ], [ %58, %77 ]
%114 = phi i32 [ %109, %106 ], [ %59, %77 ]
%115 = icmp slt i32 %113, 0
br i1 %115, label %116, label %117
116: ; preds = %154, %112, %138
br label %57
117: ; preds = %112
%118 = add nuw i32 %113, 1
%119 = zext i32 %118 to i64
br label %120
120: ; preds = %117, %154
%121 = phi i64 [ 0, %117 ], [ %155, %154 ]
%122 = getelementptr inbounds i32, i32* %18, i64 %121
%123 = load i32, i32* %122
%124 = icmp slt i32 %123, 0
br i1 %124, label %154, label %125
125: ; preds = %120
%126 = call i64 @FD_ISSET(i32 %123, i32* %8)
%127 = icmp eq i64 %126, 0
br i1 %127, label %154, label %128
128: ; preds = %125
%129 = call i32 @memset(i8* %13, i32 0, i32 1025)
%130 = call i32 @recv(i32 %123, i8* %13, i32 1024, i32 0)
%131 = icmp eq i32 %130, -1
br i1 %131, label %132, label %135
132: ; preds = %128
%133 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%134 = call i32 @exit(i32 1)
unreachable
135: ; preds = %128
%136 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%137 = icmp eq i64 %136, 0
br i1 %137, label %138, label %143
138: ; preds = %135
%139 = and i64 %121, 4294967295
%140 = getelementptr inbounds i32, i32* %18, i64 %139
%141 = call i32 @close(i32 %123)
%142 = call i32 @FD_CLR(i32 %123, i32* %9)
store i32 -1, i32* %140
br label %116
143: ; preds = %135
%144 = sext i32 %130 to i64
%145 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 %144
store i8 0, i8* %145
%146 = trunc i64 %121 to i32
%147 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %146, i8* %13)
%148 = call i32 @strlen(i8* %13)
%149 = call i32 @send(i32 %123, i8* %13, i32 %148, i32 0)
%150 = icmp eq i32 %149, -1
br i1 %150, label %151, label %154
151: ; preds = %143
%152 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%153 = call i32 @exit(i32 1)
unreachable
154: ; preds = %125, %143, %120
%155 = add nuw nsw i64 %121, 1
%156 = icmp eq i64 %155, %119
br i1 %156, label %116, label %120
157: ; preds = %71
%158 = call i32 @close(i32 %24)
%159 = icmp eq i32 %158, -1
br i1 %159, label %160, label %163
160: ; preds = %157
%161 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%162 = call i32 @exit(i32 1)
unreachable
163: ; preds = %157
%164 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%165 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
ret i32 0
}