#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 matrixPrintL(long *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("%d", matrix[numCols * i + j]);
      writeDebugStream("\t");
    }
    writeDebugStreamLine("");
  }
}


x86 assembly (clang, -O0):
<matrixPrintL>:
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    11d9 <matrixPrintL+0xb9>
movw   $0x0,-0x1c(%rbp)
movswl -0x1c(%rbp),%eax
movswl -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11bc <matrixPrintL+0x9c>
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
mov    (%rax,%rcx,8),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <writeDebugStream@plt>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <writeDebugStream@plt>
mov    -0x1c(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x1c(%rbp)
jmp    1163 <matrixPrintL+0x43>
lea    0xe41(%rip),%rdi
call   1030 <writeDebugStreamLine@plt>
mov    -0x1a(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x1a(%rbp)
jmp    114d <matrixPrintL+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrixPrintL>:
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    120a <matrixPrintL+0xea>
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 <matrixPrintL+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     120a <matrixPrintL+0xea>
mov    %rcx,0x30(%rsp)
cmpw   $0x0,0xc(%rsp)
jle    1190 <matrixPrintL+0x70>
mov    0x18(%rsp),%r12
mov    0x10(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rax
sar    $0x1d,%rax
mov    (%rbx,%rax,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <writeDebugStream@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <writeDebugStream@plt>
add    %r14,%r13
add    $0xffffffffffffffff,%r12
jne    11e0 <matrixPrintL+0xc0>
jmp    1190 <matrixPrintL+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"%d\00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [1 x i8] zeroinitializer
define void @matrixPrintL(i64* %0, i16 signext %1, i16 signext %2, i8* %3) {
%5 = alloca i64*
%6 = alloca i16
%7 = alloca i16
%8 = alloca i8*
%9 = alloca i16
%10 = alloca i16
store i64* %0, i64** %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 = %46, %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 %49
19: ; preds = %13
store i16 0, i16* %10
br label %20
20: ; preds = %41, %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 %44
26: ; preds = %20
%27 = load i64*, i64** %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 i64, i64* %27, i64 %36
%38 = load i64, i64* %37
%39 = call i32 (i8*, ...) @writeDebugStream(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %38)
%40 = call i32 (i8*, ...) @writeDebugStream(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %26
%42 = load i16, i16* %10
%43 = add i16 %42, 1
store i16 %43, i16* %10
br label %20
44: ; preds = %20
%45 = call i32 @writeDebugStreamLine(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i16, i16* %9
%48 = add i16 %47, 1
store i16 %48, i16* %9
br label %13
49: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [1 x i8] zeroinitializer
define void @matrixPrintL(i64* 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 %31
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, %27
%13 = phi i64 [ 0, %7 ], [ %29, %27 ]
br i1 %8, label %14, label %27
14: ; preds = %12
%15 = mul nsw i64 %13, %9
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %25, %16 ]
%18 = add nsw i64 %15, %17
%19 = shl i64 %18, 32
%20 = ashr exact i64 %19, 32
%21 = getelementptr inbounds i64, i64* %0, i64 %20
%22 = load i64, i64* %21
%23 = tail call i32 (i8*, ...) @writeDebugStream(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %22)
%24 = tail call i32 (i8*, ...) @writeDebugStream(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = add nuw nsw i64 %17, 1
%26 = icmp eq i64 %25, %11
br i1 %26, label %27, label %16
27: ; preds = %16, %12
%28 = tail call i32 @writeDebugStreamLine(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%29 = add nuw nsw i64 %13, 1
%30 = icmp eq i64 %29, %10
br i1 %30, label %31, label %12
31: ; preds = %27, %4
ret void
}