#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_tile(const double *D, int ldD, int nR, int nC) {
  register int i, j;
  for (i = 0; i < nR; i++) {
    printf("[");
    for (j = 0; j < nC; j++) {
      if (j != 0)
        printf(", ");
      printf("%9.2e", D[j * ldD + i]);
    }
    printf("]\n");
  }
}


x86 assembly (clang, -O0):
<print_tile>:
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    -0x10(%rbp),%eax
jge    11bf <print_tile+0xaf>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a3 <print_tile+0x93>
cmpl   $0x0,-0x1c(%rbp)
je     1171 <print_tile+0x61>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe77(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114d <print_tile+0x3d>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112c <print_tile+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,0x4(%rsp)
mov    %rdi,0x8(%rsp)
test   %edx,%edx
jle    1217 <print_tile+0xe7>
movslq %esi,%rbp
mov    %edx,%eax
mov    %rax,0x20(%rsp)
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%rax
lea    (%rax,%rbp,8),%rax
mov    %rax,0x10(%rsp)
shl    $0x3,%rbp
add    $0xffffffffffffffff,%rcx
mov    %rcx,0x18(%rsp)
xor    %r12d,%r12d
jmp    119d <print_tile+0x6d>
nopl   (%rax)
lea    0xe82(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r12
addq   $0x8,0x10(%rsp)
cmp    0x20(%rsp),%r12
je     1217 <print_tile+0xe7>
mov    $0x5b,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
lea    0xe4d(%rip),%rbx
lea    0xe49(%rip),%r13
jle    1180 <print_tile+0x50>
mov    0x8(%rsp),%rax
movsd  (%rax,%r12,8),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cmpl   $0x1,0x4(%rsp)
je     1180 <print_tile+0x50>
mov    0x18(%rsp),%r15
mov    0x10(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%r14),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    %rbp,%r14
add    $0xffffffffffffffff,%r15
jne    11f0 <print_tile+0xc0>
jmp    1180 <print_tile+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"[\00"
@.str.1 = [3 x i8] c", \00"
@.str.2 = [6 x i8] c"%9.2e\00"
@.str.3 = [3 x i8] c"]\0A\00"
define void @print_tile(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
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 %11
11: ; preds = %42, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %45
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %10
br label %17
17: ; preds = %37, %15
%18 = load i32, i32* %10
%19 = load i32, i32* %8
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %40
21: ; preds = %17
%22 = load i32, i32* %10
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
%27 = load double*, double** %5
%28 = load i32, i32* %10
%29 = load i32, i32* %6
%30 = mul nsw i32 %28, %29
%31 = load i32, i32* %9
%32 = add nsw i32 %30, %31
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %27, i64 %33
%35 = load double, double* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %35)
br label %37
37: ; preds = %26
%38 = load i32, i32* %10
%39 = add nsw i32 %38, 1
store i32 %39, i32* %10
br label %17
40: ; preds = %17
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %11
45: ; preds = %11
ret void
}

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