#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*/ printf(char *, int, int, double);
void array_print(double *array[]) {
  {
    int element1, element2;
    for (element1 = 0; element1 < (2); ++element1) {
      for (element2 = 0; element2 < (2); ++element2)
        printf("array"
               "[%d][%d] = %f\n",
               element1, element2, array[element1][element2]);
    }
  };
}


x86 assembly (clang, -O0):
<array_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1186 <array_print+0x76>
movl   $0x0,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jge    1173 <array_print+0x63>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <array_print+0x24>
jmp    1178 <array_print+0x68>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <array_print+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_print>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rax
movsd  (%rax),%xmm0
lea    0xedb(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <printf@plt>
mov    (%rbx),%rax
movsd  0x8(%rax),%xmm0
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
mov    0x8(%rbx),%rax
movsd  (%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <printf@plt>
mov    0x8(%rbx),%rax
movsd  0x8(%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"array[%d][%d] = %f\0A\00"
define void @array_print(double** %0) {
%2 = alloca double**
%3 = alloca i32
%4 = alloca i32
store double** %0, double*** %2
store i32 0, i32* %3
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %32
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %25, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = load double**, double*** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double*, double** %15, i64 %17
%19 = load double*, double** %18
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, double %23)
br label %25
25: ; preds = %12
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %9
28: ; preds = %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %5
32: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"array[%d][%d] = %f\0A\00"
define void @array_print(double** nocapture %0) {
%2 = load double*, double** %0
%3 = load double, double* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, double %3)
%5 = load double*, double** %0
%6 = getelementptr inbounds double, double* %5, i64 1
%7 = load double, double* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, double %7)
%9 = getelementptr inbounds double*, double** %0, i64 1
%10 = load double*, double** %9
%11 = load double, double* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 1, i32 0, double %11)
%13 = load double*, double** %9
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 1, i32 1, double %15)
ret void
}