#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 printMatrix(float **matrix, char rows, char cols) {
  char i = 0;
  char j = 0;
  for (i = 0; i < rows; i++) {
    for (j = 0; j < cols; j++) {
      printf("%.4f, ", matrix[i][j]);
      if (j == cols - 1) {
        printf("\n");
      }
    }
  }
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movb   $0x0,-0xb(%rbp)
movb   $0x0,-0xc(%rbp)
movb   $0x0,-0xb(%rbp)
movsbl -0xb(%rbp),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jge    11c5 <printMatrix+0xb5>
movb   $0x0,-0xc(%rbp)
movsbl -0xc(%rbp),%eax
movsbl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    11b3 <printMatrix+0xa3>
mov    -0x8(%rbp),%rax
movsbq -0xb(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsbl -0xc(%rbp),%eax
movsbl -0xa(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11a1 <printMatrix+0x91>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a6 <printMatrix+0x96>
mov    -0xc(%rbp),%al
add    $0x1,%al
mov    %al,-0xc(%rbp)
jmp    1147 <printMatrix+0x37>
jmp    11b8 <printMatrix+0xa8>
mov    -0xb(%rbp),%al
add    $0x1,%al
mov    %al,-0xb(%rbp)
jmp    1133 <printMatrix+0x23>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
test   %sil,%sil
jle    11b3 <printMatrix+0x93>
mov    %rdi,%r13
movsbl 0xc(%rsp),%eax
lea    -0x1(%rax),%ebp
movzbl %sil,%ecx
mov    %rcx,0x10(%rsp)
movzbl %al,%ebx
xor    %r14d,%r14d
lea    0xea8(%rip),%r15
jmp    116b <printMatrix+0x4b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    0x10(%rsp),%r14
je     11b3 <printMatrix+0x93>
cmpb   $0x0,0xc(%rsp)
jle    1160 <printMatrix+0x40>
xor    %r12d,%r12d
jmp    1189 <printMatrix+0x69>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    %r12,%rbx
je     1160 <printMatrix+0x40>
mov    0x0(%r13,%r14,8),%rax
movss  (%rax,%r12,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmp    %r12,%rbp
jne    1180 <printMatrix+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1180 <printMatrix+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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