#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 fabs(double);
int /*<<< orphan*/ printf(char *, ...);
void m_print(double *a, int nrow, int ncol, char *s) {
  int i, j;
  printf("%s:\n", s);
  for (i = 0; i < nrow; i++) {
    for (j = 0; j < ncol; j++, a++)
      printf("  %4g", (fabs(*a) > 1e-16) ? *a : 0);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<m_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f9 <m_print+0xd9>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11dd <m_print+0xbd>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe79(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a3 <m_print+0x83>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11b0 <m_print+0x90>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11b0 <m_print+0x90>
movsd  -0x28(%rbp),%xmm0
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1162 <m_print+0x42>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <m_print+0x2f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0xeb5(%rip),%rdi
xor    %r12d,%r12d
mov    %rcx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    11bb <m_print+0x8b>
lea    0xea1(%rip),%r13
jmp    1183 <m_print+0x53>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    %r14d,%r12d
je     11bb <m_print+0x8b>
test   %r15d,%r15d
jle    1170 <m_print+0x40>
mov    %r15d,%ebx
jmp    11a8 <m_print+0x78>
nopl   (%rax)
movsd  0x0(%rbp),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x8,%rbp
add    $0xffffffff,%ebx
je     1170 <m_print+0x40>
movsd  0x0(%rbp),%xmm0
call   1050 <fabs@plt>
test   %eax,%eax
jg     1190 <m_print+0x60>
xorps  %xmm0,%xmm0
jmp    1195 <m_print+0x65>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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