#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);
void printMatrix(double *array) {
  int i, j;
  for (i = 1; i < 2048 - 1; i++) {
    for (j = 1; j < 2048 - 1; j++)
      printf("%f\t", array[i * 2048 + j]);
  }
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x7ff,-0xc(%rbp)
jge    1186 <printMatrix+0x76>
movl   $0x1,-0x10(%rbp)
cmpl   $0x7ff,-0x10(%rbp)
jge    1173 <printMatrix+0x63>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0xb,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%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    1137 <printMatrix+0x27>
jmp    1178 <printMatrix+0x68>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <printMatrix+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
add    $0x4008,%r12
mov    $0x1,%r15d
lea    0xed1(%rip),%r14
nop
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rbx,8),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x7fe,%rbx
jne    1140 <printMatrix+0x30>
add    $0x1,%r15
add    $0x4000,%r12
cmp    $0x7ff,%r15
jne    1130 <printMatrix+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\09\00"
define void @printMatrix(double* nocapture %0) {
br label %2
2: ; preds = %1, %13
%3 = phi i64 [ 1, %1 ], [ %14, %13 ]
%4 = shl nsw i64 %3, 11
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 1, %2 ], [ %11, %5 ]
%7 = add nuw nsw i64 %6, %4
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
%11 = add nuw nsw i64 %6, 1
%12 = icmp eq i64 %11, 2047
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = add nuw nsw i64 %3, 1
%15 = icmp eq i64 %14, 2047
br i1 %15, label %16, label %2
16: ; preds = %13
ret void
}