#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 *, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float input[10];
  float sum = 0;
  for (int i = 0; i < 10; ++i) {
    printf("Please insert a value number %i: ", i + 1);
    scanf("%f", &(input[i]));
  }
  for (int i = 0; i < 10; ++i) {
    sum += input[i];
  }
  printf("The sum is %f\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    1187 <main+0x67>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
movslq -0x38(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeae(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    113e <main+0x1e>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    11ba <main+0x9a>
movslq -0x3c(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
addss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    118e <main+0x6e>
movss  -0x34(%rbp),%xmm0
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xefa(%rip),%r14
movss  0xeca(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0xf05(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xeac(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe93(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe7a(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe61(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe48(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe2f(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xe16(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xdfd(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xde4(%rip),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
addss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
addss  0x20(%rsp),%xmm0
addss  0x24(%rsp),%xmm0
lea    0xdb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Please insert a value number %i: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [15 x i8] c"The sum is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store i32 0, i32* %4
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
%12 = sitofp i32 %11 to float
%13 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float %12)
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %16)
br label %18
18: ; preds = %9
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %6
21: ; preds = %6
store i32 0, i32* %5
br label %22
22: ; preds = %32, %21
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %35
25: ; preds = %22
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %27
%29 = load float, float* %28
%30 = load float, float* %3
%31 = fadd float %30, %29
store float %31, float* %3
br label %32
32: ; preds = %25
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %22
35: ; preds = %22
%36 = load float, float* %3
%37 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), float %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Please insert a value number %i: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [15 x i8] c"The sum is %f\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = bitcast [10 x float]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 1.000000e+00)
%4 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 2.000000e+00)
%7 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 3.000000e+00)
%10 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 4.000000e+00)
%13 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 5.000000e+00)
%16 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 6.000000e+00)
%19 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 5
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 7.000000e+00)
%22 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 6
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 8.000000e+00)
%25 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 7
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 9.000000e+00)
%28 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 8
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 1.000000e+01)
%31 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 9
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %31)
%33 = load float, float* %4
%34 = fadd float %33, 0.000000e+00
%35 = load float, float* %7
%36 = fadd float %34, %35
%37 = load float, float* %10
%38 = fadd float %36, %37
%39 = load float, float* %13
%40 = fadd float %38, %39
%41 = load float, float* %16
%42 = fadd float %40, %41
%43 = load float, float* %19
%44 = fadd float %42, %43
%45 = load float, float* %22
%46 = fadd float %44, %45
%47 = load float, float* %25
%48 = fadd float %46, %47
%49 = load float, float* %28
%50 = fadd float %48, %49
%51 = load float, float* %31
%52 = fadd float %50, %51
%53 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), float %52)
ret i32 0
}