#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(void) {
  int i, n;
  float result = 0;
  float A[60000];
  float B[60000];
  for (i = 0; i < 60000; i++) {
    A[i] = i / 2.0;
  }
#pragma scop
  {
#pragma species kernel A[0 : SIZE - 1] | neighbourhood(-NB                     \
                                                       : NB) ^                 \
                                             A[0 : SIZE - 1] |                 \
                                               element->B[0 : SIZE - 1] |      \
                                                          element
    for (i = 0; i < 60000; i++) {
      if (i >= 2 && i < 60000 - 2) {
        result = 0;
        for (n = -2; n <= 2; n++) {
          result = result + A[i + n];
        }
        B[i] = result / (2 * 2 + 1);
      } else {
        B[i] = A[i];
      }
    }
#pragma species endkernel example01_k1
  }
#pragma endscop
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x75310,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xea60,-0x8(%rbp)
jge    116e <main+0x5e>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xebd(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x3a990(%rbp,%rax,4)
fc ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1131 <main+0x21>
movl   $0x0,-0x8(%rbp)
cmpl   $0xea60,-0x8(%rbp)
jge    122b <main+0x11b>
cmpl   $0x2,-0x8(%rbp)
jl     11fe <main+0xee>
cmpl   $0xea5e,-0x8(%rbp)
jge    11fe <main+0xee>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0xfffffffe,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     11db <main+0xcb>
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
addss  -0x3a990(%rbp,%rax,4),%xmm0
fc ff
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a8 <main+0x98>
movss  -0x10(%rbp),%xmm0
movss  0xe18(%rip),%xmm1
divss  %xmm1,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x75310(%rbp,%rax,4)
f8 ff
jmp    1218 <main+0x108>
movslq -0x8(%rbp),%rax
movss  -0x3a990(%rbp,%rax,4),%xmm0
fc ff
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x75310(%rbp,%rax,4)
f8 ff
jmp    121d <main+0x10d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x65>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x75310,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca [60000 x float]
%6 = alloca [60000 x float]
store i32 0, i32* %1
store float 0.000000e+00, float* %4
store i32 0, i32* %2
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 60000
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 2.000000e+00
%14 = fptrunc double %13 to float
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [60000 x float], [60000 x float]* %5, i64 0, i64 %16
store float %14, float* %17
br label %18
18: ; preds = %10
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %7
21: ; preds = %7
store i32 0, i32* %2
br label %22
22: ; preds = %62, %21
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 60000
br i1 %24, label %25, label %65
25: ; preds = %22
%26 = load i32, i32* %2
%27 = icmp sge i32 %26, 2
br i1 %27, label %28, label %53
28: ; preds = %25
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, 59998
br i1 %30, label %31, label %53
31: ; preds = %28
store float 0.000000e+00, float* %4
store i32 -2, i32* %3
br label %32
32: ; preds = %44, %31
%33 = load i32, i32* %3
%34 = icmp sle i32 %33, 2
br i1 %34, label %35, label %47
35: ; preds = %32
%36 = load float, float* %4
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = add nsw i32 %37, %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [60000 x float], [60000 x float]* %5, i64 0, i64 %40
%42 = load float, float* %41
%43 = fadd float %36, %42
store float %43, float* %4
br label %44
44: ; preds = %35
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %32
47: ; preds = %32
%48 = load float, float* %4
%49 = fdiv float %48, 5.000000e+00
%50 = load i32, i32* %2
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [60000 x float], [60000 x float]* %6, i64 0, i64 %51
store float %49, float* %52
br label %61
53: ; preds = %28, %25
%54 = load i32, i32* %2
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [60000 x float], [60000 x float]* %5, i64 0, i64 %55
%57 = load float, float* %56
%58 = load i32, i32* %2
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [60000 x float], [60000 x float]* %6, i64 0, i64 %59
store float %57, float* %60
br label %61
61: ; preds = %53, %47
br label %62
62: ; preds = %61
%63 = load i32, i32* %2
%64 = add nsw i32 %63, 1
store i32 %64, i32* %2
br label %22
65: ; preds = %22
%66 = load i32, i32* @stdout
%67 = call i32 @fflush(i32 %66)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
ret i32 0
}