#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*/ LerArray(int, float *);
int /*<<< orphan*/ free(float *);
float *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int numElementos;
  printf("Oi !!!  Quantos elementos vc quer armazenar: ");
  scanf("%d", &numElementos);
  system("clear");
  float *vetorNum;
  vetorNum = malloc(numElementos * sizeof(float));
  if (vetorNum == NULL) {
    printf(
        "Erro na alocação, talvez funcione um um número de elementos menor ");
    return 1;
  }
  LerArray(numElementos, vetorNum);
  free(vetorNum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1060 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
lea    0xe9f(%rip),%rdi
call   1050 <system@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11cd <main+0x6d>
lea    0xe7b(%rip),%rdi
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <main+0x82>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <LerArray@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%rdi
call   1060 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
lea    0xea9(%rip),%rdi
call   1050 <system@plt>
mov    0x4(%rsp),%r14d
lea    0x0(,%r14,4),%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     11be <main+0x5e>
mov    %rax,%rbx
mov    %r14d,%edi
mov    %rax,%rsi
call   1040 <LerArray@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    11cf <main+0x6f>
lea    0xe72(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Oi !!! Quantos elementos vc quer armazenar: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [70 x i8] c"Erro na aloca\C3\A7\C3\A3o, talvez funcione um um n\C3\BAmero de elementos menor \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float*
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 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 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 4
%10 = trunc i64 %9 to i32
%11 = call float* @malloc(i32 %10)
store float* %11, float** %3
%12 = load float*, float** %3
%13 = icmp eq float* %12, null
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %22
16: ; preds = %0
%17 = load i32, i32* %2
%18 = load float*, float** %3
%19 = call i32 @LerArray(i32 %17, float* %18)
%20 = load float*, float** %3
%21 = call i32 @free(float* %20)
br label %22
22: ; preds = %16, %14
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [46 x i8] c"Oi !!! Quantos elementos vc quer armazenar: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [70 x i8] c"Erro na aloca\C3\A7\C3\A3o, talvez funcione um um n\C3\BAmero de elementos menor \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = shl i32 %6, 2
%8 = call float* @malloc(i32 %7)
%9 = icmp eq float* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
br label %15
12: ; preds = %0
%13 = call i32 @LerArray(i32 %6, float* %8)
%14 = call i32 @free(float* %8)
br label %15
15: ; preds = %12, %10
%16 = phi i32 [ 1, %10 ], [ 0, %12 ]
ret i32 %16
}