#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*/ ClrScreen();
int /*<<< orphan*/ PrintBoard(int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ scanw(char *, char *);
help() {
  char c;
  ClrScreen();
  printw("\n");
  printw("This program attempts to play CHESS\n\n");
  printw("To make a move, enter the column (labelled 'a' - 'h') and\n");
  printw("row (labelled '1' - '8') of the 'from' and 'to' squares.\n");
  printw("For example, to move the kings pawn forward 2 squares, type e2e4.\n");
  printw("Other commands are:\n\n");
  printw("o-o           castle king side\n");
  printw("o-o-o         castle queen side\n");
  printw("set           set up a board position\n");
  printw("switch        switch sides with computer\n");
  printw("go            skip your move\n");
  printw("reverse       reverse board display\n");
  printw("both          computer plays both sides\n");
  printw("time          change response time\n");
  printw("post          post best line of play\n");
  printw("hint          computer suggests your move\n");
  printw("list          list moves to file chess.lst\n");
  printw("save          save game to disk\n");
  printw("get           get game from disk\n");
  printw("quit          exit CHESS\n");
  refresh();
  scanw("%c", &c);
  ClrScreen();
  PrintBoard(1, 0, 0, 1);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <ClrScreen@plt>
lea    0xf8c(%rip),%rdi
call   1050 <printw@plt>
lea    0xe8e(%rip),%rdi
call   1050 <printw@plt>
lea    0xea8(%rip),%rdi
call   1050 <printw@plt>
lea    0xed7(%rip),%rdi
call   1050 <printw@plt>
lea    0xf05(%rip),%rdi
call   1050 <printw@plt>
lea    0xf3c(%rip),%rdi
call   1050 <printw@plt>
lea    0xf46(%rip),%rdi
call   1050 <printw@plt>
lea    0xf5a(%rip),%rdi
call   1050 <printw@plt>
lea    0xf6f(%rip),%rdi
call   1050 <printw@plt>
lea    0xf8a(%rip),%rdi
call   1050 <printw@plt>
lea    0xfa8(%rip),%rdi
call   1050 <printw@plt>
lea    0xfba(%rip),%rdi
call   1050 <printw@plt>
lea    0xfd3(%rip),%rdi
call   1050 <printw@plt>
lea    0xff0(%rip),%rdi
call   1050 <printw@plt>
lea    0x1008(%rip),%rdi
call   1050 <printw@plt>
lea    0x1022(%rip),%rdi
call   1050 <printw@plt>
lea    0x1041(%rip),%rdi
call   1050 <printw@plt>
lea    0x1061(%rip),%rdi
call   1050 <printw@plt>
lea    0x1076(%rip),%rdi
call   1050 <printw@plt>
lea    0x108c(%rip),%rdi
call   1050 <printw@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
lea    0x1093(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1070 <scanw@plt>
mov    $0x0,%al
call   1030 <ClrScreen@plt>
mov    $0x1,%ecx
xor    %edx,%edx
mov    %ecx,%edi
mov    %edx,%esi
call   1040 <PrintBoard@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
xor    %eax,%eax
call   1030 <ClrScreen@plt>
lea    0xf93(%rip),%rdi
call   1050 <printw@plt>
lea    0xe95(%rip),%rdi
call   1050 <printw@plt>
lea    0xeaf(%rip),%rdi
call   1050 <printw@plt>
lea    0xede(%rip),%rdi
call   1050 <printw@plt>
lea    0xf0c(%rip),%rdi
call   1050 <printw@plt>
lea    0xf43(%rip),%rdi
call   1050 <printw@plt>
lea    0xf4d(%rip),%rdi
call   1050 <printw@plt>
lea    0xf61(%rip),%rdi
call   1050 <printw@plt>
lea    0xf76(%rip),%rdi
call   1050 <printw@plt>
lea    0xf91(%rip),%rdi
call   1050 <printw@plt>
lea    0xfaf(%rip),%rdi
call   1050 <printw@plt>
lea    0xfc1(%rip),%rdi
call   1050 <printw@plt>
lea    0xfda(%rip),%rdi
call   1050 <printw@plt>
lea    0xff7(%rip),%rdi
call   1050 <printw@plt>
lea    0x100f(%rip),%rdi
call   1050 <printw@plt>
lea    0x1029(%rip),%rdi
call   1050 <printw@plt>
lea    0x1048(%rip),%rdi
call   1050 <printw@plt>
lea    0x1068(%rip),%rdi
call   1050 <printw@plt>
lea    0x107d(%rip),%rdi
call   1050 <printw@plt>
lea    0x1093(%rip),%rdi
call   1050 <printw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
lea    0x109a(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1070 <scanw@plt>
xor    %eax,%eax
call   1030 <ClrScreen@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <PrintBoard@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [38 x i8] c"This program attempts to play CHESS\0A\0A\00"
@.str.2 = [59 x i8] c"To make a move, enter the column (labelled 'a' - 'h') and\0A\00"
@.str.3 = [58 x i8] c"row (labelled '1' - '8') of the 'from' and 'to' squares.\0A\00"
@.str.4 = [67 x i8] c"For example, to move the kings pawn forward 2 squares, type e2e4.\0A\00"
@.str.5 = [22 x i8] c"Other commands are:\0A\0A\00"
@.str.6 = [32 x i8] c"o-o castle king side\0A\00"
@.str.7 = [33 x i8] c"o-o-o castle queen side\0A\00"
@.str.8 = [39 x i8] c"set set up a board position\0A\00"
@.str.9 = [42 x i8] c"switch switch sides with computer\0A\00"
@.str.10 = [30 x i8] c"go skip your move\0A\00"
@.str.11 = [37 x i8] c"reverse reverse board display\0A\00"
@.str.12 = [41 x i8] c"both computer plays both sides\0A\00"
@.str.13 = [36 x i8] c"time change response time\0A\00"
@.str.14 = [38 x i8] c"post post best line of play\0A\00"
@.str.15 = [43 x i8] c"hint computer suggests your move\0A\00"
@.str.16 = [44 x i8] c"list list moves to file chess.lst\0A\00"
@.str.17 = [33 x i8] c"save save game to disk\0A\00"
@.str.18 = [34 x i8] c"get get game from disk\0A\00"
@.str.19 = [26 x i8] c"quit exit CHESS\0A\00"
@.str.20 = [3 x i8] c"%c\00"
define i32 @help() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 (...) @ClrScreen()
%4 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printw(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printw(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printw(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printw(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printw(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printw(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printw(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printw(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @printw(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 @printw(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 @printw(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0))
%16 = call i32 @printw(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0))
%17 = call i32 @printw(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0))
%18 = call i32 @printw(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0))
%19 = call i32 @printw(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0))
%20 = call i32 @printw(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.16, i64 0, i64 0))
%21 = call i32 @printw(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0))
%22 = call i32 @printw(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.18, i64 0, i64 0))
%23 = call i32 @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
%24 = call i32 (...) @refresh()
%25 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %2)
%26 = call i32 (...) @ClrScreen()
%27 = call i32 @PrintBoard(i32 1, i32 0, i32 0, i32 1)
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [38 x i8] c"This program attempts to play CHESS\0A\0A\00"
@.str.2 = [59 x i8] c"To make a move, enter the column (labelled 'a' - 'h') and\0A\00"
@.str.3 = [58 x i8] c"row (labelled '1' - '8') of the 'from' and 'to' squares.\0A\00"
@.str.4 = [67 x i8] c"For example, to move the kings pawn forward 2 squares, type e2e4.\0A\00"
@.str.5 = [22 x i8] c"Other commands are:\0A\0A\00"
@.str.6 = [32 x i8] c"o-o castle king side\0A\00"
@.str.7 = [33 x i8] c"o-o-o castle queen side\0A\00"
@.str.8 = [39 x i8] c"set set up a board position\0A\00"
@.str.9 = [42 x i8] c"switch switch sides with computer\0A\00"
@.str.10 = [30 x i8] c"go skip your move\0A\00"
@.str.11 = [37 x i8] c"reverse reverse board display\0A\00"
@.str.12 = [41 x i8] c"both computer plays both sides\0A\00"
@.str.13 = [36 x i8] c"time change response time\0A\00"
@.str.14 = [38 x i8] c"post post best line of play\0A\00"
@.str.15 = [43 x i8] c"hint computer suggests your move\0A\00"
@.str.16 = [44 x i8] c"list list moves to file chess.lst\0A\00"
@.str.17 = [33 x i8] c"save save game to disk\0A\00"
@.str.18 = [34 x i8] c"get get game from disk\0A\00"
@.str.19 = [26 x i8] c"quit exit CHESS\0A\00"
@.str.20 = [3 x i8] c"%c\00"
define i32 @help() {
%1 = alloca i8
%2 = tail call i32 (...) @ClrScreen()
%3 = tail call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printw(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @printw(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @printw(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @printw(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @printw(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @printw(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 @printw(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%11 = tail call i32 @printw(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%12 = tail call i32 @printw(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
%13 = tail call i32 @printw(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%14 = tail call i32 @printw(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0))
%15 = tail call i32 @printw(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0))
%16 = tail call i32 @printw(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0))
%17 = tail call i32 @printw(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0))
%18 = tail call i32 @printw(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0))
%19 = tail call i32 @printw(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.16, i64 0, i64 0))
%20 = tail call i32 @printw(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0))
%21 = tail call i32 @printw(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.18, i64 0, i64 0))
%22 = tail call i32 @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
%23 = tail call i32 (...) @refresh()
%24 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %1)
%25 = call i32 (...) @ClrScreen()
%26 = call i32 @PrintBoard(i32 1, i32 0, i32 0, i32 1)
ret i32 undef
}