#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int menu_annexe(void) {
  int choix = 0;
  while (choix < 1 || choix > 4) {
    printf("Menu annexe :\n");
    printf("1 - Ecrire du texte\n");
    printf("2 - A propos de...\n");
    printf("3 - Acceder au Github\n");
    printf("4 - Retour au menu principal\n\n");
    scanf("%d", &choix);
    getchar();
    if (choix < 1 || choix > 4) {
      system("cls");
      printf("Erreur : vous n'avez pas entre un choix correct\n");
    }
  }
  switch (choix) {
  case 1:
    printf("IMPORTANT : penser a enregistrer votre travail avant de fermer "
           "Notepad.\n Le nom du fichier est 'mon_fichier.txt'\n");
    system("notepad.exe mon_fichier");
    system("pause");
    return 0;
    break;
  case 2:
    system("notepad.exe README");
    return 0;
    break;
  case 3:
    system("start iexplore.exe https://github.com/gadelain/FISA1_projet_c");
    return 0;
    break;
  case 4:
    return 0;
    break;
  default:
    printf("Erreur default / break");
    system("pause");
    return -1;
    break;
  }
  return choix;
}


x86 assembly (clang, -O0):
<menu_annexe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1168 <menu_annexe+0x28>
cmpl   $0x4,-0x8(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1178 <menu_annexe+0x38>
jmp    11fc <menu_annexe+0xbc>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
cmpl   $0x1,-0x8(%rbp)
jl     11df <menu_annexe+0x9f>
cmpl   $0x4,-0x8(%rbp)
jle    11f7 <menu_annexe+0xb7>
lea    0xe9b(%rip),%rdi
call   1030 <system@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
jmp    114f <menu_annexe+0xf>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1291 <menu_annexe+0x151>
mov    -0x18(%rbp),%rax
lea    0xde4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
call   1030 <system@plt>
lea    0xefc(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <menu_annexe+0x170>
lea    0xeea(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <menu_annexe+0x170>
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <menu_annexe+0x170>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <menu_annexe+0x170>
lea    0xeff(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1030 <system@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_annexe>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xfd9(%rip),%r13
lea    0xfe8(%rip),%rbx
lea    0xe98(%rip),%rbp
lea    0x4(%rsp),%r14
lea    0xe8f(%rip),%r15
lea    0xfec(%rip),%r12
nopl   0x0(%rax,%rax,1)
lea    0xf77(%rip),%rdi
call   1030 <puts@plt>
lea    0xf79(%rip),%rdi
call   1030 <puts@plt>
lea    0xf81(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x4(%rsp),%eax
lea    -0x5(%rax),%ecx
cmp    $0xfffffffb,%ecx
ja     11fe <menu_annexe+0xae>
mov    %r15,%rdi
call   1040 <system@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
lea    -0x5(%rax),%ecx
cmp    $0xfffffffc,%ecx
jb     1190 <menu_annexe+0x40>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1239 <menu_annexe+0xe9>
xor    %ebx,%ebx
lea    0xe26(%rip),%rdi
lea    0xdea(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
lea    0xde5(%rip),%rdi
call   1040 <system@plt>
jmp    124a <menu_annexe+0xfa>
lea    0xe46(%rip),%rdi
call   1050 <printf@plt>
mov    $0xffffffff,%ebx
lea    0xdde(%rip),%rdi
jmp    125a <menu_annexe+0x10a>
lea    0xdee(%rip),%rdi
call   1040 <system@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Menu annexe :\0A\00"
@.str.1 = [21 x i8] c"1 - Ecrire du texte\0A\00"
@.str.2 = [20 x i8] c"2 - A propos de...\0A\00"
@.str.3 = [23 x i8] c"3 - Acceder au Github\0A\00"
@.str.4 = [31 x i8] c"4 - Retour au menu principal\0A\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [4 x i8] c"cls\00"
@.str.7 = [49 x i8] c"Erreur : vous n'avez pas entre un choix correct\0A\00"
@.str.8 = [114 x i8] c"IMPORTANT : penser a enregistrer votre travail avant de fermer Notepad.\0A Le nom du fichier est 'mon_fichier.txt'\0A\00"
@.str.9 = [24 x i8] c"notepad.exe mon_fichier\00"
@.str.10 = [6 x i8] c"pause\00"
@.str.11 = [19 x i8] c"notepad.exe README\00"
@.str.12 = [62 x i8] c"start iexplore.exe https://github.com/gadelain/FISA1_projet_c\00"
@.str.13 = [23 x i8] c"Erreur default / break\00"
define i32 @menu_annexe() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %27, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 1
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 4
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ true, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %28
11: ; preds = %9
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%18 = call i32 (...) @getchar()
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 1
br i1 %20, label %24, label %21
21: ; preds = %11
%22 = load i32, i32* %2
%23 = icmp sgt i32 %22, 4
br i1 %23, label %24, label %27
24: ; preds = %21, %11
%25 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
br label %27
27: ; preds = %24, %21
br label %3
28: ; preds = %9
%29 = load i32, i32* %2
switch i32 %29, label %39 [
i32 1, label %30
i32 2, label %34
i32 3, label %36
i32 4, label %38
]
30: ; preds = %28
%31 = call i32 @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.8, i64 0, i64 0))
%32 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %42
34: ; preds = %28
%35 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %1
br label %42
36: ; preds = %28
%37 = call i32 @system(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %1
br label %42
38: ; preds = %28
store i32 0, i32* %1
br label %42
39: ; preds = %28
%40 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
%41 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %1
br label %42
42: ; preds = %39, %38, %36, %34, %30
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [4 x i8] c"cls\00"
@.str.9 = [24 x i8] c"notepad.exe mon_fichier\00"
@.str.10 = [6 x i8] c"pause\00"
@.str.11 = [19 x i8] c"notepad.exe README\00"
@.str.12 = [62 x i8] c"start iexplore.exe https://github.com/gadelain/FISA1_projet_c\00"
@.str.13 = [23 x i8] c"Erreur default / break\00"
@str = [113 x i8] c"IMPORTANT : penser a enregistrer votre travail avant de fermer Notepad.\0A Le nom du fichier est 'mon_fichier.txt'\00"
@str.14 = [14 x i8] c"Menu annexe :\00"
@str.15 = [20 x i8] c"1 - Ecrire du texte\00"
@str.16 = [19 x i8] c"2 - A propos de...\00"
@str.17 = [22 x i8] c"3 - Acceder au Github\00"
@str.18 = [30 x i8] c"4 - Retour au menu principal\0A\00"
@str.19 = [48 x i8] c"Erreur : vous n'avez pas entre un choix correct\00"
define i32 @menu_annexe() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %14
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.14, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.15, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.16, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.17, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.18, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%10 = call i32 (...) @getchar()
%11 = load i32, i32* %1
%12 = add i32 %11, -5
%13 = icmp ult i32 %12, -4
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.19, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = add i32 %17, -5
%19 = icmp ult i32 %18, -4
br i1 %19, label %3, label %20
20: ; preds = %3, %14
%21 = phi i32 [ %17, %14 ], [ %11, %3 ]
switch i32 %21, label %26 [
i32 1, label %22
i32 2, label %28
i32 3, label %25
i32 4, label %32
]
22: ; preds = %20
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @str, i64 0, i64 0))
%24 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %28
25: ; preds = %20
br label %28
26: ; preds = %20
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %28
28: ; preds = %20, %22, %25, %26
%29 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), %26 ], [ getelementptr inbounds ([62 x i8], [62 x i8]* @.str.12, i64 0, i64 0), %25 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), %22 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), %20 ]
%30 = phi i32 [ -1, %26 ], [ 0, %25 ], [ 0, %22 ], [ 0, %20 ]
%31 = call i32 @system(i8* %29)
br label %32
32: ; preds = %28, %20
%33 = phi i32 [ 0, %20 ], [ %30, %28 ]
ret i32 %33
}