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

/* Variables and functions */
int /*<<< orphan*/ AttenteClient();
int /*<<< orphan*/ F_OK;
int /*<<< orphan*/ Initialisation();
char *Reception();
int /*<<< orphan*/ TerminaisonClient();
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ envoyerContenuFichierBinaire(char *);
int /*<<< orphan*/ envoyerContenuFichierTexte(char *);
scalar_t__ envoyerReponse200HTML(char *);
scalar_t__ envoyerReponse200ICO(char *);
scalar_t__ envoyerReponse200JPG(char *);
int /*<<< orphan*/ envoyerReponse404(char *);
int /*<<< orphan*/ envoyerReponse500(char *);
int extraitFichier(char *, char *, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
char *strtok(char *, char *);
int main() {
  int fini;
  char *message = NULL;
  char nomFichier[30];
  int extr_fich = 5;
  char *extensionFichier;
  char *tmp;
  Initialisation();
  while (1) {
    fini = 0;
    AttenteClient();
    while (!fini) {
      message = Reception();
      printf("J'ai recu: %s\n", message);
      if (message != NULL) {
        if (message[0] == 'G' && message[1] == 'E' && message[2] == 'T') {
          extr_fich = extraitFichier(message, nomFichier, 30);
          if ((extr_fich == 0) && (strcmp(nomFichier, "") == 0)) {
            if (access("index.html", F_OK) != -1) {
              if (envoyerReponse200HTML("index.html") == 0)
                envoyerContenuFichierTexte("index.html");
            } else if (access("index.php", F_OK) != -1) {
              if (envoyerReponse200HTML("index.php") == 0)
                envoyerContenuFichierTexte("index.php");
            } else {
              envoyerReponse500("Fichier manquant :index.html; aucune page n'a "
                                "était demandé.");
              extr_fich = 1;
            }
          } else if ((extr_fich == 0) && (access(nomFichier, F_OK) == -1)) {
            envoyerReponse404(nomFichier);
            extr_fich = 1;
          } else {
            tmp = strdup(nomFichier);
            extensionFichier = strtok(tmp, ".");
            extensionFichier = strtok(NULL, ".");
            if ((extr_fich == 0) && (strcmp(extensionFichier, "html") == 0)) {
              if (envoyerReponse200HTML(nomFichier) == 0)
                envoyerContenuFichierTexte(nomFichier);
            } else if ((extr_fich == 0) &&
                       (strcmp(extensionFichier, "php") == 0)) {
              if (envoyerReponse200JPG(nomFichier) == 0)
                envoyerContenuFichierBinaire(nomFichier);
            } else if ((extr_fich == 0) &&
                       (strcmp(extensionFichier, "jpg") == 0)) {
              if (envoyerReponse200JPG(nomFichier) == 0)
                envoyerContenuFichierBinaire(nomFichier);
            } else if ((extr_fich == 0) &&
                       (strcmp(extensionFichier, "ico") == 0)) {
              if (envoyerReponse200ICO(nomFichier) == 0)
                envoyerContenuFichierBinaire(nomFichier);
            } else if (extr_fich == -2) {
              printf("La requete n'est pas formaté correctement.\n");
              break;
            }
            free(tmp);
          }
        }
        free(message);
      } else
        fini = 1;
    }
    TerminaisonClient();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x5,-0x34(%rbp)
mov    $0x0,%al
call   10d0 <Initialisation@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1070 <AttenteClient@plt>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1269 <main+0x49>
jmp    1584 <main+0x364>
mov    $0x0,%al
call   10e0 <Reception@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1578 <main+0x358>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x47,%eax
jne    156a <main+0x34a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x45,%eax
jne    156a <main+0x34a>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x54,%eax
jne    156a <main+0x34a>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1e,%edx
call   10c0 <extraitFichier@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    13a3 <main+0x183>
lea    -0x30(%rbp),%rdi
lea    0xdaa(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    13a3 <main+0x183>
mov    0x2cd5(%rip),%rax
mov    (%rax),%esi
lea    0xd03(%rip),%rdi
call   10f0 <access@plt>
cmp    $0xffffffff,%eax
je     1341 <main+0x121>
lea    0xcee(%rip),%rdi
call   1110 <envoyerReponse200HTML@plt>
cmp    $0x0,%rax
jne    133c <main+0x11c>
lea    0xcd8(%rip),%rdi
call   1140 <envoyerContenuFichierTexte@plt>
jmp    139e <main+0x17e>
mov    0x2c90(%rip),%rax
mov    (%rax),%esi
lea    0xcc9(%rip),%rdi
call   10f0 <access@plt>
cmp    $0xffffffff,%eax
je     1386 <main+0x166>
lea    0xcb4(%rip),%rdi
call   1110 <envoyerReponse200HTML@plt>
cmp    $0x0,%rax
jne    1381 <main+0x161>
lea    0xc9e(%rip),%rdi
call   1140 <envoyerContenuFichierTexte@plt>
jmp    1399 <main+0x179>
lea    0xc97(%rip),%rdi
call   1060 <envoyerReponse500@plt>
movl   $0x1,-0x34(%rbp)
jmp    139e <main+0x17e>
jmp    1565 <main+0x345>
cmpl   $0x0,-0x34(%rbp)
jne    13dd <main+0x1bd>
lea    -0x30(%rbp),%rdi
mov    0x2c20(%rip),%rax
mov    (%rax),%esi
call   10f0 <access@plt>
cmp    $0xffffffff,%eax
jne    13dd <main+0x1bd>
lea    -0x30(%rbp),%rdi
call   1040 <envoyerReponse404@plt>
movl   $0x1,-0x34(%rbp)
jmp    1560 <main+0x340>
lea    -0x30(%rbp),%rdi
call   1130 <strdup@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xc6c(%rip),%rsi
call   1100 <strtok@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc58(%rip),%rsi
call   1100 <strtok@plt>
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1457 <main+0x237>
mov    -0x40(%rbp),%rdi
lea    0xbee(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1457 <main+0x237>
lea    -0x30(%rbp),%rdi
call   1110 <envoyerReponse200HTML@plt>
cmp    $0x0,%rax
jne    1452 <main+0x232>
lea    -0x30(%rbp),%rdi
call   1140 <envoyerContenuFichierTexte@plt>
jmp    1557 <main+0x337>
cmpl   $0x0,-0x34(%rbp)
jne    149c <main+0x27c>
mov    -0x40(%rbp),%rdi
lea    0xbb4(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    149c <main+0x27c>
lea    -0x30(%rbp),%rdi
call   10a0 <envoyerReponse200JPG@plt>
cmp    $0x0,%rax
jne    1497 <main+0x277>
lea    -0x30(%rbp),%rdi
call   1050 <envoyerContenuFichierBinaire@plt>
jmp    1552 <main+0x332>
cmpl   $0x0,-0x34(%rbp)
jne    14e1 <main+0x2c1>
mov    -0x40(%rbp),%rdi
lea    0xbb2(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    14e1 <main+0x2c1>
lea    -0x30(%rbp),%rdi
call   10a0 <envoyerReponse200JPG@plt>
cmp    $0x0,%rax
jne    14dc <main+0x2bc>
lea    -0x30(%rbp),%rdi
call   1050 <envoyerContenuFichierBinaire@plt>
jmp    154d <main+0x32d>
cmpl   $0x0,-0x34(%rbp)
jne    1526 <main+0x306>
mov    -0x40(%rbp),%rdi
lea    0xb71(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1526 <main+0x306>
lea    -0x30(%rbp),%rdi
call   1120 <envoyerReponse200ICO@plt>
cmp    $0x0,%rax
jne    1521 <main+0x301>
lea    -0x30(%rbp),%rdi
call   1050 <envoyerContenuFichierBinaire@plt>
jmp    1548 <main+0x328>
cmpl   $0xfffffffe,-0x34(%rbp)
jne    1543 <main+0x323>
lea    0xb34(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1584 <main+0x364>
jmp    1548 <main+0x328>
jmp    154d <main+0x32d>
jmp    1552 <main+0x332>
jmp    1557 <main+0x337>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
jmp    1565 <main+0x345>
jmp    156a <main+0x34a>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
jmp    157f <main+0x35f>
movl   $0x1,-0x8(%rbp)
jmp    1253 <main+0x33>
mov    $0x0,%al
call   1080 <TerminaisonClient@plt>
jmp    1245 <main+0x25>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   10e0 <Initialisation@plt>
lea    0xdb4(%rip),%rbx
mov    %rsp,%rbp
lea    0xdb9(%rip),%r14
lea    0xdbd(%rip),%r13
jmp    1287 <main+0x57>
lea    0xe05(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%rbp
lea    0xda5(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1090 <TerminaisonClient@plt>
xor    %eax,%eax
call   1080 <AttenteClient@plt>
jmp    12b8 <main+0x88>
cmp    $0xfffffffe,%r15d
je     125f <main+0x2f>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rsp,%rbp
lea    0xd72(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10f0 <Reception@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
test   %r12,%r12
je     1280 <main+0x50>
cmpb   $0x47,(%r12)
jne    12b0 <main+0x80>
cmpb   $0x45,0x1(%r12)
jne    12b0 <main+0x80>
cmpb   $0x54,0x2(%r12)
jne    12b0 <main+0x80>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x1e,%edx
call   10d0 <extraitFichier@plt>
mov    %eax,%r15d
test   %eax,%eax
je     13ac <main+0x17c>
mov    %rbp,%rdi
call   1140 <strdup@plt>
mov    %rax,%r13
mov    %rax,%rdi
lea    0xd7a(%rip),%rbp
mov    %rbp,%rsi
call   1110 <strtok@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1110 <strtok@plt>
test   %r15d,%r15d
jne    1290 <main+0x60>
mov    %rax,%rbp
mov    %rax,%rdi
lea    0xcd2(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1430 <main+0x200>
mov    %rbp,%rdi
lea    0xcc5(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1412 <main+0x1e2>
mov    %rbp,%rdi
lea    0xcf0(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1412 <main+0x1e2>
mov    %rbp,%rdi
lea    0xcdc(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    1296 <main+0x66>
mov    %rsp,%rdi
call   1130 <envoyerReponse200ICO@plt>
test   %rax,%rax
jne    1296 <main+0x66>
jmp    1423 <main+0x1f3>
mov    %rbp,%rdi
lea    0xc58(%rip),%rsi
call   10c0 <strcmp@plt>
mov    0x2c16(%rip),%rcx
mov    (%rcx),%esi
test   %rax,%rax
je     13e7 <main+0x1b7>
mov    %rbp,%rdi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
jne    1306 <main+0xd6>
mov    %rbp,%rdi
call   1040 <envoyerReponse404@plt>
jmp    12b0 <main+0x80>
mov    %r14,%rdi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
je     144e <main+0x21e>
mov    %r14,%rdi
call   1120 <envoyerReponse200HTML@plt>
test   %rax,%rax
jne    12b0 <main+0x80>
mov    %r14,%rdi
call   1150 <envoyerContenuFichierTexte@plt>
jmp    12b0 <main+0x80>
mov    %rsp,%rdi
call   10b0 <envoyerReponse200JPG@plt>
test   %rax,%rax
jne    1296 <main+0x66>
mov    %rsp,%rdi
call   1060 <envoyerContenuFichierBinaire@plt>
jmp    1296 <main+0x66>
mov    %rsp,%rdi
call   1120 <envoyerReponse200HTML@plt>
test   %rax,%rax
jne    1296 <main+0x66>
mov    %rsp,%rdi
call   1150 <envoyerContenuFichierTexte@plt>
jmp    1296 <main+0x66>
mov    0x2b83(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
je     1482 <main+0x252>
mov    %r13,%rdi
call   1120 <envoyerReponse200HTML@plt>
test   %rax,%rax
jne    12b0 <main+0x80>
mov    %r13,%rdi
call   1150 <envoyerContenuFichierTexte@plt>
jmp    12b0 <main+0x80>
lea    0xb9b(%rip),%rdi
call   1070 <envoyerReponse500@plt>
jmp    12b0 <main+0x80>

LLVM IR (-O0):
@.str = [15 x i8] c"J'ai recu: %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [11 x i8] c"index.html\00"
@F_OK = global i32 0
@.str.3 = [10 x i8] c"index.php\00"
@.str.4 = [63 x i8] c"Fichier manquant :index.html; aucune page n'a \C3\A9tait demand\C3\A9.\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [5 x i8] c"html\00"
@.str.7 = [4 x i8] c"php\00"
@.str.8 = [4 x i8] c"jpg\00"
@.str.9 = [4 x i8] c"ico\00"
@.str.10 = [45 x i8] c"La requete n'est pas format\C3\A9 correctement.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [30 x i8]
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %3
store i32 5, i32* %5
%8 = call i32 (...) @Initialisation()
br label %9
9: ; preds = %0, %168
store i32 0, i32* %2
%10 = call i32 (...) @AttenteClient()
br label %11
11: ; preds = %167, %9
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %168
15: ; preds = %11
%16 = call i8* (...) @Reception()
store i8* %16, i8** %3
%17 = load i8*, i8** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %3
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %166
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 71
br i1 %26, label %27, label %163
27: ; preds = %21
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 69
br i1 %32, label %33, label %163
33: ; preds = %27
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i64 2
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 84
br i1 %38, label %39, label %163
39: ; preds = %33
%40 = load i8*, i8** %3
%41 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%42 = call i32 @extraitFichier(i8* %40, i8* %41, i32 30)
store i32 %42, i32* %5
%43 = load i32, i32* %5
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %73
45: ; preds = %39
%46 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %73
49: ; preds = %45
%50 = load i32, i32* @F_OK
%51 = call i32 @access(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%52 = icmp ne i32 %51, -1
br i1 %52, label %53, label %59
53: ; preds = %49
%54 = call i64 @envoyerReponse200HTML(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 @envoyerContenuFichierTexte(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56, %53
br label %72
59: ; preds = %49
%60 = load i32, i32* @F_OK
%61 = call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %60)
%62 = icmp ne i32 %61, -1
br i1 %62, label %63, label %69
63: ; preds = %59
%64 = call i64 @envoyerReponse200HTML(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 @envoyerContenuFichierTexte(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %68
68: ; preds = %66, %63
br label %71
69: ; preds = %59
%70 = call i32 @envoyerReponse500(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %5
br label %71
71: ; preds = %69, %68
br label %72
72: ; preds = %71, %58
br label %162
73: ; preds = %45, %39
%74 = load i32, i32* %5
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %84
76: ; preds = %73
%77 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%78 = load i32, i32* @F_OK
%79 = call i32 @access(i8* %77, i32 %78)
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %76
%82 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%83 = call i32 @envoyerReponse404(i8* %82)
store i32 1, i32* %5
br label %161
84: ; preds = %76, %73
%85 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%86 = call i8* @strdup(i8* %85)
store i8* %86, i8** %7
%87 = load i8*, i8** %7
%88 = call i8* @strtok(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %88, i8** %6
%89 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %89, i8** %6
%90 = load i32, i32* %5
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %104
92: ; preds = %84
%93 = load i8*, i8** %6
%94 = call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %104
96: ; preds = %92
%97 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%98 = call i64 @envoyerReponse200HTML(i8* %97)
%99 = icmp eq i64 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %96
%101 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%102 = call i32 @envoyerContenuFichierTexte(i8* %101)
br label %103
103: ; preds = %100, %96
br label %158
104: ; preds = %92, %84
%105 = load i32, i32* %5
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %119
107: ; preds = %104
%108 = load i8*, i8** %6
%109 = call i64 @strcmp(i8* %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%110 = icmp eq i64 %109, 0
br i1 %110, label %111, label %119
111: ; preds = %107
%112 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%113 = call i64 @envoyerReponse200JPG(i8* %112)
%114 = icmp eq i64 %113, 0
br i1 %114, label %115, label %118
115: ; preds = %111
%116 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%117 = call i32 @envoyerContenuFichierBinaire(i8* %116)
br label %118
118: ; preds = %115, %111
br label %157
119: ; preds = %107, %104
%120 = load i32, i32* %5
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %134
122: ; preds = %119
%123 = load i8*, i8** %6
%124 = call i64 @strcmp(i8* %123, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%125 = icmp eq i64 %124, 0
br i1 %125, label %126, label %134
126: ; preds = %122
%127 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%128 = call i64 @envoyerReponse200JPG(i8* %127)
%129 = icmp eq i64 %128, 0
br i1 %129, label %130, label %133
130: ; preds = %126
%131 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%132 = call i32 @envoyerContenuFichierBinaire(i8* %131)
br label %133
133: ; preds = %130, %126
br label %156
134: ; preds = %122, %119
%135 = load i32, i32* %5
%136 = icmp eq i32 %135, 0
br i1 %136, label %137, label %149
137: ; preds = %134
%138 = load i8*, i8** %6
%139 = call i64 @strcmp(i8* %138, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%140 = icmp eq i64 %139, 0
br i1 %140, label %141, label %149
141: ; preds = %137
%142 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%143 = call i64 @envoyerReponse200ICO(i8* %142)
%144 = icmp eq i64 %143, 0
br i1 %144, label %145, label %148
145: ; preds = %141
%146 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%147 = call i32 @envoyerContenuFichierBinaire(i8* %146)
br label %148
148: ; preds = %145, %141
br label %155
149: ; preds = %137, %134
%150 = load i32, i32* %5
%151 = icmp eq i32 %150, -2
br i1 %151, label %152, label %154
152: ; preds = %149
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.10, i64 0, i64 0))
br label %168
154: ; preds = %149
br label %155
155: ; preds = %154, %148
br label %156
156: ; preds = %155, %133
br label %157
157: ; preds = %156, %118
br label %158
158: ; preds = %157, %103
%159 = load i8*, i8** %7
%160 = call i32 @free(i8* %159)
br label %161
161: ; preds = %158, %81
br label %162
162: ; preds = %161, %72
br label %163
163: ; preds = %162, %33, %27, %21
%164 = load i8*, i8** %3
%165 = call i32 @free(i8* %164)
br label %167
166: ; preds = %15
store i32 1, i32* %2
br label %167
167: ; preds = %166, %163
br label %11
168: ; preds = %152, %11
%169 = call i32 (...) @TerminaisonClient()
br label %9
}

LLVM IR (-O2):
@.str = [15 x i8] c"J'ai recu: %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [11 x i8] c"index.html\00"
@F_OK = global i32 0
@.str.3 = [10 x i8] c"index.php\00"
@.str.4 = [63 x i8] c"Fichier manquant :index.html; aucune page n'a \C3\A9tait demand\C3\A9.\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [5 x i8] c"html\00"
@.str.7 = [4 x i8] c"php\00"
@.str.8 = [4 x i8] c"jpg\00"
@.str.9 = [4 x i8] c"ico\00"
@str = [44 x i8] c"La requete n'est pas format\C3\A9 correctement.\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @Initialisation()
br label %4
4: ; preds = %99, %0
%5 = call i32 (...) @AttenteClient()
%6 = call i8* (...) @Reception()
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i8* %6, null
br i1 %8, label %99, label %9
9: ; preds = %4, %94
%10 = phi i8* [ %96, %94 ], [ %6, %4 ]
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 71
br i1 %12, label %13, label %94
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 69
br i1 %16, label %17, label %94
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %10, i64 2
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 84
br i1 %20, label %21, label %94
21: ; preds = %17
%22 = call i32 @extraitFichier(i8* %10, i8* %2, i32 30)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %52
24: ; preds = %21
%25 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
%27 = load i32, i32* @F_OK
br i1 %26, label %28, label %47
28: ; preds = %24
%29 = call i32 @access(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%30 = icmp eq i32 %29, -1
br i1 %30, label %36, label %31
31: ; preds = %28
%32 = call i64 @envoyerReponse200HTML(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %94
34: ; preds = %31
%35 = call i32 @envoyerContenuFichierTexte(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %94
36: ; preds = %28
%37 = load i32, i32* @F_OK
%38 = call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %45, label %40
40: ; preds = %36
%41 = call i64 @envoyerReponse200HTML(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %94
43: ; preds = %40
%44 = call i32 @envoyerContenuFichierTexte(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %94
45: ; preds = %36
%46 = call i32 @envoyerReponse500(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
br label %94
47: ; preds = %24
%48 = call i32 @access(i8* %2, i32 %27)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @envoyerReponse404(i8* %2)
br label %94
52: ; preds = %21, %47
%53 = call i8* @strdup(i8* %2)
%54 = call i8* @strtok(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%55 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br i1 %23, label %56, label %88
56: ; preds = %52
%57 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %64
59: ; preds = %56
%60 = call i64 @envoyerReponse200HTML(i8* %2)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %92
62: ; preds = %59
%63 = call i32 @envoyerContenuFichierTexte(i8* %2)
br label %92
64: ; preds = %56
%65 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %72
67: ; preds = %64
%68 = call i64 @envoyerReponse200JPG(i8* %2)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %92
70: ; preds = %67
%71 = call i32 @envoyerContenuFichierBinaire(i8* %2)
br label %92
72: ; preds = %64
%73 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %80
75: ; preds = %72
%76 = call i64 @envoyerReponse200JPG(i8* %2)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %92
78: ; preds = %75
%79 = call i32 @envoyerContenuFichierBinaire(i8* %2)
br label %92
80: ; preds = %72
%81 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %92
83: ; preds = %80
%84 = call i64 @envoyerReponse200ICO(i8* %2)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %83
%87 = call i32 @envoyerContenuFichierBinaire(i8* %2)
br label %92
88: ; preds = %52
%89 = icmp eq i32 %22, -2
br i1 %89, label %90, label %92
90: ; preds = %88
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %99
92: ; preds = %80, %70, %67, %86, %83, %88, %75, %78, %59, %62
%93 = call i32 @free(i8* %53)
br label %94
94: ; preds = %9, %13, %17, %50, %92, %34, %31, %40, %43, %45
%95 = call i32 @free(i8* %10)
%96 = call i8* (...) @Reception()
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %96)
%98 = icmp eq i8* %96, null
br i1 %98, label %99, label %9
99: ; preds = %94, %4, %90
%100 = call i32 (...) @TerminaisonClient()
br label %4
}