#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 *, double);
int main(void) {
  double vecA[102400], vecB[102400], vecC[102400];
  double sum;
  int i;
  for (i = 0; i < 102400; i++) {
    vecA[i] = 1.0 / ((double)(102400 - i));
    vecB[i] = vecA[i] * vecA[i];
  }
  sum = 0.0;
  for (i = 0; i < 102400; i++) {
    sum += vecC[i];
  }
  printf("Reduction sum: %18.16f\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x258020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x25801c(%rbp)
cmpl   $0x19000,-0x25801c(%rbp)
jge    11ab <main+0x9b>
mov    $0x19000,%eax
sub    -0x25801c(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xead(%rip),%xmm0
divsd  %xmm1,%xmm0
movslq -0x25801c(%rbp),%rax
movsd  %xmm0,-0xc8010(%rbp,%rax,8)
f3 ff
movslq -0x25801c(%rbp),%rax
movsd  -0xc8010(%rbp,%rax,8),%xmm0
f3 ff
movslq -0x25801c(%rbp),%rax
mulsd  -0xc8010(%rbp,%rax,8),%xmm0
f3 ff
movslq -0x25801c(%rbp),%rax
movsd  %xmm0,-0x190010(%rbp,%rax,8)
e6 ff
mov    -0x25801c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25801c(%rbp)
jmp    112c <main+0x1c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x258018(%rbp)
ff
movl   $0x0,-0x25801c(%rbp)
cmpl   $0x19000,-0x25801c(%rbp)
jge    1204 <main+0xf4>
movslq -0x25801c(%rbp),%rax
movsd  -0x258010(%rbp,%rax,8),%xmm0
da ff
addsd  -0x258018(%rbp),%xmm0
ff
movsd  %xmm0,-0x258018(%rbp)
ff
mov    -0x25801c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25801c(%rbp)
jmp    11c0 <main+0xb0>
movsd  -0x258018(%rbp),%xmm0
ff
lea    0xdf5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x258020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc8008,%rsp
xorpd  %xmm0,%xmm0
mov    $0x7,%eax
addsd  -0x38(%rsp,%rax,8),%xmm0
addsd  -0x30(%rsp,%rax,8),%xmm0
addsd  -0x28(%rsp,%rax,8),%xmm0
addsd  -0x20(%rsp,%rax,8),%xmm0
addsd  -0x18(%rsp,%rax,8),%xmm0
addsd  -0x10(%rsp,%rax,8),%xmm0
addsd  -0x8(%rsp,%rax,8),%xmm0
addsd  (%rsp,%rax,8),%xmm0
add    $0x8,%rax
cmp    $0x19007,%rax
jne    1120 <main+0x10>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc8008,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Reduction sum: %18.16f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [102400 x double]
%3 = alloca [102400 x double]
%4 = alloca [102400 x double]
%5 = alloca double
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
br label %7
7: ; preds = %30, %0
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 102400
br i1 %9, label %10, label %33
10: ; preds = %7
%11 = load i32, i32* %6
%12 = sub nsw i32 102400, %11
%13 = sitofp i32 %12 to double
%14 = fdiv double 1.000000e+00, %13
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %16
store double %14, double* %17
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %19
%21 = load double, double* %20
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %23
%25 = load double, double* %24
%26 = fmul double %21, %25
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %28
store double %26, double* %29
br label %30
30: ; preds = %10
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %7
33: ; preds = %7
store double 0.000000e+00, double* %5
store i32 0, i32* %6
br label %34
34: ; preds = %44, %33
%35 = load i32, i32* %6
%36 = icmp slt i32 %35, 102400
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [102400 x double], [102400 x double]* %4, i64 0, i64 %39
%41 = load double, double* %40
%42 = load double, double* %5
%43 = fadd double %42, %41
store double %43, double* %5
br label %44
44: ; preds = %37
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %34
47: ; preds = %34
%48 = load double, double* %5
%49 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Reduction sum: %18.16f\0A\00"
define i32 @main() {
%1 = alloca [102400 x double]
%2 = bitcast [102400 x double]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %37, %3 ]
%5 = phi double [ 0.000000e+00, %0 ], [ %36, %3 ]
%6 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %4
%7 = load double, double* %6
%8 = fadd double %5, %7
%9 = or i64 %4, 1
%10 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %9
%11 = load double, double* %10
%12 = fadd double %8, %11
%13 = or i64 %4, 2
%14 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %13
%15 = load double, double* %14
%16 = fadd double %12, %15
%17 = or i64 %4, 3
%18 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %17
%19 = load double, double* %18
%20 = fadd double %16, %19
%21 = or i64 %4, 4
%22 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %21
%23 = load double, double* %22
%24 = fadd double %20, %23
%25 = or i64 %4, 5
%26 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %25
%27 = load double, double* %26
%28 = fadd double %24, %27
%29 = or i64 %4, 6
%30 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %29
%31 = load double, double* %30
%32 = fadd double %28, %31
%33 = or i64 %4, 7
%34 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %33
%35 = load double, double* %34
%36 = fadd double %32, %35
%37 = add nuw nsw i64 %4, 8
%38 = icmp eq i64 %37, 102400
br i1 %38, label %39, label %3
39: ; preds = %3
%40 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %36)
ret i32 0
}