#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 prntT(double *matrix, int nx, int ny) {
  int i;
  for (i = 1; i <= nx * ny; i++) {
    printf("%f\t", matrix[i - 1]);
    if (i % nx == 0)
      printf("\n");
  }
}


x86 assembly (clang, -O0):
<prntT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     118c <prntT+0x7c>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeac(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1179 <prntT+0x69>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117e <prntT+0x6e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <prntT+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prntT>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebx
imul   %esi,%ebx
test   %ebx,%ebx
jle    1180 <prntT+0x60>
mov    %esi,%r15d
mov    %rdi,%r14
add    $0x1,%ebx
mov    $0x1,%ebp
lea    0xeba(%rip),%r12
jmp    1159 <prntT+0x39>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1180 <prntT+0x60>
movsd  -0x8(%r14,%rbp,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebp,%eax
cltd
idiv   %r15d
test   %edx,%edx
jne    1150 <prntT+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <prntT+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\09\00"
define void @prntT(double* nocapture %0, i32 %1, i32 %2) {
%4 = mul i32 %2, %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %23, label %6
6: ; preds = %3
%7 = add nuw i32 %4, 1
%8 = zext i32 %7 to i64
br label %9
9: ; preds = %6, %20
%10 = phi i64 [ 1, %6 ], [ %21, %20 ]
%11 = add nsw i64 %10, -1
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %13)
%15 = trunc i64 %10 to i32
%16 = srem i32 %15, %1
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %9
%19 = tail call i32 @putchar(i32 10)
br label %20
20: ; preds = %9, %18
%21 = add nuw nsw i64 %10, 1
%22 = icmp eq i64 %21, %8
br i1 %22, label %23, label %9
23: ; preds = %20, %3
ret void
}