#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*/ A_DIM;
int /*<<< orphan*/ A_STANDOUT;
int COLS;
int LINES;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ insch(char);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ sleep(int);
int strlen(char const *);
int main() {
  const char witch_one[] = "First witch: ";
  const char witch_two[] = "Second witch: ";
  initscr();
  move(5, 15);
  attron(A_BOLD);
  printw("Macbeth");
  attroff(A_BOLD);
  refresh();
  sleep(1);
  move(8, 15);
  attron(A_STANDOUT);
  printw("Thunder and lightning");
  attroff(A_STANDOUT);
  refresh();
  sleep(1);
  move(10, 10);
  printw("when shall we three meet again");
  move(13, 10);
  printw("in thunder, or in rain ?");
  move(17, 10);
  printw("when the hurlyburly'done,");
  move(20, 10);
  printw("when the battle's lost or win");
  refresh();
  sleep(1);
  move(10, 10);
  attron(A_DIM);
  char *scan_ptr = (char *)(witch_one + strlen(witch_one) - 1);
  while (scan_ptr >= witch_one) {
    move(10, 10);
    insch(*scan_ptr);
    scan_ptr--;
    refresh();
    sleep(1);
  }
  move(17, 10);
  scan_ptr = (char *)(witch_two + strlen(witch_two) - 1);
  while (scan_ptr >= witch_two) {
    move(17, 10);
    insch(*scan_ptr);
    scan_ptr--;
    refresh();
    sleep(1);
  }
  attroff(A_DIM);
  refresh();
  sleep(3);
  move(LINES - 1, COLS - 1);
  refresh();
  sleep(1);
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe4a(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xe48(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xe42(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xe39(%rip),%rax
mov    %rax,-0x21(%rbp)
mov    0xe37(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xe31(%rip),%ax
mov    %ax,-0x15(%rbp)
mov    0xe29(%rip),%al
mov    %al,-0x13(%rbp)
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x5,%edi
mov    $0xf,%esi
call   10c0 <move@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
call   1060 <attron@plt>
lea    0xdfc(%rip),%rdi
call   1070 <printw@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0x8,%edi
mov    $0xf,%esi
call   10c0 <move@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
call   1060 <attron@plt>
lea    0xdbc(%rip),%rdi
call   1070 <printw@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0xa,%esi
mov    %esi,%edi
call   10c0 <move@plt>
lea    0xd9b(%rip),%rdi
call   1070 <printw@plt>
mov    $0xd,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0xd9f(%rip),%rdi
call   1070 <printw@plt>
mov    $0x11,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0xd9d(%rip),%rdi
call   1070 <printw@plt>
mov    $0x14,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0xd9c(%rip),%rdi
call   1070 <printw@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0xa,%esi
mov    %esi,%edi
call   10c0 <move@plt>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
call   1060 <attron@plt>
lea    -0x12(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x12(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
lea    -0x12(%rbp),%rcx
cmp    %rcx,%rax
jb     1391 <main+0x1f1>
mov    $0xa,%esi
mov    %esi,%edi
call   10c0 <move@plt>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   10a0 <insch@plt>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
jmp    1346 <main+0x1a6>
mov    $0x11,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    -0x21(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x21(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
lea    -0x21(%rbp),%rcx
cmp    %rcx,%rax
jb     1413 <main+0x273>
mov    $0x11,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   10a0 <insch@plt>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
jmp    13c5 <main+0x225>
mov    0x2bae(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x3,%edi
call   10b0 <sleep@plt>
mov    0x2baf(%rip),%rax
mov    (%rax),%edi
sub    $0x1,%edi
mov    0x2b9b(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
call   10c0 <move@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0x0,%al
call   1090 <endwin@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movabs $0x203a6863746977,%rax
mov    %rax,0x6(%rsp)
movabs $0x6977207473726946,%rcx
20 77 69
mov    %rcx,(%rsp)
mov    %rax,0x17(%rsp)
movabs $0x7720646e6f636553,%rax
64 20 77
mov    %rax,0x10(%rsp)
xor    %eax,%eax
call   1050 <initscr@plt>
mov    $0x5,%edi
mov    $0xf,%esi
call   10c0 <move@plt>
mov    0x2dc9(%rip),%rbx
mov    (%rbx),%edi
call   1060 <attron@plt>
lea    0xe18(%rip),%rdi
call   1070 <printw@plt>
mov    (%rbx),%edi
call   1030 <attroff@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0x8,%edi
mov    $0xf,%esi
call   10c0 <move@plt>
mov    0x2d98(%rip),%rbx
mov    (%rbx),%edi
call   1060 <attron@plt>
lea    0xddf(%rip),%rdi
call   1070 <printw@plt>
mov    (%rbx),%edi
call   1030 <attroff@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0xa,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0xdc2(%rip),%rdi
call   1070 <printw@plt>
mov    $0xd,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0xdc6(%rip),%rdi
call   1070 <printw@plt>
mov    $0x11,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0xdc4(%rip),%rdi
call   1070 <printw@plt>
mov    $0x14,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0xdc3(%rip),%rdi
call   1070 <printw@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0xa,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
mov    0x2cd2(%rip),%r14
mov    (%r14),%edi
call   1060 <attron@plt>
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rbx
add    $0xffffffffffffffff,%rbx
cmp    %r15,%rbx
jb     1351 <main+0x1b1>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
movsbl (%rbx),%edi
call   10a0 <insch@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
add    $0xffffffffffffffff,%rbx
cmp    %r15,%rbx
jae    1320 <main+0x180>
mov    $0x11,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rbx
add    $0xf,%rbx
cmp    %r15,%rbx
jb     13b1 <main+0x211>
nopl   0x0(%rax)
mov    $0x11,%edi
mov    $0xa,%esi
call   10c0 <move@plt>
movsbl (%rbx),%edi
call   10a0 <insch@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
add    $0xffffffffffffffff,%rbx
cmp    %r15,%rbx
jae    1380 <main+0x1e0>
mov    (%r14),%edi
call   1030 <attroff@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    $0x3,%edi
call   10b0 <sleep@plt>
mov    0x2c17(%rip),%rax
mov    (%rax),%edi
add    $0xffffffff,%edi
mov    0x2c03(%rip),%rax
mov    (%rax),%esi
add    $0xffffffff,%esi
call   10c0 <move@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
xor    %eax,%eax
call   1090 <endwin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.witch_one = [14 x i8] c"First witch: \00"
@__const.main.witch_two = [15 x i8] c"Second witch: \00"
@A_BOLD = global i32 0
@.str = [8 x i8] c"Macbeth\00"
@A_STANDOUT = global i32 0
@.str.1 = [22 x i8] c"Thunder and lightning\00"
@.str.2 = [31 x i8] c"when shall we three meet again\00"
@.str.3 = [25 x i8] c"in thunder, or in rain ?\00"
@.str.4 = [26 x i8] c"when the hurlyburly'done,\00"
@.str.5 = [30 x i8] c"when the battle's lost or win\00"
@A_DIM = global i32 0
@LINES = global i32 0
@COLS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
%3 = alloca [15 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [14 x i8]* %2 to i8*
%6 = bitcast [15 x i8]* %3 to i8*
%7 = call i32 (...) @initscr()
%8 = call i32 @move(i32 5, i32 15)
%9 = load i32, i32* @A_BOLD
%10 = call i32 @attron(i32 %9)
%11 = call i32 @printw(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @A_BOLD
%13 = call i32 @attroff(i32 %12)
%14 = call i32 (...) @refresh()
%15 = call i32 @sleep(i32 1)
%16 = call i32 @move(i32 8, i32 15)
%17 = load i32, i32* @A_STANDOUT
%18 = call i32 @attron(i32 %17)
%19 = call i32 @printw(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @A_STANDOUT
%21 = call i32 @attroff(i32 %20)
%22 = call i32 (...) @refresh()
%23 = call i32 @sleep(i32 1)
%24 = call i32 @move(i32 10, i32 10)
%25 = call i32 @printw(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @move(i32 13, i32 10)
%27 = call i32 @printw(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @move(i32 17, i32 10)
%29 = call i32 @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 @move(i32 20, i32 10)
%31 = call i32 @printw(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%32 = call i32 (...) @refresh()
%33 = call i32 @sleep(i32 1)
%34 = call i32 @move(i32 10, i32 10)
%35 = load i32, i32* @A_DIM
%36 = call i32 @attron(i32 %35)
%37 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%38 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%39 = call i32 @strlen(i8* %38)
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
%42 = getelementptr inbounds i8, i8* %41, i64 -1
store i8* %42, i8** %4
br label %43
43: ; preds = %47, %0
%44 = load i8*, i8** %4
%45 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%46 = icmp uge i8* %44, %45
br i1 %46, label %47, label %56
47: ; preds = %43
%48 = call i32 @move(i32 10, i32 10)
%49 = load i8*, i8** %4
%50 = load i8, i8* %49
%51 = call i32 @insch(i8 signext %50)
%52 = load i8*, i8** %4
%53 = getelementptr inbounds i8, i8* %52, i32 -1
store i8* %53, i8** %4
%54 = call i32 (...) @refresh()
%55 = call i32 @sleep(i32 1)
br label %43
56: ; preds = %43
%57 = call i32 @move(i32 17, i32 10)
%58 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%59 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%60 = call i32 @strlen(i8* %59)
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %58, i64 %61
%63 = getelementptr inbounds i8, i8* %62, i64 -1
store i8* %63, i8** %4
br label %64
64: ; preds = %68, %56
%65 = load i8*, i8** %4
%66 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%67 = icmp uge i8* %65, %66
br i1 %67, label %68, label %77
68: ; preds = %64
%69 = call i32 @move(i32 17, i32 10)
%70 = load i8*, i8** %4
%71 = load i8, i8* %70
%72 = call i32 @insch(i8 signext %71)
%73 = load i8*, i8** %4
%74 = getelementptr inbounds i8, i8* %73, i32 -1
store i8* %74, i8** %4
%75 = call i32 (...) @refresh()
%76 = call i32 @sleep(i32 1)
br label %64
77: ; preds = %64
%78 = load i32, i32* @A_DIM
%79 = call i32 @attroff(i32 %78)
%80 = call i32 (...) @refresh()
%81 = call i32 @sleep(i32 3)
%82 = load i32, i32* @LINES
%83 = sub nsw i32 %82, 1
%84 = load i32, i32* @COLS
%85 = sub nsw i32 %84, 1
%86 = call i32 @move(i32 %83, i32 %85)
%87 = call i32 (...) @refresh()
%88 = call i32 @sleep(i32 1)
%89 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@__const.main.witch_one = [14 x i8] c"First witch: \00"
@__const.main.witch_two = [15 x i8] c"Second witch: \00"
@A_BOLD = global i32 0
@.str = [8 x i8] c"Macbeth\00"
@A_STANDOUT = global i32 0
@.str.1 = [22 x i8] c"Thunder and lightning\00"
@.str.2 = [31 x i8] c"when shall we three meet again\00"
@.str.3 = [25 x i8] c"in thunder, or in rain ?\00"
@.str.4 = [26 x i8] c"when the hurlyburly'done,\00"
@.str.5 = [30 x i8] c"when the battle's lost or win\00"
@A_DIM = global i32 0
@LINES = global i32 0
@COLS = global i32 0
define i32 @main() {
%1 = alloca [14 x i8]
%2 = alloca [15 x i8]
%3 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @initscr()
%6 = tail call i32 @move(i32 5, i32 15)
%7 = load i32, i32* @A_BOLD
%8 = tail call i32 @attron(i32 %7)
%9 = tail call i32 @printw(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @A_BOLD
%11 = tail call i32 @attroff(i32 %10)
%12 = tail call i32 (...) @refresh()
%13 = tail call i32 @sleep(i32 1)
%14 = tail call i32 @move(i32 8, i32 15)
%15 = load i32, i32* @A_STANDOUT
%16 = tail call i32 @attron(i32 %15)
%17 = tail call i32 @printw(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @A_STANDOUT
%19 = tail call i32 @attroff(i32 %18)
%20 = tail call i32 (...) @refresh()
%21 = tail call i32 @sleep(i32 1)
%22 = tail call i32 @move(i32 10, i32 10)
%23 = tail call i32 @printw(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32 @move(i32 13, i32 10)
%25 = tail call i32 @printw(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 @move(i32 17, i32 10)
%27 = tail call i32 @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%28 = tail call i32 @move(i32 20, i32 10)
%29 = tail call i32 @printw(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%30 = tail call i32 (...) @refresh()
%31 = tail call i32 @sleep(i32 1)
%32 = tail call i32 @move(i32 10, i32 10)
%33 = load i32, i32* @A_DIM
%34 = tail call i32 @attron(i32 %33)
%35 = call i32 @strlen(i8* %3)
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 %36
%38 = getelementptr inbounds i8, i8* %37, i64 -1
%39 = icmp ult i8* %38, %3
br i1 %39, label %49, label %40
40: ; preds = %0, %40
%41 = phi i8* [ %47, %40 ], [ %38, %0 ]
%42 = call i32 @move(i32 10, i32 10)
%43 = load i8, i8* %41
%44 = call i32 @insch(i8 signext %43)
%45 = call i32 (...) @refresh()
%46 = call i32 @sleep(i32 1)
%47 = getelementptr inbounds i8, i8* %41, i64 -1
%48 = icmp ult i8* %47, %3
br i1 %48, label %49, label %40
49: ; preds = %40, %0
%50 = call i32 @move(i32 17, i32 10)
%51 = call i32 @strlen(i8* %4)
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 %52
%54 = getelementptr inbounds i8, i8* %53, i64 -1
%55 = icmp ult i8* %54, %4
br i1 %55, label %65, label %56
56: ; preds = %49, %56
%57 = phi i8* [ %63, %56 ], [ %54, %49 ]
%58 = call i32 @move(i32 17, i32 10)
%59 = load i8, i8* %57
%60 = call i32 @insch(i8 signext %59)
%61 = call i32 (...) @refresh()
%62 = call i32 @sleep(i32 1)
%63 = getelementptr inbounds i8, i8* %57, i64 -1
%64 = icmp ult i8* %63, %4
br i1 %64, label %65, label %56
65: ; preds = %56, %49
%66 = load i32, i32* @A_DIM
%67 = call i32 @attroff(i32 %66)
%68 = call i32 (...) @refresh()
%69 = call i32 @sleep(i32 3)
%70 = load i32, i32* @LINES
%71 = add nsw i32 %70, -1
%72 = load i32, i32* @COLS
%73 = add nsw i32 %72, -1
%74 = call i32 @move(i32 %71, i32 %73)
%75 = call i32 (...) @refresh()
%76 = call i32 @sleep(i32 1)
%77 = call i32 (...) @endwin()
ret i32 0
}