#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 Verification(char *, char **, int, int);
int /*<<< orphan*/ affiche(char *);
int /*<<< orphan*/ message(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ saisiChaine(char *);
int saisi(char **arret, int nbre_arret, int position_ecran) {
  char nomArret[30];
  int numArret = -1;
  do {
    printf("\033[s");
    printf("\033[%d;%dH", position_ecran, 25);
    printf("\033[K");
    saisiChaine(nomArret);
    printf("\033[u");
    numArret = Verification(nomArret, arret, nbre_arret, 3);
    if (numArret == 0) {
      message("Arret incorrect");
    }
    if (numArret > 0) {
      message("Saisi confirmée");
      affiche("Arret:");
      affiche(arret[numArret - 1]);
    }
    if (numArret < 0) {
      message("Erreur de saisi. Arret possible: ");
      affiche(arret[(-(numArret + 1))]);
    }
  } while (numArret <= 0);
  return (numArret - 1);
}


x86 assembly (clang, -O0):
<saisi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0xffffffff,-0x34(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x19,%edx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1060 <saisiChaine@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x3,%ecx
call   1070 <Verification@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    11e0 <saisi+0x90>
lea    0xe3a(%rip),%rdi
call   1030 <message@plt>
cmpl   $0x0,-0x34(%rbp)
jle    1218 <saisi+0xc8>
lea    0xe34(%rip),%rdi
call   1030 <message@plt>
lea    0xe39(%rip),%rdi
call   1050 <affiche@plt>
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <affiche@plt>
cmpl   $0x0,-0x34(%rbp)
jge    1248 <saisi+0xf8>
lea    0xe14(%rip),%rdi
call   1030 <message@plt>
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%edx
add    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <affiche@plt>
jmp    124d <saisi+0xfd>
cmpl   $0x0,-0x34(%rbp)
jle    1169 <saisi+0x19>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saisi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r15
lea    0xea1(%rip),%r12
jmp    118c <saisi+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe8e(%rip),%rdi
call   1030 <message@plt>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
mov    %r14d,%esi
mov    $0x19,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1060 <saisiChaine@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    $0x3,%ecx
call   1070 <Verification@plt>
test   %eax,%eax
je     1180 <saisi+0x30>
mov    %eax,%r13d
jg     1205 <saisi+0xb5>
lea    0xe4b(%rip),%rdi
call   1030 <message@plt>
not    %r13d
mov    (%rbx,%r13,8),%rdi
call   1050 <affiche@plt>
jmp    118c <saisi+0x3c>
lea    0xe19(%rip),%rdi
call   1030 <message@plt>
lea    0xe1e(%rip),%rdi
call   1050 <affiche@plt>
add    $0xffffffff,%r13d
mov    (%rbx,%r13,8),%rdi
call   1050 <affiche@plt>
mov    %r13d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[s\00"
@.str.1 = [9 x i8] c"\1B[%d;%dH\00"
@.str.2 = [4 x i8] c"\1B[K\00"
@.str.3 = [4 x i8] c"\1B[u\00"
@.str.4 = [16 x i8] c"Arret incorrect\00"
@.str.5 = [17 x i8] c"Saisi confirm\C3\A9e\00"
@.str.6 = [7 x i8] c"Arret:\00"
@.str.7 = [34 x i8] c"Erreur de saisi. Arret possible: \00"
define i32 @saisi(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca [30 x i8]
%8 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 -1, i32* %8
br label %9
9: ; preds = %52, %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 25)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%15 = call i32 @saisiChaine(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%18 = load i8**, i8*** %4
%19 = load i32, i32* %5
%20 = call i32 @Verification(i8* %17, i8** %18, i32 %19, i32 3)
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %9
%24 = call i32 @message(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %9
%26 = load i32, i32* %8
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = call i32 @message(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @affiche(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%31 = load i8**, i8*** %4
%32 = load i32, i32* %8
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %31, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @affiche(i8* %36)
br label %38
38: ; preds = %28, %25
%39 = load i32, i32* %8
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = call i32 @message(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%43 = load i8**, i8*** %4
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
%46 = sub nsw i32 0, %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %43, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @affiche(i8* %49)
br label %51
51: ; preds = %41, %38
br label %52
52: ; preds = %51
%53 = load i32, i32* %8
%54 = icmp sle i32 %53, 0
br i1 %54, label %9, label %55
55: ; preds = %52
%56 = load i32, i32* %8
%57 = sub nsw i32 %56, 1
ret i32 %57
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[s\00"
@.str.1 = [9 x i8] c"\1B[%d;%dH\00"
@.str.2 = [4 x i8] c"\1B[K\00"
@.str.3 = [4 x i8] c"\1B[u\00"
@.str.4 = [16 x i8] c"Arret incorrect\00"
@.str.5 = [17 x i8] c"Saisi confirm\C3\A9e\00"
@.str.6 = [7 x i8] c"Arret:\00"
@.str.7 = [34 x i8] c"Erreur de saisi. Arret possible: \00"
define i32 @saisi(i8** %0, i32 %1, i32 %2) {
%4 = alloca [30 x i8]
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
br label %6
6: ; preds = %16, %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 25)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @saisiChaine(i8* %5)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @Verification(i8* %5, i8** %0, i32 %1, i32 3)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %6
%15 = call i32 @message(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %16
16: ; preds = %14, %19
br label %6
17: ; preds = %6
%18 = icmp sgt i32 %12, 0
br i1 %18, label %26, label %19
19: ; preds = %17
%20 = call i32 @message(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%21 = xor i32 %12, -1
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %0, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @affiche(i8* %24)
br label %16
26: ; preds = %17
%27 = call i32 @message(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%28 = call i32 @affiche(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%29 = add nsw i32 %12, -1
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %0, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @affiche(i8* %32)
ret i32 %29
}