#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*/ Process_Acceleration_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Bumper_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Compass_Conf_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Compass_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Configuration_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Infrared_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Laser_Line_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Laser_Point_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Sonar_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Special_Pkg(unsigned char *);
int /*<<< orphan*/ Process_State_Pkg(unsigned char *);
int /*<<< orphan*/ Process_Velocity_Pkg(unsigned char *);
int /*<<< orphan*/ printf(char *);
int Process_Robot_Resp(unsigned char inbuf[4096]) {
  switch (inbuf[0]) {
  case 1:
  case 2:
  case 3:
  case 4:
  case 5:
  case 43:
  case 6:
  case 7:
  case 9:
  case 10:
  case 12:
  case 30:
  case 31:
  case 13:
  case 11:
  case 14:
  case 15:
  case 17:
  case 18:
  case 28:
  case 35:
  case 26:
    Process_State_Pkg(inbuf);
    break;
  case 16:
    Process_Compass_Conf_Pkg(inbuf);
    break;
  case 8:
    printf("Nak\n");
    break;
  case 19:
    Process_Infrared_Pkg(inbuf);
    break;
  case 20:
    Process_Sonar_Pkg(inbuf);
    break;
  case 21:
    Process_Configuration_Pkg(inbuf);
    break;
  case 22:
    Process_Velocity_Pkg(inbuf);
    break;
  case 23:
    Process_Acceleration_Pkg(inbuf);
    break;
  case 24:
    Process_Compass_Pkg(inbuf);
    break;
  case 25:
    Process_Laser_Point_Pkg(inbuf);
    break;
  case 27:
    Process_Bumper_Pkg(inbuf);
    break;
  case 29:
    Process_Laser_Line_Pkg(inbuf);
    break;
  case 128:
    Process_Special_Pkg(inbuf);
    break;
  default:
    printf("Invalid Robot Response\n");
    return (0);
    break;
  }
  return (1);
}


x86 assembly (clang, -O0):
<Process_Robot_Resp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7f,%eax
ja     12c2 <Process_Robot_Resp+0xf2>
mov    -0x18(%rbp),%rax
lea    0xe00(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1040 <Process_State_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   1070 <Process_Compass_Conf_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
lea    0xfd4(%rip),%rdi
call   1050 <printf@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   10f0 <Process_Infrared_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   10d0 <Process_Sonar_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   10e0 <Process_Configuration_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   10a0 <Process_Velocity_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   1080 <Process_Acceleration_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   10c0 <Process_Compass_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   1030 <Process_Laser_Point_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   10b0 <Process_Bumper_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   1060 <Process_Laser_Line_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
mov    -0x10(%rbp),%rdi
call   1090 <Process_Special_Pkg@plt>
jmp    12da <Process_Robot_Resp+0x10a>
lea    0xf3c(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12e1 <Process_Robot_Resp+0x111>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Process_Robot_Resp>:
push   %rax
mov    (%rdi),%al
add    $0x80,%al
cmp    $0xab,%al
ja     11ff <Process_Robot_Resp+0x2f>
movzbl %al,%eax
lea    0xe1d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
call   1050 <Process_State_Pkg@plt>
mov    $0x1,%eax
pop    %rcx
ret
call   1090 <Process_Special_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
lea    0x10ae(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0x109a(%rip),%rdi
call   1040 <puts@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   1070 <Process_Compass_Conf_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   10f0 <Process_Infrared_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   10d0 <Process_Sonar_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   10e0 <Process_Configuration_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   10a0 <Process_Velocity_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   1080 <Process_Acceleration_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   10c0 <Process_Compass_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   1030 <Process_Laser_Point_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   10b0 <Process_Bumper_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>
call   1060 <Process_Laser_Line_Pkg@plt>
jmp    11f1 <Process_Robot_Resp+0x21>

LLVM IR (-O0):
@.str = [5 x i8] c"Nak\0A\00"
@.str.1 = [24 x i8] c"Invalid Robot Response\0A\00"
define i32 @Process_Robot_Resp(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
switch i32 %7, label %46 [
i32 1, label %8
i32 2, label %8
i32 3, label %8
i32 4, label %8
i32 5, label %8
i32 43, label %8
i32 6, label %8
i32 7, label %8
i32 9, label %8
i32 10, label %8
i32 12, label %8
i32 30, label %8
i32 31, label %8
i32 13, label %8
i32 11, label %8
i32 14, label %8
i32 15, label %8
i32 17, label %8
i32 18, label %8
i32 28, label %8
i32 35, label %8
i32 26, label %8
i32 16, label %11
i32 8, label %14
i32 19, label %16
i32 20, label %19
i32 21, label %22
i32 22, label %25
i32 23, label %28
i32 24, label %31
i32 25, label %34
i32 27, label %37
i32 29, label %40
i32 128, label %43
]
8: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%9 = load i8*, i8** %3
%10 = call i32 @Process_State_Pkg(i8* %9)
br label %48
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i32 @Process_Compass_Conf_Pkg(i8* %12)
br label %48
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %48
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = call i32 @Process_Infrared_Pkg(i8* %17)
br label %48
19: ; preds = %1
%20 = load i8*, i8** %3
%21 = call i32 @Process_Sonar_Pkg(i8* %20)
br label %48
22: ; preds = %1
%23 = load i8*, i8** %3
%24 = call i32 @Process_Configuration_Pkg(i8* %23)
br label %48
25: ; preds = %1
%26 = load i8*, i8** %3
%27 = call i32 @Process_Velocity_Pkg(i8* %26)
br label %48
28: ; preds = %1
%29 = load i8*, i8** %3
%30 = call i32 @Process_Acceleration_Pkg(i8* %29)
br label %48
31: ; preds = %1
%32 = load i8*, i8** %3
%33 = call i32 @Process_Compass_Pkg(i8* %32)
br label %48
34: ; preds = %1
%35 = load i8*, i8** %3
%36 = call i32 @Process_Laser_Point_Pkg(i8* %35)
br label %48
37: ; preds = %1
%38 = load i8*, i8** %3
%39 = call i32 @Process_Bumper_Pkg(i8* %38)
br label %48
40: ; preds = %1
%41 = load i8*, i8** %3
%42 = call i32 @Process_Laser_Line_Pkg(i8* %41)
br label %48
43: ; preds = %1
%44 = load i8*, i8** %3
%45 = call i32 @Process_Special_Pkg(i8* %44)
br label %48
46: ; preds = %1
%47 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %49
48: ; preds = %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %14, %11, %8
store i32 1, i32* %2
br label %49
49: ; preds = %48, %46
%50 = load i32, i32* %2
ret i32 %50
}

LLVM IR (-O2):
@str = [4 x i8] c"Nak\00"
@str.2 = [23 x i8] c"Invalid Robot Response\00"
define i32 @Process_Robot_Resp(i8* %0) {
%2 = load i8, i8* %0
switch i8 %2, label %29 [
i8 1, label %3
i8 2, label %3
i8 3, label %3
i8 4, label %3
i8 5, label %3
i8 43, label %3
i8 6, label %3
i8 7, label %3
i8 9, label %3
i8 10, label %3
i8 12, label %3
i8 30, label %3
i8 31, label %3
i8 13, label %3
i8 11, label %3
i8 14, label %3
i8 15, label %3
i8 17, label %3
i8 18, label %3
i8 28, label %3
i8 35, label %3
i8 26, label %3
i8 16, label %5
i8 8, label %7
i8 19, label %9
i8 20, label %11
i8 21, label %13
i8 22, label %15
i8 23, label %17
i8 24, label %19
i8 25, label %21
i8 27, label %23
i8 29, label %25
i8 -128, label %27
]
3: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%4 = tail call i32 @Process_State_Pkg(i8* %0)
br label %31
5: ; preds = %1
%6 = tail call i32 @Process_Compass_Conf_Pkg(i8* %0)
br label %31
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %31
9: ; preds = %1
%10 = tail call i32 @Process_Infrared_Pkg(i8* %0)
br label %31
11: ; preds = %1
%12 = tail call i32 @Process_Sonar_Pkg(i8* %0)
br label %31
13: ; preds = %1
%14 = tail call i32 @Process_Configuration_Pkg(i8* %0)
br label %31
15: ; preds = %1
%16 = tail call i32 @Process_Velocity_Pkg(i8* %0)
br label %31
17: ; preds = %1
%18 = tail call i32 @Process_Acceleration_Pkg(i8* %0)
br label %31
19: ; preds = %1
%20 = tail call i32 @Process_Compass_Pkg(i8* %0)
br label %31
21: ; preds = %1
%22 = tail call i32 @Process_Laser_Point_Pkg(i8* %0)
br label %31
23: ; preds = %1
%24 = tail call i32 @Process_Bumper_Pkg(i8* %0)
br label %31
25: ; preds = %1
%26 = tail call i32 @Process_Laser_Line_Pkg(i8* %0)
br label %31
27: ; preds = %1
%28 = tail call i32 @Process_Special_Pkg(i8* %0)
br label %31
29: ; preds = %1
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0))
br label %31
31: ; preds = %3, %5, %7, %9, %11, %13, %15, %17, %19, %21, %23, %25, %27, %29
%32 = phi i32 [ 0, %29 ], [ 1, %27 ], [ 1, %25 ], [ 1, %23 ], [ 1, %21 ], [ 1, %19 ], [ 1, %17 ], [ 1, %15 ], [ 1, %13 ], [ 1, %11 ], [ 1, %9 ], [ 1, %7 ], [ 1, %5 ], [ 1, %3 ]
ret i32 %32
}