#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*/ clreol();
int /*<<< orphan*/ gotoxy(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int wherex();
int wherey();
GetChoix(void) {
  int x, y;
  char a;
  x = 35;
  y = wherey();
  gotoxy(x, y + 3);
  printf("Votre choix : ");
  x = wherex();
  y = wherey();
  do {
    gotoxy(x, y);
    clreol();
    gotoxy(x, y);
    scanf("%c", &a);
  } while (a < '1' || a > '5');
  return (a - '0');
}


x86 assembly (clang, -O0):
<GetChoix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x23,-0x4(%rbp)
mov    $0x0,%al
call   1030 <wherey@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x3,%esi
call   1070 <gotoxy@plt>
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <wherex@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <wherey@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <gotoxy@plt>
mov    $0x0,%al
call   1080 <clreol@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <gotoxy@plt>
lea    0xe44(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x31,%ecx
mov    %al,-0xa(%rbp)
jl     11f3 <GetChoix+0x93>
movsbl -0x9(%rbp),%eax
cmp    $0x35,%eax
setg   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11a7 <GetChoix+0x47>
movsbl -0x9(%rbp),%eax
sub    $0x30,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetChoix>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <wherey@plt>
lea    0x3(%rax),%esi
mov    $0x23,%edi
call   1070 <gotoxy@plt>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <wherex@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <wherey@plt>
mov    %eax,%ebp
lea    0xe6f(%rip),%r14
lea    0x7(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <gotoxy@plt>
xor    %eax,%eax
call   1080 <clreol@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <gotoxy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
movzbl 0x7(%rsp),%eax
lea    -0x36(%rax),%ecx
cmp    $0xfb,%cl
jb     11b0 <GetChoix+0x50>
add    $0xffffffd0,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Votre choix : \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @GetChoix() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 35, i32* %1
%4 = call i32 (...) @wherey()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 3
%8 = call i32 @gotoxy(i32 %5, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @wherex()
store i32 %10, i32* %1
%11 = call i32 (...) @wherey()
store i32 %11, i32* %2
br label %12
12: ; preds = %29, %0
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 @gotoxy(i32 %13, i32 %14)
%16 = call i32 (...) @clreol()
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @gotoxy(i32 %17, i32 %18)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %21
21: ; preds = %12
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp slt i32 %23, 49
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp sgt i32 %27, 53
br label %29
29: ; preds = %25, %21
%30 = phi i1 [ true, %21 ], [ %28, %25 ]
br i1 %30, label %12, label %31
31: ; preds = %29
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
ret i32 %34
}

LLVM IR (-O2):
@.str = [15 x i8] c"Votre choix : \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @GetChoix() {
%1 = alloca i8
%2 = tail call i32 (...) @wherey()
%3 = add nsw i32 %2, 3
%4 = tail call i32 @gotoxy(i32 35, i32 %3)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @wherex()
%7 = tail call i32 (...) @wherey()
br label %8
8: ; preds = %8, %0
%9 = call i32 @gotoxy(i32 %6, i32 %7)
%10 = call i32 (...) @clreol()
%11 = call i32 @gotoxy(i32 %6, i32 %7)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%13 = load i8, i8* %1
%14 = add i8 %13, -54
%15 = icmp ult i8 %14, -5
br i1 %15, label %8, label %16
16: ; preds = %8
%17 = zext i8 %13 to i32
%18 = add nsw i32 %17, -48
ret i32 %18
}