#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 Emission(char *);
int longueur_fichier(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int envoyerReponse200HTML(char *nomFichier) {
  char req[500];
  char len[2];
  int lenght = 0;
  lenght = longueur_fichier(nomFichier);
  sprintf(len, "%d", lenght);
  strcpy(req, "\nHTTP/1.1 200 OK\nContent-type: text/html\nContent-length: ");
  strcat(req, len);
  strcat(req, "\n\n");
  if (Emission(req) != 1)
    printf("Erreur d'emission\n");
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x208(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <longueur_fichier@plt>
mov    %eax,-0x208(%rbp)
lea    -0x202(%rbp),%rdi
mov    -0x208(%rbp),%edx
lea    0xe64(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x200(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x200(%rbp),%rdi
lea    -0x202(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x200(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x200(%rbp),%rdi
call   1060 <Emission@plt>
cmp    $0x1,%eax
je     11fb <envoyerReponse200HTML+0x9b>
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r14
push   %rbx
sub    $0x208,%rsp
call   1050 <longueur_fichier@plt>
lea    0xe8a(%rip),%rsi
lea    0xe(%rsp),%r14
mov    %r14,%rdi
mov    %eax,%edx
call   1080 <sprintf@plt>
lea    0xe77(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
call   1060 <Emission@plt>
cmp    $0x1,%eax
je     11cc <envoyerReponse200HTML+0x6c>
lea    0xe79(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [58 x i8] c"\0AHTTP/1.1 200 OK\0AContent-type: text/html\0AContent-length: \00"
@.str.2 = [3 x i8] c"\0A\0A\00"
@.str.3 = [19 x i8] c"Erreur d'emission\0A\00"
define i32 @envoyerReponse200HTML(i8* %0) {
%2 = alloca i8*
%3 = alloca [500 x i8]
%4 = alloca [2 x i8]
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %5
%6 = load i8*, i8** %2
%7 = call i32 @longueur_fichier(i8* %6)
store i32 %7, i32* %5
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%9 = load i32, i32* %5
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%15 = call i32 @strcat(i8* %13, i8* %14)
%16 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%17 = call i32 @strcat(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%19 = call i32 @Emission(i8* %18)
%20 = icmp ne i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %1
%22 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %1
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [58 x i8] c"\0AHTTP/1.1 200 OK\0AContent-type: text/html\0AContent-length: \00"
@.str.2 = [3 x i8] c"\0A\0A\00"
@str = [18 x i8] c"Erreur d'emission\00"
define i32 @envoyerReponse200HTML(i8* %0) {
%2 = alloca [500 x i8]
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @longueur_fichier(i8* %0)
%7 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @strcat(i8* %4, i8* %5)
%10 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @Emission(i8* %4)
%12 = icmp eq i32 %11, 1
br i1 %12, label %15, label %13
13: ; preds = %1
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %1
ret i32 0
}