#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 stat {
  int st_mode;
  int st_uid;
  int st_gid;
  int /*<<< orphan*/ st_blocks;
  int /*<<< orphan*/ st_blksize;
  scalar_t__ st_size;
  int /*<<< orphan*/ st_rdev;
  int /*<<< orphan*/ st_nlink;
  int /*<<< orphan*/ st_ino;
  int /*<<< orphan*/ st_dev;
};
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*/ addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ log_(char *);
int /*<<< orphan*/ memcmp(char *, char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
char *ptime();
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int main() {
  int sock, listener;
  struct sockaddr_in addr;
  char buf[2048];
  int bytes_read;
  int i;
  struct stat struktura;
  FILE *fp;
  char buf2[2048];
  printf("%s proolhttpd started\n", ptime());
  log_("proolhttpd started");
  listener = socket(AF_INET, SOCK_STREAM, 0);
  if (listener < 0) {
    perror("socket");
    exit(1);
  }
  addr.sin_family = AF_INET;
  addr.sin_port = htons(2222);
  addr.sin_addr.s_addr = htonl(INADDR_ANY);
  if (bind(listener, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
    perror("proolhttpd bind");
    exit(2);
  }
  listen(listener, 1);
  while (1) {
    sock = accept(listener, NULL, NULL);
    if (sock < 0) {
      perror("accept");
      exit(3);
    }
    while (1) {
      for (i = 0; i < 2048; i++)
        buf[i] = 0;
      bytes_read = recv(sock, buf, 2048, 0);
      if (bytes_read <= 0)
        break;
      printf("%s GET\n", ptime());
      log_(buf);
      if (!memcmp(buf, "GET ", 4)) {
        if (stat("index.html", &struktura)) {
          send(sock,
               "HTTP/1.1 404 Not Found`\nServer: proolhttpd\nDate: Sat, 27 Feb "
               "2016 21:45:06 GMT\nContent-Type: text/html\nContent-Length: "
               "144\nConnection: close\n\n<html>\n<head><title>404 Not "
               "Found</title></head>\n<body>\n<center><h1>404 Not "
               "Found</h1></center>\n<hr><center>proolhttpd</center>\n</"
               "body>\n</html>\n",
               strlen("HTTP/1.1 404 Not Found`\nServer: proolhttpd\nDate: Sat, "
                      "27 Feb 2016 21:45:06 GMT\nContent-Type: "
                      "text/html\nContent-Length: 144\nConnection: "
                      "close\n\n<html>\n<head><title>404 Not "
                      "Found</title></head>\n<body>\n<center><h1>404 Not "
                      "Found</h1></center>\n<hr><center>proolhttpd</center>\n</"
                      "body>\n</html>\n"),
               0);
        } else {
          send(sock, "HTTP/1.1 200 OK\nServer: proolhttpd/0.0.2\n",
               strlen("HTTP/1.1 200 OK\nServer: proolhttpd/0.0.2\n"), 0);
          sprintf(buf2, "Date: %s\n", ptime());
          send(sock, buf2, strlen(buf2), 0);
          send(sock, "Content-Type: text/html\n",
               strlen("Content-Type: text/html\n"), 0);
          sprintf(buf2, "Content-Length: %li\nLast-Modified: %s\n",
                  struktura.st_size + 16, ptime());
          send(sock, buf2, strlen(buf2), 0);
          send(sock,
               "Connection: close\nAccept-Ranges: bytes\n\n<!DOCTYPE html>\n\n",
               strlen("Connection: close\nAccept-Ranges: bytes\n\n<!DOCTYPE "
                      "html>\n\n"),
               0);
          fp = fopen("index.html", "r");
          if (fp) {
            while (!feof(fp)) {
              buf2[0] = 0;
              fgets(buf2, 2048, fp);
              if (buf2[0]) {
                send(sock, buf2, strlen(buf2), 0);
              }
            }
          }
          send(sock, "\n", 1, 0);
        }
        close(sock);
        if (0) {
          printf("st_dev=%li\n", struktura.st_dev);
          printf("st_ino=%li\n", struktura.st_ino);
          printf("st_mode=%i\n", struktura.st_mode);
          printf("st_nlink=%li\n", struktura.st_nlink);
          printf("st_uid=%i\n", struktura.st_uid);
          printf("st_gid=%i\n", struktura.st_gid);
          printf("st_rdev=%li\n", struktura.st_rdev);
          printf("st_size=%li\n", struktura.st_size);
          printf("st_blksize=%li\n", struktura.st_blksize);
          printf("st_blocks=%li\n", struktura.st_blocks);
        }
      } else if (!strcmp(buf, "QUIT\r\n")) {
        printf("Quit\n");
        close(sock);
        exit(0);
      } else {
        send(sock, "Unknown command\r\n", strlen("Unknown command\r\n"), 0);
        printf("%s Unknown command '%s'\n", ptime(), buf);
        for (i = 0; i < strlen(buf); i++)
          printf("%02X ", buf[i]);
        printf("\n");
        close(sock);
      }
    }
    close(sock);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10f0 <ptime@plt>
mov    %rax,%rsi
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd86(%rip),%rdi
call   1100 <log_@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    0x2d2a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1180 <socket@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    12d2 <main+0x72>
lea    0xd67(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x8ae,%edi
call   1050 <htons@plt>
mov    %eax,-0x14(%rbp)
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   1120 <bind@plt>
cmp    $0x0,%rax
jge    132d <main+0xcd>
lea    0xd13(%rip),%rdi
call   1140 <perror@plt>
mov    $0x2,%edi
call   1170 <exit@plt>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1110 <listen@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1150 <accept@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    136c <main+0x10c>
lea    0xce4(%rip),%rdi
call   1140 <perror@plt>
mov    $0x3,%edi
call   1170 <exit@plt>
jmp    1371 <main+0x111>
movl   $0x0,-0x828(%rbp)
cmpl   $0x800,-0x828(%rbp)
jge    13ae <main+0x14e>
movslq -0x828(%rbp),%rax
movb   $0x0,-0x820(%rbp,%rax,1)
mov    -0x828(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x828(%rbp)
jmp    137b <main+0x11b>
mov    -0x8(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x800,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x824(%rbp)
cmpl   $0x0,-0x824(%rbp)
jg     13dc <main+0x17c>
jmp    17ba <main+0x55a>
mov    $0x0,%al
call   10f0 <ptime@plt>
mov    %rax,%rsi
lea    0xc5b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x820(%rbp),%rdi
call   1100 <log_@plt>
lea    -0x820(%rbp),%rdi
lea    0xc42(%rip),%rsi
mov    $0x4,%edx
call   10a0 <memcmp@plt>
cmp    $0x0,%eax
jne    16b4 <main+0x454>
lea    0xc2d(%rip),%rdi
lea    -0x858(%rbp),%rsi
call   10e0 <stat@plt>
cmp    $0x0,%rax
je     146e <main+0x20e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1064(%rbp)
lea    0xc12(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x1064(%rbp),%edi
mov    %eax,%edx
lea    0xbfe(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
jmp    16a7 <main+0x447>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10ac(%rbp)
lea    0xd01(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x10ac(%rbp),%edi
mov    %eax,%edx
lea    0xced(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
lea    -0x1060(%rbp),%rax
mov    %rax,-0x10a8(%rbp)
mov    $0x0,%al
call   10f0 <ptime@plt>
mov    -0x10a8(%rbp),%rdi
mov    %rax,%rdx
lea    0xcea(%rip),%rsi
mov    $0x0,%al
call   1160 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x109c(%rbp)
lea    -0x1060(%rbp),%rax
mov    %rax,-0x1098(%rbp)
lea    -0x1060(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x109c(%rbp),%edi
mov    -0x1098(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x108c(%rbp)
lea    0xca4(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x108c(%rbp),%edi
mov    %eax,%edx
lea    0xc90(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
lea    -0x1060(%rbp),%rax
mov    %rax,-0x1088(%rbp)
mov    -0x840(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x1080(%rbp)
mov    $0x0,%al
call   10f0 <ptime@plt>
mov    -0x1088(%rbp),%rdi
mov    -0x1080(%rbp),%rdx
mov    %rax,%rcx
lea    0xc63(%rip),%rsi
mov    $0x0,%al
call   1160 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1074(%rbp)
lea    -0x1060(%rbp),%rax
mov    %rax,-0x1070(%rbp)
lea    -0x1060(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1074(%rbp),%edi
mov    -0x1070(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1068(%rbp)
lea    0xc3a(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x1068(%rbp),%edi
mov    %eax,%edx
lea    0xc26(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
lea    0xa7a(%rip),%rdi
lea    0xc4b(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x860(%rbp)
cmpq   $0x0,-0x860(%rbp)
je     1691 <main+0x431>
jmp    1601 <main+0x3a1>
mov    -0x860(%rbp),%rdi
call   10d0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1622 <main+0x3c2>
jmp    168c <main+0x42c>
movb   $0x0,-0x1060(%rbp)
lea    -0x1060(%rbp),%rdi
mov    -0x860(%rbp),%rdx
mov    $0x800,%esi
call   10b0 <fgets@plt>
cmpb   $0x0,-0x1060(%rbp)
je     1687 <main+0x427>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10bc(%rbp)
lea    -0x1060(%rbp),%rax
mov    %rax,-0x10b8(%rbp)
lea    -0x1060(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10bc(%rbp),%edi
mov    -0x10b8(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
jmp    1601 <main+0x3a1>
jmp    1691 <main+0x431>
mov    -0x8(%rbp),%edi
lea    0xb90(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
jmp    17b5 <main+0x555>
lea    -0x820(%rbp),%rdi
lea    0xb6d(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
jne    16ed <main+0x48d>
lea    0xb5f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
xor    %edi,%edi
call   1170 <exit@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10c0(%rbp)
lea    0xb3f(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x10c0(%rbp),%edi
mov    %eax,%edx
lea    0xb2b(%rip),%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
mov    $0x0,%al
call   10f0 <ptime@plt>
mov    %rax,%rsi
lea    -0x820(%rbp),%rdx
lea    0xb1e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x828(%rbp)
mov    -0x828(%rbp),%eax
mov    %eax,-0x10c4(%rbp)
lea    -0x820(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x10c4(%rbp),%eax
cmp    %ecx,%eax
jge    179a <main+0x53a>
movslq -0x828(%rbp),%rax
movsbl -0x820(%rbp,%rax,1),%esi
ff
lea    0xae8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x828(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x828(%rbp)
jmp    1741 <main+0x4e1>
lea    0xa8a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
jmp    17b5 <main+0x555>
jmp    1371 <main+0x111>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
jmp    133a <main+0xda>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1058,%rsp
xor    %eax,%eax
call   1110 <ptime@plt>
lea    0xd61(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xd67(%rip),%rdi
call   1120 <log_@plt>
mov    0x2d2c(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d0b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11a0 <socket@plt>
test   %eax,%eax
jns    12e8 <main+0x68>
lea    0xd51(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
mov    %eax,%ebp
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    $0x8ae,%edi
call   1070 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   1140 <bind@plt>
test   %rax,%rax
jns    133c <main+0xbc>
lea    0xd04(%rip),%rdi
call   1160 <perror@plt>
mov    $0x2,%edi
call   1190 <exit@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1130 <listen@plt>
mov    %ebp,0xc(%rsp)
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1170 <accept@plt>
test   %eax,%eax
jns    1371 <main+0xf1>
lea    0xcdf(%rip),%rdi
call   1160 <perror@plt>
mov    $0x3,%edi
call   1190 <exit@plt>
mov    %eax,%r13d
lea    0x850(%rsp),%rbx
lea    0xcc5(%rip),%r12
lea    0xccb(%rip),%r14
lea    0xed0(%rip),%r15
jmp    13b9 <main+0x139>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xca4(%rip),%r14
mov    %r13d,%edi
call   10c0 <close@plt>
mov    $0x800,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <memset@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jle    1653 <main+0x3d3>
xor    %eax,%eax
call   1110 <ptime@plt>
mov    %r12,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
call   1120 <log_@plt>
mov    %rbx,%rdi
lea    0xc48(%rip),%rsi
mov    $0x4,%edx
call   10d0 <memcmp@plt>
test   %eax,%eax
je     14c0 <main+0x240>
mov    $0x7,%edx
mov    %rbx,%rdi
lea    0xe06(%rip),%rsi
call   10d0 <memcmp@plt>
test   %eax,%eax
je     1678 <main+0x3f8>
lea    0xdf9(%rip),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
xor    %eax,%eax
call   1110 <ptime@plt>
lea    0xde6(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    13a0 <main+0x120>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x850(%rsp,%rbp,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1490 <main+0x210>
jmp    13a0 <main+0x120>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
lea    0x20(%rsp),%rsi
call   1100 <stat@plt>
test   %rax,%rax
je     14f5 <main+0x275>
lea    0xb87(%rip),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
jmp    13b1 <main+0x131>
lea    0xc83(%rip),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
xor    %eax,%eax
call   1110 <ptime@plt>
lea    0x50(%rsp),%rdi
lea    0xc83(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1180 <sprintf@plt>
lea    0x50(%rsp),%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
lea    0x50(%rsp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    0xc61(%rip),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    0x38(%rsp),%rbp
add    $0x10,%rbp
xor    %eax,%eax
call   1110 <ptime@plt>
lea    0x50(%rsp),%rdi
lea    0xc47(%rip),%rsi
mov    %rbp,%rdx
lea    0xac6(%rip),%r14
mov    %rax,%rcx
xor    %eax,%eax
call   1180 <sprintf@plt>
lea    0x50(%rsp),%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
lea    0x50(%rsp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    0xc38(%rip),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
lea    0x50(%rsp),%rbp
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    %r14,%rdi
lea    0xc4c(%rip),%rsi
call   1150 <fopen@plt>
test   %rax,%rax
je     1631 <main+0x3b1>
mov    %rax,%r12
xchg   %ax,%ax
mov    %r12,%rdi
call   10f0 <feof@plt>
test   %eax,%eax
jne    1631 <main+0x3b1>
movb   $0x0,0x50(%rsp)
mov    %rbp,%rdi
mov    $0x800,%esi
mov    %r12,%rdx
call   10e0 <fgets@plt>
cmpb   $0x0,0x50(%rsp)
je     15f0 <main+0x370>
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
jmp    15f0 <main+0x370>
mov    %r13d,%edi
lea    0xbf0(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    0x9fa(%rip),%r12
jmp    13b1 <main+0x131>
mov    %r13d,%edi
call   10c0 <close@plt>
mov    0xc(%rsp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1170 <accept@plt>
mov    %eax,%r13d
test   %eax,%eax
jns    13b9 <main+0x139>
jmp    135b <main+0xdb>
lea    0xbe8(%rip),%rdi
call   1050 <puts@plt>
mov    %r13d,%edi
call   10c0 <close@plt>
xor    %edi,%edi
call   1190 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.stat = type { i32, i32, i32, i32, i32, i64, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [23 x i8] c"%s proolhttpd started\0A\00"
@.str.1 = [19 x i8] c"proolhttpd started\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@INADDR_ANY = global i32 0
@.str.3 = [16 x i8] c"proolhttpd bind\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.5 = [8 x i8] c"%s GET\0A\00"
@.str.6 = [5 x i8] c"GET \00"
@.str.7 = [11 x i8] c"index.html\00"
@.str.8 = [287 x i8] c"HTTP/1.1 404 Not Found`\0AServer: proolhttpd\0ADate: Sat, 27 Feb 2016 21:45:06 GMT\0AContent-Type: text/html\0AContent-Length: 144\0AConnection: close\0A\0A<html>\0A<head><title>404 Not Found</title></head>\0A<body>\0A<center><h1>404 Not Found</h1></center>\0A<hr><center>proolhttpd</center>\0A</body>\0A</html>\0A\00"
@.str.9 = [42 x i8] c"HTTP/1.1 200 OK\0AServer: proolhttpd/0.0.2\0A\00"
@.str.10 = [10 x i8] c"Date: %s\0A\00"
@.str.11 = [25 x i8] c"Content-Type: text/html\0A\00"
@.str.12 = [39 x i8] c"Content-Length: %li\0ALast-Modified: %s\0A\00"
@.str.13 = [58 x i8] c"Connection: close\0AAccept-Ranges: bytes\0A\0A<!DOCTYPE html>\0A\0A\00"
@.str.14 = [2 x i8] c"r\00"
@.str.15 = [2 x i8] c"\0A\00"
@.str.16 = [7 x i8] c"QUIT\0D\0A\00"
@.str.17 = [6 x i8] c"Quit\0A\00"
@.str.18 = [18 x i8] c"Unknown command\0D\0A\00"
@.str.19 = [25 x i8] c"%s Unknown command '%s'\0A\00"
@.str.20 = [6 x i8] c"%02X \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca [2048 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca i32*
%10 = alloca [2048 x i8]
store i32 0, i32* %1
%11 = call i8* (...) @ptime()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @log_(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @AF_INET
%15 = load i32, i32* @SOCK_STREAM
%16 = call i32 @socket(i32 %14, i32 %15, i32 0)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %0
%20 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %0
%23 = load i32, i32* @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %23, i32* %24
%25 = call i32 @htons(i32 2222)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
store i32 %25, i32* %26
%27 = load i32, i32* @INADDR_ANY
%28 = call i32 @htonl(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%30 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i32 0, i32 0
store i32 %28, i32* %30
%31 = load i32, i32* %3
%32 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%33 = call i64 @bind(i32 %31, %struct.sockaddr* %32, i32 12)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %22
%36 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @exit(i32 2)
unreachable
38: ; preds = %22
%39 = load i32, i32* %3
%40 = call i32 @listen(i32 %39, i32 1)
br label %41
41: ; preds = %38, %181
%42 = load i32, i32* %3
%43 = call i32 @accept(i32 %42, i32* null, i32* null)
store i32 %43, i32* %2
%44 = load i32, i32* %2
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%48 = call i32 @exit(i32 3)
unreachable
49: ; preds = %41
br label %50
50: ; preds = %49, %180
store i32 0, i32* %7
br label %51
51: ; preds = %58, %50
%52 = load i32, i32* %7
%53 = icmp slt i32 %52, 2048
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 %56
store i8 0, i8* %57
br label %58
58: ; preds = %54
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %51
61: ; preds = %51
%62 = load i32, i32* %2
%63 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%64 = call i32 @recv(i32 %62, i8* %63, i32 2048, i32 0)
store i32 %64, i32* %6
%65 = load i32, i32* %6
%66 = icmp sle i32 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %61
br label %181
68: ; preds = %61
%69 = call i8* (...) @ptime()
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %69)
%71 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%72 = call i32 @log_(i8* %71)
%73 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%74 = call i32 @memcmp(i8* %73, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%75 = icmp ne i32 %74, 0
br i1 %75, label %144, label %76
76: ; preds = %68
%77 = call i64 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %struct.stat* %8)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = load i32, i32* %2
%81 = call i32 @strlen(i8* getelementptr inbounds ([287 x i8], [287 x i8]* @.str.8, i64 0, i64 0))
%82 = call i32 @send(i32 %80, i8* getelementptr inbounds ([287 x i8], [287 x i8]* @.str.8, i64 0, i64 0), i32 %81, i32 0)
br label %141
83: ; preds = %76
%84 = load i32, i32* %2
%85 = call i32 @strlen(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
%86 = call i32 @send(i32 %84, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i32 %85, i32 0)
%87 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%88 = call i8* (...) @ptime()
%89 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %87, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %88)
%90 = load i32, i32* %2
%91 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%92 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%93 = call i32 @strlen(i8* %92)
%94 = call i32 @send(i32 %90, i8* %91, i32 %93, i32 0)
%95 = load i32, i32* %2
%96 = call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%97 = call i32 @send(i32 %95, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %96, i32 0)
%98 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%99 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 5
%100 = load i64, i64* %99
%101 = add nsw i64 %100, 16
%102 = inttoptr i64 %101 to i8*
%103 = call i8* (...) @ptime()
%104 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %98, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0), i8* %102, i8* %103)
%105 = load i32, i32* %2
%106 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%107 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%108 = call i32 @strlen(i8* %107)
%109 = call i32 @send(i32 %105, i8* %106, i32 %108, i32 0)
%110 = load i32, i32* %2
%111 = call i32 @strlen(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0))
%112 = call i32 @send(i32 %110, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0), i32 %111, i32 0)
%113 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32* %113, i32** %9
%114 = load i32*, i32** %9
%115 = icmp ne i32* %114, null
br i1 %115, label %116, label %138
116: ; preds = %83
br label %117
117: ; preds = %136, %116
%118 = load i32*, i32** %9
%119 = call i32 @feof(i32* %118)
%120 = icmp ne i32 %119, 0
%121 = xor i1 %120, true
br i1 %121, label %122, label %137
122: ; preds = %117
%123 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
store i8 0, i8* %123
%124 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%125 = load i32*, i32** %9
%126 = call i32 @fgets(i8* %124, i32 2048, i32* %125)
%127 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%128 = load i8, i8* %127
%129 = icmp ne i8 %128, 0
br i1 %129, label %130, label %136
130: ; preds = %122
%131 = load i32, i32* %2
%132 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%133 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%134 = call i32 @strlen(i8* %133)
%135 = call i32 @send(i32 %131, i8* %132, i32 %134, i32 0)
br label %136
136: ; preds = %130, %122
br label %117
137: ; preds = %117
br label %138
138: ; preds = %137, %83
%139 = load i32, i32* %2
%140 = call i32 @send(i32 %139, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 0)
br label %141
141: ; preds = %138, %79
%142 = load i32, i32* %2
%143 = call i32 @close(i32 %142)
br label %180
144: ; preds = %68
%145 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%146 = call i32 @strcmp(i8* %145, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
%147 = icmp ne i32 %146, 0
br i1 %147, label %153, label %148
148: ; preds = %144
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0))
%150 = load i32, i32* %2
%151 = call i32 @close(i32 %150)
%152 = call i32 @exit(i32 0)
unreachable
153: ; preds = %144
%154 = load i32, i32* %2
%155 = call i32 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0))
%156 = call i32 @send(i32 %154, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i32 %155, i32 0)
%157 = call i8* (...) @ptime()
%158 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.19, i64 0, i64 0), i8* %157, i8* %158)
store i32 0, i32* %7
br label %160
160: ; preds = %172, %153
%161 = load i32, i32* %7
%162 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%163 = call i32 @strlen(i8* %162)
%164 = icmp slt i32 %161, %163
br i1 %164, label %165, label %175
165: ; preds = %160
%166 = load i32, i32* %7
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 %167
%169 = load i8, i8* %168
%170 = sext i8 %169 to i32
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 %170)
br label %172
172: ; preds = %165
%173 = load i32, i32* %7
%174 = add nsw i32 %173, 1
store i32 %174, i32* %7
br label %160
175: ; preds = %160
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%177 = load i32, i32* %2
%178 = call i32 @close(i32 %177)
br label %179
179: ; preds = %175
br label %180
180: ; preds = %179, %141
br label %50
181: ; preds = %67
%182 = load i32, i32* %2
%183 = call i32 @close(i32 %182)
br label %41
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.stat = type { i32, i32, i32, i32, i32, i64, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [23 x i8] c"%s proolhttpd started\0A\00"
@.str.1 = [19 x i8] c"proolhttpd started\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@INADDR_ANY = global i32 0
@.str.3 = [16 x i8] c"proolhttpd bind\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.5 = [8 x i8] c"%s GET\0A\00"
@.str.6 = [5 x i8] c"GET \00"
@.str.7 = [11 x i8] c"index.html\00"
@.str.8 = [287 x i8] c"HTTP/1.1 404 Not Found`\0AServer: proolhttpd\0ADate: Sat, 27 Feb 2016 21:45:06 GMT\0AContent-Type: text/html\0AContent-Length: 144\0AConnection: close\0A\0A<html>\0A<head><title>404 Not Found</title></head>\0A<body>\0A<center><h1>404 Not Found</h1></center>\0A<hr><center>proolhttpd</center>\0A</body>\0A</html>\0A\00"
@.str.9 = [42 x i8] c"HTTP/1.1 200 OK\0AServer: proolhttpd/0.0.2\0A\00"
@.str.10 = [10 x i8] c"Date: %s\0A\00"
@.str.11 = [25 x i8] c"Content-Type: text/html\0A\00"
@.str.12 = [39 x i8] c"Content-Length: %li\0ALast-Modified: %s\0A\00"
@.str.13 = [58 x i8] c"Connection: close\0AAccept-Ranges: bytes\0A\0A<!DOCTYPE html>\0A\0A\00"
@.str.14 = [2 x i8] c"r\00"
@.str.15 = [2 x i8] c"\0A\00"
@.str.16 = [7 x i8] c"QUIT\0D\0A\00"
@.str.18 = [18 x i8] c"Unknown command\0D\0A\00"
@.str.19 = [25 x i8] c"%s Unknown command '%s'\0A\00"
@.str.20 = [6 x i8] c"%02X \00"
@str = [5 x i8] c"Quit\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca [2048 x i8]
%3 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%4 = alloca %struct.stat
%5 = alloca [2048 x i8]
%6 = bitcast %struct.sockaddr_in* %1 to i8*
%7 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%8 = bitcast %struct.stat* %4 to i8*
%9 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%10 = tail call i8* (...) @ptime()
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = tail call i32 @log_(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* @AF_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 ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %0
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %21, i32* %22
%23 = tail call i32 @htons(i32 2222)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
store i32 %23, i32* %24
%25 = load i32, i32* @INADDR_ANY
%26 = tail call i32 @htonl(i32 %25)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0, i32 0
store i32 %26, i32* %27
%28 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%29 = call i64 @bind(i32 %15, %struct.sockaddr* %28, i32 12)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %20
%32 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @exit(i32 2)
unreachable
34: ; preds = %20
%35 = call i32 @listen(i32 %15, i32 1)
%36 = call i32 @accept(i32 %15, i32* null, i32* null)
%37 = icmp slt i32 %36, 0
br i1 %37, label %44, label %38
38: ; preds = %34
%39 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 5
br label %40
40: ; preds = %38, %124
%41 = phi i32 [ %36, %38 ], [ %126, %124 ]
%42 = call i32 @recv(i32 %41, i8* %7, i32 2048, i32 0)
%43 = icmp slt i32 %42, 1
br i1 %43, label %124, label %47
44: ; preds = %124, %34
%45 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @exit(i32 3)
unreachable
47: ; preds = %40, %120
%48 = call i8* (...) @ptime()
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %48)
%50 = call i32 @log_(i8* %7)
%51 = call i32 @memcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %94
53: ; preds = %47
%54 = call i64 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %struct.stat* %4)
%55 = icmp eq i64 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %53
%57 = call i32 @strlen(i8* getelementptr inbounds ([287 x i8], [287 x i8]* @.str.8, i64 0, i64 0))
%58 = call i32 @send(i32 %41, i8* getelementptr inbounds ([287 x i8], [287 x i8]* @.str.8, i64 0, i64 0), i32 %57, i32 0)
br label %120
59: ; preds = %53
%60 = call i32 @strlen(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
%61 = call i32 @send(i32 %41, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i32 %60, i32 0)
%62 = call i8* (...) @ptime()
%63 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %62)
%64 = call i32 @strlen(i8* %9)
%65 = call i32 @send(i32 %41, i8* %9, i32 %64, i32 0)
%66 = call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%67 = call i32 @send(i32 %41, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %66, i32 0)
%68 = load i64, i64* %39
%69 = add nsw i64 %68, 16
%70 = inttoptr i64 %69 to i8*
%71 = call i8* (...) @ptime()
%72 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0), i8* %70, i8* %71)
%73 = call i32 @strlen(i8* %9)
%74 = call i32 @send(i32 %41, i8* %9, i32 %73, i32 0)
%75 = call i32 @strlen(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0))
%76 = call i32 @send(i32 %41, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0), i32 %75, i32 0)
%77 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%78 = icmp eq i32* %77, null
br i1 %78, label %92, label %79
79: ; preds = %59
%80 = call i32 @feof(i32* %77)
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %92
82: ; preds = %79, %89
store i8 0, i8* %9
%83 = call i32 @fgets(i8* %9, i32 2048, i32* %77)
%84 = load i8, i8* %9
%85 = icmp eq i8 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %82
%87 = call i32 @strlen(i8* %9)
%88 = call i32 @send(i32 %41, i8* %9, i32 %87, i32 0)
br label %89
89: ; preds = %86, %82
%90 = call i32 @feof(i32* %77)
%91 = icmp eq i32 %90, 0
br i1 %91, label %82, label %92
92: ; preds = %89, %79, %59
%93 = call i32 @send(i32 %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 0)
br label %120
94: ; preds = %47
%95 = call i32 bitcast (i32 (i8*, i8*, i32)* @memcmp to i32 (i8*, i8*, i64)*)(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i64 7)
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %94
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%99 = call i32 @close(i32 %41)
%100 = call i32 @exit(i32 0)
unreachable
101: ; preds = %94
%102 = call i32 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0))
%103 = call i32 @send(i32 %41, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i32 %102, i32 0)
%104 = call i8* (...) @ptime()
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.19, i64 0, i64 0), i8* %104, i8* %7)
%106 = call i32 @strlen(i8* %7)
%107 = icmp sgt i32 %106, 0
br i1 %107, label %108, label %118
108: ; preds = %101, %108
%109 = phi i64 [ %114, %108 ], [ 0, %101 ]
%110 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 %112)
%114 = add nuw nsw i64 %109, 1
%115 = call i32 @strlen(i8* %7)
%116 = sext i32 %115 to i64
%117 = icmp slt i64 %114, %116
br i1 %117, label %108, label %118
118: ; preds = %108, %101
%119 = call i32 @putchar(i32 10)
br label %120
120: ; preds = %56, %92, %118
%121 = call i32 @close(i32 %41)
%122 = call i32 @recv(i32 %41, i8* %7, i32 2048, i32 0)
%123 = icmp slt i32 %122, 1
br i1 %123, label %124, label %47
124: ; preds = %120, %40
%125 = call i32 @close(i32 %41)
%126 = call i32 @accept(i32 %15, i32* null, i32* null)
%127 = icmp slt i32 %126, 0
br i1 %127, label %44, label %40
}