#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;
  float factor;
  int size = 512;
  float A[size];
  float B[size];
  float C[size];
  for (i = 0; i < size; i++) {
    A[i] = i * 2.3;
    B[i] = i + 6.0;
  }
#pragma scop
#pragma species kernel B[0 : size - 1] |                                       \
                         neighbourhood(-1 : 1) ^ A[0 : size - 1] |             \
                                                   element->C[0 : size - 1] |  \
                                                              element
  for (i = 0; i < size; i++) {
    factor = A[i] / 100.0;
    if ((i >= 1) && (i < size - 1)) {
      C[i] = factor * (B[i - 1] + B[i] + B[i + 1]);
    } else {
      C[i] = B[i];
    }
  }
#pragma species endkernel example4
#pragma endscop
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x200,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f2 <main+0xe2>
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%rcx
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe5b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x8(%rbp),%rdx
movss  %xmm0,(%rcx,%rdx,4)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe35(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1194 <main+0x84>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12b7 <main+0x1a7>
mov    -0x48(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     128a <main+0x17a>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    128a <main+0x17a>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movss  (%rcx,%rdx,4),%xmm1
movslq -0x8(%rbp),%rdx
addss  (%rcx,%rdx,4),%xmm1
mov    -0x8(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
addss  (%rcx,%rdx,4),%xmm1
mulss  %xmm1,%xmm0
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    12a4 <main+0x194>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
movslq -0x8(%rbp),%rdx
movss  (%rcx,%rdx,4),%xmm0
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    12a9 <main+0x199>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f9 <main+0xe9>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%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 float
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %1
store i32 512, i32* %4
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca float, i64 %10
store i64 %10, i64* %6
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = alloca float, i64 %14
store i64 %14, i64* %7
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = alloca float, i64 %17
store i64 %17, i64* %8
store i32 0, i32* %2
br label %19
19: ; preds = %38, %0
%20 = load i32, i32* %2
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %41
23: ; preds = %19
%24 = load i32, i32* %2
%25 = sitofp i32 %24 to double
%26 = fmul double %25, 2.300000e+00
%27 = fptrunc double %26 to float
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %12, i64 %29
store float %27, float* %30
%31 = load i32, i32* %2
%32 = sitofp i32 %31 to double
%33 = fadd double %32, 6.000000e+00
%34 = fptrunc double %33 to float
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds float, float* %15, i64 %36
store float %34, float* %37
br label %38
38: ; preds = %23
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %19
41: ; preds = %19
store i32 0, i32* %2
br label %42
42: ; preds = %92, %41
%43 = load i32, i32* %2
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %95
46: ; preds = %42
%47 = load i32, i32* %2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds float, float* %12, i64 %48
%50 = load float, float* %49
%51 = fpext float %50 to double
%52 = fdiv double %51, 1.000000e+02
%53 = fptrunc double %52 to float
store float %53, float* %3
%54 = load i32, i32* %2
%55 = icmp sge i32 %54, 1
br i1 %55, label %56, label %83
56: ; preds = %46
%57 = load i32, i32* %2
%58 = load i32, i32* %4
%59 = sub nsw i32 %58, 1
%60 = icmp slt i32 %57, %59
br i1 %60, label %61, label %83
61: ; preds = %56
%62 = load float, float* %3
%63 = load i32, i32* %2
%64 = sub nsw i32 %63, 1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds float, float* %15, i64 %65
%67 = load float, float* %66
%68 = load i32, i32* %2
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds float, float* %15, i64 %69
%71 = load float, float* %70
%72 = fadd float %67, %71
%73 = load i32, i32* %2
%74 = add nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds float, float* %15, i64 %75
%77 = load float, float* %76
%78 = fadd float %72, %77
%79 = fmul float %62, %78
%80 = load i32, i32* %2
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds float, float* %18, i64 %81
store float %79, float* %82
br label %91
83: ; preds = %56, %46
%84 = load i32, i32* %2
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds float, float* %15, i64 %85
%87 = load float, float* %86
%88 = load i32, i32* %2
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds float, float* %18, i64 %89
store float %87, float* %90
br label %91
91: ; preds = %83, %61
br label %92
92: ; preds = %91
%93 = load i32, i32* %2
%94 = add nsw i32 %93, 1
store i32 %94, i32* %2
br label %42
95: ; preds = %42
%96 = load i32, i32* @stdout
%97 = call i32 @fflush(i32 %96)
store i32 0, i32* %1
%98 = load i8*, i8** %5
%99 = load i32, i32* %1
ret i32 %99
}

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
}