#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_1d(int, int, double *, double *);
scalar_t__ polybench_alloc_data(scalar_t__, int);
int /*<<< orphan*/ print_array(int, double *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int n = 2000;
  int tsteps = 500;
  double(*A)[2000 + 0];
  A = (double(*)[2000 + 0]) polybench_alloc_data(2000 + 0, sizeof(double));
  ;
  double(*B)[2000 + 0];
  B = (double(*)[2000 + 0]) polybench_alloc_data(2000 + 0, sizeof(double));
  ;
  init_array(n, *A, *B);
  ;
  kernel_jacobi_1d(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   $0x7d0,-0x14(%rbp)
movl   $0x1f4,-0x18(%rbp)
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x20(%rbp)
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1070 <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   1080 <kernel_jacobi_1d@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    11ff <main+0x9f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe1b(%rip),%rsi
call   1060 <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    $0x7d0,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x7d0,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <init_array@plt>
mov    $0x1f4,%edi
mov    $0x7d0,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1070 <kernel_jacobi_1d@plt>
cmp    $0x2b,%ebp
jl     11bf <main+0x6f>
mov    (%r15),%rax
cmpb   $0x0,(%rax)
jne    11bf <main+0x6f>
mov    $0x7d0,%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 [2000 x double]*
%9 = alloca [2000 x double]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2000, i32* %6
store i32 500, i32* %7
%10 = call i64 @polybench_alloc_data(i64 2000, i32 8)
%11 = inttoptr i64 %10 to [2000 x double]*
store [2000 x double]* %11, [2000 x double]** %8
%12 = call i64 @polybench_alloc_data(i64 2000, i32 8)
%13 = inttoptr i64 %12 to [2000 x double]*
store [2000 x double]* %13, [2000 x double]** %9
%14 = load i32, i32* %6
%15 = load [2000 x double]*, [2000 x double]** %8
%16 = getelementptr inbounds [2000 x double], [2000 x double]* %15, i64 0, i64 0
%17 = load [2000 x double]*, [2000 x double]** %9
%18 = getelementptr inbounds [2000 x double], [2000 x double]* %17, i64 0, i64 0
%19 = call i32 @init_array(i32 %14, double* %16, double* %18)
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = load [2000 x double]*, [2000 x double]** %8
%23 = getelementptr inbounds [2000 x double], [2000 x double]* %22, i64 0, i64 0
%24 = load [2000 x double]*, [2000 x double]** %9
%25 = getelementptr inbounds [2000 x double], [2000 x double]* %24, i64 0, i64 0
%26 = call i32 @kernel_jacobi_1d(i32 %20, i32 %21, double* %23, double* %25)
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, 42
br i1 %28, label %29, label %40
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %29
%36 = load i32, i32* %6
%37 = load [2000 x double]*, [2000 x double]** %8
%38 = getelementptr inbounds [2000 x double], [2000 x double]* %37, i64 0, i64 0
%39 = call i32 @print_array(i32 %36, double* %38)
br label %40
40: ; preds = %35, %29, %2
%41 = load [2000 x double]*, [2000 x double]** %8
%42 = bitcast [2000 x double]* %41 to i8*
%43 = call i32 @free(i8* %42)
%44 = load [2000 x double]*, [2000 x double]** %9
%45 = bitcast [2000 x double]* %44 to i8*
%46 = call i32 @free(i8* %45)
ret i32 0
}

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