#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*/ binaire_bit_a_bit(unsigned int);
int /*<<< orphan*/ binaire_iteratif(unsigned int);
int /*<<< orphan*/ binaire_rec(unsigned int);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, unsigned int *);
int main(void) {
  unsigned int n;
  while (scanf("%ud", &n) > 0) {
    printf("version récursive: ");
    binaire_rec(n);
    printf("\n");
    printf("version itérative: ");
    binaire_iteratif(n);
    printf("\n");
    printf("version bit à bit: ");
    binaire_bit_a_bit(n);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x0,%rax
jle    11de <main+0x8e>
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <binaire_rec@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <binaire_iteratif@plt>
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1070 <binaire_bit_a_bit@plt>
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
jmp    115f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe8c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
test   %rax,%rax
jle    1211 <main+0xb1>
lea    0xe76(%rip),%r14
lea    0xe84(%rip),%r15
lea    0xe92(%rip),%r12
lea    0xe5d(%rip),%r13
lea    0xc(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    0xc(%rsp),%edi
call   1060 <binaire_rec@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    0xc(%rsp),%edi
call   1040 <binaire_iteratif@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    0xc(%rsp),%edi
call   1080 <binaire_bit_a_bit@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
test   %rax,%rax
jg     11b0 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ud\00"
@.str.1 = [21 x i8] c"version r\C3\A9cursive: \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [21 x i8] c"version it\C3\A9rative: \00"
@.str.4 = [21 x i8] c"version bit \C3\A0 bit: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %6, %0
%4 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = call i32 @binaire_rec(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 @binaire_iteratif(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = call i32 @binaire_bit_a_bit(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %3
19: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ud\00"
@.str.1 = [21 x i8] c"version r\C3\A9cursive: \00"
@.str.3 = [21 x i8] c"version it\C3\A9rative: \00"
@.str.4 = [21 x i8] c"version bit \C3\A0 bit: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %20
5: ; preds = %0, %5
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %1
%8 = call i32 @binaire_rec(i32 %7)
%9 = call i32 @putchar(i32 10)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = call i32 @binaire_iteratif(i32 %11)
%13 = call i32 @putchar(i32 10)
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = call i32 @binaire_bit_a_bit(i32 %15)
%17 = call i32 @putchar(i32 10)
%18 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %5, label %20
20: ; preds = %5, %0
ret i32 0
}