#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, j;
  int i2, j2;
  int result = 0;
  int A[560][32];
  int B[56][16];
  for (i = 0; i < 560; i++) {
    for (j = 0; j < 32; j++) {
      A[i][j] = i + j;
    }
  }
#pragma scop
  {
#pragma species kernel A[0 : 559, 0 : 31] |                                    \
                         chunk(0 : 9, 0 : 1)->B[0 : 55, 0 : 15] | element
    for (i = 0; i < 56; i++) {
      for (j = 0; j < 16; j++) {
        result = 0;
        for (i2 = 0; i2 < 10; i2++) {
          for (j2 = 0; j2 < 2; j2++) {
            result = result + A[i * 10 + i2][j * 2 + j2];
          }
        }
        B[i][j] = result;
      }
    }
#pragma species endkernel example01_k1
  }
#pragma endscop
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x12620,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x230,-0x8(%rbp)
jge    118e <main+0x7e>
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    117b <main+0x6b>
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
movslq -0x8(%rbp),%rcx
lea    -0x11820(%rbp),%rax
shl    $0x7,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x34>
jmp    1180 <main+0x70>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <main+0x20>
movl   $0x0,-0x8(%rbp)
cmpl   $0x38,-0x8(%rbp)
jge    1264 <main+0x154>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1251 <main+0x141>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    1227 <main+0x117>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1214 <main+0x104>
mov    -0x18(%rbp),%eax
imul   $0xa,-0x8(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rdx
lea    -0x11820(%rbp),%rcx
shl    $0x7,%rdx
add    %rdx,%rcx
mov    -0xc(%rbp),%edx
shl    $0x1,%edx
add    -0x14(%rbp),%edx
movslq %edx,%rdx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cf <main+0xbf>
jmp    1219 <main+0x109>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11be <main+0xae>
mov    -0x18(%rbp),%edx
movslq -0x8(%rbp),%rcx
lea    -0x12620(%rbp),%rax
shl    $0x6,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x96>
jmp    1256 <main+0x146>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1195 <main+0x85>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x12620,%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 i32
%6 = alloca i32
%7 = alloca [560 x [32 x i32]]
%8 = alloca [56 x [16 x i32]]
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %2
br label %9
9: ; preds = %30, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 560
br i1 %11, label %12, label %33
12: ; preds = %9
store i32 0, i32* %3
br label %13
13: ; preds = %26, %12
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 32
br i1 %15, label %16, label %29
16: ; preds = %13
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [560 x [32 x i32]], [560 x [32 x i32]]* %7, i64 0, i64 %21
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [32 x i32], [32 x i32]* %22, i64 0, i64 %24
store i32 %19, i32* %25
br label %26
26: ; preds = %16
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %13
29: ; preds = %13
br label %30
30: ; preds = %29
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %9
33: ; preds = %9
store i32 0, i32* %2
br label %34
34: ; preds = %84, %33
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 56
br i1 %36, label %37, label %87
37: ; preds = %34
store i32 0, i32* %3
br label %38
38: ; preds = %80, %37
%39 = load i32, i32* %3
%40 = icmp slt i32 %39, 16
br i1 %40, label %41, label %83
41: ; preds = %38
store i32 0, i32* %6
store i32 0, i32* %4
br label %42
42: ; preds = %69, %41
%43 = load i32, i32* %4
%44 = icmp slt i32 %43, 10
br i1 %44, label %45, label %72
45: ; preds = %42
store i32 0, i32* %5
br label %46
46: ; preds = %65, %45
%47 = load i32, i32* %5
%48 = icmp slt i32 %47, 2
br i1 %48, label %49, label %68
49: ; preds = %46
%50 = load i32, i32* %6
%51 = load i32, i32* %2
%52 = mul nsw i32 %51, 10
%53 = load i32, i32* %4
%54 = add nsw i32 %52, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [560 x [32 x i32]], [560 x [32 x i32]]* %7, i64 0, i64 %55
%57 = load i32, i32* %3
%58 = mul nsw i32 %57, 2
%59 = load i32, i32* %5
%60 = add nsw i32 %58, %59
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [32 x i32], [32 x i32]* %56, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = add nsw i32 %50, %63
store i32 %64, i32* %6
br label %65
65: ; preds = %49
%66 = load i32, i32* %5
%67 = add nsw i32 %66, 1
store i32 %67, i32* %5
br label %46
68: ; preds = %46
br label %69
69: ; preds = %68
%70 = load i32, i32* %4
%71 = add nsw i32 %70, 1
store i32 %71, i32* %4
br label %42
72: ; preds = %42
%73 = load i32, i32* %6
%74 = load i32, i32* %2
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [56 x [16 x i32]], [56 x [16 x i32]]* %8, i64 0, i64 %75
%77 = load i32, i32* %3
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [16 x i32], [16 x i32]* %76, i64 0, i64 %78
store i32 %73, i32* %79
br label %80
80: ; preds = %72
%81 = load i32, i32* %3
%82 = add nsw i32 %81, 1
store i32 %82, i32* %3
br label %38
83: ; preds = %38
br label %84
84: ; preds = %83
%85 = load i32, i32* %2
%86 = add nsw i32 %85, 1
store i32 %86, i32* %2
br label %34
87: ; preds = %34
%88 = load i32, i32* @stdout
%89 = call i32 @fflush(i32 %88)
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
}