#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, float *);
void LerArray(int numElementos, float *elemArray) {
  for (int i = 0; i < numElementos; i++) {
    float num;
    printf("Digite um numero para seu array:  ");
    scanf("%f", &num);
    *(elemArray + i) = num;
    printf("\n\n");
  }
}


x86 assembly (clang, -O0):
<LerArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118a <LerArray+0x6a>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <LerArray+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LerArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1194 <LerArray+0x64>
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
lea    0xed5(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xecc(%rip),%r13
nopw   0x0(%rax,%rax,1)
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  %xmm0,(%rbx,%r14,4)
mov    %r13,%rdi
call   1030 <puts@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1160 <LerArray+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Digite um numero para seu array: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define void @LerArray(i32 %0, float* %1) {
%3 = alloca i32
%4 = alloca float*
%5 = alloca i32
%6 = alloca float
store i32 %0, i32* %3
store float* %1, float** %4
store i32 0, i32* %5
br label %7
7: ; preds = %20, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%14 = load float, float* %6
%15 = load float*, float** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds float, float* %15, i64 %17
store float %14, float* %18
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %11
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %7
23: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"Digite um numero para seu array: \00"
@.str.1 = [3 x i8] c"%f\00"
@str = [2 x i8] c"\0A\00"
define void @LerArray(i32 %0, float* nocapture writeonly %1) {
%3 = alloca float
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = bitcast float* %3 to i8*
%7 = zext i32 %0 to i64
br label %9
8: ; preds = %9, %2
ret void
9: ; preds = %5, %9
%10 = phi i64 [ 0, %5 ], [ %16, %9 ]
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = load float, float* %3
%14 = getelementptr inbounds float, float* %1, i64 %10
store float %13, float* %14
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %7
br i1 %17, label %8, label %9
}