#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 *create_tab(int *, unsigned int);
int /*<<< orphan*/ handle_prompt_error(int, int *);
int prompt_value(char *, int *);
int *prompt_array(int array[], unsigned *size) {
  int errno = prompt_value("Taille du tableau?", (int *)size);
  array = create_tab(array, *size);
  for (unsigned i = 0; i < *size; i++) {
    errno += prompt_value("Valeur?", &array[i]);
    handle_prompt_error(errno, array);
  }
  return array;
}


x86 assembly (clang, -O0):
<prompt_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1050 <prompt_value@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1040 <create_tab@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jae    11b6 <prompt_array+0x86>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%eax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe82(%rip),%rdi
call   1050 <prompt_value@plt>
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <handle_prompt_error@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116d <prompt_array+0x3d>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeb8(%rip),%rdi
call   1050 <prompt_value@plt>
mov    %eax,%r13d
mov    (%r14),%esi
mov    %rbx,%rdi
call   1040 <create_tab@plt>
mov    %rax,%r12
cmpl   $0x0,(%r14)
je     1199 <prompt_array+0x69>
xor    %ebp,%ebp
lea    0xea6(%rip),%r15
mov    %r12,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <prompt_value@plt>
add    %eax,%r13d
mov    %r13d,%edi
mov    %r12,%rsi
call   1030 <handle_prompt_error@plt>
add    $0x1,%rbp
mov    (%r14),%eax
add    $0x4,%rbx
cmp    %rax,%rbp
jb     1170 <prompt_array+0x40>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Taille du tableau?\00"
@.str.1 = [8 x i8] c"Valeur?\00"
define i32* @prompt_array(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = call i32 @prompt_value(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32* %7)
store i32 %8, i32* %5
%9 = load i32*, i32** %3
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = call i32* @create_tab(i32* %9, i32 %11)
store i32* %12, i32** %3
store i32 0, i32* %6
br label %13
13: ; preds = %29, %2
%14 = load i32, i32* %6
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = icmp ult i32 %14, %16
br i1 %17, label %18, label %32
18: ; preds = %13
%19 = load i32*, i32** %3
%20 = load i32, i32* %6
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = call i32 @prompt_value(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %5
%25 = add nsw i32 %24, %23
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = load i32*, i32** %3
%28 = call i32 @handle_prompt_error(i32 %26, i32* %27)
br label %29
29: ; preds = %18
%30 = load i32, i32* %6
%31 = add i32 %30, 1
store i32 %31, i32* %6
br label %13
32: ; preds = %13
%33 = load i32*, i32** %3
ret i32* %33
}

LLVM IR (-O2):
@.str = [19 x i8] c"Taille du tableau?\00"
@.str.1 = [8 x i8] c"Valeur?\00"
define i32* @prompt_array(i32* %0, i32* %1) {
%3 = tail call i32 @prompt_value(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = tail call i32* @create_tab(i32* %0, i32 %4)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %9, %2
ret i32* %5
9: ; preds = %2, %9
%10 = phi i64 [ %16, %9 ], [ 0, %2 ]
%11 = phi i32 [ %14, %9 ], [ %3, %2 ]
%12 = getelementptr inbounds i32, i32* %5, i64 %10
%13 = tail call i32 @prompt_value(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = add nsw i32 %13, %11
%15 = tail call i32 @handle_prompt_error(i32 %14, i32* %5)
%16 = add nuw nsw i64 %10, 1
%17 = load i32, i32* %1
%18 = zext i32 %17 to i64
%19 = icmp ult i64 %16, %18
br i1 %19, label %9, label %8
}