#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 */
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ time_t;
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 /*<<< orphan*/ storage;
typedef size_t ssize_t;
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ content;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SOCK_STREAM;
int SO_REUSEPORT;
int TCP_NODELAY;
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
char *asctime(int /*<<< orphan*/);
scalar_t__ atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
scalar_t__ listen(int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
size_t read(int, char *, int);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int,
                              struct sockaddr_in *, int /*<<< orphan*/);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int strlen(char const *);
int /*<<< orphan*/ strncat(char *, char *, int);
char *strstr(char *, char const *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int c, char **v) {
  FILE *fp;
  ssize_t i;
  time_t tm = time(NULL);
  char *index = v[2];
  const char *get = "GET /";
  const char *http = " HTTP";
  char *target = NULL;
  char *start, *end;
  int tcpfd = 0;
  int connfd = 0;
  char content[1024];
  char storage[1024];
  struct sockaddr_in serv_addr;
  memset(content, 0, sizeof(content));
  memset(storage, 0, sizeof(storage));
  if (c != 3) {
    printf("Usage: %s <port> <index_page>\n", v[0]);
    return EXIT_FAILURE;
  }
  if ((tcpfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("Error");
    return EXIT_FAILURE;
  }
  bzero(&serv_addr, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_port = htons((uint16_t)atoi(v[1]));
  serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  if ((bind(tcpfd, (struct sockaddr *)&serv_addr,
            (socklen_t)sizeof(serv_addr))) < 0) {
    perror("Error");
    return EXIT_FAILURE;
  }
  if (listen(tcpfd, 1024) < 0) {
    perror("Error");
    return EXIT_FAILURE;
  }
  setsockopt(tcpfd, IPPROTO_TCP, TCP_NODELAY | SO_REUSEPORT, &serv_addr,
             (socklen_t)sizeof(serv_addr));
  fp = fopen(index, "r");
  if (!fp) {
    perror("Error");
    return 1;
  }
  for (;;) {
    if ((connfd = accept(tcpfd, NULL, NULL)) < 0) {
      perror("Error");
      return EXIT_FAILURE;
    }
    signal(SIGCHLD, NULL);
    while ((i = read(connfd, content, sizeof(content) - 1)) > 0) {
      fp = fopen("./log/access.log", "a+");
      content[i] = 0;
      fprintf(fp, "Date: %s", asctime(gmtime(&tm)));
      fprintf(fp, "%s", content);
      (void)fflush(fp);
      fputs(content, stdout);
      if ((start = strstr(content, get))) {
        start += strlen(get);
        if ((end = strstr(start, http))) {
          target = (char *)malloc(end - start + 1);
          memcpy(target, start, end - start);
          target[end - start] = '\0';
        }
      }
      if (strlen(target) > 1) {
        fp = fopen(target, "r");
        if (!fp) {
          perror("Error");
          return 1;
        }
        free(target);
      } else {
        fp = fopen(index, "r");
      }
      break;
    }
    if (!fork()) {
      while ((fgets(content, (size_t)sizeof(content), fp)) != NULL) {
        strncat(storage, content, sizeof(storage) - 1);
      }
      send(connfd, "HTTP/1.1 200\r\n\r\n", 16, 0);
      send(connfd, storage, sizeof(storage) - 1, 0);
      memset(content, 0, sizeof(content));
      memset(storage, 0, sizeof(storage));
    }
    close(connfd);
  }
  shutdown(tcpfd, 0);
  close(tcpfd);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x880,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1140 <time@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
lea    0xcd8(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xcd3(%rip),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
lea    -0x460(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
lea    -0x860(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
cmpl   $0x3,-0x8(%rbp)
je     13a1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xc81(%rip),%rdi
call   1090 <printf@plt>
mov    0x2c11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    17bf <main+0x4cf>
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
mov    0x2bff(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1210 <socket@plt>
mov    %eax,-0x5c(%rbp)
cmp    $0x0,%eax
jge    13e3 <main+0xf3>
lea    0xc5e(%rip),%rdi
call   11a0 <perror@plt>
mov    0x2bcf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    17bf <main+0x4cf>
lea    -0x870(%rbp),%rdi
mov    $0xc,%esi
call   11b0 <bzero@plt>
mov    0x2be5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x868(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   11e0 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,-0x86c(%rbp)
mov    0x2bac(%rip),%rax
mov    (%rax),%edi
call   10b0 <htonl@plt>
mov    %eax,-0x870(%rbp)
mov    -0x5c(%rbp),%edi
lea    -0x870(%rbp),%rsi
mov    $0xc,%edx
call   1180 <bind@plt>
cmp    $0x0,%rax
jge    146c <main+0x17c>
lea    0xbd5(%rip),%rdi
call   11a0 <perror@plt>
mov    0x2b46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    17bf <main+0x4cf>
mov    -0x5c(%rbp),%edi
mov    $0x400,%esi
call   1170 <listen@plt>
cmp    $0x0,%rax
jge    14a0 <main+0x1b0>
lea    0xba1(%rip),%rdi
call   11a0 <perror@plt>
mov    0x2b12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    17bf <main+0x4cf>
mov    -0x5c(%rbp),%edi
mov    0x2b1e(%rip),%rax
mov    (%rax),%esi
mov    0x2b35(%rip),%rax
mov    (%rax),%edx
mov    0x2b1c(%rip),%rax
or     (%rax),%edx
lea    -0x870(%rbp),%rcx
mov    $0xc,%r8d
call   1040 <setsockopt@plt>
mov    -0x30(%rbp),%rdi
lea    0xb54(%rip),%rsi
call   1190 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1507 <main+0x217>
lea    0xb35(%rip),%rdi
call   11a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    17bf <main+0x4cf>
jmp    150c <main+0x21c>
mov    -0x5c(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   11d0 <accept@plt>
mov    %eax,-0x60(%rbp)
cmp    $0x0,%eax
jge    1544 <main+0x254>
lea    0xafd(%rip),%rdi
call   11a0 <perror@plt>
mov    0x2a6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    17bf <main+0x4cf>
mov    0x2a75(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1110 <signal@plt>
mov    -0x60(%rbp),%edi
lea    -0x460(%rbp),%rsi
mov    $0x3ff,%edx
call   10f0 <read@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jbe    170f <main+0x41f>
lea    0xab2(%rip),%rdi
lea    0xabc(%rip),%rsi
call   1190 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,-0x460(%rbp,%rax,1)
mov    -0x18(%rbp),%rax
mov    %rax,-0x878(%rbp)
lea    -0x24(%rbp),%rdi
call   11c0 <gmtime@plt>
mov    %eax,%edi
call   1060 <asctime@plt>
mov    -0x878(%rbp),%rdi
mov    %rax,%rdx
lea    0xa7e(%rip),%rsi
call   1120 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x460(%rbp),%rdx
lea    0xa6d(%rip),%rsi
call   1120 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1160 <fflush@plt>
lea    -0x460(%rbp),%rdi
mov    0x29a6(%rip),%rax
mov    (%rax),%esi
call   10a0 <fputs@plt>
lea    -0x460(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1200 <strstr@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
je     169f <main+0x3af>
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1200 <strstr@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
je     169a <main+0x3aa>
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1150 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1130 <memcpy@plt>
mov    -0x48(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    -0x50(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    169f <main+0x3af>
mov    -0x48(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x1,%eax
jle    16f6 <main+0x406>
mov    -0x48(%rbp),%rdi
lea    0x973(%rip),%rsi
call   1190 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    16e8 <main+0x3f8>
lea    0x954(%rip),%rdi
call   11a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    17bf <main+0x4cf>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
jmp    170a <main+0x41a>
mov    -0x30(%rbp),%rdi
lea    0x92e(%rip),%rsi
call   1190 <fopen@plt>
mov    %rax,-0x18(%rbp)
jmp    170f <main+0x41f>
mov    $0x0,%al
call   11f0 <fork@plt>
cmp    $0x0,%eax
jne    17b2 <main+0x4c2>
jmp    1724 <main+0x434>
lea    -0x460(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1100 <fgets@plt>
cmp    $0x0,%rax
je     1760 <main+0x470>
lea    -0x860(%rbp),%rdi
lea    -0x460(%rbp),%rsi
mov    $0x3ff,%edx
call   10d0 <strncat@plt>
jmp    1724 <main+0x434>
mov    -0x60(%rbp),%edi
lea    0x8e4(%rip),%rsi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    -0x60(%rbp),%edi
lea    -0x860(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    -0x460(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
lea    -0x860(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
mov    -0x60(%rbp),%edi
call   10e0 <close@plt>
jmp    150c <main+0x21c>
mov    -0x4(%rbp),%eax
add    $0x880,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x838,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
call   1140 <time@plt>
mov    %eax,0x14(%rsp)
mov    0x10(%rbx),%r15
lea    0x30(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
lea    0x430(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
cmp    $0x3,%ebp
je     1369 <main+0x79>
mov    (%rbx),%rsi
lea    0xcc3(%rip),%rdi
call   1090 <printf@plt>
mov    0x2c53(%rip),%rax
mov    (%rax),%eax
add    $0x838,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c70(%rip),%r12
mov    (%r12),%edi
mov    0x2c35(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1210 <socket@plt>
test   %eax,%eax
js     13ef <main+0xff>
mov    %eax,%ebp
lea    0x18(%rsp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   11b0 <bzero@plt>
mov    (%r12),%eax
mov    %eax,0x20(%rsp)
mov    0x8(%rbx),%rdi
call   11e0 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,0x1c(%rsp)
mov    0x2c11(%rip),%rax
mov    (%rax),%edi
call   10b0 <htonl@plt>
mov    %eax,0x18(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1180 <bind@plt>
test   %rax,%rax
js     13ef <main+0xff>
mov    %ebp,%edi
mov    $0x400,%esi
call   1170 <listen@plt>
test   %rax,%rax
jns    1400 <main+0x110>
lea    0xc35(%rip),%rdi
call   11a0 <perror@plt>
jmp    134e <main+0x5e>
mov    0x2bc1(%rip),%rax
mov    (%rax),%esi
mov    0x2bd8(%rip),%rax
mov    0x2bc1(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0x18(%rsp),%rcx
mov    %ebp,%edi
mov    $0xc,%r8d
call   1040 <setsockopt@plt>
lea    0xbfb(%rip),%rsi
mov    %r15,%rdi
call   1190 <fopen@plt>
test   %rax,%rax
jne    1457 <main+0x167>
lea    0xbe3(%rip),%rdi
call   11a0 <perror@plt>
mov    $0x1,%eax
jmp    1357 <main+0x67>
mov    %rax,%r14
mov    %r15,0x28(%rsp)
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   11d0 <accept@plt>
test   %eax,%eax
js     13ef <main+0xff>
mov    %eax,%r15d
lea    0x30(%rsp),%r12
lea    0x430(%rsp),%r13
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    %ebp,0x4(%rsp)
jmp    14d5 <main+0x1e5>
nopl   0x0(%rax,%rax,1)
mov    0x28(%rsp),%rdi
lea    0xb93(%rip),%rsi
call   1190 <fopen@plt>
mov    %rax,%r14
mov    0x4(%rsp),%ebp
xor    %eax,%eax
call   11f0 <fork@plt>
test   %eax,%eax
je     15e0 <main+0x2f0>
mov    %r15d,%edi
call   10e0 <close@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   11d0 <accept@plt>
mov    %eax,%r15d
test   %eax,%eax
js     13ef <main+0xff>
mov    0x2ae4(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1110 <signal@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    $0x3ff,%edx
call   10f0 <read@plt>
test   %rax,%rax
je     14a8 <main+0x1b8>
mov    %rax,%rbx
lea    0xb2d(%rip),%rdi
lea    0xb37(%rip),%rsi
call   1190 <fopen@plt>
mov    %rax,%rbp
movb   $0x0,0x30(%rsp,%rbx,1)
lea    0x14(%rsp),%rdi
call   11c0 <gmtime@plt>
mov    %eax,%edi
call   1060 <asctime@plt>
mov    %rbp,%rdi
lea    0xb12(%rip),%rsi
mov    %rax,%rdx
call   1120 <fprintf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   10a0 <fputs@plt>
mov    %rbp,%rdi
call   1160 <fflush@plt>
mov    0x2a4b(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   10a0 <fputs@plt>
mov    %r12,%rdi
lea    0xa97(%rip),%rbp
mov    %rbp,%rsi
call   1200 <strstr@plt>
test   %rax,%rax
je     1640 <main+0x350>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1050 <strlen@plt>
cltq
add    %rax,%rbx
mov    %rbx,%rdi
lea    0xa72(%rip),%rsi
call   1200 <strstr@plt>
test   %rax,%rax
mov    0x8(%rsp),%rbp
je     1645 <main+0x355>
mov    %rax,%r14
sub    %rbx,%r14
lea    0x1(%r14),%edi
call   1150 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1130 <memcpy@plt>
movb   $0x0,0x0(%rbp,%r14,1)
jmp    1645 <main+0x355>
nop
mov    %r13,%rdi
mov    %r12,%rsi
mov    $0x3ff,%edx
call   10d0 <strncat@plt>
mov    $0x400,%esi
mov    %r12,%rdi
mov    %r14,%rdx
call   1100 <fgets@plt>
test   %rax,%rax
jne    15d0 <main+0x2e0>
mov    %r15d,%edi
lea    0xa4f(%rip),%rsi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    %r15d,%edi
mov    %r13,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
jmp    14b7 <main+0x1c7>
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
mov    %rbp,0x8(%rsp)
jl     1490 <main+0x1a0>
mov    %rbp,%rdi
lea    0x9ca(%rip),%rsi
call   1190 <fopen@plt>
mov    %rbp,%rdi
test   %rax,%rax
mov    0x4(%rsp),%ebp
je     1441 <main+0x151>
mov    %rax,%r14
call   1030 <free@plt>
jmp    14a8 <main+0x1b8>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [6 x i8] c"GET /\00"
@.str.1 = [6 x i8] c" HTTP\00"
@.str.2 = [31 x i8] c"Usage: %s <port> <index_page>\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [6 x i8] c"Error\00"
@INADDR_ANY = global i32 0
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
@SO_REUSEPORT = global i32 0
@.str.4 = [2 x i8] c"r\00"
@SIGCHLD = global i32 0
@.str.5 = [17 x i8] c"./log/access.log\00"
@.str.6 = [3 x i8] c"a+\00"
@.str.7 = [9 x i8] c"Date: %s\00"
@.str.8 = [3 x i8] c"%s\00"
@stdout = global i32 0
@.str.9 = [17 x i8] c"HTTP/1.1 200\0D\0A\0D\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca [1024 x i8]
%18 = alloca [1024 x i8]
%19 = alloca %struct.sockaddr_in
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = call i32 @time(i32* null)
store i32 %20, i32* %8
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
store i8* %23, i8** %9
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %11
store i8* null, i8** %12
store i32 0, i32* %15
store i32 0, i32* %16
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%25 = call i32 @memset(i8* %24, i32 0, i32 1024)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%27 = call i32 @memset(i8* %26, i32 0, i32 1024)
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 3
br i1 %29, label %30, label %36
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
store i32 %35, i32* %3
br label %203
36: ; preds = %2
%37 = load i32, i32* @AF_INET
%38 = load i32, i32* @SOCK_STREAM
%39 = call i32 @socket(i32 %37, i32 %38, i32 0)
store i32 %39, i32* %15
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %36
%42 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
store i32 %43, i32* %3
br label %203
44: ; preds = %36
%45 = call i32 @bzero(%struct.sockaddr_in* %19, i32 12)
%46 = load i32, i32* @AF_INET
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 2
store i32 %46, i32* %47
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i64 @atoi(i8* %50)
%52 = trunc i64 %51 to i32
%53 = call i32 @htons(i32 %52)
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 1
store i32 %53, i32* %54
%55 = load i32, i32* @INADDR_ANY
%56 = call i32 @htonl(i32 %55)
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 0
%58 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %57, i32 0, i32 0
store i32 %56, i32* %58
%59 = load i32, i32* %15
%60 = bitcast %struct.sockaddr_in* %19 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 %66
63: ; preds = %44
%64 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%65 = load i32, i32* @EXIT_FAILURE
store i32 %65, i32* %3
br label %203
66: ; preds = %44
%67 = load i32, i32* %15
%68 = call i64 @listen(i32 %67, i32 1024)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%72 = load i32, i32* @EXIT_FAILURE
store i32 %72, i32* %3
br label %203
73: ; preds = %66
%74 = load i32, i32* %15
%75 = load i32, i32* @IPPROTO_TCP
%76 = load i32, i32* @TCP_NODELAY
%77 = load i32, i32* @SO_REUSEPORT
%78 = or i32 %76, %77
%79 = call i32 @setsockopt(i32 %74, i32 %75, i32 %78, %struct.sockaddr_in* %19, i32 12)
%80 = load i8*, i8** %9
%81 = call i32* @fopen(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %81, i32** %6
%82 = load i32*, i32** %6
%83 = icmp ne i32* %82, null
br i1 %83, label %86, label %84
84: ; preds = %73
%85 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %203
86: ; preds = %73
br label %87
87: ; preds = %200, %86
%88 = load i32, i32* %15
%89 = call i32 @accept(i32 %88, i32* null, i32* null)
store i32 %89, i32* %16
%90 = icmp slt i32 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %87
%92 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%93 = load i32, i32* @EXIT_FAILURE
store i32 %93, i32* %3
br label %203
94: ; preds = %87
%95 = load i32, i32* @SIGCHLD
%96 = call i32 @signal(i32 %95, i32* null)
br label %97
97: ; preds = %94
%98 = load i32, i32* %16
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%100 = call i64 @read(i32 %98, i8* %99, i32 1023)
store i64 %100, i64* %7
%101 = icmp ugt i64 %100, 0
br i1 %101, label %102, label %177
102: ; preds = %97
%103 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %103, i32** %6
%104 = load i64, i64* %7
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 %104
store i8 0, i8* %105
%106 = load i32*, i32** %6
%107 = call i32 @gmtime(i32* %8)
%108 = call i8* @asctime(i32 %107)
%109 = call i32 @fprintf(i32* %106, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %108)
%110 = load i32*, i32** %6
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%112 = call i32 @fprintf(i32* %110, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %111)
%113 = load i32*, i32** %6
%114 = call i32 @fflush(i32* %113)
%115 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%116 = load i32, i32* @stdout
%117 = call i32 @fputs(i8* %115, i32 %116)
%118 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%119 = load i8*, i8** %10
%120 = call i8* @strstr(i8* %118, i8* %119)
store i8* %120, i8** %13
%121 = icmp ne i8* %120, null
br i1 %121, label %122, label %159
122: ; preds = %102
%123 = load i8*, i8** %10
%124 = call i32 @strlen(i8* %123)
%125 = load i8*, i8** %13
%126 = sext i32 %124 to i64
%127 = getelementptr inbounds i8, i8* %125, i64 %126
store i8* %127, i8** %13
%128 = load i8*, i8** %13
%129 = load i8*, i8** %11
%130 = call i8* @strstr(i8* %128, i8* %129)
store i8* %130, i8** %14
%131 = icmp ne i8* %130, null
br i1 %131, label %132, label %158
132: ; preds = %122
%133 = load i8*, i8** %14
%134 = load i8*, i8** %13
%135 = ptrtoint i8* %133 to i64
%136 = ptrtoint i8* %134 to i64
%137 = sub i64 %135, %136
%138 = add nsw i64 %137, 1
%139 = trunc i64 %138 to i32
%140 = call i64 @malloc(i32 %139)
%141 = inttoptr i64 %140 to i8*
store i8* %141, i8** %12
%142 = load i8*, i8** %12
%143 = load i8*, i8** %13
%144 = load i8*, i8** %14
%145 = load i8*, i8** %13
%146 = ptrtoint i8* %144 to i64
%147 = ptrtoint i8* %145 to i64
%148 = sub i64 %146, %147
%149 = trunc i64 %148 to i32
%150 = call i32 @memcpy(i8* %142, i8* %143, i32 %149)
%151 = load i8*, i8** %12
%152 = load i8*, i8** %14
%153 = load i8*, i8** %13
%154 = ptrtoint i8* %152 to i64
%155 = ptrtoint i8* %153 to i64
%156 = sub i64 %154, %155
%157 = getelementptr inbounds i8, i8* %151, i64 %156
store i8 0, i8* %157
br label %158
158: ; preds = %132, %122
br label %159
159: ; preds = %158, %102
%160 = load i8*, i8** %12
%161 = call i32 @strlen(i8* %160)
%162 = icmp sgt i32 %161, 1
br i1 %162, label %163, label %173
163: ; preds = %159
%164 = load i8*, i8** %12
%165 = call i32* @fopen(i8* %164, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %165, i32** %6
%166 = load i32*, i32** %6
%167 = icmp ne i32* %166, null
br i1 %167, label %170, label %168
168: ; preds = %163
%169 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %203
170: ; preds = %163
%171 = load i8*, i8** %12
%172 = call i32 @free(i8* %171)
br label %176
173: ; preds = %159
%174 = load i8*, i8** %9
%175 = call i32* @fopen(i8* %174, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %175, i32** %6
br label %176
176: ; preds = %173, %170
br label %177
177: ; preds = %176, %97
%178 = call i32 (...) @fork()
%179 = icmp ne i32 %178, 0
br i1 %179, label %200, label %180
180: ; preds = %177
br label %181
181: ; preds = %186, %180
%182 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%183 = load i32*, i32** %6
%184 = call i32* @fgets(i8* %182, i64 1024, i32* %183)
%185 = icmp ne i32* %184, null
br i1 %185, label %186, label %190
186: ; preds = %181
%187 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%188 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%189 = call i32 @strncat(i8* %187, i8* %188, i32 1023)
br label %181
190: ; preds = %181
%191 = load i32, i32* %16
%192 = call i32 @send(i32 %191, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 16, i32 0)
%193 = load i32, i32* %16
%194 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%195 = call i32 @send(i32 %193, i8* %194, i32 1023, i32 0)
%196 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%197 = call i32 @memset(i8* %196, i32 0, i32 1024)
%198 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%199 = call i32 @memset(i8* %198, i32 0, i32 1024)
br label %200
200: ; preds = %190, %177
%201 = load i32, i32* %16
%202 = call i32 @close(i32 %201)
br label %87
203: ; preds = %168, %91, %84, %70, %63, %41, %30
%204 = load i32, i32* %3
ret i32 %204
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [6 x i8] c"GET /\00"
@.str.1 = [6 x i8] c" HTTP\00"
@.str.2 = [31 x i8] c"Usage: %s <port> <index_page>\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [6 x i8] c"Error\00"
@INADDR_ANY = global i32 0
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
@SO_REUSEPORT = global i32 0
@.str.4 = [2 x i8] c"r\00"
@SIGCHLD = global i32 0
@.str.5 = [17 x i8] c"./log/access.log\00"
@.str.6 = [3 x i8] c"a+\00"
@.str.7 = [9 x i8] c"Date: %s\00"
@stdout = global i32 0
@.str.9 = [17 x i8] c"HTTP/1.1 200\0D\0A\0D\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca %struct.sockaddr_in
%7 = bitcast i32* %3 to i8*
%8 = tail call i32 @time(i32* null)
store i32 %8, i32* %3
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%13 = bitcast %struct.sockaddr_in* %6 to i8*
%14 = call i32 @memset(i8* %11, i32 0, i32 1024)
%15 = call i32 @memset(i8* %12, i32 0, i32 1024)
%16 = icmp eq i32 %0, 3
br i1 %16, label %21, label %17
17: ; preds = %2
%18 = load i8*, i8** %1
%19 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
br label %140
21: ; preds = %2
%22 = load i32, i32* @AF_INET
%23 = load i32, i32* @SOCK_STREAM
%24 = call i32 @socket(i32 %22, i32 %23, i32 0)
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
br label %140
29: ; preds = %21
%30 = call i32 @bzero(%struct.sockaddr_in* %6, i32 12)
%31 = load i32, i32* @AF_INET
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 2
store i32 %31, i32* %32
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @atoi(i8* %34)
%36 = trunc i64 %35 to i32
%37 = call i32 @htons(i32 %36)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1
store i32 %37, i32* %38
%39 = load i32, i32* @INADDR_ANY
%40 = call i32 @htonl(i32 %39)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0, i32 0
store i32 %40, i32* %41
%42 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%43 = call i64 @bind(i32 %24, %struct.sockaddr* %42, i32 12)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %29
%46 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
br label %140
48: ; preds = %29
%49 = call i64 @listen(i32 %24, i32 1024)
%50 = icmp slt i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
br label %140
54: ; preds = %48
%55 = load i32, i32* @IPPROTO_TCP
%56 = load i32, i32* @TCP_NODELAY
%57 = load i32, i32* @SO_REUSEPORT
%58 = or i32 %57, %56
%59 = call i32 @setsockopt(i32 %24, i32 %55, i32 %58, %struct.sockaddr_in* %6, i32 12)
%60 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %65, label %62
62: ; preds = %54
%63 = call i32 @accept(i32 %24, i32* null, i32* null)
%64 = icmp slt i32 %63, 0
br i1 %64, label %67, label %70
65: ; preds = %54
%66 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %140
67: ; preds = %136, %62
%68 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%69 = load i32, i32* @EXIT_FAILURE
br label %140
70: ; preds = %62, %136
%71 = phi i32 [ %138, %136 ], [ %63, %62 ]
%72 = phi i8* [ %121, %136 ], [ null, %62 ]
%73 = phi i32* [ %120, %136 ], [ %60, %62 ]
%74 = load i32, i32* @SIGCHLD
%75 = call i32 @signal(i32 %74, i32* null)
%76 = call i64 @read(i32 %71, i8* %11, i32 1023)
%77 = icmp eq i64 %76, 0
br i1 %77, label %119, label %78
78: ; preds = %70
%79 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %76
store i8 0, i8* %80
%81 = call i32 @gmtime(i32* %3)
%82 = call i8* @asctime(i32 %81)
%83 = call i32 @fprintf(i32* %79, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %82)
%84 = call i32 bitcast (i32 (i8*, i32)* @fputs to i32 (i8*, i32*)*)(i8* %11, i32* %79)
%85 = call i32 @fflush(i32* %79)
%86 = load i32, i32* @stdout
%87 = call i32 @fputs(i8* %11, i32 %86)
%88 = call i8* @strstr(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%89 = icmp eq i8* %88, null
br i1 %89, label %106, label %90
90: ; preds = %78
%91 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %88, i64 %92
%94 = call i8* @strstr(i8* %93, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%95 = icmp eq i8* %94, null
br i1 %95, label %106, label %96
96: ; preds = %90
%97 = ptrtoint i8* %94 to i64
%98 = ptrtoint i8* %93 to i64
%99 = sub i64 %97, %98
%100 = trunc i64 %99 to i32
%101 = add i32 %100, 1
%102 = call i64 @malloc(i32 %101)
%103 = inttoptr i64 %102 to i8*
%104 = call i32 @memcpy(i8* %103, i8* %93, i32 %100)
%105 = getelementptr inbounds i8, i8* %103, i64 %99
store i8 0, i8* %105
br label %106
106: ; preds = %90, %96, %78
%107 = phi i8* [ %103, %96 ], [ %72, %90 ], [ %72, %78 ]
%108 = call i32 @strlen(i8* %107)
%109 = icmp sgt i32 %108, 1
br i1 %109, label %110, label %117
110: ; preds = %106
%111 = call i32* @fopen(i8* %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%112 = icmp eq i32* %111, null
br i1 %112, label %113, label %115
113: ; preds = %110
%114 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %140
115: ; preds = %110
%116 = call i32 @free(i8* %107)
br label %119
117: ; preds = %106
%118 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %119
119: ; preds = %115, %117, %70
%120 = phi i32* [ %111, %115 ], [ %118, %117 ], [ %73, %70 ]
%121 = phi i8* [ %107, %115 ], [ %107, %117 ], [ %72, %70 ]
%122 = call i32 (...) @fork()
%123 = icmp eq i32 %122, 0
br i1 %123, label %124, label %136
124: ; preds = %119
%125 = call i32* @fgets(i8* %11, i64 1024, i32* %120)
%126 = icmp eq i32* %125, null
br i1 %126, label %131, label %127
127: ; preds = %124, %127
%128 = call i32 @strncat(i8* %12, i8* %11, i32 1023)
%129 = call i32* @fgets(i8* %11, i64 1024, i32* %120)
%130 = icmp eq i32* %129, null
br i1 %130, label %131, label %127
131: ; preds = %127, %124
%132 = call i32 @send(i32 %71, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 16, i32 0)
%133 = call i32 @send(i32 %71, i8* %12, i32 1023, i32 0)
%134 = call i32 @memset(i8* %11, i32 0, i32 1024)
%135 = call i32 @memset(i8* %12, i32 0, i32 1024)
br label %136
136: ; preds = %131, %119
%137 = call i32 @close(i32 %71)
%138 = call i32 @accept(i32 %24, i32* null, i32* null)
%139 = icmp slt i32 %138, 0
br i1 %139, label %67, label %70
140: ; preds = %113, %67, %65, %51, %45, %26, %17
%141 = phi i32 [ %20, %17 ], [ %28, %26 ], [ %47, %45 ], [ %53, %51 ], [ %69, %67 ], [ 1, %113 ], [ 1, %65 ]
ret i32 %141
}