#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*/ printf(char *);
void help_message(void) {
  printf("\nStuck in a pickle? Give us a few minutes, a representative will be "
         "with you shortly!\n");
  for (int i = 0; i < 30; i++) {
    printf(".");
    int j = 0;
    while (j < 1e7 * 2) {
      j++;
    }
    if (i == 10 || i == 20) {
      printf("\r           ");
      printf("\r");
    }
  }
  printf("\n\nJK ain't nobody got time for dat!\n");
  printf("\nHere is a list of your options:\n");
  printf("\t'a' - change the conditional code (case sensitive)\n");
  printf("\t'c' - *change the value of a memory location\n");
  printf("\t'd' - dumps out CPU\n");
  printf("\t'f' - change running flag to 1\n");
  printf("\t'h' or '?' - help menu (seems kinda redundant at this point)\n");
  printf("\t'p' - *change the PC\n");
  printf("\t'q' - quits the program\n");
  printf("\t'r' - *change the value of a register\n");
  printf("\t's' - *dumps a specific section of memory\n");
  printf("\tan integer > 0 - executes N instruction cycles (don't get too "
         "crazy with this one!)\n");
  printf("\treturn - executes one instruction cycle\n");
  printf("\t\t*(*YOU MUST ENTER A 4-DIGIT HEX VALUE OR ELSE!)\n");
  printf("\t\t\t*this assumption was approved by Dr. Jim Sasaki\n");
}


x86 assembly (clang, -O0):
<help_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x1e,-0x4(%rbp)
jge    11ac <help_message+0x9c>
lea    0xf23(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xeab(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    116d <help_message+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <help_message+0x38>
cmpl   $0xa,-0x4(%rbp)
je     1181 <help_message+0x71>
cmpl   $0x14,-0x4(%rbp)
jne    1199 <help_message+0x89>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
jmp    119e <help_message+0x8e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112b <help_message+0x1b>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
call   1030 <printf@plt>
lea    0xf38(%rip),%rdi
call   1030 <printf@plt>
lea    0xf42(%rip),%rdi
call   1030 <printf@plt>
lea    0xf57(%rip),%rdi
call   1030 <printf@plt>
lea    0xf8a(%rip),%rdi
call   1030 <printf@plt>
lea    0xf95(%rip),%rdi
call   1030 <printf@plt>
lea    0xfa3(%rip),%rdi
call   1030 <printf@plt>
lea    0xfbf(%rip),%rdi
call   1030 <printf@plt>
lea    0xfdf(%rip),%rdi
call   1030 <printf@plt>
lea    0x1029(%rip),%rdi
call   1030 <printf@plt>
lea    0x1047(%rip),%rdi
call   1030 <printf@plt>
lea    0x106e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help_message>:
push   %rbp
push   %rbx
push   %rax
lea    0xed3(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
lea    0xeb8(%rip),%rbx
jmp    116a <help_message+0x3a>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xd,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0x1e,%ebp
je     1180 <help_message+0x50>
mov    $0x2e,%edi
call   1030 <putchar@plt>
cmp    $0x14,%ebp
je     1150 <help_message+0x20>
cmp    $0xa,%ebp
je     1150 <help_message+0x20>
jmp    1162 <help_message+0x32>
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
lea    0xef4(%rip),%rdi
call   1040 <puts@plt>
lea    0xf09(%rip),%rdi
call   1040 <puts@plt>
lea    0xf31(%rip),%rdi
call   1040 <puts@plt>
lea    0xf53(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf70(%rip),%rdi
call   1040 <puts@plt>
lea    0xfa2(%rip),%rdi
call   1040 <puts@plt>
lea    0xfac(%rip),%rdi
call   1040 <puts@plt>
lea    0xfb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xfd4(%rip),%rdi
call   1040 <puts@plt>
lea    0xff3(%rip),%rdi
call   1040 <puts@plt>
lea    0x103c(%rip),%rdi
call   1040 <puts@plt>
lea    0x1059(%rip),%rdi
call   1040 <puts@plt>
lea    0x107f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [87 x i8] c"\0AStuck in a pickle? Give us a few minutes, a representative will be with you shortly!\0A\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [13 x i8] c"\0D \00"
@.str.3 = [2 x i8] c"\0D\00"
@.str.4 = [37 x i8] c"\0A\0AJK ain't nobody got time for dat!\0A\00"
@.str.5 = [34 x i8] c"\0AHere is a list of your options:\0A\00"
@.str.6 = [53 x i8] c"\09'a' - change the conditional code (case sensitive)\0A\00"
@.str.7 = [47 x i8] c"\09'c' - *change the value of a memory location\0A\00"
@.str.8 = [22 x i8] c"\09'd' - dumps out CPU\0A\00"
@.str.9 = [33 x i8] c"\09'f' - change running flag to 1\0A\00"
@.str.10 = [63 x i8] c"\09'h' or '?' - help menu (seems kinda redundant at this point)\0A\00"
@.str.11 = [23 x i8] c"\09'p' - *change the PC\0A\00"
@.str.12 = [26 x i8] c"\09'q' - quits the program\0A\00"
@.str.13 = [40 x i8] c"\09'r' - *change the value of a register\0A\00"
@.str.14 = [44 x i8] c"\09's' - *dumps a specific section of memory\0A\00"
@.str.15 = [86 x i8] c"\09an integer > 0 - executes N instruction cycles (don't get too crazy with this one!)\0A\00"
@.str.16 = [42 x i8] c"\09return - executes one instruction cycle\0A\00"
@.str.17 = [51 x i8] c"\09\09*(*YOU MUST ENTER A 4-DIGIT HEX VALUE OR ELSE!)\0A\00"
@.str.18 = [52 x i8] c"\09\09\09*this assumption was approved by Dr. Jim Sasaki\0A\00"
define void @help_message() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %4
4: ; preds = %26, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 30
br i1 %6, label %7, label %29
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %9
9: ; preds = %13, %7
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fcmp olt double %11, 2.000000e+07
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %9
16: ; preds = %9
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 10
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %1
%21 = icmp eq i32 %20, 20
br i1 %21, label %22, label %25
22: ; preds = %19, %16
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %22, %19
br label %26
26: ; preds = %25
%27 = load i32, i32* %1
%28 = add nsw i32 %27, 1
store i32 %28, i32* %1
br label %4
29: ; preds = %4
%30 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.10, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.13, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.15, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.16, i64 0, i64 0))
%43 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.17, i64 0, i64 0))
%44 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.18, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [13 x i8] c"\0D \00"
@str = [86 x i8] c"\0AStuck in a pickle? Give us a few minutes, a representative will be with you shortly!\00"
@str.19 = [36 x i8] c"\0A\0AJK ain't nobody got time for dat!\00"
@str.20 = [33 x i8] c"\0AHere is a list of your options:\00"
@str.21 = [52 x i8] c"\09'a' - change the conditional code (case sensitive)\00"
@str.22 = [46 x i8] c"\09'c' - *change the value of a memory location\00"
@str.23 = [21 x i8] c"\09'd' - dumps out CPU\00"
@str.24 = [32 x i8] c"\09'f' - change running flag to 1\00"
@str.25 = [62 x i8] c"\09'h' or '?' - help menu (seems kinda redundant at this point)\00"
@str.26 = [22 x i8] c"\09'p' - *change the PC\00"
@str.27 = [25 x i8] c"\09'q' - quits the program\00"
@str.28 = [39 x i8] c"\09'r' - *change the value of a register\00"
@str.29 = [43 x i8] c"\09's' - *dumps a specific section of memory\00"
@str.30 = [85 x i8] c"\09an integer > 0 - executes N instruction cycles (don't get too crazy with this one!)\00"
@str.31 = [41 x i8] c"\09return - executes one instruction cycle\00"
@str.32 = [50 x i8] c"\09\09*(*YOU MUST ENTER A 4-DIGIT HEX VALUE OR ELSE!)\00"
@str.33 = [51 x i8] c"\09\09\09*this assumption was approved by Dr. Jim Sasaki\00"
define void @help_message() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @str, i64 0, i64 0))
br label %18
2: ; preds = %24
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.19, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.20, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.21, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.22, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.24, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.25, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.26, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.27, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.28, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.29, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.30, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.31, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.32, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.33, i64 0, i64 0))
ret void
18: ; preds = %0, %24
%19 = phi i32 [ 0, %0 ], [ %25, %24 ]
%20 = tail call i32 @putchar(i32 46)
switch i32 %19, label %24 [
i32 20, label %21
i32 10, label %21
]
21: ; preds = %18, %18
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 @putchar(i32 13)
br label %24
24: ; preds = %18, %21
%25 = add nuw nsw i32 %19, 1
%26 = icmp eq i32 %25, 30
br i1 %26, label %2, label %18
}