#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*/ get_app_path();
int /*<<< orphan*/ process_mode(char const *);
int /*<<< orphan*/ strncmp(char const *, char *, int);
int /*<<< orphan*/ systemf(char *, int /*<<< orphan*/);
void process_key(const char *line) {
  if (!strncmp(line, "keyup ", 6)) {
    process_mode(line + 6);
  } else if (!strncmp(line, "keydown Help", 12)) {
    systemf("%s/menu.sh", get_app_path());
  }
}


x86 assembly (clang, -O0):
<process_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    117c <process_key+0x3c>
mov    -0x8(%rbp),%rdi
add    $0x6,%rdi
call   1060 <process_mode@plt>
jmp    11b4 <process_key+0x74>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11af <process_key+0x6f>
mov    $0x0,%al
call   1040 <get_app_path@plt>
mov    %eax,%esi
lea    0xe6a(%rip),%rdi
call   1050 <systemf@plt>
jmp    11b4 <process_key+0x74>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_key>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1173 <process_key+0x33>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
mov    $0xc,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1180 <process_key+0x40>
pop    %rbx
ret
add    $0x6,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <process_mode@plt>
xor    %eax,%eax
call   1040 <get_app_path@plt>
lea    0xe86(%rip),%rdi
mov    %eax,%esi
pop    %rbx
jmp    1050 <systemf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"keyup \00"
@.str.1 = [13 x i8] c"keydown Help\00"
@.str.2 = [11 x i8] c"%s/menu.sh\00"
define void @process_key(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strncmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%5 = icmp ne i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 6
%9 = call i32 @process_mode(i8* %8)
br label %18
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @strncmp(i8* %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 12)
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = call i32 (...) @get_app_path()
%16 = call i32 @systemf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %10
br label %18
18: ; preds = %17, %6
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"keyup \00"
@.str.1 = [13 x i8] c"keydown Help\00"
@.str.2 = [11 x i8] c"%s/menu.sh\00"
define void @process_key(i8* %0) {
%2 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 6
%6 = tail call i32 @process_mode(i8* %5)
br label %13
7: ; preds = %1
%8 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 12)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i32 (...) @get_app_path()
%12 = tail call i32 @systemf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %7, %10, %4
ret void
}