#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 A[2048][1024];
  int B[2048][1024];
  int C[2048][1024];
  for (i = 0; i < 2048; i++) {
    for (j = 0; j < 1024; j++) {
      A[i][j] = i + j;
    }
  }
#pragma scop
#pragma species kernel A[0 : 2047, 0 : 1023] | element->B[0 : 2047,            \
                                                          0 : 1023] | element
  for (i = 0; i < 2048; i++) {
    for (j = 0; j < 1024; j++) {
      B[i][j] = A[i][j] + 3;
    }
  }
#pragma species endkernel example05 - part1
#pragma species kernel A[0 : 2047, 0 : 979] | element->C[0 : 2047,             \
                                                         0 : 979] | element
  for (i = 0; i < 2048; i++) {
    for (j = 0; j < 980; j++) {
      C[i][j] = 9 * A[i][j];
    }
  }
#pragma species endkernel example05 - part2
#pragma endscop
  fflush(stdout);
  C[8][9] = C[8][9];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1800010,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jge    118a <main+0x7a>
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    1177 <main+0x67>
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
movslq -0x8(%rbp),%rcx
lea    -0x800010(%rbp),%rax
shl    $0xc,%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    113d <main+0x2d>
jmp    117c <main+0x6c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <main+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jge    1208 <main+0xf8>
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    11f5 <main+0xe5>
movslq -0x8(%rbp),%rcx
lea    -0x800010(%rbp),%rax
shl    $0xc,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x3,%edx
movslq -0x8(%rbp),%rcx
lea    -0x1000010(%rbp),%rax
shl    $0xc,%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    11a5 <main+0x95>
jmp    11fa <main+0xea>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1191 <main+0x81>
movl   $0x0,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jge    1284 <main+0x174>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3d4,-0xc(%rbp)
jge    1271 <main+0x161>
movslq -0x8(%rbp),%rcx
lea    -0x800010(%rbp),%rax
shl    $0xc,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
imul   $0x9,(%rax,%rcx,4),%edx
movslq -0x8(%rbp),%rcx
lea    -0x1800010(%rbp),%rax
shl    $0xc,%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    1223 <main+0x113>
jmp    1276 <main+0x166>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120f <main+0xff>
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
mov    -0x17f7fec(%rbp),%eax
mov    %eax,-0x17f7fec(%rbp)
xor    %eax,%eax
add    $0x1800010,%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 [2048 x [1024 x i32]]
%5 = alloca [2048 x [1024 x i32]]
%6 = alloca [2048 x [1024 x i32]]
store i32 0, i32* %1
store i32 0, i32* %2
br label %7
7: ; preds = %28, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 2048
br i1 %9, label %10, label %31
10: ; preds = %7
store i32 0, i32* %3
br label %11
11: ; preds = %24, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 1024
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [2048 x [1024 x i32]], [2048 x [1024 x i32]]* %4, i64 0, i64 %19
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1024 x i32], [1024 x i32]* %20, i64 0, i64 %22
store i32 %17, i32* %23
br label %24
24: ; preds = %14
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %11
27: ; preds = %11
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %7
31: ; preds = %7
store i32 0, i32* %2
br label %32
32: ; preds = %58, %31
%33 = load i32, i32* %2
%34 = icmp slt i32 %33, 2048
br i1 %34, label %35, label %61
35: ; preds = %32
store i32 0, i32* %3
br label %36
36: ; preds = %54, %35
%37 = load i32, i32* %3
%38 = icmp slt i32 %37, 1024
br i1 %38, label %39, label %57
39: ; preds = %36
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [2048 x [1024 x i32]], [2048 x [1024 x i32]]* %4, i64 0, i64 %41
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1024 x i32], [1024 x i32]* %42, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = add nsw i32 %46, 3
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [2048 x [1024 x i32]], [2048 x [1024 x i32]]* %5, i64 0, i64 %49
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1024 x i32], [1024 x i32]* %50, i64 0, i64 %52
store i32 %47, i32* %53
br label %54
54: ; preds = %39
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %36
57: ; preds = %36
br label %58
58: ; preds = %57
%59 = load i32, i32* %2
%60 = add nsw i32 %59, 1
store i32 %60, i32* %2
br label %32
61: ; preds = %32
store i32 0, i32* %2
br label %62
62: ; preds = %88, %61
%63 = load i32, i32* %2
%64 = icmp slt i32 %63, 2048
br i1 %64, label %65, label %91
65: ; preds = %62
store i32 0, i32* %3
br label %66
66: ; preds = %84, %65
%67 = load i32, i32* %3
%68 = icmp slt i32 %67, 980
br i1 %68, label %69, label %87
69: ; preds = %66
%70 = load i32, i32* %2
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [2048 x [1024 x i32]], [2048 x [1024 x i32]]* %4, i64 0, i64 %71
%73 = load i32, i32* %3
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [1024 x i32], [1024 x i32]* %72, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = mul nsw i32 9, %76
%78 = load i32, i32* %2
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [2048 x [1024 x i32]], [2048 x [1024 x i32]]* %6, i64 0, i64 %79
%81 = load i32, i32* %3
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [1024 x i32], [1024 x i32]* %80, i64 0, i64 %82
store i32 %77, i32* %83
br label %84
84: ; preds = %69
%85 = load i32, i32* %3
%86 = add nsw i32 %85, 1
store i32 %86, i32* %3
br label %66
87: ; preds = %66
br label %88
88: ; preds = %87
%89 = load i32, i32* %2
%90 = add nsw i32 %89, 1
store i32 %90, i32* %2
br label %62
91: ; preds = %62
%92 = load i32, i32* @stdout
%93 = call i32 @fflush(i32 %92)
%94 = getelementptr inbounds [2048 x [1024 x i32]], [2048 x [1024 x i32]]* %6, i64 0, i64 8
%95 = getelementptr inbounds [1024 x i32], [1024 x i32]* %94, i64 0, i64 9
%96 = load i32, i32* %95
%97 = getelementptr inbounds [2048 x [1024 x i32]], [2048 x [1024 x i32]]* %6, i64 0, i64 8
%98 = getelementptr inbounds [1024 x i32], [1024 x i32]* %97, i64 0, i64 9
store i32 %96, i32* %98
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
}