#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;
  int t = 0;
  float result = 0;
  float A[2048];
  float B[(2048 * 64)];
  float out1[(2048 * 64)];
  float out2[(2048 * 64)];
  for (i = 0; i < 2048; i++) {
    A[i] = 0.6;
  }
  for (i = 0; i < (2048 * 64); i++) {
    B[i] = i % 6 + i;
  }
#pragma scop
  {
#pragma species kernel A[0 : BASE - 1] |                                       \
                         element ^                                             \
                             B[0 : (BASE * TILE) - 1] |                        \
                               chunk(0                                         \
                                     : TILE - 1)                               \
                                   ->out1[0 : (BASE * TILE) - 1] |             \
                                          chunk(0                              \
                                                : TILE - 1) ^                  \
                                              out2[0 : (BASE * TILE) - 1] |    \
                                                   chunk(0                     \
                                                         : TILE - 1)
    for (i = 0; i < 2048; i++) {
      result = A[i];
      for (t = 0; t < 64; t++) {
        result = result + t * B[i * 64 + t];
      }
      for (t = 0; t < 64; t++) {
        out1[i * 64 + t] = result;
        out2[i * 64 + t] = -result;
      }
    }
#pragma species endkernel example03_k1
  }
#pragma endscop
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x182010,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jge    1168 <main+0x58>
movslq -0x8(%rbp),%rax
movss  0xeaf(%rip),%xmm0
movss  %xmm0,-0x2010(%rbp,%rax,4)
ff ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1138 <main+0x28>
movl   $0x0,-0x8(%rbp)
cmpl   $0x20000,-0x8(%rbp)
jge    11a9 <main+0x99>
mov    -0x8(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
cvtsi2ss %edx,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x82010(%rbp,%rax,4)
f7 ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <main+0x5f>
movl   $0x0,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jge    128a <main+0x17a>
movslq -0x8(%rbp),%rax
movss  -0x2010(%rbp,%rax,4),%xmm0
ff ff
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    1219 <main+0x109>
movss  -0x10(%rbp),%xmm1
cvtsi2ssl -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%eax
shl    $0x6,%eax
add    -0xc(%rbp),%eax
cltq
movss  -0x82010(%rbp,%rax,4),%xmm2
f7 ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <main+0xc6>
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    1277 <main+0x167>
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%eax
shl    $0x6,%eax
add    -0xc(%rbp),%eax
cltq
movss  %xmm0,-0x102010(%rbp,%rax,4)
ef ff
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%eax
shl    $0x6,%eax
add    -0xc(%rbp),%eax
cltq
movss  %xmm0,-0x182010(%rbp,%rax,4)
e7 ff
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1220 <main+0x110>
jmp    127c <main+0x16c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <main+0xa0>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x182010,%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 [2048 x float]
%6 = alloca [131072 x float]
%7 = alloca [131072 x float]
%8 = alloca [131072 x float]
store i32 0, i32* %1
store i32 0, i32* %3
store float 0.000000e+00, float* %4
store i32 0, i32* %2
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 2048
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [2048 x float], [2048 x float]* %5, i64 0, i64 %14
store float 0x3FE3333340000000, float* %15
br label %16
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %9
19: ; preds = %9
store i32 0, i32* %2
br label %20
20: ; preds = %32, %19
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 131072
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = load i32, i32* %2
%25 = srem i32 %24, 6
%26 = load i32, i32* %2
%27 = add nsw i32 %25, %26
%28 = sitofp i32 %27 to float
%29 = load i32, i32* %2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [131072 x float], [131072 x float]* %6, i64 0, i64 %30
store float %28, float* %31
br label %32
32: ; preds = %23
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %20
35: ; preds = %20
store i32 0, i32* %2
br label %36
36: ; preds = %86, %35
%37 = load i32, i32* %2
%38 = icmp slt i32 %37, 2048
br i1 %38, label %39, label %89
39: ; preds = %36
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [2048 x float], [2048 x float]* %5, i64 0, i64 %41
%43 = load float, float* %42
store float %43, float* %4
store i32 0, i32* %3
br label %44
44: ; preds = %59, %39
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 64
br i1 %46, label %47, label %62
47: ; preds = %44
%48 = load float, float* %4
%49 = load i32, i32* %3
%50 = sitofp i32 %49 to float
%51 = load i32, i32* %2
%52 = mul nsw i32 %51, 64
%53 = load i32, i32* %3
%54 = add nsw i32 %52, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [131072 x float], [131072 x float]* %6, i64 0, i64 %55
%57 = load float, float* %56
%58 = call float @llvm.fmuladd.f32(float %50, float %57, float %48)
store float %58, float* %4
br label %59
59: ; preds = %47
%60 = load i32, i32* %3
%61 = add nsw i32 %60, 1
store i32 %61, i32* %3
br label %44
62: ; preds = %44
store i32 0, i32* %3
br label %63
63: ; preds = %82, %62
%64 = load i32, i32* %3
%65 = icmp slt i32 %64, 64
br i1 %65, label %66, label %85
66: ; preds = %63
%67 = load float, float* %4
%68 = load i32, i32* %2
%69 = mul nsw i32 %68, 64
%70 = load i32, i32* %3
%71 = add nsw i32 %69, %70
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [131072 x float], [131072 x float]* %7, i64 0, i64 %72
store float %67, float* %73
%74 = load float, float* %4
%75 = fneg float %74
%76 = load i32, i32* %2
%77 = mul nsw i32 %76, 64
%78 = load i32, i32* %3
%79 = add nsw i32 %77, %78
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [131072 x float], [131072 x float]* %8, i64 0, i64 %80
store float %75, float* %81
br label %82
82: ; preds = %66
%83 = load i32, i32* %3
%84 = add nsw i32 %83, 1
store i32 %84, i32* %3
br label %63
85: ; preds = %63
br label %86
86: ; preds = %85
%87 = load i32, i32* %2
%88 = add nsw i32 %87, 1
store i32 %88, i32* %2
br label %36
89: ; preds = %36
%90 = load i32, i32* @stdout
%91 = call i32 @fflush(i32 %90)
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
}