#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 sdprintarr(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 || i == x + 1) && j == y)
        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):
<sdprintarr>:
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 <sdprintarr+0xa8>
cmpl   $0xa,-0x24(%rbp)
jge    11f0 <sdprintarr+0x80>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe20(%rip),%rsi
mov    $0x0,%al
call   1040 <wprintw@plt>
jmp    1205 <sdprintarr+0x95>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1040 <wprintw@plt>
jmp    120a <sdprintarr+0x9a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c0 <sdprintarr+0x50>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12ff <sdprintarr+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 <sdprintarr+0x17c>
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1270 <sdprintarr+0x100>
mov    -0x24(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1293 <sdprintarr+0x123>
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1293 <sdprintarr+0x123>
mov    -0x8(%rbp),%rdi
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
call   1070 <wattron@plt>
jmp    12a5 <sdprintarr+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 <sdprintarr+0xd7>
jmp    12f1 <sdprintarr+0x181>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    121f <sdprintarr+0xaf>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdprintarr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%r12d
mov    %rcx,0x8(%rsp)
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    0xe57(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <wprintw@plt>
test   %r13d,%r13d
jle    12d5 <sdprintarr+0x165>
mov    %r13d,%eax
mov    %rax,0x10(%rsp)
lea    0xe39(%rip),%r14
lea    0xe33(%rip),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0xa,%ebp
mov    %r15,%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 <sdprintarr+0x70>
test   %r13d,%r13d
jle    12d5 <sdprintarr+0x165>
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%eax
mov    %rax,0x20(%rsp)
mov    %rcx,%rax
mov    %r12d,%r12d
mov    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r13d,%r13d
jmp    1243 <sdprintarr+0xd3>
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
add    %rax,0x18(%rsp)
cmp    %rax,%r13
je     12d5 <sdprintarr+0x165>
mov    %rbx,%rdi
lea    0xdbc(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <wprintw@plt>
cmp    0x8(%rsp),%r13
sete   %al
cmp    0x20(%rsp),%r13
sete   %r14b
or     %al,%r14b
add    $0x1,%r13
mov    $0x3,%ebp
xor    %r15d,%r15d
jmp    12b5 <sdprintarr+0x145>
nopl   0x0(%rax)
call   1060 <wattroff@plt>
mov    0x18(%rsp),%rax
movsbl (%rax,%r15,1),%r8d
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %ebp,%edx
lea    0xd6e(%rip),%rcx
call   1050 <mvwprintw@plt>
add    $0x1,%r15
add    $0x3,%ebp
cmp    %r15,0x10(%rsp)
je     1230 <sdprintarr+0xc0>
cmp    %r15,%r12
sete   %al
and    %r14b,%al
mov    0x2d1b(%rip),%rcx
mov    (%rcx),%esi
mov    %rbx,%rdi
cmp    $0x1,%al
jne    1280 <sdprintarr+0x110>
call   1070 <wattron@plt>
jmp    1285 <sdprintarr+0x115>
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 @sdprintarr(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 %64, label %59
59: ; preds = %55
%60 = load i32, i32* %11
%61 = load i32, i32* %9
%62 = add nsw i32 %61, 1
%63 = icmp eq i32 %60, %62
br i1 %63, label %64, label %72
64: ; preds = %59, %55
%65 = load i32, i32* %12
%66 = load i32, i32* %10
%67 = icmp eq i32 %65, %66
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = load i32*, i32** %6
%70 = load i32, i32* @A_BOLD
%71 = call i32 @wattron(i32* %69, i32 %70)
br label %76
72: ; preds = %64, %59
%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 @sdprintarr(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 %55
11: ; preds = %17
br i1 %10, label %12, label %55
12: ; preds = %11
%13 = add nsw i32 %3, 1
%14 = zext i32 %4 to i64
%15 = zext i32 %13 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 = %53, %12
%25 = phi i64 [ 0, %12 ], [ %31, %53 ]
%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 = icmp eq i64 %25, %15
%30 = select i1 %28, i1 true, i1 %29
%31 = add nuw nsw i64 %25, 1
%32 = mul nuw nsw i64 %25, %6
%33 = getelementptr inbounds i8, i8* %2, i64 %32
%34 = trunc i64 %31 to i32
br label %35
35: ; preds = %24, %44
%36 = phi i64 [ 0, %24 ], [ %51, %44 ]
%37 = icmp eq i64 %36, %14
%38 = select i1 %30, i1 %37, i1 false
%39 = load i32, i32* @A_BOLD
br i1 %38, label %40, label %42
40: ; preds = %35
%41 = tail call i32 @wattron(i32* %0, i32 %39)
br label %44
42: ; preds = %35
%43 = tail call i32 @wattroff(i32* %0, i32 %39)
br label %44
44: ; preds = %42, %40
%45 = trunc i64 %36 to i32
%46 = mul nsw i32 %45, 3
%47 = add nuw nsw i32 %46, 3
%48 = getelementptr inbounds i8, i8* %33, i64 %36
%49 = load i8, i8* %48
%50 = tail call i32 @mvwprintw(i32* %0, i32 %34, i32 %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 signext %49)
%51 = add nuw nsw i64 %36, 1
%52 = icmp eq i64 %51, %6
br i1 %52, label %53, label %35
53: ; preds = %44
%54 = icmp eq i64 %31, %6
br i1 %54, label %55, label %24
55: ; preds = %53, %5, %11
%56 = tail call i32 @wrefresh(i32* %0)
ret void
}