#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ generation_temperatures(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  char nomFichier[100];
  printf("Entrez le nom du fichier : ");
  scanf("%[^\n]s", nomFichier);
  FILE *fichier = fopen(nomFichier, "w+");
  if (fichier) {
    generation_temperatures(fichier, 1901, 2099);
    fclose(fichier);
  } else
    printf("Impossible d'ouvrir le fichier.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     11ee <main+0x7e>
mov    -0x78(%rbp),%rdi
mov    $0x76d,%esi
mov    $0x833,%edx
call   1040 <generation_temperatures@plt>
mov    -0x78(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11fa <main+0x8a>
lea    0xe31(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
lea    0xe66(%rip),%rdi
call   1060 <printf@plt>
lea    0xe76(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <scanf@plt>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     11e4 <main+0x64>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x76d,%esi
mov    $0x833,%edx
call   1050 <generation_temperatures@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    11f0 <main+0x70>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Entrez le nom du fichier : \00"
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [3 x i8] c"w+\00"
@.str.3 = [33 x i8] c"Impossible d'ouvrir le fichier.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %0
%14 = load i32*, i32** %3
%15 = call i32 @generation_temperatures(i32* %14, i32 1901, i32 2099)
%16 = load i32*, i32** %3
%17 = call i32 @fclose(i32* %16)
br label %20
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %13
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Entrez le nom du fichier : \00"
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [3 x i8] c"w+\00"
@str = [32 x i8] c"Impossible d'ouvrir le fichier.\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = call i32 @generation_temperatures(i32* %7, i32 1901, i32 2099)
%11 = call i32 @fclose(i32* %7)
br label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
ret i32 0
}