#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*/ imprimir_vetor(float *, int);
int /*<<< orphan*/ preencher_vetor(float *, int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int *);
double somatorio_vetor(float *, int);
int main() {
  float v[15];
  int n;
  do {
    scanf("%d", &n);
  } while (n <= 0 || n > 15);
  preencher_vetor(v, n);
  imprimir_vetor(v, n);
  printf("%f\n", somatorio_vetor(v, n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x44(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x44(%rbp)
mov    %al,-0x45(%rbp)
jle    1188 <main+0x38>
cmpl   $0xf,-0x44(%rbp)
setg   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    115f <main+0xf>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1050 <preencher_vetor@plt>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1060 <imprimir_vetor@plt>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <somatorio_vetor@plt>
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xea2(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
lea    -0x10(%rsi),%eax
cmp    $0xfffffff1,%eax
jb     1170 <main+0x20>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <preencher_vetor@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <imprimir_vetor@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <somatorio_vetor@plt>
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x float]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %12, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %6
6: ; preds = %4
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 15
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ true, %6 ], [ %11, %9 ]
br i1 %13, label %4, label %14
14: ; preds = %12
%15 = getelementptr inbounds [15 x float], [15 x float]* %2, i64 0, i64 0
%16 = load i32, i32* %3
%17 = call i32 @preencher_vetor(float* %15, i32 %16)
%18 = getelementptr inbounds [15 x float], [15 x float]* %2, i64 0, i64 0
%19 = load i32, i32* %3
%20 = call i32 @imprimir_vetor(float* %18, i32 %19)
%21 = getelementptr inbounds [15 x float], [15 x float]* %2, i64 0, i64 0
%22 = load i32, i32* %3
%23 = call double @somatorio_vetor(float* %21, i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca [15 x float]
%2 = alloca i32
%3 = bitcast [15 x float]* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = add i32 %7, -16
%9 = icmp ult i32 %8, -15
br i1 %9, label %5, label %10
10: ; preds = %5
%11 = getelementptr inbounds [15 x float], [15 x float]* %1, i64 0, i64 0
%12 = call i32 @preencher_vetor(float* %11, i32 %7)
%13 = load i32, i32* %2
%14 = call i32 @imprimir_vetor(float* %11, i32 %13)
%15 = load i32, i32* %2
%16 = call double @somatorio_vetor(float* %11, i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %16)
ret i32 0
}