#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 A[2048];
  float B[(2048 / 2)];
  for (i = 0; i < 2048; i++) {
    A[i] = i % 6 + i;
  }
#pragma scop
  {
#pragma species kernel A[0 : 2 * HALFSIZE - 1] |                               \
                         chunk(0 : 1)->B[0 : HALFSIZE - 1] | element
    for (i = 0; i < (2048 / 2); i++) {
      B[i] = A[i * 2] + A[i * 2 + 1];
    }
#pragma species endkernel example02_k1
  }
#pragma endscop
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3010,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jge    1163 <main+0x53>
mov    -0x8(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
cvtsi2ss %edx,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x2010(%rbp,%rax,4)
ff ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <main+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x400,-0x8(%rbp)
jge    11b7 <main+0xa7>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
cltq
movss  -0x2010(%rbp,%rax,4),%xmm0
ff ff
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
addss  -0x2010(%rbp,%rax,4),%xmm0
ff ff
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x3010(%rbp,%rax,4)
ff ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x5a>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x3010,%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 [2048 x float]
%4 = alloca [1024 x float]
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 2048
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %2
%10 = srem i32 %9, 6
%11 = load i32, i32* %2
%12 = add nsw i32 %10, %11
%13 = sitofp i32 %12 to float
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [2048 x float], [2048 x float]* %3, i64 0, i64 %15
store float %13, float* %16
br label %17
17: ; preds = %8
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %5
20: ; preds = %5
store i32 0, i32* %2
br label %21
21: ; preds = %40, %20
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 1024
br i1 %23, label %24, label %43
24: ; preds = %21
%25 = load i32, i32* %2
%26 = mul nsw i32 %25, 2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2048 x float], [2048 x float]* %3, i64 0, i64 %27
%29 = load float, float* %28
%30 = load i32, i32* %2
%31 = mul nsw i32 %30, 2
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [2048 x float], [2048 x float]* %3, i64 0, i64 %33
%35 = load float, float* %34
%36 = fadd float %29, %35
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [1024 x float], [1024 x float]* %4, i64 0, i64 %38
store float %36, float* %39
br label %40
40: ; preds = %24
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %21
43: ; preds = %21
%44 = load i32, i32* @stdout
%45 = call i32 @fflush(i32 %44)
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
}