#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*/ writeDebugStream(char *, ...);
int /*<<< orphan*/ writeDebugStreamLine(char *);
void matrixPrintF(float *matrix, short numRows, short numCols, char *label) {
  short i, j;
  writeDebugStreamLine(label);
  for (i = 0; i < numRows; i++) {
    for (j = 0; j < numCols; j++) {
      writeDebugStream("%f", matrix[numCols * i + j]);
      writeDebugStream("\t");
    }
    writeDebugStreamLine("");
  }
}


x86 assembly (clang, -O0):
<matrixPrintF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dx,%ax
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <writeDebugStreamLine@plt>
movw   $0x0,-0x1a(%rbp)
movswl -0x1a(%rbp),%eax
movswl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    11de <matrixPrintF+0xbe>
movw   $0x0,-0x1c(%rbp)
movswl -0x1c(%rbp),%eax
movswl -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11c1 <matrixPrintF+0xa1>
mov    -0x8(%rbp),%rax
movswl -0xc(%rbp),%ecx
movswl -0x1a(%rbp),%edx
imul   %edx,%ecx
movswl -0x1c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1040 <writeDebugStream@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1040 <writeDebugStream@plt>
mov    -0x1c(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x1c(%rbp)
jmp    1163 <matrixPrintF+0x43>
lea    0xe3c(%rip),%rdi
call   1030 <writeDebugStreamLine@plt>
mov    -0x1a(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x1a(%rbp)
jmp    114d <matrixPrintF+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrixPrintF>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rcx,%rdi
call   1030 <writeDebugStreamLine@plt>
test   %bp,%bp
jle    120f <matrixPrintF+0xef>
movswq 0xc(%rsp),%rax
movzwl %bp,%ecx
mov    %rcx,0x20(%rsp)
movzwl %ax,%ecx
mov    %rcx,0x18(%rsp)
shl    $0x20,%rax
mov    %rax,0x28(%rsp)
lea    0xe92(%rip),%r15
lea    0xe8e(%rip),%rbp
movabs $0x100000000,%r14
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %ecx,%ecx
jmp    11bb <matrixPrintF+0x9b>
nopw   0x0(%rax,%rax,1)
lea    0xe6d(%rip),%rdi
call   1030 <writeDebugStreamLine@plt>
mov    0x30(%rsp),%rcx
add    $0x1,%rcx
mov    0x10(%rsp),%rax
add    0x28(%rsp),%rax
mov    %rax,0x10(%rsp)
cmp    0x20(%rsp),%rcx
je     120f <matrixPrintF+0xef>
mov    %rcx,0x30(%rsp)
cmpw   $0x0,0xc(%rsp)
jle    1190 <matrixPrintF+0x70>
mov    0x18(%rsp),%r12
mov    0x10(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rax
sar    $0x1e,%rax
movss  (%rbx,%rax,1),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <writeDebugStream@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <writeDebugStream@plt>
add    %r14,%r13
add    $0xffffffffffffffff,%r12
jne    11e0 <matrixPrintF+0xc0>
jmp    1190 <matrixPrintF+0x70>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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