#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*/ insertion(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int main(void) {
  int array[100];
  int n, items, nbval = 0;
  do {
    printf("Entrer un entier: ");
    items = scanf("%d", &n);
    if (items == 1 && n >= 0) {
      insertion(array, nbval++, n);
      print_array(array, nbval);
    }
  } while (items == 1 && n >= 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1ac(%rbp)
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1060 <scanf@plt>
mov    %eax,-0x1a8(%rbp)
cmpl   $0x1,-0x1a8(%rbp)
jne    11d0 <main+0x90>
cmpl   $0x0,-0x1a4(%rbp)
jl     11d0 <main+0x90>
lea    -0x1a0(%rbp),%rdi
mov    -0x1ac(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
mov    -0x1a4(%rbp),%edx
call   1050 <insertion@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1ac(%rbp),%esi
call   1030 <print_array@plt>
jmp    11d5 <main+0x95>
xor    %eax,%eax
cmpl   $0x1,-0x1a8(%rbp)
mov    %al,-0x1ad(%rbp)
jne    11fa <main+0xba>
cmpl   $0x0,-0x1a4(%rbp)
setge  %al
mov    %al,-0x1ad(%rbp)
mov    -0x1ad(%rbp),%al
test   $0x1,%al
jne    115c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
xor    %r15d,%r15d
lea    0xea5(%rip),%rbx
lea    0xeb1(%rip),%r14
lea    0xc(%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
mov    %eax,%ebp
mov    0xc(%rsp),%edx
cmp    $0x1,%eax
jne    11be <main+0x7e>
test   %edx,%edx
js     11be <main+0x7e>
mov    %r14,%r12
lea    0x1(%r15),%r14d
mov    %r15,%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdi
call   1050 <insertion@plt>
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <print_array@plt>
mov    0xc(%rsp),%edx
mov    %r14d,%r15d
mov    %r12,%r14
cmp    $0x1,%ebp
jne    11c7 <main+0x87>
test   %edx,%edx
jns    1170 <main+0x30>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Entrer un entier: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %30, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %23
11: ; preds = %6
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
%18 = load i32, i32* %3
%19 = call i32 @insertion(i32* %15, i32 %16, i32 %18)
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%21 = load i32, i32* %5
%22 = call i32 @print_array(i32* %20, i32 %21)
br label %23
23: ; preds = %14, %11, %6
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp sge i32 %28, 0
br label %30
30: ; preds = %27, %24
%31 = phi i1 [ false, %24 ], [ %29, %27 ]
br i1 %31, label %6, label %32
32: ; preds = %30
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [19 x i8] c"Entrer un entier: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
br label %6
6: ; preds = %19, %0
%7 = phi i32 [ 0, %0 ], [ %21, %19 ]
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = icmp eq i32 %9, 1
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, -1
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %14, label %19
14: ; preds = %6
%15 = add nsw i32 %7, 1
%16 = call i32 @insertion(i32* %5, i32 %7, i32 %11)
%17 = call i32 @print_array(i32* %5, i32 %15)
%18 = load i32, i32* %2
br label %19
19: ; preds = %6, %14
%20 = phi i32 [ %18, %14 ], [ %11, %6 ]
%21 = phi i32 [ %15, %14 ], [ %7, %6 ]
%22 = icmp sgt i32 %20, -1
%23 = select i1 %10, i1 %22, i1 false
br i1 %23, label %6, label %24
24: ; preds = %19
ret i32 0
}