#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 atoi(char *);
int key(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (2 != argc) {
    printf("Nombre de parametres insuffisants\n");
    return 1;
  }
  int input = atoi(argv[1]);
  if (input > 9999 || input < 1000) {
    printf("incorrect\n");
    return 1;
  }
  printf("cle : %c", key(input));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     116e <main+0x3e>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d1 <main+0xa1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x270f,-0x14(%rbp)
jg     1198 <main+0x68>
cmpl   $0x3e8,-0x14(%rbp)
jge    11b2 <main+0x82>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d1 <main+0xa1>
mov    -0x14(%rbp),%edi
call   1030 <key@plt>
mov    %eax,%esi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1166 <main+0x26>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
lea    -0x2710(%rax),%ecx
cmp    $0xffffdcd7,%ecx
ja     1179 <main+0x39>
lea    0xea5(%rip),%rdi
jmp    116d <main+0x2d>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    1192 <main+0x52>
mov    %eax,%edi
call   1040 <key@plt>
lea    0xe79(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Nombre de parametres insuffisants\0A\00"
@.str.1 = [11 x i8] c"incorrect\0A\00"
@.str.2 = [9 x i8] c"cle : %c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 2, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %27
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 9999
br i1 %17, label %21, label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 1000
br i1 %20, label %21, label %23
21: ; preds = %18, %11
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %27
23: ; preds = %18
%24 = load i32, i32* %6
%25 = call i32 @key(i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %25)
store i32 0, i32* %3
br label %27
27: ; preds = %23, %21, %9
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"cle : %c\00"
@str = [10 x i8] c"incorrect\00"
@str.3 = [34 x i8] c"Nombre de parametres insuffisants\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0))
br label %17
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = add i32 %9, -10000
%11 = icmp ult i32 %10, -9000
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %17
14: ; preds = %6
%15 = tail call i32 @key(i32 %9)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %12, %14, %4
%18 = phi i32 [ 1, %4 ], [ 1, %12 ], [ 0, %14 ]
ret i32 %18
}