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

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ checkGet(char *);
scalar_t__ checkHost(char *);
scalar_t__ checkURL(char *);
int close(int);
int creer_serveur(int);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ *fgets_or_exit(char *, int, int /*<<< orphan*/ *);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char const *);
int getpid();
char *malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
scalar_t__ strcmp(char *, char *);
int main(void) {
  printf("%s\n", "Lancement de Swanson");
  int socket_serveur = creer_serveur(8080);
  while (1) {
    int socket_client;
    socket_client = accept(socket_serveur, NULL, NULL);
    if (socket_client == -1) {
      perror("accept socket_serveur");
      return -1;
    }
    const char *message_bienvenue = "She's here. I can smell it\n";
    if (fork() == 0) {
      int taille = 256 * sizeof(char);
      char *buffer = malloc(taille);
      FILE *socket_client_file = fdopen(socket_client, "w+");
      fgets_or_exit(buffer, taille, socket_client_file);
      int lignesPresentes = 0;
      int wrongURL = 0;
      while (strcmp(buffer, "\n") != 0 && strcmp(buffer, "\r\n") != 0) {
        printf(buffer);
        if (lignesPresentes == 0 && checkGet(buffer) == 0) {
          if (checkURL(buffer) != 0) {
            wrongURL = 1;
          }
          lignesPresentes++;
        }
        if (lignesPresentes == 1 && checkHost(buffer) == 0) {
          lignesPresentes++;
        }
        fgets_or_exit(buffer, taille, socket_client_file);
      }
      if (lignesPresentes != 2) {
        fprintf(socket_client_file, "HTTP/1.1 400 Bad Request\r\n");
        fprintf(socket_client_file, "Connection: close\r\n");
        fprintf(socket_client_file, "Content-Length: 17\r\n");
        fprintf(socket_client_file, "\r\n");
        fprintf(socket_client_file, "400 Bad request\r\n");
        return -1;
      }
      if (wrongURL != 0) {
        fprintf(socket_client_file, "HTTP/1.1 404 URL Not Found\r\n");
        fprintf(socket_client_file, "Connection: close\r\n");
        fprintf(socket_client_file, "Content-Length: 17\r\n");
        fprintf(socket_client_file, "\r\n");
        fprintf(socket_client_file, "404 URL Not Found\r\n");
        return -1;
      }
      fprintf(socket_client_file, "HTTP/1.1 200 OK\r\nConnection: "
                                  "close\r\nContent-Length: 2\r\n\r\nOk\r\n");
      sleep(1);
      int i;
      for (i = 0; i < 10; i++) {
        fprintf(socket_client_file, message_bienvenue);
      }
      printf("<%d> %s", getpid(), buffer);
      while (fgets_or_exit(buffer, taille, socket_client_file) != NULL) {
        printf("<%d> %s", getpid(), buffer);
      }
    } else {
      if (close(socket_client) == -1) {
        perror("close socket_client");
        return -1;
      }
    }
  }
  if (close(socket_serveur) == -1) {
    perror("close socket_serveur");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xdea(%rip),%rdi
lea    0xde7(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1f90,%edi
call   1090 <creer_serveur@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1100 <accept@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1265 <main+0x65>
lea    0xdc5(%rip),%rdi
call   10f0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1536 <main+0x336>
lea    0xdc3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1120 <fork@plt>
cmp    $0x0,%rax
jne    1503 <main+0x303>
movl   $0x100,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
lea    0xdad(%rip),%rsi
call   10d0 <fdopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1030 <fgets_or_exit@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   10a0 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x3d(%rbp)
je     1301 <main+0x101>
mov    -0x28(%rbp),%rdi
lea    0xd9d(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
test   $0x1,%al
jne    1311 <main+0x111>
jmp    1397 <main+0x197>
mov    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    135c <main+0x15c>
mov    -0x28(%rbp),%rdi
call   1070 <checkGet@plt>
cmp    $0x0,%rax
jne    135c <main+0x15c>
mov    -0x28(%rbp),%rdi
call   1050 <checkURL@plt>
cmp    $0x0,%rax
je     1353 <main+0x153>
movl   $0x1,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    1382 <main+0x182>
mov    -0x28(%rbp),%rdi
call   10e0 <checkHost@plt>
cmp    $0x0,%rax
jne    1382 <main+0x182>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1030 <fgets_or_exit@plt>
jmp    12c5 <main+0xc5>
cmpl   $0x2,-0x34(%rbp)
je     13fd <main+0x1fd>
mov    -0x30(%rbp),%rdi
lea    0xca2(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xcad(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xcb1(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xcb3(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xca6(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1536 <main+0x336>
cmpl   $0x0,-0x38(%rbp)
je     1463 <main+0x263>
mov    -0x30(%rbp),%rdi
lea    0xc92(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xc47(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xc4b(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xc4d(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xc5b(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1536 <main+0x336>
mov    -0x30(%rbp),%rdi
lea    0xc53(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <sleep@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    14a9 <main+0x2a9>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1484 <main+0x284>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
mov    -0x28(%rbp),%rdx
lea    0xc42(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1030 <fgets_or_exit@plt>
cmp    $0x0,%rax
je     14fe <main+0x2fe>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
mov    -0x28(%rbp),%rdx
lea    0xc0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14c4 <main+0x2c4>
jmp    1531 <main+0x331>
mov    -0xc(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    152c <main+0x32c>
lea    0xbec(%rip),%rdi
call   10f0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1536 <main+0x336>
jmp    1531 <main+0x331>
jmp    1231 <main+0x31>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xdde(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1f90,%edi
call   10a0 <creer_serveur@plt>
mov    %eax,%ebp
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1100 <accept@plt>
cmp    $0xffffffff,%eax
je     15b3 <main+0x3a3>
mov    %eax,%ebx
lea    0xeab(%rip),%r14
jmp    1286 <main+0x76>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
je     15bc <main+0x3ac>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1100 <accept@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     15b3 <main+0x3a3>
xor    %eax,%eax
call   1130 <fork@plt>
test   %rax,%rax
jne    1260 <main+0x50>
mov    $0x100,%edi
call   10c0 <malloc@plt>
mov    %rax,%r15
mov    %ebx,%edi
lea    0xd9f(%rip),%rsi
call   10d0 <fdopen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1030 <fgets_or_exit@plt>
mov    %r15,%rdi
lea    0xdc2(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     14b0 <main+0x2a0>
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    131a <main+0x10a>
mov    %r15,%rdi
call   10e0 <checkHost@plt>
cmp    $0x1,%rax
mov    $0x1,%r12d
adc    $0x0,%r12d
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets_or_exit@plt>
mov    %r15,%rdi
lea    0xd7c(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1370 <main+0x160>
mov    %r15,%rdi
lea    0xd67(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1370 <main+0x160>
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    $0x1,%r12d
je     12e0 <main+0xd0>
test   %r12d,%r12d
jne    12f6 <main+0xe6>
mov    %r15,%rdi
call   1080 <checkGet@plt>
xor    %r12d,%r12d
test   %rax,%rax
jne    12f6 <main+0xe6>
mov    %r15,%rdi
call   1060 <checkURL@plt>
test   %rax,%rax
mov    $0x1,%eax
cmovne %eax,%r13d
jmp    12e0 <main+0xd0>
nopl   0x0(%rax)
cmp    $0x2,%r12d
jne    14b0 <main+0x2a0>
test   %r13d,%r13d
jne    1522 <main+0x312>
mov    $0x3d,%esi
mov    $0x1,%edx
lea    0xd29(%rip),%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
lea    0xc74(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   1110 <fwrite@plt>
nop
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets_or_exit@plt>
test   %rax,%rax
jne    1480 <main+0x270>
jmp    1270 <main+0x60>
lea    0xb93(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb95(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb90(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb89(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb73(%rip),%rdi
mov    $0x11,%esi
jmp    1592 <main+0x382>
lea    0xb77(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb23(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb1e(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb17(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
lea    0xb1c(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa5b(%rip),%rdi
jmp    15c3 <main+0x3b3>
lea    0xb40(%rip),%rdi
call   10f0 <perror@plt>
jmp    159f <main+0x38f>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [21 x i8] c"Lancement de Swanson\00"
@.str.2 = [22 x i8] c"accept socket_serveur\00"
@.str.3 = [28 x i8] c"She's here. I can smell it\0A\00"
@.str.4 = [3 x i8] c"w+\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [3 x i8] c"\0D\0A\00"
@.str.7 = [27 x i8] c"HTTP/1.1 400 Bad Request\0D\0A\00"
@.str.8 = [20 x i8] c"Connection: close\0D\0A\00"
@.str.9 = [21 x i8] c"Content-Length: 17\0D\0A\00"
@.str.10 = [18 x i8] c"400 Bad request\0D\0A\00"
@.str.11 = [29 x i8] c"HTTP/1.1 404 URL Not Found\0D\0A\00"
@.str.12 = [20 x i8] c"404 URL Not Found\0D\0A\00"
@.str.13 = [62 x i8] c"HTTP/1.1 200 OK\0D\0AConnection: close\0D\0AContent-Length: 2\0D\0A\0D\0AOk\0D\0A\00"
@.str.14 = [8 x i8] c"<%d> %s\00"
@.str.15 = [20 x i8] c"close socket_client\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @creer_serveur(i32 8080)
store i32 %12, i32* %2
br label %13
13: ; preds = %0, %138
%14 = load i32, i32* %2
%15 = call i32 @accept(i32 %14, i32* null, i32* null)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %139
20: ; preds = %13
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8** %4
%21 = call i64 (...) @fork()
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %131
23: ; preds = %20
store i32 256, i32* %5
%24 = load i32, i32* %5
%25 = call i8* @malloc(i32 %24)
store i8* %25, i8** %6
%26 = load i32, i32* %3
%27 = call i32* @fdopen(i32 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %27, i32** %7
%28 = load i8*, i8** %6
%29 = load i32, i32* %5
%30 = load i32*, i32** %7
%31 = call i32* @fgets_or_exit(i8* %28, i32 %29, i32* %30)
store i32 0, i32* %8
store i32 0, i32* %9
br label %32
32: ; preds = %69, %23
%33 = load i8*, i8** %6
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i8*, i8** %6
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%39 = icmp ne i64 %38, 0
br label %40
40: ; preds = %36, %32
%41 = phi i1 [ false, %32 ], [ %39, %36 ]
br i1 %41, label %42, label %74
42: ; preds = %40
%43 = load i8*, i8** %6
%44 = call i32 (i8*, ...) @printf(i8* %43)
%45 = load i32, i32* %8
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %59
47: ; preds = %42
%48 = load i8*, i8** %6
%49 = call i64 @checkGet(i8* %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %47
%52 = load i8*, i8** %6
%53 = call i64 @checkURL(i8* %52)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 1, i32* %9
br label %56
56: ; preds = %55, %51
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %59
59: ; preds = %56, %47, %42
%60 = load i32, i32* %8
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %69
62: ; preds = %59
%63 = load i8*, i8** %6
%64 = call i64 @checkHost(i8* %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i32, i32* %8
%68 = add nsw i32 %67, 1
store i32 %68, i32* %8
br label %69
69: ; preds = %66, %62, %59
%70 = load i8*, i8** %6
%71 = load i32, i32* %5
%72 = load i32*, i32** %7
%73 = call i32* @fgets_or_exit(i8* %70, i32 %71, i32* %72)
br label %32
74: ; preds = %40
%75 = load i32, i32* %8
%76 = icmp ne i32 %75, 2
br i1 %76, label %77, label %88
77: ; preds = %74
%78 = load i32*, i32** %7
%79 = call i32 @fprintf(i32* %78, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%80 = load i32*, i32** %7
%81 = call i32 @fprintf(i32* %80, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%82 = load i32*, i32** %7
%83 = call i32 @fprintf(i32* %82, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%84 = load i32*, i32** %7
%85 = call i32 @fprintf(i32* %84, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%86 = load i32*, i32** %7
%87 = call i32 @fprintf(i32* %86, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %1
br label %139
88: ; preds = %74
%89 = load i32, i32* %9
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %102
91: ; preds = %88
%92 = load i32*, i32** %7
%93 = call i32 @fprintf(i32* %92, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
%94 = load i32*, i32** %7
%95 = call i32 @fprintf(i32* %94, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%96 = load i32*, i32** %7
%97 = call i32 @fprintf(i32* %96, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%98 = load i32*, i32** %7
%99 = call i32 @fprintf(i32* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%100 = load i32*, i32** %7
%101 = call i32 @fprintf(i32* %100, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
store i32 -1, i32* %1
br label %139
102: ; preds = %88
%103 = load i32*, i32** %7
%104 = call i32 @fprintf(i32* %103, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.13, i64 0, i64 0))
%105 = call i32 @sleep(i32 1)
store i32 0, i32* %10
br label %106
106: ; preds = %113, %102
%107 = load i32, i32* %10
%108 = icmp slt i32 %107, 10
br i1 %108, label %109, label %116
109: ; preds = %106
%110 = load i32*, i32** %7
%111 = load i8*, i8** %4
%112 = call i32 @fprintf(i32* %110, i8* %111)
br label %113
113: ; preds = %109
%114 = load i32, i32* %10
%115 = add nsw i32 %114, 1
store i32 %115, i32* %10
br label %106
116: ; preds = %106
%117 = call i32 (...) @getpid()
%118 = load i8*, i8** %6
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 %117, i8* %118)
br label %120
120: ; preds = %126, %116
%121 = load i8*, i8** %6
%122 = load i32, i32* %5
%123 = load i32*, i32** %7
%124 = call i32* @fgets_or_exit(i8* %121, i32 %122, i32* %123)
%125 = icmp ne i32* %124, null
br i1 %125, label %126, label %130
126: ; preds = %120
%127 = call i32 (...) @getpid()
%128 = load i8*, i8** %6
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 %127, i8* %128)
br label %120
130: ; preds = %120
br label %138
131: ; preds = %20
%132 = load i32, i32* %3
%133 = call i32 @close(i32 %132)
%134 = icmp eq i32 %133, -1
br i1 %134, label %135, label %137
135: ; preds = %131
%136 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
store i32 -1, i32* %1
br label %139
137: ; preds = %131
br label %138
138: ; preds = %137, %130
br label %13
139: ; preds = %135, %91, %77, %18
%140 = load i32, i32* %1
ret i32 %140
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"Lancement de Swanson\00"
@.str.2 = [22 x i8] c"accept socket_serveur\00"
@.str.3 = [28 x i8] c"She's here. I can smell it\0A\00"
@.str.4 = [3 x i8] c"w+\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [3 x i8] c"\0D\0A\00"
@.str.7 = [27 x i8] c"HTTP/1.1 400 Bad Request\0D\0A\00"
@.str.8 = [20 x i8] c"Connection: close\0D\0A\00"
@.str.9 = [21 x i8] c"Content-Length: 17\0D\0A\00"
@.str.10 = [18 x i8] c"400 Bad request\0D\0A\00"
@.str.11 = [29 x i8] c"HTTP/1.1 404 URL Not Found\0D\0A\00"
@.str.12 = [20 x i8] c"404 URL Not Found\0D\0A\00"
@.str.13 = [62 x i8] c"HTTP/1.1 200 OK\0D\0AConnection: close\0D\0AContent-Length: 2\0D\0A\0D\0AOk\0D\0A\00"
@.str.14 = [8 x i8] c"<%d> %s\00"
@.str.15 = [20 x i8] c"close socket_client\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @creer_serveur(i32 8080)
%3 = tail call i32 @accept(i32 %2, i32* null, i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %87, %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %90
7: ; preds = %0, %87
%8 = phi i32 [ %88, %87 ], [ %3, %0 ]
%9 = tail call i64 (...) @fork()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %82
11: ; preds = %7
%12 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%13 = tail call i32* @fdopen(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i32* @fgets_or_exit(i8* %12, i32 256, i32* %13)
%15 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %46, label %17
17: ; preds = %11, %36
%18 = phi i32 [ %37, %36 ], [ 0, %11 ]
%19 = phi i32 [ %38, %36 ], [ 0, %11 ]
%20 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %42, label %22
22: ; preds = %17
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %12)
switch i32 %19, label %36 [
i32 0, label %24
i32 1, label %31
]
24: ; preds = %22
%25 = tail call i64 @checkGet(i8* %12)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = tail call i64 @checkURL(i8* %12)
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i32 %18, i32 1
br label %31
31: ; preds = %22, %27
%32 = phi i32 [ %30, %27 ], [ %18, %22 ]
%33 = tail call i64 @checkHost(i8* %12)
%34 = icmp eq i64 %33, 0
%35 = select i1 %34, i32 2, i32 1
br label %36
36: ; preds = %22, %24, %31
%37 = phi i32 [ %32, %31 ], [ %18, %24 ], [ %18, %22 ]
%38 = phi i32 [ %35, %31 ], [ 0, %24 ], [ %19, %22 ]
%39 = tail call i32* @fgets_or_exit(i8* %12, i32 256, i32* %13)
%40 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %17
42: ; preds = %17, %36
%43 = phi i32 [ %19, %17 ], [ %38, %36 ]
%44 = phi i32 [ %18, %17 ], [ %37, %36 ]
%45 = icmp eq i32 %43, 2
br i1 %45, label %52, label %46
46: ; preds = %11, %42
%47 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i64 26, i64 1, i32* %13)
%48 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i64 19, i64 1, i32* %13)
%49 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i64 20, i64 1, i32* %13)
%50 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i64 1, i32* %13)
%51 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i64 17, i64 1, i32* %13)
br label %90
52: ; preds = %42
%53 = icmp eq i32 %44, 0
br i1 %53, label %60, label %54
54: ; preds = %52
%55 = tail call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i64 28, i64 1, i32* %13)
%56 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i64 19, i64 1, i32* %13)
%57 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i64 20, i64 1, i32* %13)
%58 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i64 1, i32* %13)
%59 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i64 19, i64 1, i32* %13)
br label %90
60: ; preds = %52
%61 = tail call i64 @fwrite(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.13, i64 0, i64 0), i64 61, i64 1, i32* %13)
%62 = tail call i32 @sleep(i32 1)
%63 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%64 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%65 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%66 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%67 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%68 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%69 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%70 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%71 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%72 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %13)
%73 = tail call i32 (...) @getpid()
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 %73, i8* %12)
%75 = tail call i32* @fgets_or_exit(i8* %12, i32 256, i32* %13)
%76 = icmp eq i32* %75, null
br i1 %76, label %87, label %77
77: ; preds = %60, %77
%78 = tail call i32 (...) @getpid()
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 %78, i8* %12)
%80 = tail call i32* @fgets_or_exit(i8* %12, i32 256, i32* %13)
%81 = icmp eq i32* %80, null
br i1 %81, label %87, label %77
82: ; preds = %7
%83 = tail call i32 @close(i32 %8)
%84 = icmp eq i32 %83, -1
br i1 %84, label %85, label %87
85: ; preds = %82
%86 = tail call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
br label %90
87: ; preds = %77, %60, %82
%88 = tail call i32 @accept(i32 %2, i32* null, i32* null)
%89 = icmp eq i32 %88, -1
br i1 %89, label %5, label %7
90: ; preds = %46, %54, %5, %85
ret i32 -1
}