#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, int, double);
void print3(int m, int n, int r, double (*const restrict A)[n][r]) {
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < r; k++)
        printf("(%d,%d,%d)=%lf\n", i, j, k, A[i][j][k]);
}


x86 assembly (clang, -O0):
<print3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ec <print3+0xdc>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d9 <print3+0xc9>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c6 <print3+0xb6>
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdi
imul   %r8,%r9
imul   %r9,%rdi
shl    $0x3,%rdi
add    %rdi,%rax
movslq -0x20(%rbp),%rdi
imul   %r8,%rdi
shl    $0x3,%rdi
add    %rdi,%rax
movslq -0x24(%rbp),%rdi
movsd  (%rax,%rdi,8),%xmm0
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1160 <print3+0x50>
jmp    11cb <print3+0xbb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114d <print3+0x3d>
jmp    11de <print3+0xce>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <print3+0x2a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,0x10(%rsp)
mov    %edx,0xc(%rsp)
mov    %esi,0x8(%rsp)
test   %edi,%edi
jle    11e0 <print3+0xd0>
mov    0xc(%rsp),%r15d
mov    0x8(%rsp),%eax
mov    %edi,%ecx
mov    %rcx,0x20(%rsp)
mov    %r15,%rcx
mov    %rax,0x30(%rsp)
imul   %rax,%rcx
shl    $0x3,%rcx
mov    %rcx,0x18(%rsp)
lea    0x0(,%r15,8),%rax
mov    %rax,0x28(%rsp)
xor    %ebx,%ebx
lea    0xe92(%rip),%r13
jmp    1185 <print3+0x75>
add    $0x1,%rbx
mov    0x18(%rsp),%rax
add    %rax,0x10(%rsp)
cmp    0x20(%rsp),%rbx
je     11e0 <print3+0xd0>
cmpl   $0x0,0x8(%rsp)
jle    1170 <print3+0x60>
mov    0x10(%rsp),%r12
xor    %ebp,%ebp
jmp    11b0 <print3+0xa0>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
add    0x28(%rsp),%r12
cmp    0x30(%rsp),%rbp
je     1170 <print3+0x60>
cmpl   $0x0,0xc(%rsp)
jle    11a0 <print3+0x90>
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%r14,8),%xmm0
mov    %r13,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    11c0 <print3+0xb0>
jmp    11a0 <print3+0x90>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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