#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);
int /*<<< orphan*/ scanf(char *, double *);
void lee_vector(double *v, int tam) {
  int i;
  for (i = 0; i < tam; i++) {
    printf("\nDar el elemento [%d] = ", i + 1);
    scanf("%lf", &v[i]);
  }
}


x86 assembly (clang, -O0):
<lee_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117d <lee_vector+0x5d>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xeaf(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <lee_vector+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lee_vector>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %esi,%esi
jle    1172 <lee_vector+0x52>
mov    %rdi,%r14
mov    %esi,%r13d
xor    %ebx,%ebx
lea    0xec4(%rip),%r15
lea    0xed6(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
add    $0x8,%r14
cmp    %rbx,%r13
jne    1150 <lee_vector+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0ADar el elemento [%d] = \00"
@.str.1 = [4 x i8] c"%lf\00"
define void @lee_vector(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
%13 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load double*, double** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0ADar el elemento [%d] = \00"
@.str.1 = [4 x i8] c"%lf\00"
define void @lee_vector(double* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %8, %6 ]
%8 = add nuw nsw i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds double, double* %0, i64 %7
%12 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %11)
%13 = icmp eq i64 %8, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}