#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_clef(void) {
  int choix = 0;
  system("cls");
  while (choix < 1 || choix > 2) {
    printf("Veulliez entrer un choix :\n");
    printf("1- Entrez votre clef\n");
    printf("2- Retour au menu principal\n\n");
    scanf("%d", &choix);
    getchar();
    if (choix < 1 || choix > 2) {
      system("cls");
      printf("Erreur : vous n'avez pas entre un choix correct\n");
    }
  }
  return choix;
}


x86 assembly (clang, -O0):
<menu_clef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <system@plt>
mov    $0x1,%al
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1174 <menu_clef+0x34>
cmpl   $0x2,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1184 <menu_clef+0x44>
jmp    11f0 <menu_clef+0xb0>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
cmpl   $0x1,-0x4(%rbp)
jl     11d3 <menu_clef+0x93>
cmpl   $0x2,-0x4(%rbp)
jle    11eb <menu_clef+0xab>
lea    0xe26(%rip),%rdi
call   1030 <system@plt>
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
jmp    115b <menu_clef+0x1b>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_clef>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xea6(%rip),%rdi
call   1040 <system@plt>
lea    0xea1(%rip),%r15
lea    0xeb5(%rip),%r12
lea    0xec3(%rip),%r13
lea    0xe89(%rip),%rbx
lea    0x4(%rsp),%rbp
lea    0xecd(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x4(%rsp),%eax
lea    -0x3(%rax),%ecx
cmp    $0xfffffffd,%ecx
ja     11e6 <menu_clef+0xa6>
lea    0xe33(%rip),%rdi
call   1040 <system@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
lea    -0x3(%rax),%ecx
cmp    $0xfffffffe,%ecx
jb     1190 <menu_clef+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [28 x i8] c"Veulliez entrer un choix :\0A\00"
@.str.2 = [22 x i8] c"1- Entrez votre clef\0A\00"
@.str.3 = [30 x i8] c"2- Retour au menu principal\0A\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [49 x i8] c"Erreur : vous n'avez pas entre un choix correct\0A\00"
define i32 @menu_clef() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %25, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 2
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ true, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %26
11: ; preds = %9
%12 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%16 = call i32 (...) @getchar()
%17 = load i32, i32* %1
%18 = icmp slt i32 %17, 1
br i1 %18, label %22, label %19
19: ; preds = %11
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 2
br i1 %21, label %22, label %25
22: ; preds = %19, %11
%23 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %22, %19
br label %3
26: ; preds = %9
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.4 = [3 x i8] c"%d\00"
@str = [27 x i8] c"Veulliez entrer un choix :\00"
@str.6 = [21 x i8] c"1- Entrez votre clef\00"
@str.7 = [29 x i8] c"2- Retour au menu principal\0A\00"
@str.8 = [48 x i8] c"Erreur : vous n'avez pas entre un choix correct\00"
define i32 @menu_clef() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %13
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%9 = call i32 (...) @getchar()
%10 = load i32, i32* %1
%11 = add i32 %10, -3
%12 = icmp ult i32 %11, -2
br i1 %12, label %13, label %19
13: ; preds = %4
%14 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.8, i64 0, i64 0))
%16 = load i32, i32* %1
%17 = add i32 %16, -3
%18 = icmp ult i32 %17, -2
br i1 %18, label %4, label %19
19: ; preds = %4, %13
%20 = phi i32 [ %16, %13 ], [ %10, %4 ]
ret i32 %20
}