#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_cesar_crypt(void) {
  int choix = 0;
  system("cls");
  while (choix < 1 || choix > 3) {
    printf("Voulez vous entrer le chiffre de Cesar ?\n");
    printf("1 - Oui\n");
    printf("2 - Non, je laisse le programme choisir\n");
    printf("3 - Retour au menu principal\n\n");
    scanf("%d", &choix);
    getchar();
    if (choix < 1 || choix > 3) {
      system("cls");
      printf("Erreur : vous n'avez pas entre un choix correct\n");
    }
  }
  return choix;
}


x86 assembly (clang, -O0):
<menu_cesar_crypt>:
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_cesar_crypt+0x34>
cmpl   $0x3,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1184 <menu_cesar_crypt+0x44>
jmp    11fc <menu_cesar_crypt+0xbc>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
cmpl   $0x1,-0x4(%rbp)
jl     11df <menu_cesar_crypt+0x9f>
cmpl   $0x3,-0x4(%rbp)
jle    11f7 <menu_cesar_crypt+0xb7>
lea    0xe1a(%rip),%rdi
call   1030 <system@plt>
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
jmp    115b <menu_cesar_crypt+0x1b>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_cesar_crypt>:
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    0xeca(%rip),%r12
lea    0xecb(%rip),%r13
lea    0xeec(%rip),%rbx
lea    0xe89(%rip),%rbp
lea    0x4(%rsp),%r14
lea    0xef7(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%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   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x4(%rsp),%eax
lea    -0x4(%rax),%ecx
cmp    $0xfffffffc,%ecx
ja     11f2 <menu_cesar_crypt+0xb2>
lea    0xe27(%rip),%rdi
call   1040 <system@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
lea    -0x4(%rax),%ecx
cmp    $0xfffffffd,%ecx
jb     1190 <menu_cesar_crypt+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 = [42 x i8] c"Voulez vous entrer le chiffre de Cesar ?\0A\00"
@.str.2 = [9 x i8] c"1 - Oui\0A\00"
@.str.3 = [41 x i8] c"2 - Non, je laisse le programme choisir\0A\00"
@.str.4 = [31 x i8] c"3 - Retour au menu principal\0A\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [49 x i8] c"Erreur : vous n'avez pas entre un choix correct\0A\00"
define i32 @menu_cesar_crypt() {
%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 = %26, %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, 3
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ true, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %27
11: ; preds = %9
%12 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%17 = call i32 (...) @getchar()
%18 = load i32, i32* %1
%19 = icmp slt i32 %18, 1
br i1 %19, label %23, label %20
20: ; preds = %11
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, 3
br i1 %22, label %23, label %26
23: ; preds = %20, %11
%24 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
br label %26
26: ; preds = %23, %20
br label %3
27: ; preds = %9
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.5 = [3 x i8] c"%d\00"
@str = [41 x i8] c"Voulez vous entrer le chiffre de Cesar ?\00"
@str.7 = [8 x i8] c"1 - Oui\00"
@str.8 = [40 x i8] c"2 - Non, je laisse le programme choisir\00"
@str.9 = [30 x i8] c"3 - Retour au menu principal\0A\00"
@str.10 = [48 x i8] c"Erreur : vous n'avez pas entre un choix correct\00"
define i32 @menu_cesar_crypt() {
%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, %14
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.8, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, 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, -4
%13 = icmp ult i32 %12, -3
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.10, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = add i32 %17, -4
%19 = icmp ult i32 %18, -3
br i1 %19, label %4, label %20
20: ; preds = %4, %14
%21 = phi i32 [ %17, %14 ], [ %11, %4 ]
ret i32 %21
}