#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 a, b, c;
  float in[8][16][32];
  float out[1];
  for (a = 0; a < 8; a++) {
    for (b = 0; b < 16; b++) {
      for (c = 0; c < 32; c++) {
        in[a][b][c] = 1;
      }
    }
  }
  out[0] = 0;
#pragma scop
  {
#pragma species kernel out[0 : 0] | full ^ in[0 : 7, 0 : 15, 0 : 31] |         \
                                              element->out[0 : 0] | shared
    for (a = 0; a < 8; a++) {
      for (b = 0; b < 16; b++) {
        for (c = 0; c < 32; c++) {
          out[0] = out[0] + in[a][b][c];
        }
      }
    }
#pragma species endkernel example02_k1
  }
#pragma endscop
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    11b7 <main+0xa7>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11a4 <main+0x94>
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x10(%rbp)
jge    1191 <main+0x81>
movslq -0x8(%rbp),%rcx
lea    -0x4010(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
shl    $0x7,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movss  0xe82(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114b <main+0x3b>
jmp    1196 <main+0x86>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <main+0x2a>
jmp    11a9 <main+0x99>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <main+0x19>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4014(%rbp)
ff
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    125f <main+0x14f>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    124c <main+0x13c>
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x10(%rbp)
jge    1239 <main+0x129>
movss  -0x4014(%rbp),%xmm0
ff
movslq -0x8(%rbp),%rcx
lea    -0x4010(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
shl    $0x7,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x4014(%rbp)
ff
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11eb <main+0xdb>
jmp    123e <main+0x12e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11da <main+0xca>
jmp    1251 <main+0x141>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c9 <main+0xb9>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x4020,%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 i32
%5 = alloca [8 x [16 x [32 x float]]]
%6 = alloca [1 x float]
store i32 0, i32* %1
store i32 0, i32* %2
br label %7
7: ; preds = %36, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %39
10: ; preds = %7
store i32 0, i32* %3
br label %11
11: ; preds = %32, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 16
br i1 %13, label %14, label %35
14: ; preds = %11
store i32 0, i32* %4
br label %15
15: ; preds = %28, %14
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 32
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [8 x [16 x [32 x float]]], [8 x [16 x [32 x float]]]* %5, i64 0, i64 %20
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [16 x [32 x float]], [16 x [32 x float]]* %21, i64 0, i64 %23
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [32 x float], [32 x float]* %24, i64 0, i64 %26
store float 1.000000e+00, float* %27
br label %28
28: ; preds = %18
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %15
31: ; preds = %15
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %11
35: ; preds = %11
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %7
39: ; preds = %7
%40 = getelementptr inbounds [1 x float], [1 x float]* %6, i64 0, i64 0
store float 0.000000e+00, float* %40
store i32 0, i32* %2
br label %41
41: ; preds = %75, %39
%42 = load i32, i32* %2
%43 = icmp slt i32 %42, 8
br i1 %43, label %44, label %78
44: ; preds = %41
store i32 0, i32* %3
br label %45
45: ; preds = %71, %44
%46 = load i32, i32* %3
%47 = icmp slt i32 %46, 16
br i1 %47, label %48, label %74
48: ; preds = %45
store i32 0, i32* %4
br label %49
49: ; preds = %67, %48
%50 = load i32, i32* %4
%51 = icmp slt i32 %50, 32
br i1 %51, label %52, label %70
52: ; preds = %49
%53 = getelementptr inbounds [1 x float], [1 x float]* %6, i64 0, i64 0
%54 = load float, float* %53
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [8 x [16 x [32 x float]]], [8 x [16 x [32 x float]]]* %5, i64 0, i64 %56
%58 = load i32, i32* %3
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [16 x [32 x float]], [16 x [32 x float]]* %57, i64 0, i64 %59
%61 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [32 x float], [32 x float]* %60, i64 0, i64 %62
%64 = load float, float* %63
%65 = fadd float %54, %64
%66 = getelementptr inbounds [1 x float], [1 x float]* %6, i64 0, i64 0
store float %65, float* %66
br label %67
67: ; preds = %52
%68 = load i32, i32* %4
%69 = add nsw i32 %68, 1
store i32 %69, i32* %4
br label %49
70: ; preds = %49
br label %71
71: ; preds = %70
%72 = load i32, i32* %3
%73 = add nsw i32 %72, 1
store i32 %73, i32* %3
br label %45
74: ; preds = %45
br label %75
75: ; preds = %74
%76 = load i32, i32* %2
%77 = add nsw i32 %76, 1
store i32 %77, i32* %2
br label %41
78: ; preds = %41
%79 = load i32, i32* @stdout
%80 = call i32 @fflush(i32 %79)
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
}