#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*/ interrupt(int, int, char *, int /*<<< orphan*/,
                             int /*<<< orphan*/);
void helpCommand(char *args[]) {
  char *commands[12];
  int count;
  commands[0] =
      "execute arg1 - execute the program of name specified in arg1\r\n\0";
  commands[1] = "delete arg1 - delete the file of name specified in arg1\r\n\0";
  commands[2] = "copy arg1 arg2 - copy the file of name arg1 to a new file "
                "named arg2\r\n\0";
  commands[3] = "dir - display the names and sizes (# sectors) of all files in "
                "the system\r\n\0";
  commands[4] = "create arg1 - create a new file of name arg1 and begin "
                "filling its contents. Type text and press enter to start a "
                "new line, and press enter on an empty line to finish.\r\n\0";
  commands[5] = "kill arg1 - kill the process of id arg1. The shell has a "
                "process id of 0.\r\n\0";
  commands[6] =
      "clear - clear the terminal window of all previously printed text\r\n\0";
  commands[7] = "quit - exit the shell\r\n\0";
  commands[8] = "executeforeground arg1 - execute the program of name arg1 in "
                "the foreground, blocking all other processes from running in "
                "the meantime\r\n\0";
  commands[9] =
      "edit arg1 - edit the file of name arg1. Upon editing, each line of the "
      "file will appear and be editable in the console. Press enter to go to "
      "the next line, or exit the file if on the last line.\r\n\0";
  commands[10] = "top - display the list of top-level processes with names and "
                 "their process ids\r\n\0";
  commands[11] = "help - display this help menu\r\n\0";
  for (count = 0; count < 12; count++) {
    interrupt(0x21, 0x0, commands[count], 0, 0);
  }
  return;
}


x86 assembly (clang, -O0):
<helpCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xf0f(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xf3f(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xf7c(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xfbd(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0x105d(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0x109f(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0x10d8(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0x10e6(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0x1165(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0x121f(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0x1266(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0xc,-0x74(%rbp)
jge    11de <helpCommand+0xce>
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rdx
mov    $0x21,%edi
xor    %r8d,%r8d
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <interrupt@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11aa <helpCommand+0x9a>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<helpCommand>:
push   %rax
lea    0xee8(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0xf10(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0xf33(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0xf63(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0xf97(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0x102a(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0x105f(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0x108b(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0x108c(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0x10fe(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0x11ab(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0x11e5(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
pop    %rax
jmp    1030 <interrupt@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"execute arg1 - execute the program of name specified in arg1\0D\0A\00\00"
@.str.1 = [59 x i8] c"delete arg1 - delete the file of name specified in arg1\0D\0A\00\00"
@.str.2 = [72 x i8] c"copy arg1 arg2 - copy the file of name arg1 to a new file named arg2\0D\0A\00\00"
@.str.3 = [76 x i8] c"dir - display the names and sizes (# sectors) of all files in the system\0D\0A\00\00"
@.str.4 = [171 x i8] c"create arg1 - create a new file of name arg1 and begin filling its contents. Type text and press enter to start a new line, and press enter on an empty line to finish.\0D\0A\00\00"
@.str.5 = [77 x i8] c"kill arg1 - kill the process of id arg1. The shell has a process id of 0.\0D\0A\00\00"
@.str.6 = [68 x i8] c"clear - clear the terminal window of all previously printed text\0D\0A\00\00"
@.str.7 = [25 x i8] c"quit - exit the shell\0D\0A\00\00"
@.str.8 = [138 x i8] c"executeforeground arg1 - execute the program of name arg1 in the foreground, blocking all other processes from running in the meantime\0D\0A\00\00"
@.str.9 = [197 x i8] c"edit arg1 - edit the file of name arg1. Upon editing, each line of the file will appear and be editable in the console. Press enter to go to the next line, or exit the file if on the last line.\0D\0A\00\00"
@.str.10 = [82 x i8] c"top - display the list of top-level processes with names and their process ids\0D\0A\00\00"
@.str.11 = [33 x i8] c"help - display this help menu\0D\0A\00\00"
define void @helpCommand(i8** %0) {
%2 = alloca i8**
%3 = alloca [12 x i8*]
%4 = alloca i32
store i8** %0, i8*** %2
%5 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 4
store i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.4, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 5
store i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 6
store i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 7
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 8
store i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.8, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 9
store i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.9, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 10
store i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.10, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 11
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), i8** %16
store i32 0, i32* %4
br label %17
17: ; preds = %26, %1
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 12
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [12 x i8*], [12 x i8*]* %3, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @interrupt(i32 33, i32 0, i8* %24, i32 0, i32 0)
br label %26
26: ; preds = %20
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %17
29: ; preds = %17
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"execute arg1 - execute the program of name specified in arg1\0D\0A\00\00"
@.str.1 = [59 x i8] c"delete arg1 - delete the file of name specified in arg1\0D\0A\00\00"
@.str.2 = [72 x i8] c"copy arg1 arg2 - copy the file of name arg1 to a new file named arg2\0D\0A\00\00"
@.str.3 = [76 x i8] c"dir - display the names and sizes (# sectors) of all files in the system\0D\0A\00\00"
@.str.4 = [171 x i8] c"create arg1 - create a new file of name arg1 and begin filling its contents. Type text and press enter to start a new line, and press enter on an empty line to finish.\0D\0A\00\00"
@.str.5 = [77 x i8] c"kill arg1 - kill the process of id arg1. The shell has a process id of 0.\0D\0A\00\00"
@.str.6 = [68 x i8] c"clear - clear the terminal window of all previously printed text\0D\0A\00\00"
@.str.7 = [25 x i8] c"quit - exit the shell\0D\0A\00\00"
@.str.8 = [138 x i8] c"executeforeground arg1 - execute the program of name arg1 in the foreground, blocking all other processes from running in the meantime\0D\0A\00\00"
@.str.9 = [197 x i8] c"edit arg1 - edit the file of name arg1. Upon editing, each line of the file will appear and be editable in the console. Press enter to go to the next line, or exit the file if on the last line.\0D\0A\00\00"
@.str.10 = [82 x i8] c"top - display the list of top-level processes with names and their process ids\0D\0A\00\00"
@.str.11 = [33 x i8] c"help - display this help menu\0D\0A\00\00"
define void @helpCommand(i8** nocapture readnone %0) {
%2 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%3 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
%4 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
%5 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0)
%6 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%7 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0), i32 0, i32 0)
%8 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0), i32 0, i32 0)
%9 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 0, i32 0)
%10 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.8, i64 0, i64 0), i32 0, i32 0)
%11 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.9, i64 0, i64 0), i32 0, i32 0)
%12 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.10, i64 0, i64 0), i32 0, i32 0)
%13 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), i32 0, i32 0)
ret void
}