#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*/ arrayPrint(int, int, double **);
int /*<<< orphan*/ printf(char *);
int main() {
  int dim1 = 5;
  int dim2 = 6;
  int i, j;
  double array[dim1][dim2];
  for (i = 0; i < dim1; i++) {
    for (j = 0; j < dim2; j++) {
      array[i][j] = i + j;
    }
  }
  double a[5][5];
  arrayPrint(dim1, dim2, array);
  printf("\n");
  arrayPrint(dim1, dim2, a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    %rax,-0x110(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,8),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x108(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f8 <main+0xd8>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e5 <main+0xc5>
mov    -0x108(%rbp),%rax
mov    -0x110(%rbp),%rdx
mov    -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
cvtsi2sd %ecx,%xmm0
movslq -0x10(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119b <main+0x7b>
jmp    11ea <main+0xca>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1188 <main+0x68>
mov    -0x108(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <arrayPrint@plt>
lea    0xdef(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x100(%rbp),%rdx
call   1030 <arrayPrint@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x1b8,%rsp
xorps  %xmm0,%xmm0
movhps 0xecf(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed8(%rip),%xmm1
movaps %xmm1,0x20(%rsp)
movaps 0xedc(%rip),%xmm2
movaps %xmm2,0x30(%rsp)
movaps 0xee0(%rip),%xmm2
movaps %xmm2,0x40(%rsp)
movaps 0xee4(%rip),%xmm3
movaps %xmm3,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm1,0x70(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm2,0x90(%rsp)
movaps %xmm3,0xa0(%rsp)
movaps 0xecf(%rip),%xmm2
movaps %xmm2,0xb0(%rsp)
movaps %xmm1,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
mov    %rsp,%rdx
mov    $0x5,%edi
mov    $0x6,%esi
call   1040 <arrayPrint@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf0(%rsp),%rdx
mov    $0x5,%edi
mov    $0x6,%esi
call   1040 <arrayPrint@plt>
xor    %eax,%eax
add    $0x1b8,%rsp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca [5 x [5 x double]]
store i32 0, i32* %1
store i32 5, i32* %2
store i32 6, i32* %3
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %6
%15 = mul nuw i64 %11, %13
%16 = alloca double, i64 %15
store i64 %11, i64* %7
store i64 %13, i64* %8
store i32 0, i32* %4
br label %17
17: ; preds = %42, %0
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %45
21: ; preds = %17
store i32 0, i32* %5
br label %22
22: ; preds = %38, %21
%23 = load i32, i32* %5
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %41
26: ; preds = %22
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = add nsw i32 %27, %28
%30 = sitofp i32 %29 to double
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = mul nsw i64 %32, %13
%34 = getelementptr inbounds double, double* %16, i64 %33
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
store double %30, double* %37
br label %38
38: ; preds = %26
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %22
41: ; preds = %22
br label %42
42: ; preds = %41
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %17
45: ; preds = %17
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = bitcast double* %16 to double**
%49 = call i32 @arrayPrint(i32 %46, i32 %47, double** %48)
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%51 = load i32, i32* %2
%52 = load i32, i32* %3
%53 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %9, i64 0, i64 0
%54 = bitcast [5 x double]* %53 to double**
%55 = call i32 @arrayPrint(i32 %51, i32 %52, double** %54)
store i32 0, i32* %1
%56 = load i8*, i8** %6
%57 = load i32, i32* %1
ret i32 %57
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x [5 x double]]
%2 = alloca [30 x double]
%3 = bitcast [30 x double]* %2 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 1.000000e+00>, <2 x double>* %3
%4 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 2
%5 = bitcast double* %4 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 3.000000e+00>, <2 x double>* %5
%6 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 4
%7 = bitcast double* %6 to <2 x double>*
store <2 x double> <double 4.000000e+00, double 5.000000e+00>, <2 x double>* %7
%8 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 6
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %9
%10 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 8
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %11
%12 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 10
%13 = bitcast double* %12 to <2 x double>*
store <2 x double> <double 5.000000e+00, double 6.000000e+00>, <2 x double>* %13
%14 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 12
%15 = bitcast double* %14 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 3.000000e+00>, <2 x double>* %15
%16 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 14
%17 = bitcast double* %16 to <2 x double>*
store <2 x double> <double 4.000000e+00, double 5.000000e+00>, <2 x double>* %17
%18 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 16
%19 = bitcast double* %18 to <2 x double>*
store <2 x double> <double 6.000000e+00, double 7.000000e+00>, <2 x double>* %19
%20 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 18
%21 = bitcast double* %20 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %21
%22 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 20
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> <double 5.000000e+00, double 6.000000e+00>, <2 x double>* %23
%24 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 22
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> <double 7.000000e+00, double 8.000000e+00>, <2 x double>* %25
%26 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 24
%27 = bitcast double* %26 to <2 x double>*
store <2 x double> <double 4.000000e+00, double 5.000000e+00>, <2 x double>* %27
%28 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 26
%29 = bitcast double* %28 to <2 x double>*
store <2 x double> <double 6.000000e+00, double 7.000000e+00>, <2 x double>* %29
%30 = getelementptr inbounds [30 x double], [30 x double]* %2, i64 0, i64 28
%31 = bitcast double* %30 to <2 x double>*
store <2 x double> <double 8.000000e+00, double 9.000000e+00>, <2 x double>* %31
%32 = bitcast [5 x [5 x double]]* %1 to i8*
%33 = bitcast [30 x double]* %2 to double**
%34 = call i32 @arrayPrint(i32 5, i32 6, double** %33)
%35 = call i32 @putchar(i32 10)
%36 = bitcast [5 x [5 x double]]* %1 to double**
%37 = call i32 @arrayPrint(i32 5, i32 6, double** %36)
ret i32 0
}