#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 print_bitmap(int col, int row, int bitmap[col][row]) {
  int c, r;
  ;
  for (r = 0; r < row; r++) {
    for (c = 0; c < col; c++) {
      if (bitmap[c][r] == 0)
        printf(". ");
      else if (bitmap[c][r] == 1)
        printf("* ");
      else
        printf("O ");
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_bitmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f9 <print_bitmap+0xe9>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11df <print_bitmap+0xcf>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1185 <print_bitmap+0x75>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    11cc <print_bitmap+0xbc>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    11bb <print_bitmap+0xab>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
jmp    11c7 <print_bitmap+0xb7>
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
jmp    11cc <print_bitmap+0xbc>
jmp    11d1 <print_bitmap+0xc1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <print_bitmap+0x33>
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1130 <print_bitmap+0x20>
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bitmap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,0x10(%rsp)
mov    %edi,0xc(%rsp)
test   %esi,%esi
jle    11c9 <print_bitmap+0xa9>
mov    %esi,%eax
mov    0xc(%rsp),%ecx
mov    %rcx,0x18(%rsp)
mov    %rax,0x20(%rsp)
lea    0x0(,%rax,4),%rbp
xor    %ebx,%ebx
lea    0xea3(%rip),%r15
lea    0xe99(%rip),%r12
jmp    118b <print_bitmap+0x6b>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
addq   $0x4,0x10(%rsp)
cmp    0x20(%rsp),%rbx
je     11c9 <print_bitmap+0xa9>
cmpl   $0x0,0xc(%rsp)
jle    1170 <print_bitmap+0x50>
mov    0x18(%rsp),%r14
mov    0x10(%rsp),%r13
jmp    11b4 <print_bitmap+0x94>
xchg   %ax,%ax
test   %eax,%eax
cmove  %r12,%rdi
call   1040 <printf@plt>
add    %rbp,%r13
add    $0xffffffffffffffff,%r14
je     1170 <print_bitmap+0x50>
mov    0x0(%r13),%eax
mov    %r15,%rdi
cmp    $0x1,%eax
je     11a0 <print_bitmap+0x80>
lea    0xe3f(%rip),%rdi
jmp    11a0 <print_bitmap+0x80>
mov    $0xa,%edi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c". \00"
@.str.1 = [3 x i8] c"* \00"
@.str.2 = [3 x i8] c"O \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print_bitmap(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 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
store i32 0, i32* %8
br label %13
13: ; preds = %57, %3
%14 = load i32, i32* %8
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %60
17: ; preds = %13
store i32 0, i32* %7
br label %18
18: ; preds = %52, %17
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %55
22: ; preds = %18
%23 = load i32*, i32** %6
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = mul nsw i64 %25, %12
%27 = getelementptr inbounds i32, i32* %23, i64 %26
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %22
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %51
35: ; preds = %22
%36 = load i32*, i32** %6
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = mul nsw i64 %38, %12
%40 = getelementptr inbounds i32, i32* %36, i64 %39
%41 = load i32, i32* %8
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %48
46: ; preds = %35
%47 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %50
48: ; preds = %35
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
br label %51
51: ; preds = %50, %33
br label %52
52: ; preds = %51
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %18
55: ; preds = %18
%56 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %57
57: ; preds = %55
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %13
60: ; preds = %13
%61 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

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