#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 *, double *);
int main(void) {
  double num1[8], num2[8] = {0};
  int i;
  printf("Please enter 8 values:\n");
  scanf("%lf", &num1[0]);
  num2[0] = num1[0];
  for (i = 1; i < 8; i++) {
    scanf("%lf", &num1[i]);
    num2[i] = num2[i - 1] + num1[i];
  }
  for (i = 0; i < 8; i++)
    printf("%6.3f ", num1[i]);
  printf("\n");
  for (i = 0; i < 8; i++)
    printf("%6.3f ", num2[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1050 <scanf@plt>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x1,-0x94(%rbp)
cmpl   $0x8,-0x94(%rbp)
jge    11fa <main+0xca>
movslq -0x94(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe68(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x94(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movslq -0x94(%rbp),%rax
addsd  -0x50(%rbp,%rax,8),%xmm0
movslq -0x94(%rbp),%rax
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    118a <main+0x5a>
movl   $0x0,-0x94(%rbp)
cmpl   $0x8,-0x94(%rbp)
jge    1240 <main+0x110>
movslq -0x94(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
lea    0xdf7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1204 <main+0xd4>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x8,-0x94(%rbp)
jge    1297 <main+0x167>
movslq -0x94(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
lea    0xda0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1258 <main+0x128>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
lea    0xea5(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,0x70(%rsp)
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x70(%rsp),%xmm0
movsd  %xmm0,0x68(%rsp)
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x60(%rsp)
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x18(%rsp),%xmm0
addsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp)
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x20(%rsp),%xmm0
addsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x28(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x30(%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x38(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x78(%rsp)
movsd  (%rsp),%xmm0
lea    0xdae(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
movsd  0x70(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0x68(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0x60(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0x58(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0x50(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0x48(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0x40(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0x78(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Please enter 8 values:\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%6.3f \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x double]
%3 = alloca [8 x double]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x double]* %3 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %7)
%9 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%10 = load double, double* %9
%11 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
store double %10, double* %11
store i32 1, i32* %4
br label %12
12: ; preds = %33, %0
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %36
15: ; preds = %12
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %18)
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 %22
%24 = load double, double* %23
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 %26
%28 = load double, double* %27
%29 = fadd double %24, %28
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 %31
store double %29, double* %32
br label %33
33: ; preds = %15
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %12
36: ; preds = %12
store i32 0, i32* %4
br label %37
37: ; preds = %46, %36
%38 = load i32, i32* %4
%39 = icmp slt i32 %38, 8
br i1 %39, label %40, label %49
40: ; preds = %37
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 %42
%44 = load double, double* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %44)
br label %46
46: ; preds = %40
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %37
49: ; preds = %37
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %51
51: ; preds = %60, %49
%52 = load i32, i32* %4
%53 = icmp slt i32 %52, 8
br i1 %53, label %54, label %63
54: ; preds = %51
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 %56
%58 = load double, double* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %58)
br label %60
60: ; preds = %54
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %51
63: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%6.3f \00"
@str = [23 x i8] c"Please enter 8 values:\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%6 = load double, double* %4
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %7)
%9 = load double, double* %7
%10 = fadd double %6, %9
%11 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 2
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %11)
%13 = load double, double* %11
%14 = fadd double %10, %13
%15 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 3
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %15)
%17 = load double, double* %15
%18 = fadd double %14, %17
%19 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 4
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %19)
%21 = load double, double* %19
%22 = fadd double %18, %21
%23 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 5
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %23)
%25 = load double, double* %23
%26 = fadd double %22, %25
%27 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 6
%28 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %27)
%29 = load double, double* %27
%30 = fadd double %26, %29
%31 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 7
%32 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %31)
%33 = load double, double* %31
%34 = fadd double %30, %33
%35 = load double, double* %4
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %35)
%37 = load double, double* %7
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %37)
%39 = load double, double* %11
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %39)
%41 = load double, double* %15
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %41)
%43 = load double, double* %19
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %43)
%45 = load double, double* %23
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %45)
%47 = load double, double* %27
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %47)
%49 = load double, double* %31
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %49)
%51 = call i32 @putchar(i32 10)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %6)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %10)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %14)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %18)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %22)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %26)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %30)
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %34)
ret i32 0
}