#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*/ printHorizontalBound(int);
int /*<<< orphan*/ printf(char *, ...);
void printMap(char mapArray[15][15], char entityArray[15][15], int roomWidth,
              int roomHeight) {
  int widthcount = 0;
  int heightcount = 0;
  printHorizontalBound(roomWidth);
  printf("\n");
  while (heightcount < roomHeight) {
    printf("|");
    while (widthcount < roomWidth) {
      if (entityArray[widthcount][heightcount] == '0') {
        printf("%c", mapArray[widthcount][heightcount]);
      } else {
        printf("%c", entityArray[widthcount][heightcount]);
      }
      widthcount++;
    }
    printf("|");
    printf("\n");
    widthcount = 0;
    heightcount++;
  }
  printHorizontalBound(roomWidth);
  printf("\n");
  return;
}


x86 assembly (clang, -O0):
<printMap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <printHorizontalBound@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    122e <printMap+0x10e>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fd <printMap+0xdd>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xf,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jne    11ca <printMap+0xaa>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xf,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <printMap+0xcf>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xf,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1174 <printMap+0x54>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115a <printMap+0x3a>
mov    -0x14(%rbp),%edi
call   1040 <printHorizontalBound@plt>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %edx,0x4(%rsp)
mov    %edx,%edi
call   1040 <printHorizontalBound@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
jle    11d1 <printMap+0xb1>
mov    %r15d,%r15d
mov    0x4(%rsp),%eax
lea    (%rax,%rax,4),%rax
lea    (%rax,%rax,2),%rbp
xor    %r13d,%r13d
jmp    1195 <printMap+0x75>
cs nopw 0x0(%rax,%rax,1)
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    $0x1,%rbx
add    $0x1,%r12
cmp    %r15,%r13
je     11d1 <printMap+0xb1>
mov    $0x7c,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    1170 <printMap+0x50>
xor    %r14d,%r14d
jmp    11c1 <printMap+0xa1>
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0xf,%r14
cmp    %r14,%rbp
je     1170 <printMap+0x50>
movzbl (%rbx,%r14,1),%eax
cmp    $0x30,%al
jne    11b0 <printMap+0x90>
movzbl (%r12,%r14,1),%eax
jmp    11b0 <printMap+0x90>
mov    0x4(%rsp),%edi
call   1040 <printHorizontalBound@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @printMap([15 x i8]* nocapture %0, [15 x i8]* nocapture %1, i32 %2, i32 %3) {
%5 = tail call i32 @printHorizontalBound(i32 %2)
%6 = tail call i32 @putchar(i32 10)
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %34
8: ; preds = %4
%9 = icmp sgt i32 %2, 0
%10 = zext i32 %3 to i64
%11 = zext i32 %2 to i64
br label %12
12: ; preds = %8, %29
%13 = phi i64 [ 0, %8 ], [ %32, %29 ]
%14 = tail call i32 @putchar(i32 124)
br i1 %9, label %15, label %29
15: ; preds = %12, %23
%16 = phi i64 [ %27, %23 ], [ 0, %12 ]
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 %16, i64 %13
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 48
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = getelementptr inbounds [15 x i8], [15 x i8]* %0, i64 %16, i64 %13
%22 = load i8, i8* %21
br label %23
23: ; preds = %15, %20
%24 = phi i8 [ %22, %20 ], [ %18, %15 ]
%25 = sext i8 %24 to i32
%26 = tail call i32 @putchar(i32 %25)
%27 = add nuw nsw i64 %16, 1
%28 = icmp eq i64 %27, %11
br i1 %28, label %29, label %15
29: ; preds = %23, %12
%30 = tail call i32 @putchar(i32 124)
%31 = tail call i32 @putchar(i32 10)
%32 = add nuw nsw i64 %13, 1
%33 = icmp eq i64 %32, %10
br i1 %33, label %34, label %12
34: ; preds = %29, %4
%35 = tail call i32 @printHorizontalBound(i32 %2)
%36 = tail call i32 @putchar(i32 10)
ret void
}