#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ menu();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ set_curseur(int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int difficulty = 0;
  char char_difficulty = 0;
  FILE *dico = 0;
  char *word = 0;
  menu();
  dico = fopen("dico.txt", "r");
  if (dico == 0)
    exit(0);
  else {
    printf("\nChoose your difficulty by the length of the word\nLevel = ");
    printf("Test 1, 2, 1, 2...\n");
    scanf("%d", &difficulty);
    printf("TEST: difficulty = %d\tchar_difficulty = %d = %c", difficulty,
           char_difficulty, char_difficulty);
    set_curseur(dico, difficulty);
    fclose(dico);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    $0x0,%al
call   1040 <menu@plt>
lea    0xe51(%rip),%rdi
lea    0xe53(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11d1 <main+0x61>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x14(%rbp),%esi
movsbl -0x15(%rbp),%edx
movsbl -0x15(%rbp),%ecx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <set_curseur@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
call   1050 <menu@plt>
lea    0xe65(%rip),%rdi
lea    0xe67(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     120c <main+0x8c>
mov    %rax,%rbx
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe76(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xe64(%rip),%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1070 <set_curseur@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"dico.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [59 x i8] c"\0AChoose your difficulty by the length of the word\0ALevel = \00"
@.str.3 = [20 x i8] c"Test 1, 2, 1, 2...\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [48 x i8] c"TEST: difficulty = %d\09char_difficulty = %d = %c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8 0, i8* %7
store i32* null, i32** %8
store i8* null, i8** %9
%10 = call i32 (...) @menu()
%11 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %8
%12 = load i32*, i32** %8
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%20 = load i32, i32* %6
%21 = load i8, i8* %7
%22 = sext i8 %21 to i32
%23 = load i8, i8* %7
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %20, i32 %22, i32 %24)
%26 = load i32*, i32** %8
%27 = load i32, i32* %6
%28 = call i32 @set_curseur(i32* %26, i32 %27)
%29 = load i32*, i32** %8
%30 = call i32 @fclose(i32* %29)
br label %31
31: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"dico.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [59 x i8] c"\0AChoose your difficulty by the length of the word\0ALevel = \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [48 x i8] c"TEST: difficulty = %d\09char_difficulty = %d = %c\00"
@str = [19 x i8] c"Test 1, 2, 1, 2...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 (...) @menu()
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %14, i32 0, i32 0)
%16 = load i32, i32* %3
%17 = call i32 @set_curseur(i32* %6, i32 %16)
%18 = call i32 @fclose(i32* %6)
ret i32 0
}