#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*/ fgets(char *, int, int /*<<< orphan*/);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ stdin;
int Saisie_Entier() {
  char entier[10];
  int ret, valeur;
  fgets(entier, 10, stdin);
  ret = sscanf(entier, "%d", &valeur);
  while (ret != 1) {
    fgets(entier, 10, stdin);
    ret = sscanf(entier, "%d", &valeur);
  }
  return valeur;
}


x86 assembly (clang, -O0):
<Saisie_Entier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0xa(%rbp),%rdi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1030 <fgets@plt>
lea    -0xa(%rbp),%rdi
lea    0xeb6(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
je     1193 <Saisie_Entier+0x73>
lea    -0xa(%rbp),%rdi
mov    0x2e7d(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1030 <fgets@plt>
lea    -0xa(%rbp),%rdi
lea    0xe7e(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
mov    %eax,-0x10(%rbp)
jmp    1156 <Saisie_Entier+0x36>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Saisie_Entier>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2eb6(%rip),%r12
mov    (%r12),%edx
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <fgets@plt>
lea    0xeb1(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     11a4 <Saisie_Entier+0x84>
lea    0xe(%rsp),%rbx
lea    0xe93(%rip),%r14
lea    0x8(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <fgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1180 <Saisie_Entier+0x60>
mov    0x8(%rsp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @Saisie_Entier() {
%1 = alloca [10 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 10, i32 %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 %8, i32* %2
br label %9
9: ; preds = %12, %0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 1
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %13, i32 10, i32 %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 %17, i32* %2
br label %9
18: ; preds = %9
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @Saisie_Entier() {
%1 = alloca [10 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %3, i32 10, i32 %5)
%7 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = icmp eq i32 %7, 1
br i1 %8, label %14, label %9
9: ; preds = %0, %9
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %3, i32 10, i32 %10)
%12 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %9
14: ; preds = %9, %0
%15 = load i32, i32* %2
ret i32 %15
}