#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 get_matrix(unsigned int **, int, int);
int /*<<< orphan*/ printf(char *, ...);
void print_M_2(unsigned int **M, int r, int c) {
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j)
      printf("%u", get_matrix(M, i, j) % 2);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_M_2>:
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
cmp    -0xc(%rbp),%eax
jge    11a9 <print_M_2+0x89>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118d <print_M_2+0x6d>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <get_matrix@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <print_M_2+0x2c>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <print_M_2+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_M_2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11ae <print_M_2+0x7e>
mov    %edx,%r13d
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xeb1(%rip),%r15
xor    %ebp,%ebp
jmp    1172 <print_M_2+0x42>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r14d,%ebp
je     11ae <print_M_2+0x7e>
test   %r13d,%r13d
jle    1160 <print_M_2+0x30>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <get_matrix@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r13d
jne    1180 <print_M_2+0x50>
jmp    1160 <print_M_2+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_M_2(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %30, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %33
13: ; preds = %9
store i32 0, i32* %8
br label %14
14: ; preds = %25, %13
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i32**, i32*** %4
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = call i32 @get_matrix(i32** %19, i32 %20, i32 %21)
%23 = srem i32 %22, 2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %14
28: ; preds = %14
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %9
33: ; preds = %9
ret void
}

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