#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*/ printf(char *, char);
void KIONIX_ACCEL_process_directional_tap(char tap_mode, char tap_direction) {
  switch (tap_direction) {
  case 0x01:
    printf("Z+, (%d)  Back \n", tap_mode);
    break;
  case 0x02:
    printf("Z-, (%d)  Front \n", tap_mode);
    break;
  case 0x04:
    printf("Y+, (%d)  Down \n", tap_mode);
    break;
  case 0x08:
    printf("Y-, (%d)  Up \n", tap_mode);
    break;
  case 0x10:
    printf("X+, (%d)  Left \n", tap_mode);
    break;
  case 0x20:
    printf("X-, (%d)  Right \n", tap_mode);
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<KIONIX_ACCEL_process_directional_tap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x1f,%eax
ja     11c7 <KIONIX_ACCEL_process_directional_tap+0xb7>
mov    -0x10(%rbp),%rax
lea    0xebb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf2b(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    11c7 <KIONIX_ACCEL_process_directional_tap+0xb7>
lea    0xf27(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    11c7 <KIONIX_ACCEL_process_directional_tap+0xb7>
lea    0xf24(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    11c7 <KIONIX_ACCEL_process_directional_tap+0xb7>
lea    0xf20(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    11c7 <KIONIX_ACCEL_process_directional_tap+0xb7>
lea    0xf1a(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    11c7 <KIONIX_ACCEL_process_directional_tap+0xb7>
lea    0xf16(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KIONIX_ACCEL_process_directional_tap>:
add    $0xffffffff,%esi
cmp    $0x1f,%esi
ja     1138 <KIONIX_ACCEL_process_directional_tap+0x28>
lea    0xf61(%rip),%rax
lea    0xeda(%rip),%rcx
movslq (%rcx,%rsi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf5b(%rip),%rax
jmp    115b <KIONIX_ACCEL_process_directional_tap+0x4b>
ret
lea    0xf63(%rip),%rax
jmp    115b <KIONIX_ACCEL_process_directional_tap+0x4b>
lea    0xf6b(%rip),%rax
jmp    115b <KIONIX_ACCEL_process_directional_tap+0x4b>
lea    0xf71(%rip),%rax
jmp    115b <KIONIX_ACCEL_process_directional_tap+0x4b>
lea    0xf79(%rip),%rax
movsbl %dil,%esi
mov    %rax,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Z+, (%d) Back \0A\00"
@.str.1 = [18 x i8] c"Z-, (%d) Front \0A\00"
@.str.2 = [17 x i8] c"Y+, (%d) Down \0A\00"
@.str.3 = [15 x i8] c"Y-, (%d) Up \0A\00"
@.str.4 = [17 x i8] c"X+, (%d) Left \0A\00"
@.str.5 = [18 x i8] c"X-, (%d) Right \0A\00"
define void @KIONIX_ACCEL_process_directional_tap(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %25 [
i32 1, label %7
i32 2, label %10
i32 4, label %13
i32 8, label %16
i32 16, label %19
i32 32, label %22
]
7: ; preds = %2
%8 = load i8, i8* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %8)
br label %25
10: ; preds = %2
%11 = load i8, i8* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8 signext %11)
br label %25
13: ; preds = %2
%14 = load i8, i8* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8 signext %14)
br label %25
16: ; preds = %2
%17 = load i8, i8* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8 signext %17)
br label %25
19: ; preds = %2
%20 = load i8, i8* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8 signext %20)
br label %25
22: ; preds = %2
%23 = load i8, i8* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8 signext %23)
br label %25
25: ; preds = %2, %22, %19, %16, %13, %10, %7
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Z+, (%d) Back \0A\00"
@.str.1 = [18 x i8] c"Z-, (%d) Front \0A\00"
@.str.2 = [17 x i8] c"Y+, (%d) Down \0A\00"
@.str.3 = [15 x i8] c"Y-, (%d) Up \0A\00"
@.str.4 = [17 x i8] c"X+, (%d) Left \0A\00"
@.str.5 = [18 x i8] c"X-, (%d) Right \0A\00"
define void @KIONIX_ACCEL_process_directional_tap(i8 signext %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %12 [
i32 1, label %9
i32 2, label %4
i32 4, label %5
i32 8, label %6
i32 16, label %7
i32 32, label %8
]
4: ; preds = %2
br label %9
5: ; preds = %2
br label %9
6: ; preds = %2
br label %9
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %2, %4, %5, %6, %7, %8
%10 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), %2 ]
%11 = tail call i32 @printf(i8* %10, i8 signext %0)
br label %12
12: ; preds = %9, %2
ret void
}