#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*/ COLOR_PAIR(int);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                             char *, int);
int /*<<< orphan*/ wattroff(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wattron(int /*<<< orphan*/ *, int /*<<< orphan*/);
int ncui_dashboard_color_test(WINDOW *win, int i) {
  int j;
  i += 2;
  for (j = 0; j < 16; j++) {
    wattron(win, COLOR_PAIR(j));
    mvwprintw(win, i++, 1, "colortest%d", j);
    wattroff(win, COLOR_PAIR(j));
  }
  i -= 16;
  for (j = 0; j < 16; j++) {
    wattron(win, COLOR_PAIR(j));
    wattron(win, A_BOLD);
    mvwprintw(win, i++, 15, "colortest%d", j);
    wattroff(win, A_BOLD);
    wattroff(win, COLOR_PAIR(j));
  }
  return i;
}


x86 assembly (clang, -O0):
<ncui_dashboard_color_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    11d1 <ncui_dashboard_color_test+0x91>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <COLOR_PAIR@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1060 <wattron@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%r8d
mov    $0x1,%edx
lea    0xe5d(%rip),%rcx
call   1040 <mvwprintw@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <COLOR_PAIR@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <wattroff@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115f <ncui_dashboard_color_test+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    1277 <ncui_dashboard_color_test+0x137>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <COLOR_PAIR@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1060 <wattron@plt>
mov    -0x8(%rbp),%rdi
mov    0x2dcf(%rip),%rax
mov    (%rax),%esi
call   1060 <wattron@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%r8d
mov    $0xf,%edx
lea    0xdc9(%rip),%rcx
call   1040 <mvwprintw@plt>
mov    -0x8(%rbp),%rdi
mov    0x2d99(%rip),%rax
mov    (%rax),%esi
call   1050 <wattroff@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <COLOR_PAIR@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1050 <wattroff@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e1 <ncui_dashboard_color_test+0xa1>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncui_dashboard_color_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
mov    $0xe,%r13d
sub    %esi,%r13d
add    $0x2,%r15d
xor    %ebx,%ebx
lea    0xe99(%rip),%r12
nopw   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%ebp
mov    %ebx,%edi
call   1030 <COLOR_PAIR@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <wattron@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r12,%rcx
mov    %ebx,%r8d
call   1040 <mvwprintw@plt>
mov    %ebx,%edi
call   1030 <COLOR_PAIR@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <wattroff@plt>
add    $0x1,%ebx
add    $0xffffffff,%r13d
cmp    $0x10,%ebx
jne    1170 <ncui_dashboard_color_test+0x30>
mov    %r13d,%r12d
neg    %r12d
xor    %ebx,%ebx
mov    0x2e1a(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%ebp
mov    %ebx,%edi
call   1030 <COLOR_PAIR@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <wattron@plt>
mov    (%r15),%esi
mov    %r14,%rdi
call   1060 <wattron@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0xf,%edx
lea    0xdff(%rip),%rcx
mov    %ebx,%r8d
call   1040 <mvwprintw@plt>
mov    (%r15),%esi
mov    %r14,%rdi
call   1050 <wattroff@plt>
mov    %ebx,%edi
call   1030 <COLOR_PAIR@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <wattroff@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    11d0 <ncui_dashboard_color_test+0x90>
sub    %r13d,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"colortest%d\00"
@A_BOLD = global i32 0
define i32 @ncui_dashboard_color_test(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 2
store i32 %7, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %25, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = call i32 @COLOR_PAIR(i32 %13)
%15 = call i32 @wattron(i32* %12, i32 %14)
%16 = load i32*, i32** %3
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
%19 = load i32, i32* %5
%20 = call i32 @mvwprintw(i32* %16, i32 %17, i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %3
%22 = load i32, i32* %5
%23 = call i32 @COLOR_PAIR(i32 %22)
%24 = call i32 @wattroff(i32* %21, i32 %23)
br label %25
25: ; preds = %11
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %8
28: ; preds = %8
%29 = load i32, i32* %4
%30 = sub nsw i32 %29, 16
store i32 %30, i32* %4
store i32 0, i32* %5
br label %31
31: ; preds = %54, %28
%32 = load i32, i32* %5
%33 = icmp slt i32 %32, 16
br i1 %33, label %34, label %57
34: ; preds = %31
%35 = load i32*, i32** %3
%36 = load i32, i32* %5
%37 = call i32 @COLOR_PAIR(i32 %36)
%38 = call i32 @wattron(i32* %35, i32 %37)
%39 = load i32*, i32** %3
%40 = load i32, i32* @A_BOLD
%41 = call i32 @wattron(i32* %39, i32 %40)
%42 = load i32*, i32** %3
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
%45 = load i32, i32* %5
%46 = call i32 @mvwprintw(i32* %42, i32 %43, i32 15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = load i32*, i32** %3
%48 = load i32, i32* @A_BOLD
%49 = call i32 @wattroff(i32* %47, i32 %48)
%50 = load i32*, i32** %3
%51 = load i32, i32* %5
%52 = call i32 @COLOR_PAIR(i32 %51)
%53 = call i32 @wattroff(i32* %50, i32 %52)
br label %54
54: ; preds = %34
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
br label %31
57: ; preds = %31
%58 = load i32, i32* %4
ret i32 %58
}

LLVM IR (-O2):
@.str = [12 x i8] c"colortest%d\00"
@A_BOLD = global i32 0
define i32 @ncui_dashboard_color_test(i32* %0, i32 %1) {
%3 = add nsw i32 %1, 2
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %13, %4 ]
%6 = phi i32 [ %3, %2 ], [ %9, %4 ]
%7 = tail call i32 @COLOR_PAIR(i32 %5)
%8 = tail call i32 @wattron(i32* %0, i32 %7)
%9 = add nsw i32 %6, 1
%10 = tail call i32 @mvwprintw(i32* %0, i32 %6, i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
%11 = tail call i32 @COLOR_PAIR(i32 %5)
%12 = tail call i32 @wattroff(i32* %0, i32 %11)
%13 = add nuw nsw i32 %5, 1
%14 = icmp eq i32 %13, 16
br i1 %14, label %15, label %4
15: ; preds = %4
%16 = add nsw i32 %6, -15
br label %17
17: ; preds = %15, %17
%18 = phi i32 [ 0, %15 ], [ %30, %17 ]
%19 = phi i32 [ %16, %15 ], [ %24, %17 ]
%20 = tail call i32 @COLOR_PAIR(i32 %18)
%21 = tail call i32 @wattron(i32* %0, i32 %20)
%22 = load i32, i32* @A_BOLD
%23 = tail call i32 @wattron(i32* %0, i32 %22)
%24 = add nsw i32 %19, 1
%25 = tail call i32 @mvwprintw(i32* %0, i32 %19, i32 15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %18)
%26 = load i32, i32* @A_BOLD
%27 = tail call i32 @wattroff(i32* %0, i32 %26)
%28 = tail call i32 @COLOR_PAIR(i32 %18)
%29 = tail call i32 @wattroff(i32* %0, i32 %28)
%30 = add nuw nsw i32 %18, 1
%31 = icmp eq i32 %30, 16
br i1 %31, label %32, label %17
32: ; preds = %17
ret i32 %24
}