#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 /*<<< orphan*/ A_BOLD;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ wclear(int /*<<< orphan*/);
void draw_screen(void) {
  int i;
  wclear(stdscr);
  attron(A_BOLD);
  mvaddstr(4 - 4, 64 / 2 - 4, "Su-Do-Ku!");
  attroff(A_BOLD);
  for (i = 0; i < 3; ++i) {
    mvaddstr(4 + 0 + 4 * i, 8, "+-------+-------+-------+");
    mvaddstr(4 + 1 + 4 * i, 8, "|       |       |       |");
    mvaddstr(4 + 2 + 4 * i, 8, "|       |       |       |");
    mvaddstr(4 + 3 + 4 * i, 8, "|       |       |       |");
  }
  mvaddstr(4 + 4 * 3, 8, "+-------+-------+-------+");
  mvaddstr(4 + 1, (8 + 3 * 8) + 6, "d-pad move cursor");
  mvaddstr(4 + 2, (8 + 3 * 8) + 7, "1-9  place digit");
  mvaddstr(4 + 3, (8 + 3 * 8) + 7, "0 .  clear digit");
  mvaddstr(4 + 4, (8 + 3 * 8) + 8, "c   clear board");
  mvaddstr(4 + 5, (8 + 3 * 8) + 8, "f   fix squares");
  mvaddstr(4 + 6, (8 + 3 * 8) + 8, "n   new board");
  mvaddstr(4 + 7, (8 + 3 * 8) + 8, "q   quit game");
  i = 4 + 7;
  mvaddstr(++i, (8 + 3 * 8) + 8, "u   undo last move");
  mvaddstr(++i, (8 + 3 * 8) + 8, "v   solve");
  mvaddstr(++i, (8 + 3 * 8) + 8, "?   request hint");
}


x86 assembly (clang, -O0):
<draw_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <wclear@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1040 <attron@plt>
xor    %edi,%edi
mov    $0x1c,%esi
lea    0xe8e(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    120c <draw_screen+0xcc>
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
add    $0x4,%edi
mov    $0x8,%esi
lea    0xe5f(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
add    $0x5,%edi
mov    $0x8,%esi
lea    0xe5f(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
add    $0x6,%edi
mov    $0x8,%esi
lea    0xe45(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
add    $0x7,%edi
mov    $0x8,%esi
lea    0xe2b(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118c <draw_screen+0x4c>
mov    $0x10,%edi
mov    $0x8,%esi
lea    0xded(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    $0x5,%edi
mov    $0x26,%esi
lea    0xe0b(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    $0x6,%edi
mov    $0x27,%esi
lea    0xe07(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    $0x7,%edi
mov    $0x27,%esi
lea    0xe02(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    $0x8,%edi
mov    $0x28,%esi
lea    0xdfd(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    $0x9,%edi
mov    $0x28,%esi
lea    0xdf7(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    $0xa,%edi
mov    $0x28,%esi
lea    0xdf1(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    $0xb,%edi
mov    $0x28,%esi
lea    0xde9(%rip),%rdx
call   1060 <mvaddstr@plt>
movl   $0xb,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x4(%rbp)
mov    $0x28,%esi
lea    0xdd6(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x4(%rbp)
mov    $0x28,%esi
lea    0xdcf(%rip),%rdx
call   1060 <mvaddstr@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x4(%rbp)
mov    $0x28,%esi
lea    0xdbf(%rip),%rdx
call   1060 <mvaddstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_screen>:
push   %r14
push   %rbx
push   %rax
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1050 <wclear@plt>
mov    0x2e7f(%rip),%rbx
mov    (%rbx),%edi
call   1040 <attron@plt>
lea    0xe99(%rip),%rdx
xor    %edi,%edi
mov    $0x1c,%esi
call   1060 <mvaddstr@plt>
mov    (%rbx),%edi
call   1030 <attroff@plt>
lea    0xe89(%rip),%r14
mov    $0x4,%edi
mov    $0x8,%esi
mov    %r14,%rdx
call   1060 <mvaddstr@plt>
lea    0xe8a(%rip),%rbx
mov    $0x5,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0x6,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0x7,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0x8,%edi
mov    $0x8,%esi
mov    %r14,%rdx
call   1060 <mvaddstr@plt>
mov    $0x9,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0xa,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0xb,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0xc,%edi
mov    $0x8,%esi
mov    %r14,%rdx
call   1060 <mvaddstr@plt>
mov    $0xd,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0xe,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0xf,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <mvaddstr@plt>
mov    $0x10,%edi
mov    $0x8,%esi
mov    %r14,%rdx
call   1060 <mvaddstr@plt>
lea    0xdc5(%rip),%rdx
mov    $0x5,%edi
mov    $0x26,%esi
call   1060 <mvaddstr@plt>
lea    0xdc1(%rip),%rdx
mov    $0x6,%edi
mov    $0x27,%esi
call   1060 <mvaddstr@plt>
lea    0xdbc(%rip),%rdx
mov    $0x7,%edi
mov    $0x27,%esi
call   1060 <mvaddstr@plt>
lea    0xdb7(%rip),%rdx
mov    $0x8,%edi
mov    $0x28,%esi
call   1060 <mvaddstr@plt>
lea    0xdb1(%rip),%rdx
mov    $0x9,%edi
mov    $0x28,%esi
call   1060 <mvaddstr@plt>
lea    0xdab(%rip),%rdx
mov    $0xa,%edi
mov    $0x28,%esi
call   1060 <mvaddstr@plt>
lea    0xda3(%rip),%rdx
mov    $0xb,%edi
mov    $0x28,%esi
call   1060 <mvaddstr@plt>
lea    0xd9b(%rip),%rdx
mov    $0xc,%edi
mov    $0x28,%esi
call   1060 <mvaddstr@plt>
lea    0xd98(%rip),%rdx
mov    $0xd,%edi
mov    $0x28,%esi
call   1060 <mvaddstr@plt>
lea    0xd8c(%rip),%rdx
mov    $0xe,%edi
mov    $0x28,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <mvaddstr@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@A_BOLD = global i32 0
@.str = [10 x i8] c"Su-Do-Ku!\00"
@.str.1 = [26 x i8] c"+-------+-------+-------+\00"
@.str.2 = [26 x i8] c"| | | |\00"
@.str.3 = [18 x i8] c"d-pad move cursor\00"
@.str.4 = [17 x i8] c"1-9 place digit\00"
@.str.5 = [17 x i8] c"0 . clear digit\00"
@.str.6 = [16 x i8] c"c clear board\00"
@.str.7 = [16 x i8] c"f fix squares\00"
@.str.8 = [14 x i8] c"n new board\00"
@.str.9 = [14 x i8] c"q quit game\00"
@.str.10 = [19 x i8] c"u undo last move\00"
@.str.11 = [10 x i8] c"v solve\00"
@.str.12 = [17 x i8] c"? request hint\00"
define void @draw_screen() {
%1 = alloca i32
%2 = load i32, i32* @stdscr
%3 = call i32 @wclear(i32 %2)
%4 = load i32, i32* @A_BOLD
%5 = call i32 @attron(i32 %4)
%6 = call i32 @mvaddstr(i32 0, i32 28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @A_BOLD
%8 = call i32 @attroff(i32 %7)
store i32 0, i32* %1
br label %9
9: ; preds = %29, %0
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %32
12: ; preds = %9
%13 = load i32, i32* %1
%14 = mul nsw i32 4, %13
%15 = add nsw i32 4, %14
%16 = call i32 @mvaddstr(i32 %15, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = mul nsw i32 4, %17
%19 = add nsw i32 5, %18
%20 = call i32 @mvaddstr(i32 %19, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %1
%22 = mul nsw i32 4, %21
%23 = add nsw i32 6, %22
%24 = call i32 @mvaddstr(i32 %23, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* %1
%26 = mul nsw i32 4, %25
%27 = add nsw i32 7, %26
%28 = call i32 @mvaddstr(i32 %27, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %12
%30 = load i32, i32* %1
%31 = add nsw i32 %30, 1
store i32 %31, i32* %1
br label %9
32: ; preds = %9
%33 = call i32 @mvaddstr(i32 16, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @mvaddstr(i32 5, i32 38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @mvaddstr(i32 6, i32 39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%36 = call i32 @mvaddstr(i32 7, i32 39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%37 = call i32 @mvaddstr(i32 8, i32 40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%38 = call i32 @mvaddstr(i32 9, i32 40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%39 = call i32 @mvaddstr(i32 10, i32 40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%40 = call i32 @mvaddstr(i32 11, i32 40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
store i32 11, i32* %1
%41 = load i32, i32* %1
%42 = add nsw i32 %41, 1
store i32 %42, i32* %1
%43 = call i32 @mvaddstr(i32 %42, i32 40, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
%44 = load i32, i32* %1
%45 = add nsw i32 %44, 1
store i32 %45, i32* %1
%46 = call i32 @mvaddstr(i32 %45, i32 40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%47 = load i32, i32* %1
%48 = add nsw i32 %47, 1
store i32 %48, i32* %1
%49 = call i32 @mvaddstr(i32 %48, i32 40, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@A_BOLD = global i32 0
@.str = [10 x i8] c"Su-Do-Ku!\00"
@.str.1 = [26 x i8] c"+-------+-------+-------+\00"
@.str.2 = [26 x i8] c"| | | |\00"
@.str.3 = [18 x i8] c"d-pad move cursor\00"
@.str.4 = [17 x i8] c"1-9 place digit\00"
@.str.5 = [17 x i8] c"0 . clear digit\00"
@.str.6 = [16 x i8] c"c clear board\00"
@.str.7 = [16 x i8] c"f fix squares\00"
@.str.8 = [14 x i8] c"n new board\00"
@.str.9 = [14 x i8] c"q quit game\00"
@.str.10 = [19 x i8] c"u undo last move\00"
@.str.11 = [10 x i8] c"v solve\00"
@.str.12 = [17 x i8] c"? request hint\00"
define void @draw_screen() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @wclear(i32 %1)
%3 = load i32, i32* @A_BOLD
%4 = tail call i32 @attron(i32 %3)
%5 = tail call i32 @mvaddstr(i32 0, i32 28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @A_BOLD
%7 = tail call i32 @attroff(i32 %6)
%8 = tail call i32 @mvaddstr(i32 4, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @mvaddstr(i32 5, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @mvaddstr(i32 6, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @mvaddstr(i32 7, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @mvaddstr(i32 8, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @mvaddstr(i32 9, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 @mvaddstr(i32 10, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @mvaddstr(i32 11, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @mvaddstr(i32 12, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 @mvaddstr(i32 13, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call i32 @mvaddstr(i32 14, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @mvaddstr(i32 15, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%20 = tail call i32 @mvaddstr(i32 16, i32 8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i32 @mvaddstr(i32 5, i32 38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%22 = tail call i32 @mvaddstr(i32 6, i32 39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 @mvaddstr(i32 7, i32 39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%24 = tail call i32 @mvaddstr(i32 8, i32 40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%25 = tail call i32 @mvaddstr(i32 9, i32 40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%26 = tail call i32 @mvaddstr(i32 10, i32 40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%27 = tail call i32 @mvaddstr(i32 11, i32 40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%28 = tail call i32 @mvaddstr(i32 12, i32 40, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
%29 = tail call i32 @mvaddstr(i32 13, i32 40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%30 = tail call i32 @mvaddstr(i32 14, i32 40, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
ret void
}