#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];
  }
#pragma acc kernels
  for (i = 0; i < 102400; i++) {
    vecC[i] = vecA[i] * vecB[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>
movl   $0x0,-0x25801c(%rbp)
cmpl   $0x19000,-0x25801c(%rbp)
jge    1209 <main+0xf9>
movslq -0x25801c(%rbp),%rax
movsd  -0xc8010(%rbp,%rax,8),%xmm0
f3 ff
movslq -0x25801c(%rbp),%rax
mulsd  -0x190010(%rbp,%rax,8),%xmm0
e6 ff
movslq -0x25801c(%rbp),%rax
movsd  %xmm0,-0x258010(%rbp,%rax,8)
da ff
mov    -0x25801c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25801c(%rbp)
jmp    11b5 <main+0xa5>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x258018(%rbp)
ff
movl   $0x0,-0x25801c(%rbp)
cmpl   $0x19000,-0x25801c(%rbp)
jge    1262 <main+0x152>
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    121e <main+0x10e>
movsd  -0x258018(%rbp),%xmm0
ff
lea    0xd97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x258020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x258008,%rsp
movdqa 0xee1(%rip),%xmm0
mov    $0x2,%eax
movdqa 0xee4(%rip),%xmm1
movapd 0xeec(%rip),%xmm2
movdqa 0xef4(%rip),%xmm3
movdqa 0xefc(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm1,%xmm5
psubd  %xmm0,%xmm5
cvtdq2pd %xmm5,%xmm5
movapd %xmm2,%xmm6
divpd  %xmm5,%xmm6
movapd %xmm6,0x18fff0(%rsp,%rax,8)
mulpd  %xmm6,%xmm6
movdqa %xmm3,%xmm5
psubd  %xmm0,%xmm5
cvtdq2pd %xmm5,%xmm5
movapd %xmm6,0xc7ff0(%rsp,%rax,8)
movapd %xmm2,%xmm6
divpd  %xmm5,%xmm6
movapd %xmm6,0x190000(%rsp,%rax,8)
mulpd  %xmm6,%xmm6
movapd %xmm6,0xc8000(%rsp,%rax,8)
paddd  %xmm4,%xmm0
add    $0x4,%rax
cmp    $0x19002,%rax
jne    1150 <main+0x40>
mov    $0x6,%eax
nopl   0x0(%rax)
movapd 0x18ffd0(%rsp,%rax,8),%xmm0
movapd 0x18ffe0(%rsp,%rax,8),%xmm1
movapd 0x18fff0(%rsp,%rax,8),%xmm2
movapd 0x190000(%rsp,%rax,8),%xmm3
mulpd  0xc7fd0(%rsp,%rax,8),%xmm0
mulpd  0xc7fe0(%rsp,%rax,8),%xmm1
movapd %xmm0,-0x30(%rsp,%rax,8)
movapd %xmm1,-0x20(%rsp,%rax,8)
mulpd  0xc7ff0(%rsp,%rax,8),%xmm2
mulpd  0xc8000(%rsp,%rax,8),%xmm3
movapd %xmm2,-0x10(%rsp,%rax,8)
movapd %xmm3,(%rsp,%rax,8)
add    $0x8,%rax
cmp    $0x19006,%rax
jne    11c0 <main+0xb0>
pxor   %xmm0,%xmm0
mov    $0x7,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
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    1240 <main+0x130>
lea    0xdce(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x258008,%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 i32 0, i32* %6
br label %34
34: ; preds = %50, %33
%35 = load i32, i32* %6
%36 = icmp slt i32 %35, 102400
br i1 %36, label %37, label %53
37: ; preds = %34
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %39
%41 = load double, double* %40
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %43
%45 = load double, double* %44
%46 = fmul double %41, %45
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [102400 x double], [102400 x double]* %4, i64 0, i64 %48
store double %46, double* %49
br label %50
50: ; preds = %37
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %34
53: ; preds = %34
store double 0.000000e+00, double* %5
store i32 0, i32* %6
br label %54
54: ; preds = %64, %53
%55 = load i32, i32* %6
%56 = icmp slt i32 %55, 102400
br i1 %56, label %57, label %67
57: ; preds = %54
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [102400 x double], [102400 x double]* %4, i64 0, i64 %59
%61 = load double, double* %60
%62 = load double, double* %5
%63 = fadd double %62, %61
store double %63, double* %5
br label %64
64: ; preds = %57
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %54
67: ; preds = %54
%68 = load double, double* %5
%69 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %68)
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 = alloca [102400 x double]
%3 = alloca [102400 x double]
%4 = bitcast [102400 x double]* %1 to i8*
%5 = bitcast [102400 x double]* %2 to i8*
%6 = bitcast [102400 x double]* %3 to i8*
br label %7
7: ; preds = %7, %0
%8 = phi i64 [ 0, %0 ], [ %27, %7 ]
%9 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %28, %7 ]
%10 = sub <2 x i32> <i32 102400, i32 102400>, %9
%11 = sitofp <2 x i32> %10 to <2 x double>
%12 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %11
%13 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %8
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> %12, <2 x double>* %14
%15 = fmul <2 x double> %12, %12
%16 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %8
%17 = bitcast double* %16 to <2 x double>*
store <2 x double> %15, <2 x double>* %17
%18 = or i64 %8, 2
%19 = sub <2 x i32> <i32 102398, i32 102398>, %9
%20 = sitofp <2 x i32> %19 to <2 x double>
%21 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %20
%22 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %18
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> %21, <2 x double>* %23
%24 = fmul <2 x double> %21, %21
%25 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %18
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> %24, <2 x double>* %26
%27 = add nuw nsw i64 %8, 4
%28 = add <2 x i32> %9, <i32 4, i32 4>
%29 = icmp eq i64 %27, 102400
br i1 %29, label %30, label %7
30: ; preds = %7, %30
%31 = phi i64 [ %69, %30 ], [ 0, %7 ]
%32 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %31
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = getelementptr inbounds double, double* %32, i64 2
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %31
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = getelementptr inbounds double, double* %38, i64 2
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = fmul <2 x double> %34, %40
%45 = fmul <2 x double> %37, %43
%46 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %31
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> %44, <2 x double>* %47
%48 = getelementptr inbounds double, double* %46, i64 2
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> %45, <2 x double>* %49
%50 = or i64 %31, 4
%51 = getelementptr inbounds [102400 x double], [102400 x double]* %1, i64 0, i64 %50
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr inbounds double, double* %51, i64 2
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds [102400 x double], [102400 x double]* %2, i64 0, i64 %50
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %57, i64 2
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = fmul <2 x double> %53, %59
%64 = fmul <2 x double> %56, %62
%65 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %50
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> %63, <2 x double>* %66
%67 = getelementptr inbounds double, double* %65, i64 2
%68 = bitcast double* %67 to <2 x double>*
store <2 x double> %64, <2 x double>* %68
%69 = add nuw nsw i64 %31, 8
%70 = icmp eq i64 %69, 102400
br i1 %70, label %71, label %30
71: ; preds = %30, %71
%72 = phi i64 [ %105, %71 ], [ 0, %30 ]
%73 = phi double [ %104, %71 ], [ 0.000000e+00, %30 ]
%74 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %72
%75 = load double, double* %74
%76 = fadd double %73, %75
%77 = or i64 %72, 1
%78 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %77
%79 = load double, double* %78
%80 = fadd double %76, %79
%81 = or i64 %72, 2
%82 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %81
%83 = load double, double* %82
%84 = fadd double %80, %83
%85 = or i64 %72, 3
%86 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %85
%87 = load double, double* %86
%88 = fadd double %84, %87
%89 = or i64 %72, 4
%90 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %89
%91 = load double, double* %90
%92 = fadd double %88, %91
%93 = or i64 %72, 5
%94 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %93
%95 = load double, double* %94
%96 = fadd double %92, %95
%97 = or i64 %72, 6
%98 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %97
%99 = load double, double* %98
%100 = fadd double %96, %99
%101 = or i64 %72, 7
%102 = getelementptr inbounds [102400 x double], [102400 x double]* %3, i64 0, i64 %101
%103 = load double, double* %102
%104 = fadd double %100, %103
%105 = add nuw nsw i64 %72, 8
%106 = icmp eq i64 %105, 102400
br i1 %106, label %107, label %71
107: ; preds = %71
%108 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %104)
ret i32 0
}