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

/* Variables and functions */
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ init_pair(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int, int, char *, char *);
int /*<<< orphan*/ wattroff(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ wattron(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void print_draw_options(WINDOW *draw_win, int n_draw_choices, int highlight) {
  int x = 2;
  int y = 5;
  int i;
  char *draw_choices[] = {"Show me the algorithm", "Just let me play"};
  init_pair(2, 4, 0);
  init_pair(1, 7, 0);
  wattron(draw_win, (((chtype)(1) << 24) & (chtype)0xff000000));
  box(draw_win, 0, 0);
  for (i = 0; i < n_draw_choices; ++i) {
    if (highlight == i + 1) {
      wattron(draw_win, (((chtype)(2) << 24) & (chtype)0xff000000));
      mvwprintw(draw_win, x, y, "%s", draw_choices[i]);
      wattroff(draw_win, (((chtype)(2) << 24) & (chtype)0xff000000));
    } else {
      wattron(draw_win, (((chtype)(1) << 24) & (chtype)0xff000000));
      mvwprintw(draw_win, x, y, "%s", draw_choices[i]);
      wattroff(draw_win, (((chtype)(1) << 24) & (chtype)0xff000000));
    }
    ++x;
  }
  wrefresh(draw_win);
}


x86 assembly (clang, -O0):
<print_draw_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
mov    0x2c89(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c86(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    $0x2,%edi
mov    $0x4,%esi
xor    %edx,%edx
call   1030 <init_pair@plt>
mov    $0x1,%edi
mov    $0x7,%esi
xor    %edx,%edx
call   1030 <init_pair@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1000000,%esi
call   1080 <wattron@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <box@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1289 <print_draw_options+0x129>
mov    -0x10(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1237 <print_draw_options+0xd7>
mov    -0x8(%rbp),%rdi
mov    $0x2000000,%esi
call   1080 <wattron@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movslq -0x1c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%r8
lea    0xe08(%rip),%rcx
call   1060 <mvwprintw@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2000000,%esi
call   1070 <wattroff@plt>
jmp    1272 <print_draw_options+0x112>
mov    -0x8(%rbp),%rdi
mov    $0x1000000,%esi
call   1080 <wattron@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movslq -0x1c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%r8
lea    0xdc8(%rip),%rcx
call   1060 <mvwprintw@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1000000,%esi
call   1070 <wattroff@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11da <print_draw_options+0x7a>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_draw_options>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%r12
mov    $0x2,%ebp
mov    $0x2,%edi
mov    $0x4,%esi
xor    %edx,%edx
call   1030 <init_pair@plt>
mov    $0x1,%edi
mov    $0x7,%esi
xor    %edx,%edx
call   1030 <init_pair@plt>
mov    %r12,%rdi
mov    $0x1000000,%esi
call   1080 <wattron@plt>
mov    %r12,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <box@plt>
test   %r14d,%r14d
jle    122f <print_draw_options+0xcf>
mov    %r15d,%eax
mov    %r14d,%r15d
shl    $0x2,%r15
lea    -0x4(,%rax,4),%rax
ff
mov    %rax,(%rsp)
xor    %r14d,%r14d
lea    0xe53(%rip),%r13
nopl   0x0(%rax)
xor    %ebx,%ebx
cmp    %r14,(%rsp)
sete   %bl
shl    $0x18,%ebx
add    $0x1000000,%ebx
mov    %r12,%rdi
mov    %ebx,%esi
call   1080 <wattron@plt>
movslq (%r14,%r13,1),%r8
add    %r13,%r8
mov    %r12,%rdi
mov    %ebp,%esi
mov    $0x5,%edx
lea    0xe13(%rip),%rcx
call   1060 <mvwprintw@plt>
mov    %r12,%rdi
mov    %ebx,%esi
call   1070 <wattroff@plt>
add    $0x1,%ebp
add    $0x4,%r14
cmp    %r14,%r15
jne    11e0 <print_draw_options+0x80>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <wrefresh@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Show me the algorithm\00"
@.str.1 = [17 x i8] c"Just let me play\00"
@__const.print_draw_options.draw_choices = [2 x i8*] [i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [3 x i8] c"%s\00"
define void @print_draw_options(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2 x i8*]
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 2, i32* %7
store i32 5, i32* %8
%11 = bitcast [2 x i8*]* %10 to i8*
%12 = call i32 @init_pair(i32 2, i32 4, i32 0)
%13 = call i32 @init_pair(i32 1, i32 7, i32 0)
%14 = load i32*, i32** %4
%15 = call i32 @wattron(i32* %14, i32 16777216)
%16 = load i32*, i32** %4
%17 = call i32 @box(i32* %16, i32 0, i32 0)
store i32 0, i32* %9
br label %18
18: ; preds = %56, %3
%19 = load i32, i32* %9
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %59
22: ; preds = %18
%23 = load i32, i32* %6
%24 = load i32, i32* %9
%25 = add nsw i32 %24, 1
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %40
27: ; preds = %22
%28 = load i32*, i32** %4
%29 = call i32 @wattron(i32* %28, i32 33554432)
%30 = load i32*, i32** %4
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [2 x i8*], [2 x i8*]* %10, i64 0, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @mvwprintw(i32* %30, i32 %31, i32 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = load i32*, i32** %4
%39 = call i32 @wattroff(i32* %38, i32 33554432)
br label %53
40: ; preds = %22
%41 = load i32*, i32** %4
%42 = call i32 @wattron(i32* %41, i32 16777216)
%43 = load i32*, i32** %4
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [2 x i8*], [2 x i8*]* %10, i64 0, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @mvwprintw(i32* %43, i32 %44, i32 %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %49)
%51 = load i32*, i32** %4
%52 = call i32 @wattroff(i32* %51, i32 16777216)
br label %53
53: ; preds = %40, %27
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %56
56: ; preds = %53
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %18
59: ; preds = %18
%60 = load i32*, i32** %4
%61 = call i32 @wrefresh(i32* %60)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Show me the algorithm\00"
@.str.1 = [17 x i8] c"Just let me play\00"
@reltable.print_draw_options = [2 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str to i64), i64 ptrtoint ([2 x i32]* @reltable.print_draw_options to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.1 to i64), i64 ptrtoint ([2 x i32]* @reltable.print_draw_options to i64)) to i32)]
@.str.2 = [3 x i8] c"%s\00"
define void @print_draw_options(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @init_pair(i32 2, i32 4, i32 0)
%5 = tail call i32 @init_pair(i32 1, i32 7, i32 0)
%6 = tail call i32 @wattron(i32* %0, i32 16777216)
%7 = tail call i32 @box(i32* %0, i32 0, i32 0)
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %25
9: ; preds = %3
%10 = zext i32 %2 to i64
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %15, %12 ]
%14 = phi i32 [ 2, %9 ], [ %23, %12 ]
%15 = add nuw nsw i64 %13, 1
%16 = icmp eq i64 %15, %10
%17 = select i1 %16, i32 33554432, i32 16777216
%18 = tail call i32 @wattron(i32* %0, i32 %17)
%19 = shl i64 %13, 2
%20 = call i8* @llvm.load.relative.i64(i8* bitcast ([2 x i32]* @reltable.print_draw_options to i8*), i64 %19)
%21 = tail call i32 @mvwprintw(i32* %0, i32 %14, i32 5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = tail call i32 @wattroff(i32* %0, i32 %17)
%23 = add nuw nsw i32 %14, 1
%24 = icmp eq i64 %15, %11
br i1 %24, label %25, label %12
25: ; preds = %12, %3
%26 = tail call i32 @wrefresh(i32* %0)
ret void
}