#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*/ *);
int /*<<< orphan*/ close(int);
int compter_char(char *, char);
int creer_serveur(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ initialiser_signaux();
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ str_match(char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ write(int, char *, scalar_t__);
int main(int argc, char **argv) {
  argc = argc;
  argv = argv;
  int serveur = creer_serveur(8080);
  if (serveur < 0) {
    return serveur;
  }
  initialiser_signaux();
  printf("%s\n", "server started listening on 8080 ...");
  while (1) {
    int file_attente = 10;
    if (listen(serveur, file_attente) == -1) {
      perror("listen socket_serveur");
      return -3;
    }
    int socket_client;
    socket_client = accept(serveur, NULL, NULL);
    if (socket_client == -1) {
      perror("accept");
      return -4;
    }
    if (fork() == 0) {
      char buf[255] = "a";
      FILE *file = fdopen(socket_client, "w+");
      if (file == NULL) {
        fprintf(stderr, "%s\n", "ERROR opening socket_client");
        return -7;
      } else {
        int entete_ok = 0;
        int ligne_vide_detecter = 0;
        while (strlen(buf) != 0) {
          if (fgets(buf, 255, file) == NULL) {
            fprintf(stderr, "%s\n", "ERROR reading from socket_client");
            return -5;
          }
          printf("%s\n", buf);
          char bufcpy[255];
          strcpy(bufcpy, buf);
          int i = compter_char(bufcpy, ' ');
          if (strncmp(buf, "GET", 3) == 0 && i == 2 && str_match(bufcpy)) {
            entete_ok = 1;
          }
          if (entete_ok == 1) {
            if (strncmp(buf, "\n", 1) == 0 || strncmp(buf, "\r\n", 2) == 0) {
              ligne_vide_detecter = 1;
            }
            if (ligne_vide_detecter == 1) {
              char *msg_bjr =
                  "HTTP/1.1 200 OK\r\nContent-Length: "
                  "1079\r\n\r\n010000100110111101101110011010100110111101110101"
                  "011100100010000000101100001000000110001001101001011001010110"
                  "111001110110011001010110111001110101011001010010000001110011"
                  "011101010111001000100000011011010110111101101110001000000111"
                  "0011011001010111001001110110011001010111010101110010\n102 "
                  "157 156 152 157 165 162 054 040 142 151 145 156 166 145 156 "
                  "165 145 040 163 165 162 040 155 157 156 040 163 145 162 166 "
                  "145 165 162\n66 111 110 106 111 117 114 44 32 98 105 101 "
                  "110 118 101 110 117 101 32 115 117 114 32 109 111 110 32 "
                  "115 101 114 118 101 117 114\n42 6f 6e 6a 6f 75 72 2c 20 62 "
                  "69 65 6e 76 65 6e 75 65 20 73 75 72 20 6d 6f 6e 20 73 65 72 "
                  "76 65 75 72\nLXVI CXI CX CVI CXI CXVII CXIV XLIV XXXII "
                  "XCVIII CV CI CX CXVIII CI CX CXVII CI XXXII CXV CXVII CXIV "
                  "XXXII CIX CXI CX XXXII CXV CI CXIV CXVIII CI CXVII "
                  "CXIV\n-... --- -. .--- --- ..- .-. --..-- / -... .. . -. "
                  "...- . -. ..- . / ... ..- .-. / -- --- -. / ... . .-. ...- "
                  ". ..- .-.\nßo|\\|joµ12, b][env3nue su.- mo/V "
                  "$&12\\/"
                  "eur\n7752e0fad02e1ac9dbda87af611e6602\n79039ee375d4ec5cd4b8d"
                  "29bdba19e279ee8c03e\nBonjour, bienvenue sur mon serveur\n";
              write(socket_client, msg_bjr, strlen(msg_bjr));
            }
          } else {
            char *msg_400 =
                "HTTP/1.1 400 Bad Request\r\nConnection: "
                "close\r\nContent-Length: 17\r\n\r\n400 Bad request\r\n";
            write(socket_client, msg_400, strlen(msg_400));
            break;
          }
        }
      }
      fclose(file);
      close(socket_client);
      exit(0);
    }
    close(socket_client);
  }
  close(serveur);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x1f90,%edi
call   10d0 <creer_serveur@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1289 <main+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15b1 <main+0x371>
mov    $0x0,%al
call   1060 <initialiser_signaux@plt>
lea    0xd69(%rip),%rdi
lea    0xd66(%rip),%rsi
call   10a0 <printf@plt>
movl   $0xa,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1100 <listen@plt>
cmp    $0xffffffff,%eax
jne    12d6 <main+0x96>
lea    0xd64(%rip),%rdi
call   1130 <perror@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    15b1 <main+0x371>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1140 <accept@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    130a <main+0xca>
lea    0xd46(%rip),%rdi
call   1130 <perror@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    15b1 <main+0x371>
mov    $0x0,%al
call   1160 <fork@plt>
cmp    $0x0,%rax
jne    15a4 <main+0x364>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   10b0 <memset@plt>
movb   $0x61,-0x120(%rbp)
mov    -0x1c(%rbp),%edi
lea    0xd07(%rip),%rsi
call   1120 <fdopen@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
jne    1381 <main+0x141>
mov    0x2c80(%rip),%rax
mov    (%rax),%edi
lea    0xc97(%rip),%rsi
lea    0xcd9(%rip),%rdx
call   10f0 <fprintf@plt>
movl   $0xfffffff9,-0x4(%rbp)
jmp    15b1 <main+0x371>
movl   $0x0,-0x12c(%rbp)
movl   $0x0,-0x130(%rbp)
lea    -0x120(%rbp),%rdi
call   1090 <strlen@plt>
cmp    $0x0,%rax
je     1584 <main+0x344>
lea    -0x120(%rbp),%rdi
mov    -0x128(%rbp),%rdx
mov    $0xff,%esi
call   10e0 <fgets@plt>
cmp    $0x0,%rax
jne    13f5 <main+0x1b5>
mov    0x2c0c(%rip),%rax
mov    (%rax),%edi
lea    0xc23(%rip),%rsi
lea    0xc81(%rip),%rdx
call   10f0 <fprintf@plt>
movl   $0xfffffffb,-0x4(%rbp)
jmp    15b1 <main+0x371>
lea    -0x120(%rbp),%rsi
lea    0xbfd(%rip),%rdi
call   10a0 <printf@plt>
lea    -0x230(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x230(%rbp),%rdi
mov    $0x20,%esi
call   1030 <compter_char@plt>
mov    %eax,-0x234(%rbp)
lea    -0x120(%rbp),%rdi
lea    0xc46(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1481 <main+0x241>
cmpl   $0x2,-0x234(%rbp)
jne    1481 <main+0x241>
lea    -0x230(%rbp),%rdi
call   1110 <str_match@plt>
cmp    $0x0,%rax
je     1481 <main+0x241>
movl   $0x1,-0x12c(%rbp)
cmpl   $0x1,-0x12c(%rbp)
jne    1534 <main+0x2f4>
lea    -0x120(%rbp),%rdi
lea    0x10a2(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     14d2 <main+0x292>
lea    -0x120(%rbp),%rdi
lea    0x107f(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14dc <main+0x29c>
movl   $0x1,-0x130(%rbp)
cmpl   $0x1,-0x130(%rbp)
jne    152f <main+0x2ef>
lea    0xb9a(%rip),%rax
mov    %rax,-0x240(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x254(%rbp)
mov    -0x240(%rbp),%rax
mov    %rax,-0x250(%rbp)
mov    -0x240(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x254(%rbp),%edi
mov    -0x250(%rbp),%rsi
mov    %rax,%rdx
call   1070 <write@plt>
jmp    157f <main+0x33f>
lea    0xfb0(%rip),%rax
mov    %rax,-0x248(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x264(%rbp)
mov    -0x248(%rbp),%rax
mov    %rax,-0x260(%rbp)
mov    -0x248(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x264(%rbp),%edi
mov    -0x260(%rbp),%rsi
mov    %rax,%rdx
call   1070 <write@plt>
jmp    1584 <main+0x344>
jmp    1395 <main+0x155>
jmp    1589 <main+0x349>
mov    -0x128(%rbp),%rdi
call   1080 <fclose@plt>
mov    -0x1c(%rbp),%edi
call   10c0 <close@plt>
xor    %edi,%edi
call   1150 <exit@plt>
mov    -0x1c(%rbp),%edi
call   10c0 <close@plt>
jmp    12a3 <main+0x63>
mov    -0x4(%rbp),%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    $0x1f90,%edi
call   10b0 <creer_serveur@plt>
mov    %eax,%ebp
test   %eax,%eax
js     14a7 <main+0x287>
xor    %eax,%eax
call   1060 <initialiser_signaux@plt>
lea    0xdad(%rip),%rdi
lea    0xdaa(%rip),%rsi
call   1090 <printf@plt>
nop
mov    %ebp,%edi
mov    $0xa,%esi
call   10e0 <listen@plt>
cmp    $0xffffffff,%eax
je     1483 <main+0x263>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
cmp    $0xffffffff,%eax
je     1496 <main+0x276>
mov    %eax,%ebx
xor    %eax,%eax
call   1140 <fork@plt>
test   %rax,%rax
je     12a0 <main+0x80>
mov    %ebx,%edi
call   10a0 <close@plt>
jmp    1260 <main+0x40>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movups %xmm0,0xff(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movb   $0x61,0x10(%rsp)
lea    0xd2c(%rip),%rsi
mov    %ebx,%edi
call   1100 <fdopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1460 <main+0x240>
xor    %r14d,%r14d
lea    0x10(%rsp),%r15
lea    0x110(%rsp),%r13
xor    %r12d,%r12d
jmp    1377 <main+0x157>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x460,%edx
mov    %ebx,%edi
lea    0xd2c(%rip),%rsi
call   1070 <write@plt>
mov    $0x1,%r12d
mov    $0x1,%r14b
cmpb   $0x0,0x10(%rsp)
je     14ce <main+0x2ae>
mov    %r15,%rdi
mov    $0xff,%esi
mov    0x8(%rsp),%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     143d <main+0x21d>
lea    0xc67(%rip),%rdi
mov    %r15,%rsi
call   1090 <printf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
mov    %r13,%rdi
mov    $0x20,%esi
call   1030 <compter_char@plt>
mov    %eax,%ebp
mov    %r15,%rdi
lea    0xcc1(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    13ea <main+0x1ca>
cmp    $0x2,%ebp
jne    13ea <main+0x1ca>
mov    %r13,%rdi
call   10f0 <str_match@plt>
test   %rax,%rax
setne  %al
or     %al,%r14b
test   $0x1,%r14b
je     14bb <main+0x29b>
mov    %r15,%rdi
lea    0x1140(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1350 <main+0x130>
mov    %r15,%rdi
lea    0x1122(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1350 <main+0x130>
cmp    $0x1,%r12d
jne    1369 <main+0x149>
jmp    1350 <main+0x130>
mov    0x2b9c(%rip),%rax
mov    (%rax),%edi
lea    0xbb3(%rip),%rsi
lea    0xc11(%rip),%rdx
call   10d0 <fprintf@plt>
mov    $0xfffffffb,%ebp
jmp    14a7 <main+0x287>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
lea    0xb90(%rip),%rsi
lea    0xbd2(%rip),%rdx
call   10d0 <fprintf@plt>
mov    $0xfffffff9,%ebp
jmp    14a7 <main+0x287>
lea    0xb9f(%rip),%rdi
call   1110 <perror@plt>
mov    $0xfffffffd,%ebp
jmp    14a7 <main+0x287>
lea    0xba2(%rip),%rdi
call   1110 <perror@plt>
mov    $0xfffffffc,%ebp
mov    %ebp,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x1029(%rip),%rsi
mov    $0x54,%edx
mov    %ebx,%edi
call   1070 <write@plt>
mov    0x8(%rsp),%rdi
call   1080 <fclose@plt>
mov    %ebx,%edi
call   10a0 <close@plt>
xor    %edi,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [37 x i8] c"server started listening on 8080 ...\00"
@.str.2 = [22 x i8] c"listen socket_serveur\00"
@.str.3 = [7 x i8] c"accept\00"
@.str.4 = [3 x i8] c"w+\00"
@stderr = global i32 0
@.str.5 = [28 x i8] c"ERROR opening socket_client\00"
@.str.6 = [33 x i8] c"ERROR reading from socket_client\00"
@.str.7 = [4 x i8] c"GET\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [3 x i8] c"\0D\0A\00"
@.str.10 = [1121 x i8] c"HTTP/1.1 200 OK\0D\0AContent-Length: 1079\0D\0A\0D\0A0100001001101111011011100110101001101111011101010111001000100000001011000010000001100010011010010110010101101110011101100110010101101110011101010110010100100000011100110111010101110010001000000110110101101111011011100010000001110011011001010111001001110110011001010111010101110010\0A102 157 156 152 157 165 162 054 040 142 151 145 156 166 145 156 165 145 040 163 165 162 040 155 157 156 040 163 145 162 166 145 165 162\0A66 111 110 106 111 117 114 44 32 98 105 101 110 118 101 110 117 101 32 115 117 114 32 109 111 110 32 115 101 114 118 101 117 114\0A42 6f 6e 6a 6f 75 72 2c 20 62 69 65 6e 76 65 6e 75 65 20 73 75 72 20 6d 6f 6e 20 73 65 72 76 65 75 72\0ALXVI CXI CX CVI CXI CXVII CXIV XLIV XXXII XCVIII CV CI CX CXVIII CI CX CXVII CI XXXII CXV CXVII CXIV XXXII CIX CXI CX XXXII CXV CI CXIV CXVIII CI CXVII CXIV\0A-... --- -. .--- --- ..- .-. --..-- / -... .. . -. ...- . -. ..- . / ... ..- .-. / -- --- -. / ... . .-. ...- . ..- .-.\0A\C3\9Fo|\\|jo\C2\B512, b][env3nue su.- mo/V $&12\\/eur\0A7752e0fad02e1ac9dbda87af611e6602\0A79039ee375d4ec5cd4b8d29bdba19e279ee8c03e\0ABonjour, bienvenue sur mon serveur\0A\00"
@.str.11 = [85 x i8] c"HTTP/1.1 400 Bad Request\0D\0AConnection: close\0D\0AContent-Length: 17\0D\0A\0D\0A400 Bad request\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [255 x i8]
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [255 x i8]
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
store i32 %17, i32* %4
%18 = load i8**, i8*** %5
store i8** %18, i8*** %5
%19 = call i32 @creer_serveur(i32 8080)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = load i32, i32* %6
store i32 %23, i32* %3
br label %126
24: ; preds = %2
%25 = call i32 (...) @initialiser_signaux()
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %24, %123
store i32 10, i32* %7
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = call i32 @listen(i32 %28, i32 %29)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 -3, i32* %3
br label %126
34: ; preds = %27
%35 = load i32, i32* %6
%36 = call i32 @accept(i32 %35, i32* null, i32* null)
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 -4, i32* %3
br label %126
41: ; preds = %34
%42 = call i64 (...) @fork()
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %123
44: ; preds = %41
%45 = bitcast [255 x i8]* %9 to i8*
%46 = bitcast i8* %45 to [255 x i8]*
%47 = getelementptr inbounds [255 x i8], [255 x i8]* %46, i32 0, i32 0
store i8 97, i8* %47
%48 = load i32, i32* %8
%49 = call i32* @fdopen(i32 %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %49, i32** %10
%50 = load i32*, i32** %10
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %55
52: ; preds = %44
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i32 -7, i32* %3
br label %126
55: ; preds = %44
store i32 0, i32* %11
store i32 0, i32* %12
br label %56
56: ; preds = %115, %55
%57 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%58 = call i64 @strlen(i8* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %116
60: ; preds = %56
%61 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%62 = load i32*, i32** %10
%63 = call i32* @fgets(i8* %61, i32 255, i32* %62)
%64 = icmp eq i32* %63, null
br i1 %64, label %65, label %68
65: ; preds = %60
%66 = load i32, i32* @stderr
%67 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
store i32 -5, i32* %3
br label %126
68: ; preds = %60
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%70 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %69)
%71 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%72 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%73 = call i32 @strcpy(i8* %71, i8* %72)
%74 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%75 = call i32 @compter_char(i8* %74, i8 signext 32)
store i32 %75, i32* %14
%76 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%77 = call i64 @strncmp(i8* %76, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %87
79: ; preds = %68
%80 = load i32, i32* %14
%81 = icmp eq i32 %80, 2
br i1 %81, label %82, label %87
82: ; preds = %79
%83 = getelementptr inbounds [255 x i8], [255 x i8]* %13, i64 0, i64 0
%84 = call i64 @str_match(i8* %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %82
store i32 1, i32* %11
br label %87
87: ; preds = %86, %82, %79, %68
%88 = load i32, i32* %11
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %109
90: ; preds = %87
%91 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%92 = call i64 @strncmp(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 1)
%93 = icmp eq i64 %92, 0
br i1 %93, label %98, label %94
94: ; preds = %90
%95 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%96 = call i64 @strncmp(i8* %95, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 2)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %94, %90
store i32 1, i32* %12
br label %99
99: ; preds = %98, %94
%100 = load i32, i32* %12
%101 = icmp eq i32 %100, 1
br i1 %101, label %102, label %108
102: ; preds = %99
store i8* getelementptr inbounds ([1121 x i8], [1121 x i8]* @.str.10, i64 0, i64 0), i8** %15
%103 = load i32, i32* %8
%104 = load i8*, i8** %15
%105 = load i8*, i8** %15
%106 = call i64 @strlen(i8* %105)
%107 = call i32 @write(i32 %103, i8* %104, i64 %106)
br label %108
108: ; preds = %102, %99
br label %115
109: ; preds = %87
store i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.11, i64 0, i64 0), i8** %16
%110 = load i32, i32* %8
%111 = load i8*, i8** %16
%112 = load i8*, i8** %16
%113 = call i64 @strlen(i8* %112)
%114 = call i32 @write(i32 %110, i8* %111, i64 %113)
br label %116
115: ; preds = %108
br label %56
116: ; preds = %109, %56
br label %117
117: ; preds = %116
%118 = load i32*, i32** %10
%119 = call i32 @fclose(i32* %118)
%120 = load i32, i32* %8
%121 = call i32 @close(i32 %120)
%122 = call i32 @exit(i32 0)
unreachable
123: ; preds = %41
%124 = load i32, i32* %8
%125 = call i32 @close(i32 %124)
br label %27
126: ; preds = %65, %52, %39, %32, %22
%127 = load i32, i32* %3
ret i32 %127
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [37 x i8] c"server started listening on 8080 ...\00"
@.str.2 = [22 x i8] c"listen socket_serveur\00"
@.str.3 = [7 x i8] c"accept\00"
@.str.4 = [3 x i8] c"w+\00"
@stderr = global i32 0
@.str.5 = [28 x i8] c"ERROR opening socket_client\00"
@.str.6 = [33 x i8] c"ERROR reading from socket_client\00"
@.str.7 = [4 x i8] c"GET\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [3 x i8] c"\0D\0A\00"
@.str.10 = [1121 x i8] c"HTTP/1.1 200 OK\0D\0AContent-Length: 1079\0D\0A\0D\0A0100001001101111011011100110101001101111011101010111001000100000001011000010000001100010011010010110010101101110011101100110010101101110011101010110010100100000011100110111010101110010001000000110110101101111011011100010000001110011011001010111001001110110011001010111010101110010\0A102 157 156 152 157 165 162 054 040 142 151 145 156 166 145 156 165 145 040 163 165 162 040 155 157 156 040 163 145 162 166 145 165 162\0A66 111 110 106 111 117 114 44 32 98 105 101 110 118 101 110 117 101 32 115 117 114 32 109 111 110 32 115 101 114 118 101 117 114\0A42 6f 6e 6a 6f 75 72 2c 20 62 69 65 6e 76 65 6e 75 65 20 73 75 72 20 6d 6f 6e 20 73 65 72 76 65 75 72\0ALXVI CXI CX CVI CXI CXVII CXIV XLIV XXXII XCVIII CV CI CX CXVIII CI CX CXVII CI XXXII CXV CXVII CXIV XXXII CIX CXI CX XXXII CXV CI CXIV CXVIII CI CXVII CXIV\0A-... --- -. .--- --- ..- .-. --..-- / -... .. . -. ...- . -. ..- . / ... ..- .-. / -- --- -. / ... . .-. ...- . ..- .-.\0A\C3\9Fo|\\|jo\C2\B512, b][env3nue su.- mo/V $&12\\/eur\0A7752e0fad02e1ac9dbda87af611e6602\0A79039ee375d4ec5cd4b8d29bdba19e279ee8c03e\0ABonjour, bienvenue sur mon serveur\0A\00"
@.str.11 = [85 x i8] c"HTTP/1.1 400 Bad Request\0D\0AConnection: close\0D\0AContent-Length: 17\0D\0A\0D\0A400 Bad request\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [255 x i8]
%4 = alloca [255 x i8]
%5 = tail call i32 @creer_serveur(i32 8080)
%6 = icmp slt i32 %5, 0
br i1 %6, label %78, label %7
7: ; preds = %2
%8 = tail call i32 (...) @initialiser_signaux()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @listen(i32 %5, i32 10)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %74, %7
%13 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %78
14: ; preds = %7, %74
%15 = tail call i32 @accept(i32 %5, i32* null, i32* null)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %78
19: ; preds = %14
%20 = tail call i64 (...) @fork()
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %74
22: ; preds = %19
%23 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
store i8 97, i8* %23
%24 = tail call i32* @fdopen(i32 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
br label %31
28: ; preds = %22
%29 = load i32, i32* @stderr
%30 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %72
31: ; preds = %26, %61
%32 = phi i1 [ false, %26 ], [ true, %61 ]
%33 = phi i32 [ 0, %26 ], [ %62, %61 ]
%34 = call i32* @fgets(i8* %23, i32 255, i32* %24)
%35 = icmp eq i32* %34, null
br i1 %35, label %65, label %36
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %23)
%38 = call i32 @strcpy(i8* %27, i8* %23)
%39 = call i32 @compter_char(i8* %27, i8 signext 32)
%40 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%41 = icmp eq i64 %40, 0
%42 = icmp eq i32 %39, 2
%43 = select i1 %41, i1 %42, i1 false
br i1 %43, label %44, label %48
44: ; preds = %36
%45 = call i64 @str_match(i8* %27)
%46 = icmp ne i64 %45, 0
%47 = or i1 %32, %46
br i1 %47, label %49, label %59
48: ; preds = %36
br i1 %32, label %49, label %59
49: ; preds = %44, %48
%50 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 1)
%51 = icmp eq i64 %50, 0
br i1 %51, label %57, label %52
52: ; preds = %49
%53 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 2)
%54 = icmp eq i64 %53, 0
%55 = icmp eq i32 %33, 1
%56 = select i1 %54, i1 true, i1 %55
br i1 %56, label %57, label %61
57: ; preds = %52, %49
%58 = call i32 @write(i32 %15, i8* getelementptr inbounds ([1121 x i8], [1121 x i8]* @.str.10, i64 0, i64 0), i64 1120)
br label %61
59: ; preds = %44, %48
%60 = call i32 @write(i32 %15, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.11, i64 0, i64 0), i64 84)
br label %68
61: ; preds = %52, %57
%62 = phi i32 [ 1, %57 ], [ %33, %52 ]
%63 = load i8, i8* %23
%64 = icmp eq i8 %63, 0
br i1 %64, label %68, label %31
65: ; preds = %31
%66 = load i32, i32* @stderr
%67 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %72
68: ; preds = %61, %59
%69 = call i32 @fclose(i32* %24)
%70 = call i32 @close(i32 %15)
%71 = call i32 @exit(i32 0)
unreachable
72: ; preds = %65, %28
%73 = phi i32 [ -7, %28 ], [ -5, %65 ]
br label %78
74: ; preds = %19
%75 = tail call i32 @close(i32 %15)
%76 = tail call i32 @listen(i32 %5, i32 10)
%77 = icmp eq i32 %76, -1
br i1 %77, label %12, label %14
78: ; preds = %72, %17, %12, %2
%79 = phi i32 [ %5, %2 ], [ %73, %72 ], [ -4, %17 ], [ -3, %12 ]
ret i32 %79
}