#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 **);
int /*<<< orphan*/ kernel_seidel_2d(int, int, 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 = 2000;
  int tsteps = 500;
  double(*A)[2000 + 0][2000 + 0];
  A = (double(*)[2000 + 0][2000 + 0])
      polybench_alloc_data((2000 + 0) * (2000 + 0), sizeof(double));
  ;
  init_array(n, *A);
  ;
  kernel_seidel_2d(tsteps, n, *A);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(n, *A);
  free((void *)A);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x7d0,-0x14(%rbp)
movl   $0x1f4,-0x18(%rbp)
mov    $0x3d0900,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1050 <init_array@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1080 <kernel_seidel_2d@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    11e4 <main+0x84>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe36(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11e4 <main+0x84>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <print_array@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x3d0900,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x7d0,%edi
mov    %rax,%rsi
call   1050 <init_array@plt>
mov    $0x1f4,%edi
mov    $0x7d0,%esi
mov    %rbx,%rdx
call   1070 <kernel_seidel_2d@plt>
cmp    $0x2b,%ebp
jl     11a4 <main+0x54>
mov    (%r14),%rax
cmpb   $0x0,(%rax)
jne    11a4 <main+0x54>
mov    $0x7d0,%edi
mov    %rbx,%rsi
call   1040 <print_array@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
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 [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
%9 = call i64 @polybench_alloc_data(i32 4000000, i32 8)
%10 = inttoptr i64 %9 to [2000 x [2000 x double]]*
store [2000 x [2000 x double]]* %10, [2000 x [2000 x double]]** %8
%11 = load i32, i32* %6
%12 = load [2000 x [2000 x double]]*, [2000 x [2000 x double]]** %8
%13 = getelementptr inbounds [2000 x [2000 x double]], [2000 x [2000 x double]]* %12, i64 0, i64 0
%14 = bitcast [2000 x double]* %13 to double**
%15 = call i32 @init_array(i32 %11, double** %14)
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = load [2000 x [2000 x double]]*, [2000 x [2000 x double]]** %8
%19 = getelementptr inbounds [2000 x [2000 x double]], [2000 x [2000 x double]]* %18, i64 0, i64 0
%20 = bitcast [2000 x double]* %19 to double**
%21 = call i32 @kernel_seidel_2d(i32 %16, i32 %17, double** %20)
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 42
br i1 %23, label %24, label %36
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %36, label %30
30: ; preds = %24
%31 = load i32, i32* %6
%32 = load [2000 x [2000 x double]]*, [2000 x [2000 x double]]** %8
%33 = getelementptr inbounds [2000 x [2000 x double]], [2000 x [2000 x double]]* %32, i64 0, i64 0
%34 = bitcast [2000 x double]* %33 to double**
%35 = call i32 @print_array(i32 %31, double** %34)
br label %36
36: ; preds = %30, %24, %2
%37 = load [2000 x [2000 x double]]*, [2000 x [2000 x double]]** %8
%38 = bitcast [2000 x [2000 x double]]* %37 to i8*
%39 = call i32 @free(i8* %38)
ret i32 0
}

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