#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*/ free(void *);
int /*<<< orphan*/ init_array(int, double **, double **);
int /*<<< orphan*/ kernel_jacobi_2d(int, int, double **, double **);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, double **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int n = 1300;
  int tsteps = 500;
  double(*A)[1300 + 0][1300 + 0];
  A = (double(*)[1300 + 0][1300 + 0])
      polybench_alloc_data((1300 + 0) * (1300 + 0), sizeof(double));
  ;
  double(*B)[1300 + 0][1300 + 0];
  B = (double(*)[1300 + 0][1300 + 0])
      polybench_alloc_data((1300 + 0) * (1300 + 0), sizeof(double));
  ;
  init_array(n, *A, *B);
  ;
  kernel_jacobi_2d(tsteps, n, *A, *B);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(n, *A);
  free((void *)A);
  ;
  free((void *)B);
  ;
  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)
movl   $0x514,-0x14(%rbp)
movl   $0x1f4,-0x18(%rbp)
mov    $0x19c990,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x20(%rbp)
mov    $0x19c990,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <init_array@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1060 <kernel_jacobi_2d@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    11ff <main+0x9f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe1b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    11ff <main+0x9f>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <print_array@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0x19c990,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x19c990,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x514,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <init_array@plt>
mov    $0x1f4,%edi
mov    $0x514,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1060 <kernel_jacobi_2d@plt>
cmp    $0x2b,%ebp
jl     11bf <main+0x6f>
mov    (%r15),%rax
cmpb   $0x0,(%rax)
jne    11bf <main+0x6f>
mov    $0x514,%edi
mov    %rbx,%rsi
call   1040 <print_array@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1300 x [1300 x double]]*
%9 = alloca [1300 x [1300 x double]]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1300, i32* %6
store i32 500, i32* %7
%10 = call i64 @polybench_alloc_data(i32 1690000, i32 8)
%11 = inttoptr i64 %10 to [1300 x [1300 x double]]*
store [1300 x [1300 x double]]* %11, [1300 x [1300 x double]]** %8
%12 = call i64 @polybench_alloc_data(i32 1690000, i32 8)
%13 = inttoptr i64 %12 to [1300 x [1300 x double]]*
store [1300 x [1300 x double]]* %13, [1300 x [1300 x double]]** %9
%14 = load i32, i32* %6
%15 = load [1300 x [1300 x double]]*, [1300 x [1300 x double]]** %8
%16 = getelementptr inbounds [1300 x [1300 x double]], [1300 x [1300 x double]]* %15, i64 0, i64 0
%17 = bitcast [1300 x double]* %16 to double**
%18 = load [1300 x [1300 x double]]*, [1300 x [1300 x double]]** %9
%19 = getelementptr inbounds [1300 x [1300 x double]], [1300 x [1300 x double]]* %18, i64 0, i64 0
%20 = bitcast [1300 x double]* %19 to double**
%21 = call i32 @init_array(i32 %14, double** %17, double** %20)
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = load [1300 x [1300 x double]]*, [1300 x [1300 x double]]** %8
%25 = getelementptr inbounds [1300 x [1300 x double]], [1300 x [1300 x double]]* %24, i64 0, i64 0
%26 = bitcast [1300 x double]* %25 to double**
%27 = load [1300 x [1300 x double]]*, [1300 x [1300 x double]]** %9
%28 = getelementptr inbounds [1300 x [1300 x double]], [1300 x [1300 x double]]* %27, i64 0, i64 0
%29 = bitcast [1300 x double]* %28 to double**
%30 = call i32 @kernel_jacobi_2d(i32 %22, i32 %23, double** %26, double** %29)
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 42
br i1 %32, label %33, label %45
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 @strcmp(i8* %36, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %45, label %39
39: ; preds = %33
%40 = load i32, i32* %6
%41 = load [1300 x [1300 x double]]*, [1300 x [1300 x double]]** %8
%42 = getelementptr inbounds [1300 x [1300 x double]], [1300 x [1300 x double]]* %41, i64 0, i64 0
%43 = bitcast [1300 x double]* %42 to double**
%44 = call i32 @print_array(i32 %40, double** %43)
br label %45
45: ; preds = %39, %33, %2
%46 = load [1300 x [1300 x double]]*, [1300 x [1300 x double]]** %8
%47 = bitcast [1300 x [1300 x double]]* %46 to i8*
%48 = call i32 @free(i8* %47)
%49 = load [1300 x [1300 x double]]*, [1300 x [1300 x double]]** %9
%50 = bitcast [1300 x [1300 x double]]* %49 to i8*
%51 = call i32 @free(i8* %50)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @polybench_alloc_data(i32 1690000, i32 8)
%4 = tail call i64 @polybench_alloc_data(i32 1690000, i32 8)
%5 = inttoptr i64 %3 to double**
%6 = inttoptr i64 %4 to double**
%7 = tail call i32 @init_array(i32 1300, double** %5, double** %6)
%8 = tail call i32 @kernel_jacobi_2d(i32 500, i32 1300, double** %5, double** %6)
%9 = icmp sgt i32 %0, 42
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8*, i8** %1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @print_array(i32 1300, double** %5)
br label %16
16: ; preds = %14, %10, %2
%17 = inttoptr i64 %3 to i8*
%18 = tail call i32 @free(i8* %17)
%19 = inttoptr i64 %4 to i8*
%20 = tail call i32 @free(i8* %19)
ret i32 0
}