#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'd' - dumps out CPU\n");
  printf("\t'h' or '?' - help menu (seems kinda redundant at this point)\n");
  printf("\t'q' - quits the program\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("\nSDC Instruction Set:");
  printf("\n   0xxx: HALT");
  printf("\n   1RMM: Load Reg[R] <- M[MM]");
  printf("\n   2RMM: Store M[MM] <- Reg[R]");
  printf("\n   3RMM: Add M[MM] to Reg[R]");
  printf("\n   4Rxx: Negate Reg[R]");
  printf("\n   5RMM: Load Immediate Reg[R] <- MM");
  printf("\n  -5RMM: Load Immediate Reg[R] <- -MM");
  printf("\n   6RMM: Add Immediate Reg[R] <- Reg[R] + MM");
  printf("\n  -6RMM: Subtract Immediate Reg[R] <- Reg[R] - MM");
  printf("\n   7xMM: Branch to MM");
  printf("\n   8RMM: Branch Conditional to MM");
  printf("\n   90xx: Read char into R0");
  printf("\n   91xx: Print char in R0");
  printf("\n   92MM: Print string starting at MM");
  printf("\n   93MM: Dump CPU");
  printf("\n   94MM: Dump memory\n\n");
  printf("Waiting on your call mate!\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    0xef6(%rip),%rdi
call   1030 <printf@plt>
lea    0xf29(%rip),%rdi
call   1030 <printf@plt>
lea    0xf37(%rip),%rdi
call   1030 <printf@plt>
lea    0xf81(%rip),%rdi
call   1030 <printf@plt>
lea    0xf9f(%rip),%rdi
call   1030 <printf@plt>
lea    0xfa9(%rip),%rdi
call   1030 <printf@plt>
lea    0xfac(%rip),%rdi
call   1030 <printf@plt>
lea    0xfbf(%rip),%rdi
call   1030 <printf@plt>
lea    0xfd3(%rip),%rdi
call   1030 <printf@plt>
lea    0xfe5(%rip),%rdi
call   1030 <printf@plt>
lea    0xff1(%rip),%rdi
call   1030 <printf@plt>
lea    0x100b(%rip),%rdi
call   1030 <printf@plt>
lea    0x1026(%rip),%rdi
call   1030 <printf@plt>
lea    0x1048(%rip),%rdi
call   1030 <printf@plt>
lea    0x106f(%rip),%rdi
call   1030 <printf@plt>
lea    0x107a(%rip),%rdi
call   1030 <printf@plt>
lea    0x1091(%rip),%rdi
call   1030 <printf@plt>
lea    0x10a1(%rip),%rdi
call   1030 <printf@plt>
lea    0x10b0(%rip),%rdi
call   1030 <printf@plt>
lea    0x10ca(%rip),%rdi
call   1030 <printf@plt>
lea    0x10d1(%rip),%rdi
call   1030 <printf@plt>
lea    0x10dd(%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    0x10c5(%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    0x10ce(%rip),%rdi
call   1040 <puts@plt>
lea    0x10e6(%rip),%rdi
call   1040 <puts@plt>
lea    0x10fb(%rip),%rdi
call   1040 <puts@plt>
lea    0x1104(%rip),%rdi
call   1040 <puts@plt>
lea    0x1136(%rip),%rdi
call   1040 <puts@plt>
lea    0x1143(%rip),%rdi
call   1040 <puts@plt>
lea    0x118c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe32(%rip),%rdi
call   1050 <printf@plt>
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe3f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe52(%rip),%rdi
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
lea    0xe78(%rip),%rdi
call   1050 <printf@plt>
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1050 <printf@plt>
lea    0xedb(%rip),%rdi
call   1050 <printf@plt>
lea    0xf02(%rip),%rdi
call   1050 <printf@plt>
lea    0xf0d(%rip),%rdi
call   1050 <printf@plt>
lea    0xf24(%rip),%rdi
call   1050 <printf@plt>
lea    0xf34(%rip),%rdi
call   1050 <printf@plt>
lea    0xf43(%rip),%rdi
call   1050 <printf@plt>
lea    0xf5d(%rip),%rdi
call   1050 <printf@plt>
lea    0x10e9(%rip),%rdi
call   1040 <puts@plt>
lea    0x10f4(%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 = [22 x i8] c"\09'd' - dumps out CPU\0A\00"
@.str.7 = [63 x i8] c"\09'h' or '?' - help menu (seems kinda redundant at this point)\0A\00"
@.str.8 = [26 x i8] c"\09'q' - quits the program\0A\00"
@.str.9 = [86 x i8] c"\09an integer > 0 - executes N instruction cycles (don't get too crazy with this one!)\0A\00"
@.str.10 = [42 x i8] c"\09return - executes one instruction cycle\0A\00"
@.str.11 = [22 x i8] c"\0ASDC Instruction Set:\00"
@.str.12 = [15 x i8] c"\0A 0xxx: HALT\00"
@.str.13 = [31 x i8] c"\0A 1RMM: Load Reg[R] <- M[MM]\00"
@.str.14 = [32 x i8] c"\0A 2RMM: Store M[MM] <- Reg[R]\00"
@.str.15 = [30 x i8] c"\0A 3RMM: Add M[MM] to Reg[R]\00"
@.str.16 = [24 x i8] c"\0A 4Rxx: Negate Reg[R]\00"
@.str.17 = [38 x i8] c"\0A 5RMM: Load Immediate Reg[R] <- MM\00"
@.str.18 = [39 x i8] c"\0A -5RMM: Load Immediate Reg[R] <- -MM\00"
@.str.19 = [46 x i8] c"\0A 6RMM: Add Immediate Reg[R] <- Reg[R] + MM\00"
@.str.20 = [51 x i8] c"\0A -6RMM: Subtract Immediate Reg[R] <- Reg[R] - MM\00"
@.str.21 = [23 x i8] c"\0A 7xMM: Branch to MM\00"
@.str.22 = [35 x i8] c"\0A 8RMM: Branch Conditional to MM\00"
@.str.23 = [28 x i8] c"\0A 90xx: Read char into R0\00"
@.str.24 = [27 x i8] c"\0A 91xx: Print char in R0\00"
@.str.25 = [38 x i8] c"\0A 92MM: Print string starting at MM\00"
@.str.26 = [19 x i8] c"\0A 93MM: Dump CPU\00"
@.str.27 = [24 x i8] c"\0A 94MM: Dump memory\0A\0A\00"
@.str.28 = [28 x i8] c"Waiting on your call mate!\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 ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.9, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0))
%43 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.17, i64 0, i64 0))
%44 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0))
%45 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.19, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.20, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0))
%48 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.22, i64 0, i64 0))
%49 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.23, i64 0, i64 0))
%50 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.24, i64 0, i64 0))
%51 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.25, i64 0, i64 0))
%52 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.26, i64 0, i64 0))
%53 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.27, i64 0, i64 0))
%54 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.28, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [13 x i8] c"\0D \00"
@.str.11 = [22 x i8] c"\0ASDC Instruction Set:\00"
@.str.12 = [15 x i8] c"\0A 0xxx: HALT\00"
@.str.13 = [31 x i8] c"\0A 1RMM: Load Reg[R] <- M[MM]\00"
@.str.14 = [32 x i8] c"\0A 2RMM: Store M[MM] <- Reg[R]\00"
@.str.15 = [30 x i8] c"\0A 3RMM: Add M[MM] to Reg[R]\00"
@.str.16 = [24 x i8] c"\0A 4Rxx: Negate Reg[R]\00"
@.str.17 = [38 x i8] c"\0A 5RMM: Load Immediate Reg[R] <- MM\00"
@.str.18 = [39 x i8] c"\0A -5RMM: Load Immediate Reg[R] <- -MM\00"
@.str.19 = [46 x i8] c"\0A 6RMM: Add Immediate Reg[R] <- Reg[R] + MM\00"
@.str.20 = [51 x i8] c"\0A -6RMM: Subtract Immediate Reg[R] <- Reg[R] - MM\00"
@.str.21 = [23 x i8] c"\0A 7xMM: Branch to MM\00"
@.str.22 = [35 x i8] c"\0A 8RMM: Branch Conditional to MM\00"
@.str.23 = [28 x i8] c"\0A 90xx: Read char into R0\00"
@.str.24 = [27 x i8] c"\0A 91xx: Print char in R0\00"
@.str.25 = [38 x i8] c"\0A 92MM: Print string starting at MM\00"
@.str.26 = [19 x i8] c"\0A 93MM: Dump CPU\00"
@str = [86 x i8] c"\0AStuck in a pickle? Give us a few minutes, a representative will be with you shortly!\00"
@str.29 = [36 x i8] c"\0A\0AJK ain't nobody got time for dat!\00"
@str.30 = [33 x i8] c"\0AHere is a list of your options:\00"
@str.31 = [21 x i8] c"\09'd' - dumps out CPU\00"
@str.32 = [62 x i8] c"\09'h' or '?' - help menu (seems kinda redundant at this point)\00"
@str.33 = [25 x i8] c"\09'q' - quits the program\00"
@str.34 = [85 x i8] c"\09an integer > 0 - executes N instruction cycles (don't get too crazy with this one!)\00"
@str.35 = [41 x i8] c"\09return - executes one instruction cycle\00"
@str.36 = [23 x i8] c"\0A 94MM: Dump memory\0A\00"
@str.37 = [27 x i8] c"Waiting on your call mate!\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 %28
2: ; preds = %34
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.29, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.30, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.31, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.32, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.33, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.34, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.35, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0))
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0))
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.17, i64 0, i64 0))
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.19, i64 0, i64 0))
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.20, i64 0, i64 0))
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0))
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.22, i64 0, i64 0))
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.23, i64 0, i64 0))
%23 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.24, i64 0, i64 0))
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.25, i64 0, i64 0))
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.26, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.36, i64 0, i64 0))
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.37, i64 0, i64 0))
ret void
28: ; preds = %0, %34
%29 = phi i32 [ 0, %0 ], [ %35, %34 ]
%30 = tail call i32 @putchar(i32 46)
switch i32 %29, label %34 [
i32 20, label %31
i32 10, label %31
]
31: ; preds = %28, %28
%32 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%33 = tail call i32 @putchar(i32 13)
br label %34
34: ; preds = %28, %31
%35 = add nuw nsw i32 %29, 1
%36 = icmp eq i32 %35, 30
br i1 %36, label %2, label %28
}