#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 A_NORMAL;
int COLOR_PAIR(int);
int /*<<< orphan*/ attroff(int);
int /*<<< orphan*/ attron(int);
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ printw(char *, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
void nright(int type, int value) {
  int maxcol, maxrow, rrow;
  getmaxyx(stdscr, maxrow, maxcol);
  if (type == 1)
    rrow = 1;
  if (type == 2)
    rrow = 2;
  if (type == 3)
    rrow = 3;
  if (type == 4)
    rrow = 4;
  if (type == 5)
    rrow = 5;
  if (type == 6)
    rrow = 6;
  attron(COLOR_PAIR(1) | A_NORMAL);
  move(rrow, maxcol - 8);
  printw("%d", value);
  attroff(COLOR_PAIR(1) | A_NORMAL);
  refresh();
}


x86 assembly (clang, -O0):
<nright>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <getmaxyx@plt>
cmpl   $0x1,-0x4(%rbp)
jne    11a3 <nright+0x33>
movl   $0x1,-0x14(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    11b4 <nright+0x44>
movl   $0x2,-0x14(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    11c5 <nright+0x55>
movl   $0x3,-0x14(%rbp)
cmpl   $0x4,-0x4(%rbp)
jne    11d6 <nright+0x66>
movl   $0x4,-0x14(%rbp)
cmpl   $0x5,-0x4(%rbp)
jne    11e7 <nright+0x77>
movl   $0x5,-0x14(%rbp)
cmpl   $0x6,-0x4(%rbp)
jne    11f8 <nright+0x88>
movl   $0x6,-0x14(%rbp)
mov    $0x1,%edi
call   1070 <COLOR_PAIR@plt>
mov    %eax,%edi
mov    0x2ddd(%rip),%rax
or     (%rax),%edi
call   1040 <attron@plt>
mov    -0x14(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x8,%esi
call   1090 <move@plt>
mov    -0x8(%rbp),%esi
lea    0xdd6(%rip),%rdi
call   1060 <printw@plt>
mov    $0x1,%edi
call   1070 <COLOR_PAIR@plt>
mov    %eax,%edi
mov    0x2da6(%rip),%rax
or     (%rax),%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nright>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
call   1050 <getmaxyx@plt>
xor    %ebp,%ebp
cmp    $0x2,%ebx
sete   %bpl
add    $0x1,%ebp
cmp    $0x3,%ebx
cmove  %ebx,%ebp
cmp    $0x4,%ebx
cmove  %ebx,%ebp
cmp    $0x5,%ebx
cmove  %ebx,%ebp
cmp    $0x6,%ebx
cmove  %ebx,%ebp
mov    $0x1,%edi
call   1070 <COLOR_PAIR@plt>
mov    0x2e2c(%rip),%rbx
or     (%rbx),%eax
mov    %eax,%edi
call   1040 <attron@plt>
mov    %ebp,%edi
call   1090 <move@plt>
lea    0xe2d(%rip),%rdi
mov    %r14d,%esi
call   1060 <printw@plt>
mov    $0x1,%edi
call   1070 <COLOR_PAIR@plt>
or     (%rbx),%eax
mov    %eax,%edi
call   1030 <attroff@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1080 <refresh@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@A_NORMAL = global i32 0
@.str = [3 x i8] c"%d\00"
define void @nright(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* @stdscr
%9 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = call i32 @getmaxyx(i32 %8, i32 %9, i32 %10)
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 1, i32* %7
br label %15
15: ; preds = %14, %2
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 2, i32* %7
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 3, i32* %7
br label %23
23: ; preds = %22, %19
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 4
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 4, i32* %7
br label %27
27: ; preds = %26, %23
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 5
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 5, i32* %7
br label %31
31: ; preds = %30, %27
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 6
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 6, i32* %7
br label %35
35: ; preds = %34, %31
%36 = call i32 @COLOR_PAIR(i32 1)
%37 = load i32, i32* @A_NORMAL
%38 = or i32 %36, %37
%39 = call i32 @attron(i32 %38)
%40 = load i32, i32* %7
%41 = load i32, i32* %5
%42 = sub nsw i32 %41, 8
%43 = call i32 @move(i32 %40, i32 %42)
%44 = load i32, i32* %4
%45 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = call i32 @COLOR_PAIR(i32 1)
%47 = load i32, i32* @A_NORMAL
%48 = or i32 %46, %47
%49 = call i32 @attroff(i32 %48)
%50 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@A_NORMAL = global i32 0
@.str = [3 x i8] c"%d\00"
define void @nright(i32 %0, i32 %1) {
%3 = load i32, i32* @stdscr
%4 = tail call i32 @getmaxyx(i32 %3, i32 undef, i32 undef)
%5 = icmp eq i32 %0, 2
%6 = select i1 %5, i32 2, i32 1
%7 = icmp eq i32 %0, 3
%8 = select i1 %7, i32 3, i32 %6
%9 = icmp eq i32 %0, 4
%10 = select i1 %9, i32 4, i32 %8
%11 = icmp eq i32 %0, 5
%12 = select i1 %11, i32 5, i32 %10
%13 = icmp eq i32 %0, 6
%14 = select i1 %13, i32 6, i32 %12
%15 = tail call i32 @COLOR_PAIR(i32 1)
%16 = load i32, i32* @A_NORMAL
%17 = or i32 %16, %15
%18 = tail call i32 @attron(i32 %17)
%19 = tail call i32 @move(i32 %14, i32 undef)
%20 = tail call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%21 = tail call i32 @COLOR_PAIR(i32 1)
%22 = load i32, i32* @A_NORMAL
%23 = or i32 %22, %21
%24 = tail call i32 @attroff(i32 %23)
%25 = tail call i32 (...) @refresh()
ret void
}