#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ A_BOLD;
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int, int, char *, char);
int /*<<< orphan*/ wattroff(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wattron(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ werase(int /*<<< orphan*/ *);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ wprintw(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void saprintarr(WINDOW *win, int size, char array[size][size], int x, int y) {
  int i, j;
  werase(win);
  wmove(win, 0, 0);
  wprintw(win, "   ");
  for (i = 0; i < size; i++)
    if (i < 10)
      wprintw(win, " %d ", i);
    else
      wprintw(win, "%d ", i);
  for (i = 0; i < size; i++) {
    wprintw(win, "%d", i);
    for (j = 0; j < size; j++) {
      if (i == x && (j == y || j == y + 1))
        wattron(win, A_BOLD);
      else
        wattroff(win, A_BOLD);
      mvwprintw(win, i + 1, (j * 3) + 3, "[%c]", array[i][j]);
    }
  }
  wrefresh(win);
}


x86 assembly (clang, -O0):
<saprintarr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <werase@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1080 <wmove@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1040 <wprintw@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1218 <saprintarr+0xa8>
cmpl   $0xa,-0x24(%rbp)
jge    11f0 <saprintarr+0x80>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe20(%rip),%rsi
mov    $0x0,%al
call   1040 <wprintw@plt>
jmp    1205 <saprintarr+0x95>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1040 <wprintw@plt>
jmp    120a <saprintarr+0x9a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c0 <saprintarr+0x50>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12ff <saprintarr+0x18f>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
call   1040 <wprintw@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12ec <saprintarr+0x17c>
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1293 <saprintarr+0x123>
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
je     127c <saprintarr+0x10c>
mov    -0x28(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1293 <saprintarr+0x123>
mov    -0x8(%rbp),%rdi
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
call   1070 <wattron@plt>
jmp    12a5 <saprintarr+0x135>
mov    -0x8(%rbp),%rdi
mov    0x2d42(%rip),%rax
mov    (%rax),%esi
call   1060 <wattroff@plt>
mov    -0x30(%rbp),%r8
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
add    $0x1,%esi
imul   $0x3,-0x28(%rbp),%edx
add    $0x3,%edx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   %r8,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%r8
lea    0xd38(%rip),%rcx
movsbl (%rax,%r8,1),%r8d
call   1050 <mvwprintw@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1247 <saprintarr+0xd7>
jmp    12f1 <saprintarr+0x181>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    121f <saprintarr+0xaf>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saprintarr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %rdx,0x18(%rsp)
mov    %esi,%r13d
mov    %rdi,%rbx
call   1090 <werase@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <wmove@plt>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <wprintw@plt>
test   %r13d,%r13d
jle    12d4 <saprintarr+0x164>
mov    %r14,0x8(%rsp)
mov    %r13d,%eax
mov    %rax,0x10(%rsp)
lea    0xe36(%rip),%r14
lea    0xe30(%rip),%r12
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
cmp    $0xa,%ebp
mov    %r12,%rsi
cmovb  %r14,%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <wprintw@plt>
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    11e0 <saprintarr+0x70>
test   %r13d,%r13d
mov    0x8(%rsp),%rcx
jle    12d4 <saprintarr+0x164>
lea    0x1(%rcx),%eax
mov    %rax,0x20(%rsp)
mov    %ecx,%eax
mov    %rax,0x8(%rsp)
mov    %r15d,%r14d
xor    %r13d,%r13d
jmp    1246 <saprintarr+0xd6>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp),%rax
add    %rax,0x18(%rsp)
mov    %rbp,%r13
cmp    %rax,%rbp
je     12d4 <saprintarr+0x164>
mov    %rbx,%rdi
lea    0xdb9(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <wprintw@plt>
lea    0x1(%r13),%rbp
mov    $0x3,%r15d
xor    %r12d,%r12d
jmp    12ae <saprintarr+0x13e>
nopl   0x0(%rax)
mov    0x2d69(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1060 <wattroff@plt>
mov    0x18(%rsp),%rax
movsbl (%rax,%r12,1),%r8d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
lea    0xd72(%rip),%rcx
call   1050 <mvwprintw@plt>
add    $0x1,%r12
add    $0x3,%r15d
cmp    %r12,0x10(%rsp)
je     1230 <saprintarr+0xc0>
cmp    %r14,%r13
jne    1270 <saprintarr+0x100>
cmp    %r12,0x8(%rsp)
je     12c1 <saprintarr+0x151>
cmp    %r12,0x20(%rsp)
jne    1270 <saprintarr+0x100>
mov    0x2d18(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <wattron@plt>
jmp    1281 <saprintarr+0x111>
mov    %rbx,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <wrefresh@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" \00"
@.str.1 = [5 x i8] c" %d \00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [3 x i8] c"%d\00"
@A_BOLD = global i32 0
@.str.4 = [5 x i8] c"[%c]\00"
define void @saprintarr(i32* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %7
%14 = zext i32 %13 to i64
%15 = load i32, i32* %7
%16 = zext i32 %15 to i64
%17 = load i32*, i32** %6
%18 = call i32 @werase(i32* %17)
%19 = load i32*, i32** %6
%20 = call i32 @wmove(i32* %19, i32 0, i32 0)
%21 = load i32*, i32** %6
%22 = call i32 (i32*, i8*, ...) @wprintw(i32* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %11
br label %23
23: ; preds = %39, %5
%24 = load i32, i32* %11
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %42
27: ; preds = %23
%28 = load i32, i32* %11
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32*, i32** %6
%32 = load i32, i32* %11
%33 = call i32 (i32*, i8*, ...) @wprintw(i32* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %38
34: ; preds = %27
%35 = load i32*, i32** %6
%36 = load i32, i32* %11
%37 = call i32 (i32*, i8*, ...) @wprintw(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %34, %30
br label %39
39: ; preds = %38
%40 = load i32, i32* %11
%41 = add nsw i32 %40, 1
store i32 %41, i32* %11
br label %23
42: ; preds = %23
store i32 0, i32* %11
br label %43
43: ; preds = %97, %42
%44 = load i32, i32* %11
%45 = load i32, i32* %7
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %100
47: ; preds = %43
%48 = load i32*, i32** %6
%49 = load i32, i32* %11
%50 = call i32 (i32*, i8*, ...) @wprintw(i32* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %49)
store i32 0, i32* %12
br label %51
51: ; preds = %93, %47
%52 = load i32, i32* %12
%53 = load i32, i32* %7
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %96
55: ; preds = %51
%56 = load i32, i32* %11
%57 = load i32, i32* %9
%58 = icmp eq i32 %56, %57
br i1 %58, label %59, label %72
59: ; preds = %55
%60 = load i32, i32* %12
%61 = load i32, i32* %10
%62 = icmp eq i32 %60, %61
br i1 %62, label %68, label %63
63: ; preds = %59
%64 = load i32, i32* %12
%65 = load i32, i32* %10
%66 = add nsw i32 %65, 1
%67 = icmp eq i32 %64, %66
br i1 %67, label %68, label %72
68: ; preds = %63, %59
%69 = load i32*, i32** %6
%70 = load i32, i32* @A_BOLD
%71 = call i32 @wattron(i32* %69, i32 %70)
br label %76
72: ; preds = %63, %55
%73 = load i32*, i32** %6
%74 = load i32, i32* @A_BOLD
%75 = call i32 @wattroff(i32* %73, i32 %74)
br label %76
76: ; preds = %72, %68
%77 = load i32*, i32** %6
%78 = load i32, i32* %11
%79 = add nsw i32 %78, 1
%80 = load i32, i32* %12
%81 = mul nsw i32 %80, 3
%82 = add nsw i32 %81, 3
%83 = load i8*, i8** %8
%84 = load i32, i32* %11
%85 = sext i32 %84 to i64
%86 = mul nsw i64 %85, %16
%87 = getelementptr inbounds i8, i8* %83, i64 %86
%88 = load i32, i32* %12
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = load i8, i8* %90
%92 = call i32 @mvwprintw(i32* %77, i32 %79, i32 %82, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 signext %91)
br label %93
93: ; preds = %76
%94 = load i32, i32* %12
%95 = add nsw i32 %94, 1
store i32 %95, i32* %12
br label %51
96: ; preds = %51
br label %97
97: ; preds = %96
%98 = load i32, i32* %11
%99 = add nsw i32 %98, 1
store i32 %99, i32* %11
br label %43
100: ; preds = %43
%101 = load i32*, i32** %6
%102 = call i32 @wrefresh(i32* %101)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" \00"
@.str.1 = [5 x i8] c" %d \00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [3 x i8] c"%d\00"
@A_BOLD = global i32 0
@.str.4 = [5 x i8] c"[%c]\00"
define void @saprintarr(i32* %0, i32 %1, i8* nocapture %2, i32 %3, i32 %4) {
%6 = zext i32 %1 to i64
%7 = tail call i32 @werase(i32* %0)
%8 = tail call i32 @wmove(i32* %0, i32 0, i32 0)
%9 = tail call i32 (i32*, i8*, ...) @wprintw(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = icmp sgt i32 %1, 0
br i1 %10, label %17, label %56
11: ; preds = %17
br i1 %10, label %12, label %56
12: ; preds = %11
%13 = add nsw i32 %4, 1
%14 = zext i32 %13 to i64
%15 = zext i32 %4 to i64
%16 = zext i32 %3 to i64
br label %24
17: ; preds = %5, %17
%18 = phi i32 [ %22, %17 ], [ 0, %5 ]
%19 = icmp ult i32 %18, 10
%20 = select i1 %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%21 = tail call i32 (i32*, i8*, ...) @wprintw(i32* %0, i8* %20, i32 %18)
%22 = add nuw nsw i32 %18, 1
%23 = icmp eq i32 %22, %1
br i1 %23, label %11, label %17
24: ; preds = %54, %12
%25 = phi i64 [ 0, %12 ], [ %29, %54 ]
%26 = trunc i64 %25 to i32
%27 = tail call i32 (i32*, i8*, ...) @wprintw(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = icmp eq i64 %25, %16
%29 = add nuw nsw i64 %25, 1
%30 = mul nuw nsw i64 %25, %6
%31 = getelementptr inbounds i8, i8* %2, i64 %30
%32 = trunc i64 %29 to i32
br label %33
33: ; preds = %24, %45
%34 = phi i64 [ 0, %24 ], [ %52, %45 ]
br i1 %28, label %35, label %42
35: ; preds = %33
%36 = icmp eq i64 %34, %15
%37 = icmp eq i64 %34, %14
%38 = select i1 %36, i1 true, i1 %37
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load i32, i32* @A_BOLD
%41 = tail call i32 @wattron(i32* %0, i32 %40)
br label %45
42: ; preds = %35, %33
%43 = load i32, i32* @A_BOLD
%44 = tail call i32 @wattroff(i32* %0, i32 %43)
br label %45
45: ; preds = %42, %39
%46 = trunc i64 %34 to i32
%47 = mul nsw i32 %46, 3
%48 = add nuw nsw i32 %47, 3
%49 = getelementptr inbounds i8, i8* %31, i64 %34
%50 = load i8, i8* %49
%51 = tail call i32 @mvwprintw(i32* %0, i32 %32, i32 %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 signext %50)
%52 = add nuw nsw i64 %34, 1
%53 = icmp eq i64 %52, %6
br i1 %53, label %54, label %33
54: ; preds = %45
%55 = icmp eq i64 %29, %6
br i1 %55, label %56, label %24
56: ; preds = %54, %5, %11
%57 = tail call i32 @wrefresh(i32* %0)
ret void
}