#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ badCommand();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileNotFound();
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ getFilePath(char *, int);
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ system(char *);
void runCommand(char *inputCommand) {
  char directory[100];
  getFilePath(directory, false);
  FILE *commandFile;
  commandFile = fopen(directory, "r");
  if (commandFile == NULL) {
    fileNotFound();
  }
  char command[100];
  char action[100];
  bool found = false;
  while ((fscanf(commandFile, "%[^\x001F]\x001F%[^\x001E]\x001E", command,
                 action) != EOF) &&
         (!found)) {
    if ((strcasecmp(inputCommand, command) == 0)) {
      found = true;
      system(action);
    }
  }
  if (found == false) {
    badCommand();
  }
  fclose(commandFile);
}


x86 assembly (clang, -O0):
<runCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
call   1050 <getFilePath@plt>
lea    -0x70(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    11c0 <runCommand+0x40>
mov    $0x0,%al
call   10a0 <fileNotFound@plt>
movl   $0x0,-0x154(%rbp)
mov    -0x78(%rbp),%rdi
lea    -0xe0(%rbp),%rdx
lea    -0x150(%rbp),%rcx
lea    0xe1f(%rip),%rsi
call   1080 <fscanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2df4(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x155(%rbp)
je     1215 <runCommand+0x95>
cmpl   $0x0,-0x154(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x155(%rbp)
mov    -0x155(%rbp),%al
test   $0x1,%al
jne    1228 <runCommand+0xa8>
jmp    125d <runCommand+0xdd>
mov    -0x8(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1258 <runCommand+0xd8>
movl   $0x1,-0x154(%rbp)
lea    -0x150(%rbp),%rdi
call   1070 <system@plt>
jmp    11ca <runCommand+0x4a>
cmpl   $0x0,-0x154(%rbp)
jne    1271 <runCommand+0xf1>
mov    $0x0,%al
call   1030 <badCommand@plt>
mov    -0x78(%rbp),%rdi
call   1060 <fclose@plt>
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runCommand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rdi,%r14
lea    0xe0(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <getFilePath@plt>
lea    0xe53(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    11c4 <runCommand+0x44>
xor    %eax,%eax
call   10a0 <fileNotFound@plt>
lea    0xe37(%rip),%rsi
lea    0x70(%rsp),%rdx
mov    %rsp,%rcx
mov    %r15,%rdi
call   1080 <fscanf@plt>
mov    0x2e06(%rip),%rcx
cmp    (%rcx),%rax
je     1242 <runCommand+0xc2>
lea    0x70(%rsp),%rbx
mov    %rsp,%r12
lea    0xe0c(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcasecmp@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    121b <runCommand+0x9b>
mov    %r12,%rdi
call   1070 <system@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1080 <fscanf@plt>
test   %rbp,%rbp
je     123d <runCommand+0xbd>
mov    0x2db0(%rip),%rcx
cmp    (%rcx),%rax
jne    1200 <runCommand+0x80>
test   %rbp,%rbp
je     1249 <runCommand+0xc9>
xor    %eax,%eax
call   1030 <badCommand@plt>
mov    %r15,%rdi
call   1060 <fclose@plt>
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [13 x i8] c"%[^\1F]\1F%[^\1E]\1E\00"
@EOF = global i64 0
define void @runCommand(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
%4 = alloca i32*
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i32
store i8* %0, i8** %2
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = call i32 @getFilePath(i8* %8, i32 0)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %4
%12 = load i32*, i32** %4
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = call i32 (...) @fileNotFound()
br label %16
16: ; preds = %14, %1
store i32 0, i32* %7
br label %17
17: ; preds = %38, %16
%18 = load i32*, i32** %4
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%21 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %20)
%22 = load i64, i64* @EOF
%23 = icmp ne i64 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %17
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br label %28
28: ; preds = %24, %17
%29 = phi i1 [ false, %17 ], [ %27, %24 ]
br i1 %29, label %30, label %39
30: ; preds = %28
%31 = load i8*, i8** %2
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%33 = call i64 @strcasecmp(i8* %31, i8* %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
store i32 1, i32* %7
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%37 = call i32 @system(i8* %36)
br label %38
38: ; preds = %35, %30
br label %17
39: ; preds = %28
%40 = load i32, i32* %7
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 (...) @badCommand()
br label %44
44: ; preds = %42, %39
%45 = load i32*, i32** %4
%46 = call i32 @fclose(i32* %45)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [13 x i8] c"%[^\1F]\1F%[^\1E]\1E\00"
@EOF = global i64 0
define void @runCommand(i8* nocapture %0) {
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @getFilePath(i8* %5, i32 0)
%7 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (...) @fileNotFound()
br label %11
11: ; preds = %9, %1
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = call i64 @fscanf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %28, label %17
17: ; preds = %11, %22
%18 = call i64 @strcasecmp(i8* %0, i8* %12)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @system(i8* %13)
br label %22
22: ; preds = %20, %17
%23 = call i64 @fscanf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13)
%24 = load i64, i64* @EOF
%25 = icmp eq i64 %23, %24
%26 = or i1 %19, %25
br i1 %26, label %27, label %17
27: ; preds = %22
br i1 %19, label %30, label %28
28: ; preds = %11, %27
%29 = call i32 (...) @badCommand()
br label %30
30: ; preds = %28, %27
%31 = call i32 @fclose(i32* %7)
ret void
}