#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_current_position(unsigned short **board, int lines, int columns,
                            unsigned short startx, unsigned short int starty) {
  int i, j;
  unsigned short d = 0x4, b = 0x2;
  unsigned short temp;
  printf(".");
  for (i = 0; i < lines; i++)
    printf("....");
  for (j = 0; j < columns; j++) {
    printf("\n|");
    for (i = 0; i < lines; i++) {
      temp = board[j][i] & d;
      if ((startx == i && starty == j) && temp == d)
        printf(" + |");
      else if (startx == i && starty == j)
        printf(" +  ");
      else if (temp == d)
        printf(" o |");
      else
        printf(" o  ");
    }
    printf("\n.");
    for (i = 0; i < lines; i++) {
      temp = board[j][i] & b;
      if (temp == b)
        printf("....");
      else
        printf("    ");
    }
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<print_current_position>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r8w,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %cx,-0x12(%rbp)
mov    %ax,-0x14(%rbp)
movw   $0x4,-0x1e(%rbp)
movw   $0x2,-0x20(%rbp)
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1173 <print_current_position+0x63>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114d <print_current_position+0x3d>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1303 <print_current_position+0x1f3>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1273 <print_current_position+0x163>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
movzwl -0x1e(%rbp),%ecx
and    %ecx,%eax
mov    %ax,-0x22(%rbp)
movzwl -0x12(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11fe <print_current_position+0xee>
movzwl -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11fe <print_current_position+0xee>
movzwl -0x22(%rbp),%eax
movzwl -0x1e(%rbp),%ecx
cmp    %ecx,%eax
jne    11fe <print_current_position+0xee>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
jmp    1260 <print_current_position+0x150>
movzwl -0x12(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1229 <print_current_position+0x119>
movzwl -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1229 <print_current_position+0x119>
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <print_current_position+0x14b>
movzwl -0x22(%rbp),%eax
movzwl -0x1e(%rbp),%ecx
cmp    %ecx,%eax
jne    124a <print_current_position+0x13a>
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
jmp    1256 <print_current_position+0x146>
lea    0xdc6(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <print_current_position+0x14b>
jmp    1260 <print_current_position+0x150>
jmp    1265 <print_current_position+0x155>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1199 <print_current_position+0x89>
lea    0xda2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12f0 <print_current_position+0x1e0>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
movzwl -0x20(%rbp),%ecx
and    %ecx,%eax
mov    %ax,-0x22(%rbp)
movzwl -0x22(%rbp),%eax
movzwl -0x20(%rbp),%ecx
cmp    %ecx,%eax
jne    12d1 <print_current_position+0x1c1>
lea    0xd39(%rip),%rdi
call   1030 <printf@plt>
jmp    12dd <print_current_position+0x1cd>
lea    0xd47(%rip),%rdi
call   1030 <printf@plt>
jmp    12e2 <print_current_position+0x1d2>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1286 <print_current_position+0x176>
jmp    12f5 <print_current_position+0x1e5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117a <print_current_position+0x6a>
lea    0xd1a(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_current_position>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%ebx
mov    %ecx,%r12d
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    %ebp,0x4(%rsp)
test   %ebp,%ebp
jle    117d <print_current_position+0x4d>
lea    0xe9b(%rip),%r13
mov    0x4(%rsp),%ebp
nopl   0x0(%rax)
mov    %r13,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1170 <print_current_position+0x40>
test   %r14d,%r14d
jle    12ae <print_current_position+0x17e>
movzwl %r12w,%ecx
movzwl %bx,%r12d
mov    %r14d,%eax
mov    %rax,0x20(%rsp)
mov    0x4(%rsp),%ebx
xor    %r14d,%r14d
lea    0xe69(%rip),%r13
lea    0xe5d(%rip),%rbp
mov    %rcx,0x18(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r15,0x8(%rsp)
jmp    11e2 <print_current_position+0xb2>
nopl   0x0(%rax)
lea    0xe55(%rip),%rdi
call   1050 <printf@plt>
add    $0x1,%r14
cmp    0x20(%rsp),%r14
lea    0xe2c(%rip),%rbp
je     12ae <print_current_position+0x17e>
lea    0xe1c(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11c0 <print_current_position+0x90>
mov    %r12,%r15
xor    %r12d,%r12d
mov    0x18(%rsp),%rbx
mov    %r14,%rax
xor    %r15,%rax
mov    0x8(%rsp),%rcx
mov    (%rcx,%r14,8),%rcx
movzwl (%rcx,%r12,2),%ecx
mov    %rbx,%rdx
xor    %r12,%rdx
test   $0x4,%cl
mov    %rbp,%rdi
cmove  %r13,%rdi
lea    0xde7(%rip),%rcx
lea    0xde5(%rip),%rsi
cmove  %rsi,%rcx
or     %rax,%rdx
cmovne %r13,%rdi
cmovne %rcx,%rdi
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,0x10(%rsp)
jne    1200 <print_current_position+0xd0>
lea    0xdc4(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,0x4(%rsp)
mov    %r15,%r12
mov    0x8(%rsp),%r15
mov    0x10(%rsp),%rbx
jle    11cc <print_current_position+0x9c>
xor    %ebp,%ebp
jmp    1292 <print_current_position+0x162>
nopl   0x0(%rax)
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
je     11cc <print_current_position+0x9c>
mov    (%r15,%r14,8),%rax
movzwl (%rax,%rbp,2),%eax
lea    0xd7e(%rip),%rdi
test   $0x2,%al
je     1280 <print_current_position+0x150>
lea    0xd54(%rip),%rdi
jmp    1280 <print_current_position+0x150>
lea    0xd6f(%rip),%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@.str.1 = [5 x i8] c"....\00"
@.str.2 = [3 x i8] c"\0A|\00"
@.str.3 = [5 x i8] c" + |\00"
@.str.4 = [5 x i8] c" + \00"
@.str.5 = [5 x i8] c" o |\00"
@.str.6 = [5 x i8] c" o \00"
@.str.7 = [3 x i8] c"\0A.\00"
@.str.8 = [5 x i8] c" \00"
@.str.9 = [3 x i8] c"\0A\0A\00"
define void @print_current_position(i16** %0, i32 %1, i32 %2, i16 zeroext %3, i16 zeroext %4) {
%6 = alloca i16**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i16
%10 = alloca i16
%11 = alloca i32
%12 = alloca i32
%13 = alloca i16
%14 = alloca i16
%15 = alloca i16
store i16** %0, i16*** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i16 %3, i16* %9
store i16 %4, i16* %10
store i16 4, i16* %13
store i16 2, i16* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %11
br label %17
17: ; preds = %23, %5
%18 = load i32, i32* %11
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21
%24 = load i32, i32* %11
%25 = add nsw i32 %24, 1
store i32 %25, i32* %11
br label %17
26: ; preds = %17
store i32 0, i32* %12
br label %27
27: ; preds = %132, %26
%28 = load i32, i32* %12
%29 = load i32, i32* %8
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %135
31: ; preds = %27
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %11
br label %33
33: ; preds = %94, %31
%34 = load i32, i32* %11
%35 = load i32, i32* %7
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %97
37: ; preds = %33
%38 = load i16**, i16*** %6
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i16*, i16** %38, i64 %40
%42 = load i16*, i16** %41
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i16, i16* %42, i64 %44
%46 = load i16, i16* %45
%47 = zext i16 %46 to i32
%48 = load i16, i16* %13
%49 = zext i16 %48 to i32
%50 = and i32 %47, %49
%51 = trunc i32 %50 to i16
store i16 %51, i16* %15
%52 = load i16, i16* %9
%53 = zext i16 %52 to i32
%54 = load i32, i32* %11
%55 = icmp eq i32 %53, %54
br i1 %55, label %56, label %69
56: ; preds = %37
%57 = load i16, i16* %10
%58 = zext i16 %57 to i32
%59 = load i32, i32* %12
%60 = icmp eq i32 %58, %59
br i1 %60, label %61, label %69
61: ; preds = %56
%62 = load i16, i16* %15
%63 = zext i16 %62 to i32
%64 = load i16, i16* %13
%65 = zext i16 %64 to i32
%66 = icmp eq i32 %63, %65
br i1 %66, label %67, label %69
67: ; preds = %61
%68 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %93
69: ; preds = %61, %56, %37
%70 = load i16, i16* %9
%71 = zext i16 %70 to i32
%72 = load i32, i32* %11
%73 = icmp eq i32 %71, %72
br i1 %73, label %74, label %81
74: ; preds = %69
%75 = load i16, i16* %10
%76 = zext i16 %75 to i32
%77 = load i32, i32* %12
%78 = icmp eq i32 %76, %77
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %92
81: ; preds = %74, %69
%82 = load i16, i16* %15
%83 = zext i16 %82 to i32
%84 = load i16, i16* %13
%85 = zext i16 %84 to i32
%86 = icmp eq i32 %83, %85
br i1 %86, label %87, label %89
87: ; preds = %81
%88 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %91
89: ; preds = %81
%90 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %91
91: ; preds = %89, %87
br label %92
92: ; preds = %91, %79
br label %93
93: ; preds = %92, %67
br label %94
94: ; preds = %93
%95 = load i32, i32* %11
%96 = add nsw i32 %95, 1
store i32 %96, i32* %11
br label %33
97: ; preds = %33
%98 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %11
br label %99
99: ; preds = %128, %97
%100 = load i32, i32* %11
%101 = load i32, i32* %7
%102 = icmp slt i32 %100, %101
br i1 %102, label %103, label %131
103: ; preds = %99
%104 = load i16**, i16*** %6
%105 = load i32, i32* %12
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i16*, i16** %104, i64 %106
%108 = load i16*, i16** %107
%109 = load i32, i32* %11
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i16, i16* %108, i64 %110
%112 = load i16, i16* %111
%113 = zext i16 %112 to i32
%114 = load i16, i16* %14
%115 = zext i16 %114 to i32
%116 = and i32 %113, %115
%117 = trunc i32 %116 to i16
store i16 %117, i16* %15
%118 = load i16, i16* %15
%119 = zext i16 %118 to i32
%120 = load i16, i16* %14
%121 = zext i16 %120 to i32
%122 = icmp eq i32 %119, %121
br i1 %122, label %123, label %125
123: ; preds = %103
%124 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %127
125: ; preds = %103
%126 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %127
127: ; preds = %125, %123
br label %128
128: ; preds = %127
%129 = load i32, i32* %11
%130 = add nsw i32 %129, 1
store i32 %130, i32* %11
br label %99
131: ; preds = %99
br label %132
132: ; preds = %131
%133 = load i32, i32* %12
%134 = add nsw i32 %133, 1
store i32 %134, i32* %12
br label %27
135: ; preds = %27
%136 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"....\00"
@.str.2 = [3 x i8] c"\0A|\00"
@.str.3 = [5 x i8] c" + |\00"
@.str.4 = [5 x i8] c" + \00"
@.str.5 = [5 x i8] c" o |\00"
@.str.6 = [5 x i8] c" o \00"
@.str.7 = [3 x i8] c"\0A.\00"
@.str.8 = [5 x i8] c" \00"
@str = [2 x i8] c"\0A\00"
define void @print_current_position(i16** nocapture %0, i32 %1, i32 %2, i16 zeroext %3, i16 zeroext %4) {
%6 = tail call i32 @putchar(i32 46)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %16, label %8
8: ; preds = %16, %5
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %64
10: ; preds = %8
%11 = zext i16 %3 to i64
%12 = zext i16 %4 to i64
%13 = zext i32 %2 to i64
%14 = zext i32 %1 to i64
%15 = zext i32 %1 to i64
br label %21
16: ; preds = %5, %16
%17 = phi i32 [ %19, %16 ], [ 0, %5 ]
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%19 = add nuw nsw i32 %17, 1
%20 = icmp eq i32 %19, %1
br i1 %20, label %8, label %16
21: ; preds = %10, %61
%22 = phi i64 [ 0, %10 ], [ %62, %61 ]
%23 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br i1 %7, label %26, label %24
24: ; preds = %21
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %61
26: ; preds = %21
%27 = getelementptr inbounds i16*, i16** %0, i64 %22
%28 = icmp eq i64 %22, %12
br label %29
29: ; preds = %26, %29
%30 = phi i64 [ 0, %26 ], [ %44, %29 ]
%31 = load i16*, i16** %27
%32 = getelementptr inbounds i16, i16* %31, i64 %30
%33 = load i16, i16* %32
%34 = and i16 %33, 4
%35 = icmp eq i64 %30, %11
%36 = select i1 %35, i1 %28, i1 false
%37 = icmp eq i16 %34, 0
%38 = xor i1 %37, true
%39 = select i1 %36, i1 %38, i1 false
%40 = select i1 %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%41 = select i1 %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%42 = select i1 %36, i8* %40, i8* %41
%43 = tail call i32 @printf(i8* dereferenceable(1) %42)
%44 = add nuw nsw i64 %30, 1
%45 = icmp eq i64 %44, %14
br i1 %45, label %46, label %29
46: ; preds = %29
%47 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br i1 %7, label %48, label %61
48: ; preds = %46
%49 = getelementptr inbounds i16*, i16** %0, i64 %22
br label %50
50: ; preds = %48, %50
%51 = phi i64 [ 0, %48 ], [ %59, %50 ]
%52 = load i16*, i16** %49
%53 = getelementptr inbounds i16, i16* %52, i64 %51
%54 = load i16, i16* %53
%55 = and i16 %54, 2
%56 = icmp eq i16 %55, 0
%57 = select i1 %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%58 = tail call i32 @printf(i8* dereferenceable(1) %57)
%59 = add nuw nsw i64 %51, 1
%60 = icmp eq i64 %59, %15
br i1 %60, label %61, label %50
61: ; preds = %50, %24, %46
%62 = add nuw nsw i64 %22, 1
%63 = icmp eq i64 %62, %13
br i1 %63, label %64, label %21
64: ; preds = %61, %8
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}