#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 *, ...);
void print_double_array(double ***array, int dim1, int dim2, int dim3) {
  int i, j, k;
  for (i = 0; i < dim1; i++) {
    printf("x = %d\n", i);
    for (j = 0; j < dim2; j++) {
      printf("#%d\t", j);
      for (k = 0; k < dim3; k++) {
        printf("%.2e ", array[i][j][k]);
      }
      printf("\n");
    }
    printf("\n");
  }
  return;
}


x86 assembly (clang, -O0):
<print_double_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f1 <print_double_array+0xe1>
mov    -0x18(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d5 <print_double_array+0xc5>
mov    -0x1c(%rbp),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b9 <print_double_array+0xa9>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe69(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1174 <print_double_array+0x64>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <print_double_array+0x40>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112c <print_double_array+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_double_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0x4(%rsp)
mov    %edx,(%rsp)
test   %esi,%esi
jle    11f4 <print_double_array+0xd4>
mov    %rdi,%rbp
mov    %esi,%eax
mov    %rax,0x8(%rsp)
mov    (%rsp),%eax
mov    %rax,0x10(%rsp)
mov    0x4(%rsp),%r13d
lea    0xeb2(%rip),%rbx
xor    %r15d,%r15d
jmp    1175 <print_double_array+0x55>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
cmp    0x8(%rsp),%r15
je     11f4 <print_double_array+0xd4>
lea    0xe84(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,(%rsp)
jle    1160 <print_double_array+0x40>
xor    %r14d,%r14d
jmp    11b5 <print_double_array+0x95>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    0x10(%rsp),%r14
je     1160 <print_double_array+0x40>
lea    0xe4c(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11a0 <print_double_array+0x80>
xor    %r12d,%r12d
mov    0x0(%rbp,%r15,8),%rax
mov    (%rax,%r14,8),%rax
movsd  (%rax,%r12,8),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r13
jne    11d0 <print_double_array+0xb0>
jmp    11a0 <print_double_array+0x80>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"x = %d\0A\00"
@.str.1 = [5 x i8] c"#%d\09\00"
@.str.2 = [6 x i8] c"%.2e \00"
define void @print_double_array(double*** nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %40
6: ; preds = %4
%7 = icmp sgt i32 %2, 0
%8 = icmp sgt i32 %3, 0
%9 = zext i32 %1 to i64
%10 = zext i32 %2 to i64
%11 = zext i32 %3 to i64
br label %12
12: ; preds = %6, %36
%13 = phi i64 [ 0, %6 ], [ %38, %36 ]
%14 = trunc i64 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %14)
br i1 %7, label %16, label %36
16: ; preds = %12
%17 = getelementptr inbounds double**, double*** %0, i64 %13
br label %18
18: ; preds = %16, %32
%19 = phi i64 [ 0, %16 ], [ %34, %32 ]
%20 = trunc i64 %19 to i32
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br i1 %8, label %22, label %32
22: ; preds = %18, %22
%23 = phi i64 [ %30, %22 ], [ 0, %18 ]
%24 = load double**, double*** %17
%25 = getelementptr inbounds double*, double** %24, i64 %19
%26 = load double*, double** %25
%27 = getelementptr inbounds double, double* %26, i64 %23
%28 = load double, double* %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = add nuw nsw i64 %23, 1
%31 = icmp eq i64 %30, %11
br i1 %31, label %32, label %22
32: ; preds = %22, %18
%33 = tail call i32 @putchar(i32 10)
%34 = add nuw nsw i64 %19, 1
%35 = icmp eq i64 %34, %10
br i1 %35, label %36, label %18
36: ; preds = %32, %12
%37 = tail call i32 @putchar(i32 10)
%38 = add nuw nsw i64 %13, 1
%39 = icmp eq i64 %38, %9
br i1 %39, label %40, label %12
40: ; preds = %36, %4
ret void
}