#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, int, int, double **, double **, double **,
                              double *);
int /*<<< orphan*/ kernel_fdtd_2d(int, int, int, double **, double **,
                                  double **, double *);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, int, double **, double **, double **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int tmax = 500;
  int nx = 1000;
  int ny = 1200;
  double(*ex)[1000 + 0][1200 + 0];
  ex = (double(*)[1000 + 0][1200 + 0])
      polybench_alloc_data((1000 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*ey)[1000 + 0][1200 + 0];
  ey = (double(*)[1000 + 0][1200 + 0])
      polybench_alloc_data((1000 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*hz)[1000 + 0][1200 + 0];
  hz = (double(*)[1000 + 0][1200 + 0])
      polybench_alloc_data((1000 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*_fict_)[500 + 0];
  _fict_ = (double(*)[500 + 0]) polybench_alloc_data(500 + 0, sizeof(double));
  ;
  init_array(tmax, nx, ny, *ex, *ey, *hz, *_fict_);
  ;
  kernel_fdtd_2d(tmax, nx, ny, *ex, *ey, *hz, *_fict_);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(nx, ny, *ex, *ey, *hz);
  free((void *)ex);
  ;
  free((void *)ey);
  ;
  free((void *)hz);
  ;
  free((void *)_fict_);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1f4,-0x14(%rbp)
movl   $0x3e8,-0x18(%rbp)
movl   $0x4b0,-0x1c(%rbp)
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x28(%rbp)
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x30(%rbp)
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    $0x1f4,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    -0x40(%rbp),%rax
mov    %rax,(%rsp)
call   1050 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    -0x40(%rbp),%rax
mov    %rax,(%rsp)
call   1060 <kernel_fdtd_2d@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    1258 <main+0xf8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdcd(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1258 <main+0xf8>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
call   1040 <print_array@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%ebp
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r15
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x1f4,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r13
mov    %rax,(%rsp)
mov    $0x1f4,%edi
mov    $0x3e8,%esi
mov    $0x4b0,%edx
mov    %r14,%rcx
mov    %r15,%r8
mov    %rbx,%r9
call   1050 <init_array@plt>
mov    %r13,(%rsp)
mov    $0x1f4,%edi
mov    $0x3e8,%esi
mov    $0x4b0,%edx
mov    %r14,%rcx
mov    %r15,%r8
mov    %rbx,%r9
call   1060 <kernel_fdtd_2d@plt>
cmp    $0x2b,%ebp
jl     1210 <main+0xc0>
mov    (%r12),%rax
cmpb   $0x0,(%rax)
jne    1210 <main+0xc0>
mov    $0x3e8,%edi
mov    $0x4b0,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1040 <print_array@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 i32
%9 = alloca [1000 x [1200 x double]]*
%10 = alloca [1000 x [1200 x double]]*
%11 = alloca [1000 x [1200 x double]]*
%12 = alloca [500 x double]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 500, i32* %6
store i32 1000, i32* %7
store i32 1200, i32* %8
%13 = call i64 @polybench_alloc_data(i32 1200000, i32 8)
%14 = inttoptr i64 %13 to [1000 x [1200 x double]]*
store [1000 x [1200 x double]]* %14, [1000 x [1200 x double]]** %9
%15 = call i64 @polybench_alloc_data(i32 1200000, i32 8)
%16 = inttoptr i64 %15 to [1000 x [1200 x double]]*
store [1000 x [1200 x double]]* %16, [1000 x [1200 x double]]** %10
%17 = call i64 @polybench_alloc_data(i32 1200000, i32 8)
%18 = inttoptr i64 %17 to [1000 x [1200 x double]]*
store [1000 x [1200 x double]]* %18, [1000 x [1200 x double]]** %11
%19 = call i64 @polybench_alloc_data(i32 500, i32 8)
%20 = inttoptr i64 %19 to [500 x double]*
store [500 x double]* %20, [500 x double]** %12
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %9
%25 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %24, i64 0, i64 0
%26 = bitcast [1200 x double]* %25 to double**
%27 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%28 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %27, i64 0, i64 0
%29 = bitcast [1200 x double]* %28 to double**
%30 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %11
%31 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %30, i64 0, i64 0
%32 = bitcast [1200 x double]* %31 to double**
%33 = load [500 x double]*, [500 x double]** %12
%34 = getelementptr inbounds [500 x double], [500 x double]* %33, i64 0, i64 0
%35 = call i32 @init_array(i32 %21, i32 %22, i32 %23, double** %26, double** %29, double** %32, double* %34)
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %9
%40 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %39, i64 0, i64 0
%41 = bitcast [1200 x double]* %40 to double**
%42 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%43 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %42, i64 0, i64 0
%44 = bitcast [1200 x double]* %43 to double**
%45 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %11
%46 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %45, i64 0, i64 0
%47 = bitcast [1200 x double]* %46 to double**
%48 = load [500 x double]*, [500 x double]** %12
%49 = getelementptr inbounds [500 x double], [500 x double]* %48, i64 0, i64 0
%50 = call i32 @kernel_fdtd_2d(i32 %36, i32 %37, i32 %38, double** %41, double** %44, double** %47, double* %49)
%51 = load i32, i32* %4
%52 = icmp sgt i32 %51, 42
br i1 %52, label %53, label %72
53: ; preds = %2
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 0
%56 = load i8*, i8** %55
%57 = call i32 @strcmp(i8* %56, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%58 = icmp ne i32 %57, 0
br i1 %58, label %72, label %59
59: ; preds = %53
%60 = load i32, i32* %7
%61 = load i32, i32* %8
%62 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %9
%63 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %62, i64 0, i64 0
%64 = bitcast [1200 x double]* %63 to double**
%65 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%66 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %65, i64 0, i64 0
%67 = bitcast [1200 x double]* %66 to double**
%68 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %11
%69 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %68, i64 0, i64 0
%70 = bitcast [1200 x double]* %69 to double**
%71 = call i32 @print_array(i32 %60, i32 %61, double** %64, double** %67, double** %70)
br label %72
72: ; preds = %59, %53, %2
%73 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %9
%74 = bitcast [1000 x [1200 x double]]* %73 to i8*
%75 = call i32 @free(i8* %74)
%76 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%77 = bitcast [1000 x [1200 x double]]* %76 to i8*
%78 = call i32 @free(i8* %77)
%79 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %11
%80 = bitcast [1000 x [1200 x double]]* %79 to i8*
%81 = call i32 @free(i8* %80)
%82 = load [500 x double]*, [500 x double]** %12
%83 = bitcast [500 x double]* %82 to i8*
%84 = call i32 @free(i8* %83)
ret i32 0
}

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