#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*/ print_spaces(int);
int /*<<< orphan*/ printf(char *);
void print_help(void) {
  printf("Commands\n");
  printf("l");
  print_spaces(29);
  printf(": Load elf file\n");
  printf("b <address>");
  print_spaces(19);
  printf(": Load binary file to <address>\n");
  printf("d <start address> <num bytes> : Dump mem\n");
  printf("h");
  print_spaces(29);
  printf(": Print help message\n");
  printf("j <address>");
  print_spaces(19);
  printf(": Execute loaded elf, jumping to <address>\n");
  printf("p <address>");
  print_spaces(19);
  printf(": Print ascii mem until first 0\n");
  printf("r <address>");
  print_spaces(19);
  printf(": Read mem\n");
  printf("s");
  print_spaces(29);
  printf(": Core status\n");
  printf("w <address> <value>");
  print_spaces(11);
  printf(": Write mem\n");
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1d,%edi
call   1030 <print_spaces@plt>
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x13,%edi
call   1030 <print_spaces@plt>
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1d,%edi
call   1030 <print_spaces@plt>
lea    0xed9(%rip),%rdi
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x13,%edi
call   1030 <print_spaces@plt>
lea    0xed9(%rip),%rdi
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x13,%edi
call   1030 <print_spaces@plt>
lea    0xeef(%rip),%rdi
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
call   1040 <printf@plt>
mov    $0x13,%edi
call   1030 <print_spaces@plt>
lea    0xefa(%rip),%rdi
call   1040 <printf@plt>
lea    0xefa(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1d,%edi
call   1030 <print_spaces@plt>
lea    0xee6(%rip),%rdi
call   1040 <printf@plt>
lea    0xee9(%rip),%rdi
call   1040 <printf@plt>
mov    $0xb,%edi
call   1030 <print_spaces@plt>
lea    0xee7(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
push   %rax
lea    0xefc(%rip),%rdi
call   1050 <puts@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x1d,%edi
call   1040 <print_spaces@plt>
lea    0xee5(%rip),%rdi
call   1050 <puts@plt>
lea    0xe8c(%rip),%rdi
call   1060 <printf@plt>
mov    $0x13,%edi
call   1040 <print_spaces@plt>
lea    0xed3(%rip),%rdi
call   1050 <puts@plt>
lea    0xee7(%rip),%rdi
call   1050 <puts@plt>
mov    $0x68,%edi
call   1030 <putchar@plt>
mov    $0x1d,%edi
call   1040 <print_spaces@plt>
lea    0xef0(%rip),%rdi
call   1050 <puts@plt>
lea    0xe4a(%rip),%rdi
call   1060 <printf@plt>
mov    $0x13,%edi
call   1040 <print_spaces@plt>
lea    0xee3(%rip),%rdi
call   1050 <puts@plt>
lea    0xe34(%rip),%rdi
call   1060 <printf@plt>
mov    $0x13,%edi
call   1040 <print_spaces@plt>
lea    0xeec(%rip),%rdi
call   1050 <puts@plt>
lea    0xe1e(%rip),%rdi
call   1060 <printf@plt>
mov    $0x13,%edi
call   1040 <print_spaces@plt>
lea    0xeea(%rip),%rdi
call   1050 <puts@plt>
mov    $0x73,%edi
call   1030 <putchar@plt>
mov    $0x1d,%edi
call   1040 <print_spaces@plt>
lea    0xed5(%rip),%rdi
call   1050 <puts@plt>
lea    0xde8(%rip),%rdi
call   1060 <printf@plt>
mov    $0xb,%edi
call   1040 <print_spaces@plt>
lea    0xec1(%rip),%rdi
pop    %rax
jmp    1050 <puts@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Commands\0A\00"
@.str.1 = [2 x i8] c"l\00"
@.str.2 = [17 x i8] c": Load elf file\0A\00"
@.str.3 = [12 x i8] c"b <address>\00"
@.str.4 = [33 x i8] c": Load binary file to <address>\0A\00"
@.str.5 = [42 x i8] c"d <start address> <num bytes> : Dump mem\0A\00"
@.str.6 = [2 x i8] c"h\00"
@.str.7 = [22 x i8] c": Print help message\0A\00"
@.str.8 = [12 x i8] c"j <address>\00"
@.str.9 = [44 x i8] c": Execute loaded elf, jumping to <address>\0A\00"
@.str.10 = [12 x i8] c"p <address>\00"
@.str.11 = [33 x i8] c": Print ascii mem until first 0\0A\00"
@.str.12 = [12 x i8] c"r <address>\00"
@.str.13 = [12 x i8] c": Read mem\0A\00"
@.str.14 = [2 x i8] c"s\00"
@.str.15 = [15 x i8] c": Core status\0A\00"
@.str.16 = [20 x i8] c"w <address> <value>\00"
@.str.17 = [13 x i8] c": Write mem\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @print_spaces(i32 29)
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @print_spaces(i32 19)
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @print_spaces(i32 29)
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @print_spaces(i32 19)
%14 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%16 = call i32 @print_spaces(i32 19)
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%19 = call i32 @print_spaces(i32 19)
%20 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%22 = call i32 @print_spaces(i32 29)
%23 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%25 = call i32 @print_spaces(i32 11)
%26 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.3 = [12 x i8] c"b <address>\00"
@.str.8 = [12 x i8] c"j <address>\00"
@.str.10 = [12 x i8] c"p <address>\00"
@.str.12 = [12 x i8] c"r <address>\00"
@.str.16 = [20 x i8] c"w <address> <value>\00"
@str = [9 x i8] c"Commands\00"
@str.18 = [16 x i8] c": Load elf file\00"
@str.19 = [32 x i8] c": Load binary file to <address>\00"
@str.20 = [41 x i8] c"d <start address> <num bytes> : Dump mem\00"
@str.21 = [21 x i8] c": Print help message\00"
@str.22 = [43 x i8] c": Execute loaded elf, jumping to <address>\00"
@str.23 = [32 x i8] c": Print ascii mem until first 0\00"
@str.24 = [11 x i8] c": Read mem\00"
@str.25 = [14 x i8] c": Core status\00"
@str.26 = [12 x i8] c": Write mem\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 108)
%3 = tail call i32 @print_spaces(i32 29)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.18, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @print_spaces(i32 19)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.19, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.20, i64 0, i64 0))
%9 = tail call i32 @putchar(i32 104)
%10 = tail call i32 @print_spaces(i32 29)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 @print_spaces(i32 19)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.22, i64 0, i64 0))
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%16 = tail call i32 @print_spaces(i32 19)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.23, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%19 = tail call i32 @print_spaces(i32 19)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.24, i64 0, i64 0))
%21 = tail call i32 @putchar(i32 115)
%22 = tail call i32 @print_spaces(i32 29)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.25, i64 0, i64 0))
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%25 = tail call i32 @print_spaces(i32 11)
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.26, i64 0, i64 0))
ret void
}