#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*/ alloc_and_genmat(long ***);
int /*<<< orphan*/ stencil_op(int, long, long, long **);
int main(int argc, char **argv) {
  long(*A)[((4L - 2L) + 2) * 16L];
#pragma css start
  alloc_and_genmat(&A);
#pragma css barrier
  int iters;
  long i, j;
  for (iters = 0; iters < 1; iters++) {
    for (i = 16L; i < ((4L - 2L) + 1) * 16L; i += 16L) {
      for (j = 16L; j < ((4L - 2L) + 1) * 16L; j += 16L) {
        stencil_op(iters, i - 1, j - 1,
                   (long(*)[((4L - 2L) + 2) * 16L])(&A[i - 1][j - 1]));
      }
    }
  }
#pragma css finish
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <alloc_and_genmat@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    11ea <main+0xca>
movq   $0x10,-0x28(%rbp)
cmpq   $0x30,-0x28(%rbp)
jge    11d7 <main+0xb7>
movq   $0x10,-0x30(%rbp)
cmpq   $0x30,-0x30(%rbp)
jge    11c1 <main+0xa1>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
sub    $0x1,%rsi
mov    -0x30(%rbp),%rdx
sub    $0x1,%rdx
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
shl    $0x9,%rax
add    %rax,%rcx
mov    -0x30(%rbp),%rax
sub    $0x1,%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1040 <stencil_op@plt>
mov    -0x30(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x30(%rbp)
jmp    116b <main+0x4b>
jmp    11c6 <main+0xa6>
mov    -0x28(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x28(%rbp)
jmp    1158 <main+0x38>
jmp    11dc <main+0xbc>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rdi
call   1030 <alloc_and_genmat@plt>
mov    $0x1e78,%ecx
add    (%rsp),%rcx
mov    $0xf,%esi
mov    $0xf,%edx
xor    %edi,%edi
call   1040 <stencil_op@plt>
mov    $0x1ef8,%ecx
add    (%rsp),%rcx
mov    $0xf,%esi
mov    $0x1f,%edx
xor    %edi,%edi
call   1040 <stencil_op@plt>
mov    $0x3e78,%ecx
add    (%rsp),%rcx
mov    $0x1f,%esi
mov    $0xf,%edx
xor    %edi,%edi
call   1040 <stencil_op@plt>
mov    $0x3ef8,%ecx
add    (%rsp),%rcx
mov    $0x1f,%esi
mov    $0x1f,%edx
xor    %edi,%edi
call   1040 <stencil_op@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [64 x i64]*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [64 x i64]** %6 to i64***
%11 = call i32 @alloc_and_genmat(i64*** %10)
store i32 0, i32* %7
br label %12
12: ; preds = %47, %2
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %50
15: ; preds = %12
store i64 16, i64* %8
br label %16
16: ; preds = %43, %15
%17 = load i64, i64* %8
%18 = icmp slt i64 %17, 48
br i1 %18, label %19, label %46
19: ; preds = %16
store i64 16, i64* %9
br label %20
20: ; preds = %39, %19
%21 = load i64, i64* %9
%22 = icmp slt i64 %21, 48
br i1 %22, label %23, label %42
23: ; preds = %20
%24 = load i32, i32* %7
%25 = load i64, i64* %8
%26 = sub nsw i64 %25, 1
%27 = load i64, i64* %9
%28 = sub nsw i64 %27, 1
%29 = load [64 x i64]*, [64 x i64]** %6
%30 = load i64, i64* %8
%31 = sub nsw i64 %30, 1
%32 = getelementptr inbounds [64 x i64], [64 x i64]* %29, i64 %31
%33 = load i64, i64* %9
%34 = sub nsw i64 %33, 1
%35 = getelementptr inbounds [64 x i64], [64 x i64]* %32, i64 0, i64 %34
%36 = bitcast i64* %35 to [64 x i64]*
%37 = bitcast [64 x i64]* %36 to i64**
%38 = call i32 @stencil_op(i32 %24, i64 %26, i64 %28, i64** %37)
br label %39
39: ; preds = %23
%40 = load i64, i64* %9
%41 = add nsw i64 %40, 16
store i64 %41, i64* %9
br label %20
42: ; preds = %20
br label %43
43: ; preds = %42
%44 = load i64, i64* %8
%45 = add nsw i64 %44, 16
store i64 %45, i64* %8
br label %16
46: ; preds = %16
br label %47
47: ; preds = %46
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %12
50: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [64 x i64]*
%4 = bitcast [64 x i64]** %3 to i8*
%5 = bitcast [64 x i64]** %3 to i64***
%6 = call i32 @alloc_and_genmat(i64*** %5)
%7 = load [64 x i64]*, [64 x i64]** %3
%8 = getelementptr inbounds [64 x i64], [64 x i64]* %7, i64 15, i64 15
%9 = bitcast i64* %8 to i64**
%10 = call i32 @stencil_op(i32 0, i64 15, i64 15, i64** %9)
%11 = load [64 x i64]*, [64 x i64]** %3
%12 = getelementptr inbounds [64 x i64], [64 x i64]* %11, i64 15, i64 31
%13 = bitcast i64* %12 to i64**
%14 = call i32 @stencil_op(i32 0, i64 15, i64 31, i64** %13)
%15 = load [64 x i64]*, [64 x i64]** %3
%16 = getelementptr inbounds [64 x i64], [64 x i64]* %15, i64 31, i64 15
%17 = bitcast i64* %16 to i64**
%18 = call i32 @stencil_op(i32 0, i64 31, i64 15, i64** %17)
%19 = load [64 x i64]*, [64 x i64]** %3
%20 = getelementptr inbounds [64 x i64], [64 x i64]* %19, i64 31, i64 31
%21 = bitcast i64* %20 to i64**
%22 = call i32 @stencil_op(i32 0, i64 31, i64 31, i64** %21)
ret i32 0
}