#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 displayMatrix(double *sparse_matrix, int row_n, int column_n) {
  for (int i = 0; i < row_n * column_n; i++) {
    if (i % column_n == 0) {
      printf("\n");
    }
    printf("%lf\t", *(sparse_matrix + i));
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<displayMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1182 <displayMatrix+0x72>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1159 <displayMatrix+0x49>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe93(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <displayMatrix+0x19>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
imul   %edx,%esi
test   %esi,%esi
jle    118f <displayMatrix+0x5f>
mov    %edx,%r12d
mov    %rdi,%r14
mov    %esi,%ebp
xor    %ebx,%ebx
lea    0xeb0(%rip),%r15
jmp    1179 <displayMatrix+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r14,%rbx,8),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     118f <displayMatrix+0x5f>
mov    %ebx,%eax
cltd
idiv   %r12d
test   %edx,%edx
jne    1160 <displayMatrix+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <displayMatrix+0x30>
lea    0xe6f(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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