#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 printmat(char str[], float **a, int row, int col) {
  int i, j;
  printf("\n");
  for (i = 1; i <= row; i++) {
    for (j = 1; j <= col; j++) {
      printf("%s[%d][%d] = %14.10f\n", str, i, j, a[i][j]);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printmat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11ac <printmat+0x9c>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1199 <printmat+0x89>
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rdi
mov    (%rax,%rdi,8),%rax
movslq -0x20(%rbp),%rdi
movss  (%rax,%rdi,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114e <printmat+0x3e>
jmp    119e <printmat+0x8e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <printmat+0x2b>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printmat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %edx,%ebx
mov    %rsi,%r12
mov    %rdi,%r13
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,0x8(%rsp)
test   %ebx,%ebx
jle    11cb <printmat+0xab>
mov    0x10(%rsp),%rax
lea    0x1(%rax),%r15d
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    $0x1,%ebx
lea    0xe90(%rip),%rbp
jmp    118b <printmat+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    0x8(%rsp),%rbx
je     11cb <printmat+0xab>
cmpl   $0x0,0x10(%rsp)
jle    1180 <printmat+0x60>
mov    $0x1,%r14d
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rax
movss  (%rax,%r14,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    11a0 <printmat+0x80>
jmp    1180 <printmat+0x60>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [22 x i8] c"%s[%d][%d] = %14.10f\0A\00"
define void @printmat(i8* %0, float** %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca float**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store float** %1, float*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %9
br label %12
12: ; preds = %40, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %7
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %43
16: ; preds = %12
store i32 1, i32* %10
br label %17
17: ; preds = %36, %16
%18 = load i32, i32* %10
%19 = load i32, i32* %8
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %39
21: ; preds = %17
%22 = load i8*, i8** %5
%23 = load i32, i32* %9
%24 = load i32, i32* %10
%25 = load float**, float*** %6
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds float*, float** %25, i64 %27
%29 = load float*, float** %28
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %29, i64 %31
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32 %23, i32 %24, double %34)
br label %36
36: ; preds = %21
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
store i32 %38, i32* %10
br label %17
39: ; preds = %17
br label %40
40: ; preds = %39
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %12
43: ; preds = %12
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

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