#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 *, double);
testArray() {
  double array[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 0, 1, 2}};
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 4; j++) {
      printf("num = %.2f\n", array[i][j]);
    }
  }
}


x86 assembly (clang, -O0):
<testArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x70(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    11a7 <testArray+0x87>
movl   $0x0,-0x78(%rbp)
cmpl   $0x4,-0x78(%rbp)
jge    1194 <testArray+0x74>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1158 <testArray+0x38>
jmp    1199 <testArray+0x79>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1147 <testArray+0x27>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testArray>:
push   %rbx
lea    0xf30(%rip),%rbx
movsd  0xee0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xed8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xed0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xec8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xec0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xeb8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xeb0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xea8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xea0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xe42(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xe3a(%rip),%xmm0
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@__const.testArray.array = [3 x [4 x double]] [[4 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00], [4 x double] [double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00], [4 x double] [double 9.000000e+00, double 0.000000e+00, double 1.000000e+00, double 2.000000e+00]]
@.str = [12 x i8] c"num = %.2f\0A\00"
define i32 @testArray() {
%1 = alloca i32
%2 = alloca [3 x [4 x double]]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [3 x [4 x double]]* %2 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %26, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %29
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %22, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [3 x [4 x double]], [3 x [4 x double]]* %2, i64 0, i64 %15
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 %18
%20 = load double, double* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %20)
br label %22
22: ; preds = %13
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %10
25: ; preds = %10
br label %26
26: ; preds = %25
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %6
29: ; preds = %6
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [12 x i8] c"num = %.2f\0A\00"
define i32 @testArray() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 2.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 3.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 4.000000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 5.000000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 6.000000e+00)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 7.000000e+00)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 8.000000e+00)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 9.000000e+00)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 0.000000e+00)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 2.000000e+00)
ret i32 undef
}