#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 factorielle_iteractive(int);
int factorielle_recursive(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n;
  do {
    printf("Entrez un nombre entier (0 pour terminer):");
    scanf("%d", &n);
    printf("factorielle_iteractive(%2d) = %15d\n", n,
           factorielle_iteractive(n));
    printf("factorielle_recursive(%2d) = %15d\n", n, factorielle_recursive(n));
  } while (n != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <factorielle_iteractive@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <factorielle_recursive@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    114f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%r14
lea    0xed2(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xec9(%rip),%r13
lea    0xee6(%rip),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebp
mov    %ebp,%edi
call   1040 <factorielle_iteractive@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%ebp
mov    %ebp,%edi
call   1060 <factorielle_recursive@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jne    1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Entrez un nombre entier (0 pour terminer):\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"factorielle_iteractive(%2d) = %15d\0A\00"
@.str.3 = [35 x i8] c"factorielle_recursive(%2d) = %15d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %14, %0
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @factorielle_iteractive(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %8)
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @factorielle_recursive(i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %12)
br label %14
14: ; preds = %3
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 0
br i1 %16, label %3, label %17
17: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Entrez un nombre entier (0 pour terminer):\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"factorielle_iteractive(%2d) = %15d\0A\00"
@.str.3 = [35 x i8] c"factorielle_recursive(%2d) = %15d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 @factorielle_iteractive(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @factorielle_recursive(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %10)
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %3
14: ; preds = %3
ret i32 0
}