#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 ProcessCommand(char *, char *);
int /*<<< orphan*/ strcmp(char const *, char *);
int ExecPressCommand(char ret[], const char *arg) {
  if (!strcmp(arg, "right"))
    return (ProcessCommand(ret, "C3A\r"));
  if (!strcmp(arg, "left"))
    return (ProcessCommand(ret, "C3B\r"));
  if (!strcmp(arg, "up"))
    return (ProcessCommand(ret, "C3C\r"));
  if (!strcmp(arg, "down"))
    return (ProcessCommand(ret, "C3D\r"));
  if (!strcmp(arg, "enter"))
    return (ProcessCommand(ret, "C3F\r"));
  return (2);
}


x86 assembly (clang, -O0):
<ExecPressCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1161 <ExecPressCommand+0x41>
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <ProcessCommand@plt>
mov    %eax,-0x4(%rbp)
jmp    122c <ExecPressCommand+0x10c>
mov    -0x18(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1192 <ExecPressCommand+0x72>
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <ProcessCommand@plt>
mov    %eax,-0x4(%rbp)
jmp    122c <ExecPressCommand+0x10c>
mov    -0x18(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c3 <ExecPressCommand+0xa3>
mov    -0x10(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1030 <ProcessCommand@plt>
mov    %eax,-0x4(%rbp)
jmp    122c <ExecPressCommand+0x10c>
mov    -0x18(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11f4 <ExecPressCommand+0xd4>
mov    -0x10(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1030 <ProcessCommand@plt>
mov    %eax,-0x4(%rbp)
jmp    122c <ExecPressCommand+0x10c>
mov    -0x18(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1225 <ExecPressCommand+0x105>
mov    -0x10(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1030 <ProcessCommand@plt>
mov    %eax,-0x4(%rbp)
jmp    122c <ExecPressCommand+0x10c>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExecPressCommand>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1196 <ExecPressCommand+0x76>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     119f <ExecPressCommand+0x7f>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11a8 <ExecPressCommand+0x88>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11b1 <ExecPressCommand+0x91>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ba <ExecPressCommand+0x9a>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe69(%rip),%rsi
jmp    11c1 <ExecPressCommand+0xa1>
lea    0xe6a(%rip),%rsi
jmp    11c1 <ExecPressCommand+0xa1>
lea    0xe69(%rip),%rsi
jmp    11c1 <ExecPressCommand+0xa1>
lea    0xe6a(%rip),%rsi
jmp    11c1 <ExecPressCommand+0xa1>
lea    0xe6c(%rip),%rsi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ProcessCommand@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"right\00"
@.str.1 = [5 x i8] c"C3A\0D\00"
@.str.2 = [5 x i8] c"left\00"
@.str.3 = [5 x i8] c"C3B\0D\00"
@.str.4 = [3 x i8] c"up\00"
@.str.5 = [5 x i8] c"C3C\0D\00"
@.str.6 = [5 x i8] c"down\00"
@.str.7 = [5 x i8] c"C3D\0D\00"
@.str.8 = [6 x i8] c"enter\00"
@.str.9 = [5 x i8] c"C3F\0D\00"
define i32 @ExecPressCommand(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @ProcessCommand(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %11, i32* %3
br label %41
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = call i32 @ProcessCommand(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 %18, i32* %3
br label %41
19: ; preds = %12
%20 = load i8*, i8** %5
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %19
%24 = load i8*, i8** %4
%25 = call i32 @ProcessCommand(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
store i32 %25, i32* %3
br label %41
26: ; preds = %19
%27 = load i8*, i8** %5
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %26
%31 = load i8*, i8** %4
%32 = call i32 @ProcessCommand(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
store i32 %32, i32* %3
br label %41
33: ; preds = %26
%34 = load i8*, i8** %5
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %33
%38 = load i8*, i8** %4
%39 = call i32 @ProcessCommand(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
store i32 %39, i32* %3
br label %41
40: ; preds = %33
store i32 2, i32* %3
br label %41
41: ; preds = %40, %37, %30, %23, %16, %9
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [6 x i8] c"right\00"
@.str.1 = [5 x i8] c"C3A\0D\00"
@.str.2 = [5 x i8] c"left\00"
@.str.3 = [5 x i8] c"C3B\0D\00"
@.str.4 = [3 x i8] c"up\00"
@.str.5 = [5 x i8] c"C3C\0D\00"
@.str.6 = [5 x i8] c"down\00"
@.str.7 = [5 x i8] c"C3D\0D\00"
@.str.8 = [6 x i8] c"enter\00"
@.str.9 = [5 x i8] c"C3F\0D\00"
define i32 @ExecPressCommand(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14, %11, %8, %5, %2
%18 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), %11 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), %14 ]
%19 = tail call i32 @ProcessCommand(i8* %0, i8* %18)
br label %20
20: ; preds = %17, %14
%21 = phi i32 [ 2, %14 ], [ %19, %17 ]
ret i32 %21
}