#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, double);
scalar_t__ scanf(char *, double *);
int main(int argc, char **argv) {
  double array[20];
  int j = 0;
  while (scanf("%lf", &array[j]) != EOF) {
    j++;
  }
  int k = 0;
  double sum, sqrsum, cubsum = 0;
  for (k = 0; k < j; k++) {
    sum = sum + array[k];
    sqrsum = sqrsum + (array[k] * array[k]);
    cubsum = cubsum + (array[k] * array[k] * array[k]);
  }
  printf("The sum of the inputed numbers is: %f\n", sum);
  printf("The sum of the inputed numbers squared is: %f\n", sqrsum);
  printf("The sum of the inputed numbers cubed is: %f\n", cubsum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xb4(%rbp)
movslq -0xb4(%rbp),%rax
lea    -0xb0(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xea1(%rip),%rdi
call   1040 <scanf@plt>
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%rax
je     1188 <main+0x68>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1143 <main+0x23>
movl   $0x0,-0xb8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    126d <main+0x14d>
movsd  -0xc0(%rbp),%xmm0
ff
movslq -0xb8(%rbp),%rax
addsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc8(%rbp),%xmm1
ff
movslq -0xb8(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movslq -0xb8(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm1
ff
movslq -0xb8(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movslq -0xb8(%rbp),%rax
mulsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movslq -0xb8(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    11a7 <main+0x87>
movsd  -0xc0(%rbp),%xmm0
ff
lea    0xd88(%rip),%rdi
call   1030 <printf@plt>
movsd  -0xc8(%rbp),%xmm0
ff
lea    0xd9b(%rip),%rdi
call   1030 <printf@plt>
movsd  -0xd0(%rbp),%xmm0
ff
lea    0xdb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    $0xffffffffffffffff,%r15
lea    0x10(%rsp),%rbx
lea    0xebf(%rip),%r14
mov    0x2ea0(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%r15
add    $0x8,%rbx
cmp    (%r12),%rax
jne    1150 <main+0x30>
cmp    $0x1,%r15d
jne    1177 <main+0x57>
xorpd  %xmm4,%xmm4
xor    %eax,%eax
jmp    11e1 <main+0xc1>
mov    %r15d,%ecx
mov    %r15d,%eax
and    $0x1,%eax
sub    %rax,%rcx
xorpd  %xmm1,%xmm1
xor    %eax,%eax
nopl   0x0(%rax)
movsd  0x10(%rsp,%rax,8),%xmm2
movsd  0x18(%rsp,%rax,8),%xmm4
addsd  %xmm2,%xmm0
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
unpcklpd %xmm2,%xmm3
unpcklpd %xmm2,%xmm2
mulpd  %xmm3,%xmm2
addpd  %xmm1,%xmm2
addsd  %xmm4,%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
unpcklpd %xmm4,%xmm1
unpcklpd %xmm4,%xmm4
mulpd  %xmm1,%xmm4
addpd  %xmm2,%xmm4
add    $0x2,%rax
movapd %xmm4,%xmm1
cmp    %rax,%rcx
jne    1190 <main+0x70>
test   $0x1,%r15b
je     1209 <main+0xe9>
movsd  0x10(%rsp,%rax,8),%xmm1
addsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
unpcklpd %xmm1,%xmm2
unpcklpd %xmm1,%xmm1
mulpd  %xmm2,%xmm1
addpd  %xmm1,%xmm4
movapd %xmm4,(%rsp)
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
lea    0xe26(%rip),%rdi
movaps (%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [39 x i8] c"The sum of the inputed numbers is: %f\0A\00"
@.str.2 = [47 x i8] c"The sum of the inputed numbers squared is: %f\0A\00"
@.str.3 = [45 x i8] c"The sum of the inputed numbers cubed is: %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x double]
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %12
12: ; preds = %19, %2
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 %14
%16 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %15)
%17 = load i64, i64* @EOF
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %12
22: ; preds = %12
store i32 0, i32* %8
store double 0.000000e+00, double* %11
store i32 0, i32* %8
br label %23
23: ; preds = %59, %22
%24 = load i32, i32* %8
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %62
27: ; preds = %23
%28 = load double, double* %9
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 %30
%32 = load double, double* %31
%33 = fadd double %28, %32
store double %33, double* %9
%34 = load double, double* %10
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 %36
%38 = load double, double* %37
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 %40
%42 = load double, double* %41
%43 = call double @llvm.fmuladd.f64(double %38, double %42, double %34)
store double %43, double* %10
%44 = load double, double* %11
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 %46
%48 = load double, double* %47
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 %50
%52 = load double, double* %51
%53 = fmul double %48, %52
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 %55
%57 = load double, double* %56
%58 = call double @llvm.fmuladd.f64(double %53, double %57, double %44)
store double %58, double* %11
br label %59
59: ; preds = %27
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %23
62: ; preds = %23
%63 = load double, double* %9
%64 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), double %63)
%65 = load double, double* %10
%66 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), double %65)
%67 = load double, double* %11
%68 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), double %67)
%69 = load i32, i32* %3
ret i32 %69
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [39 x i8] c"The sum of the inputed numbers is: %f\0A\00"
@.str.2 = [47 x i8] c"The sum of the inputed numbers squared is: %f\0A\00"
@.str.3 = [45 x i8] c"The sum of the inputed numbers cubed is: %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x double]
%4 = bitcast [20 x double]* %3 to i8*
br label %5
5: ; preds = %5, %2
%6 = phi i64 [ %11, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds [20 x double], [20 x double]* %3, i64 0, i64 %6
%8 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
%9 = load i64, i64* @EOF
%10 = icmp eq i64 %8, %9
%11 = add nuw i64 %6, 1
br i1 %10, label %12, label %5
12: ; preds = %5
%13 = trunc i64 %6 to i32
%14 = icmp ne i32 %13, 0
%15 = and i64 %6, 4294967295
%16 = and i64 %6, 1
%17 = icmp eq i64 %15, 1
br i1 %17, label %47, label %18
18: ; preds = %12
%19 = sub nsw i64 %15, %16
br label %20
20: ; preds = %20, %18
%21 = phi i64 [ 0, %18 ], [ %44, %20 ]
%22 = phi double [ undef, %18 ], [ %37, %20 ]
%23 = phi <2 x double> [ <double 0.000000e+00, double undef>, %18 ], [ %43, %20 ]
%24 = phi i64 [ 0, %18 ], [ %45, %20 ]
%25 = getelementptr inbounds [20 x double], [20 x double]* %3, i64 0, i64 %21
%26 = load double, double* %25
%27 = fadd double %22, %26
%28 = fmul double %26, %26
%29 = insertelement <2 x double> poison, double %28, i64 0
%30 = insertelement <2 x double> %29, double %26, i64 1
%31 = insertelement <2 x double> poison, double %26, i64 0
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
%33 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> %32, <2 x double> %23)
%34 = or i64 %21, 1
%35 = getelementptr inbounds [20 x double], [20 x double]* %3, i64 0, i64 %34
%36 = load double, double* %35
%37 = fadd double %27, %36
%38 = fmul double %36, %36
%39 = insertelement <2 x double> poison, double %38, i64 0
%40 = insertelement <2 x double> %39, double %36, i64 1
%41 = insertelement <2 x double> poison, double %36, i64 0
%42 = shufflevector <2 x double> %41, <2 x double> poison, <2 x i32> zeroinitializer
%43 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %40, <2 x double> %42, <2 x double> %33)
%44 = add nuw nsw i64 %21, 2
%45 = add i64 %24, 2
%46 = icmp eq i64 %45, %19
br i1 %46, label %47, label %20
47: ; preds = %20, %12
%48 = phi <2 x double> [ undef, %12 ], [ %43, %20 ]
%49 = phi i64 [ 0, %12 ], [ %44, %20 ]
%50 = phi double [ undef, %12 ], [ %37, %20 ]
%51 = phi <2 x double> [ <double 0.000000e+00, double undef>, %12 ], [ %43, %20 ]
%52 = icmp eq i64 %16, 0
br i1 %52, label %63, label %53
53: ; preds = %47
%54 = getelementptr inbounds [20 x double], [20 x double]* %3, i64 0, i64 %49
%55 = load double, double* %54
%56 = fadd double %50, %55
%57 = fmul double %55, %55
%58 = insertelement <2 x double> poison, double %57, i64 0
%59 = insertelement <2 x double> %58, double %55, i64 1
%60 = insertelement <2 x double> poison, double %55, i64 0
%61 = shufflevector <2 x double> %60, <2 x double> poison, <2 x i32> zeroinitializer
%62 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %59, <2 x double> %61, <2 x double> %51)
br label %63
63: ; preds = %47, %53
%64 = phi double [ %50, %47 ], [ %56, %53 ]
%65 = phi <2 x double> [ %48, %47 ], [ %62, %53 ]
%66 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), double %64)
%67 = extractelement <2 x double> %65, i64 1
%68 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), double %67)
%69 = extractelement <2 x double> %65, i64 0
%70 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), double %69)
ret i32 0
}