#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 */
scalar_t__ DBL_EPSILON;
scalar_t__ fabs(double);
int /*<<< orphan*/ printf(char *, ...);
void PrintMatrixAsBinary(double *m, int n) {
  int i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++)
      printf("%d ", (fabs(m[i * n + j]) <= DBL_EPSILON) ? 0 : 1);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<PrintMatrixAsBinary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c2 <PrintMatrixAsBinary+0xa2>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a6 <PrintMatrixAsBinary+0x86>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <fabs@plt>
mov    %rax,%rcx
mov    0x2e6e(%rip),%rax
mov    (%rax),%rdx
mov    $0x1,%esi
xor    %eax,%eax
cmp    %rdx,%rcx
cmovle %eax,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <PrintMatrixAsBinary+0x29>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <PrintMatrixAsBinary+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintMatrixAsBinary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11bf <PrintMatrixAsBinary+0x8f>
mov    %rdi,%rbx
mov    %esi,%r15d
lea    0x0(,%r15,8),%rax
mov    %rax,(%rsp)
mov    0x2e8c(%rip),%r13
lea    0xe9d(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rbx,%r12,8),%xmm0
call   1050 <fabs@plt>
xor    %esi,%esi
cmp    0x0(%r13),%rax
setg   %sil
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r15
jne    1180 <PrintMatrixAsBinary+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    (%rsp),%rbx
cmp    %r15,%rbp
jne    1170 <PrintMatrixAsBinary+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@DBL_EPSILON = global i64 0
@.str.1 = [2 x i8] c"\0A\00"
define void @PrintMatrixAsBinary(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %37, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %40
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %32, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %35
16: ; preds = %12
%17 = load double*, double** %3
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = load i32, i32* %6
%22 = add nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %17, i64 %23
%25 = load double, double* %24
%26 = call i64 @fabs(double %25)
%27 = load i64, i64* @DBL_EPSILON
%28 = icmp sle i64 %26, %27
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 0, i32 1
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %16
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %12
35: ; preds = %12
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %7
40: ; preds = %7
ret void
}

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