void print(int Nrows, int Ncolumns, int *board) {
  int r, c;
  system("clear");
  for (r = 0; r < Nrows; ++r) {
    for (c = 0; c < Ncolumns; ++c) {
      if (board[((r)*Ncolumns + (c))] == 1)
        printf("*");
      else
        printf(" ");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <system@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d1 <print+0xb1>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b5 <print+0x95>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1194 <print+0x74>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a2 <print+0x82>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a7 <print+0x87>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <print+0x3a>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <print+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,0x4(%rsp)
mov    %edi,%r14d
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <system@plt>
test   %r14d,%r14d
jle    11b1 <print+0x91>
movslq 0x4(%rsp),%r12
mov    %r14d,%r14d
mov    %r12d,%ebp
shl    $0x2,%r12
xor    %r13d,%r13d
jmp    1176 <print+0x56>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    %r12,%rbx
cmp    %r14,%r13
je     11b1 <print+0x91>
cmpl   $0x0,0x4(%rsp)
jle    1160 <print+0x40>
xor    %r15d,%r15d
jmp    119e <print+0x7e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1030 <putchar@plt>
add    $0x1,%r15
cmp    %r15,%rbp
je     1160 <print+0x40>
cmpl   $0x1,(%rbx,%r15,4)
mov    $0x2a,%edi
je     1190 <print+0x70>
mov    $0x20,%edi
jmp    1190 <print+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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