#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*/ print(char const *, int);
char CI_get_response(char command) {
  static const char *LookupTable[] = {"HH", "Help",
                                      "P1", "PWM enable",
                                      "P0", "PWM disable",
                                      "RF", "Right Wheel Forward",
                                      "RR", "Right Wheel Reverse",
                                      "LF", "Left Wheel Forward",
                                      "LR", "Left Wheel Reverse",
                                      "LG", "Light Get",
                                      "GO", "PID initiated",
                                      "R0", "Read Front Distance Sensor",
                                      "R1", "Read Right Distance Sensor",
                                      "TD", "Toggle Data Acquisition",
                                      "DS", "Post Drive Semaphore",
                                      "ES", "Emergency Stop",
                                      "DC", "Drive Clock Start",
                                      "ER", "Error"};
  print(":", 1);
  print(LookupTable[command], 2);
  print(LookupTable[command + 1], 26);
  return (char)command;
}


x86 assembly (clang, -O0):
<CI_get_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0x1017(%rip),%rdi
mov    $0x1,%esi
call   1030 <print@plt>
movsbq -0x1(%rbp),%rcx
lea    0x2ef5(%rip),%rax
mov    (%rax,%rcx,8),%rdi
mov    $0x2,%esi
call   1030 <print@plt>
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    0x2ed6(%rip),%rax
mov    (%rax,%rcx,8),%rdi
mov    $0x1a,%esi
call   1030 <print@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CI_get_response>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0x1020(%rip),%rdi
mov    $0x1,%esi
call   1030 <print@plt>
movslq %ebp,%rax
lea    0x2bf0(%rip),%rcx
mov    (%rcx,%rax,8),%rdi
mov    0x8(%rcx,%rax,8),%rbx
mov    $0x2,%esi
call   1030 <print@plt>
mov    %rbx,%rdi
mov    $0x1a,%esi
call   1030 <print@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@CI_get_response.LookupTable = internal global [32 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.31, i32 0, i32 0)]
@.str = [3 x i8] c"HH\00"
@.str.1 = [5 x i8] c"Help\00"
@.str.2 = [3 x i8] c"P1\00"
@.str.3 = [11 x i8] c"PWM enable\00"
@.str.4 = [3 x i8] c"P0\00"
@.str.5 = [12 x i8] c"PWM disable\00"
@.str.6 = [3 x i8] c"RF\00"
@.str.7 = [20 x i8] c"Right Wheel Forward\00"
@.str.8 = [3 x i8] c"RR\00"
@.str.9 = [20 x i8] c"Right Wheel Reverse\00"
@.str.10 = [3 x i8] c"LF\00"
@.str.11 = [19 x i8] c"Left Wheel Forward\00"
@.str.12 = [3 x i8] c"LR\00"
@.str.13 = [19 x i8] c"Left Wheel Reverse\00"
@.str.14 = [3 x i8] c"LG\00"
@.str.15 = [10 x i8] c"Light Get\00"
@.str.16 = [3 x i8] c"GO\00"
@.str.17 = [14 x i8] c"PID initiated\00"
@.str.18 = [3 x i8] c"R0\00"
@.str.19 = [27 x i8] c"Read Front Distance Sensor\00"
@.str.20 = [3 x i8] c"R1\00"
@.str.21 = [27 x i8] c"Read Right Distance Sensor\00"
@.str.22 = [3 x i8] c"TD\00"
@.str.23 = [24 x i8] c"Toggle Data Acquisition\00"
@.str.24 = [3 x i8] c"DS\00"
@.str.25 = [21 x i8] c"Post Drive Semaphore\00"
@.str.26 = [3 x i8] c"ES\00"
@.str.27 = [15 x i8] c"Emergency Stop\00"
@.str.28 = [3 x i8] c"DC\00"
@.str.29 = [18 x i8] c"Drive Clock Start\00"
@.str.30 = [3 x i8] c"ER\00"
@.str.31 = [6 x i8] c"Error\00"
@.str.32 = [2 x i8] c":\00"
define signext i8 @CI_get_response(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.32, i64 0, i64 0), i32 1)
%4 = load i8, i8* %2
%5 = sext i8 %4 to i64
%6 = getelementptr inbounds [32 x i8*], [32 x i8*]* @CI_get_response.LookupTable, i64 0, i64 %5
%7 = load i8*, i8** %6
%8 = call i32 @print(i8* %7, i32 2)
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [32 x i8*], [32 x i8*]* @CI_get_response.LookupTable, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @print(i8* %14, i32 26)
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
@CI_get_response.LookupTable = internal unnamed_addr constant [32 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.31, i32 0, i32 0)]
@.str = [3 x i8] c"HH\00"
@.str.1 = [5 x i8] c"Help\00"
@.str.2 = [3 x i8] c"P1\00"
@.str.3 = [11 x i8] c"PWM enable\00"
@.str.4 = [3 x i8] c"P0\00"
@.str.5 = [12 x i8] c"PWM disable\00"
@.str.6 = [3 x i8] c"RF\00"
@.str.7 = [20 x i8] c"Right Wheel Forward\00"
@.str.8 = [3 x i8] c"RR\00"
@.str.9 = [20 x i8] c"Right Wheel Reverse\00"
@.str.10 = [3 x i8] c"LF\00"
@.str.11 = [19 x i8] c"Left Wheel Forward\00"
@.str.12 = [3 x i8] c"LR\00"
@.str.13 = [19 x i8] c"Left Wheel Reverse\00"
@.str.14 = [3 x i8] c"LG\00"
@.str.15 = [10 x i8] c"Light Get\00"
@.str.16 = [3 x i8] c"GO\00"
@.str.17 = [14 x i8] c"PID initiated\00"
@.str.18 = [3 x i8] c"R0\00"
@.str.19 = [27 x i8] c"Read Front Distance Sensor\00"
@.str.20 = [3 x i8] c"R1\00"
@.str.21 = [27 x i8] c"Read Right Distance Sensor\00"
@.str.22 = [3 x i8] c"TD\00"
@.str.23 = [24 x i8] c"Toggle Data Acquisition\00"
@.str.24 = [3 x i8] c"DS\00"
@.str.25 = [21 x i8] c"Post Drive Semaphore\00"
@.str.26 = [3 x i8] c"ES\00"
@.str.27 = [15 x i8] c"Emergency Stop\00"
@.str.28 = [3 x i8] c"DC\00"
@.str.29 = [18 x i8] c"Drive Clock Start\00"
@.str.30 = [3 x i8] c"ER\00"
@.str.31 = [6 x i8] c"Error\00"
@.str.32 = [2 x i8] c":\00"
define signext i8 @CI_get_response(i8 returned signext %0) {
%2 = tail call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.32, i64 0, i64 0), i32 1)
%3 = sext i8 %0 to i64
%4 = getelementptr inbounds [32 x i8*], [32 x i8*]* @CI_get_response.LookupTable, i64 0, i64 %3
%5 = load i8*, i8** %4
%6 = tail call i32 @print(i8* %5, i32 2)
%7 = add nsw i64 %3, 1
%8 = getelementptr inbounds [32 x i8*], [32 x i8*]* @CI_get_response.LookupTable, i64 0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @print(i8* %9, i32 26)
ret i8 %0
}