#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 */
struct canfd_frame {
  int *data;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
char *get_mode_str(struct canfd_frame frame) {
  switch (frame.data[1]) {
  case 0x01:
    return "Show current Data";
    break;
  case 0x02:
    return "Show freeze frame";
    break;
  case 0x03:
    return "Read DTCs";
    break;
  case 0x04:
    return "Clear DTCs";
    break;
  case 0x05:
    return "Mode Test Results (Non-CAN)";
    break;
  case 0x06:
    return "Mode Test Results (CAN)";
    break;
  case 0x07:
    return "Read Pending DTCs";
    break;
  case 0x08:
    return "Control Operations";
    break;
  case 0x09:
    return "Vehicle Information";
    break;
  case 0x0A:
    return "Read Permanent DTCs";
    break;
  case 0x10:
    return "Diagnostic Control";
    break;
  case 0x11:
    return "ECU Reset";
    break;
  case 0x14:
    return "UDS Clear DTCs";
    break;
  case 0x19:
    return "UDS Read DTCs";
    break;
  case 0x1A:
    return "Read DID by ID (GM)";
    break;
  case 0x20:
    return "Restore Normal Commnications";
    break;
  case 0x22:
    return "Read DATA By ID";
    break;
  case 0x23:
    return "Read Memory By Address";
    break;
  case 0x24:
    return "Read Scalling Data by ID";
    break;
  case 0x27:
    return "Security Access";
    break;
  case 0x28:
    return "Communication Control";
    break;
  case 0x2A:
    return "Read DATA By ID Periodically";
    break;
  case 0x2C:
    return "Define DATA By ID";
    break;
  case 0x2E:
    return "Write DATA By ID";
    break;
  case 0x2F:
    return "Input/Output Control By ID";
    break;
  case 0x31:
    return "Routine Control";
    break;
  case 0x34:
    return "Request Download";
    break;
  case 0x35:
    return "Request Upload";
    break;
  case 0x36:
    return "Transfer DATA";
    break;
  case 0x37:
    return "Request Transfer Exit";
    break;
  case 0x38:
    return "Request Transfer File";
    break;
  case 0x3D:
    return "Write Memory By Address";
    break;
  case 0x3E:
    return "Tester Present";
    break;
  case 0x83:
    return "Access Timing";
    break;
  case 0x84:
    return "Secured DATA Transfer";
    break;
  case 0x85:
    return "Control DTC Settings";
    break;
  case 0x86:
    return "Response On Event";
    break;
  case 0x87:
    return "Link Control";
    break;
  case 0xA2:
    return "Programmed State (GM)";
    break;
  case 0xA5:
    return "Programming Mode (GM)";
    break;
  case 0xA9:
    return "Read Diagnostic Information (GM)";
    break;
  case 0xAA:
    return "Read DATA By ID (GM)";
    break;
  case 0xAE:
    return "Device Control (GM)";
    break;
  default:
    printf("Unknown mode/sid (%02X)\n", frame.data[1]);
    return "";
  }
}


x86 assembly (clang, -O0):
<get_mode_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xad,%eax
ja     13fb <get_mode_str+0x2eb>
mov    -0x18(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1166(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1168(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x121b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11fc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x114a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1156(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x115e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1160(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1163(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1167(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x116b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x116e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1168(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1167(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1165(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1169(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1176(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1176(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x117d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1186(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1186(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x118c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x1199(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x119b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x119c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11a7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11a7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11a8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11a7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11a5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11ab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11b1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11b9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11b8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11b6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11bc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11c1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11c3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11c0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11c6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11cc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11dd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
lea    0x11e2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1419 <get_mode_str+0x309>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
lea    0x11df(%rip),%rdi
call   1030 <printf@plt>
lea    0x11eb(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mode_str>:
push   %rax
mov    0x4(%rdi),%esi
lea    -0x1(%rsi),%ecx
cmp    $0xad,%ecx
ja     1187 <get_mode_str+0x77>
lea    0x1192(%rip),%rax
lea    0xed3(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0x118d(%rip),%rax
pop    %rcx
ret
lea    0x1247(%rip),%rax
pop    %rcx
ret
lea    0x122f(%rip),%rax
pop    %rcx
ret
lea    0x1184(%rip),%rax
pop    %rcx
ret
lea    0x1197(%rip),%rax
pop    %rcx
ret
lea    0x11a6(%rip),%rax
pop    %rcx
ret
lea    0x11af(%rip),%rax
pop    %rcx
ret
lea    0x11b9(%rip),%rax
pop    %rcx
ret
lea    0x11c4(%rip),%rax
pop    %rcx
ret
lea    0x145a(%rip),%rdi
call   1030 <printf@plt>
lea    0x1466(%rip),%rax
pop    %rcx
ret
lea    0x11ba(%rip),%rax
pop    %rcx
ret
lea    0x11c4(%rip),%rax
pop    %rcx
ret
lea    0x11c5(%rip),%rax
pop    %rcx
ret
lea    0x11cb(%rip),%rax
pop    %rcx
ret
lea    0x11d0(%rip),%rax
pop    %rcx
ret
lea    0x11db(%rip),%rax
pop    %rcx
ret
lea    0x11ef(%rip),%rax
pop    %rcx
ret
lea    0x11f6(%rip),%rax
pop    %rcx
ret
lea    0x1204(%rip),%rax
pop    %rcx
ret
lea    0x1214(%rip),%rax
pop    %rcx
ret
lea    0x121b(%rip),%rax
pop    %rcx
ret
lea    0x1228(%rip),%rax
pop    %rcx
ret
lea    0x123c(%rip),%rax
pop    %rcx
ret
lea    0x1245(%rip),%rax
pop    %rcx
ret
lea    0x124d(%rip),%rax
pop    %rcx
ret
lea    0x125f(%rip),%rax
pop    %rcx
ret
lea    0x1266(%rip),%rax
pop    %rcx
ret
lea    0x126e(%rip),%rax
pop    %rcx
ret
lea    0x1274(%rip),%rax
pop    %rcx
ret
lea    0x1279(%rip),%rax
pop    %rcx
ret
lea    0x1286(%rip),%rax
pop    %rcx
ret
lea    0x1293(%rip),%rax
pop    %rcx
ret
lea    0x12a2(%rip),%rax
pop    %rcx
ret
lea    0x12a8(%rip),%rax
pop    %rcx
ret
lea    0x12ad(%rip),%rax
pop    %rcx
ret
lea    0x12ba(%rip),%rax
pop    %rcx
ret
lea    0x12c6(%rip),%rax
pop    %rcx
ret
lea    0x12cf(%rip),%rax
pop    %rcx
ret
lea    0x12d3(%rip),%rax
pop    %rcx
ret
lea    0x12e0(%rip),%rax
pop    %rcx
ret
lea    0x12ed(%rip),%rax
pop    %rcx
ret
lea    0x1305(%rip),%rax
pop    %rcx
ret
lea    0x1311(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.canfd_frame = type { i32* }
@.str = [18 x i8] c"Show current Data\00"
@.str.1 = [18 x i8] c"Show freeze frame\00"
@.str.2 = [10 x i8] c"Read DTCs\00"
@.str.3 = [11 x i8] c"Clear DTCs\00"
@.str.4 = [28 x i8] c"Mode Test Results (Non-CAN)\00"
@.str.5 = [24 x i8] c"Mode Test Results (CAN)\00"
@.str.6 = [18 x i8] c"Read Pending DTCs\00"
@.str.7 = [19 x i8] c"Control Operations\00"
@.str.8 = [20 x i8] c"Vehicle Information\00"
@.str.9 = [20 x i8] c"Read Permanent DTCs\00"
@.str.10 = [19 x i8] c"Diagnostic Control\00"
@.str.11 = [10 x i8] c"ECU Reset\00"
@.str.12 = [15 x i8] c"UDS Clear DTCs\00"
@.str.13 = [14 x i8] c"UDS Read DTCs\00"
@.str.14 = [20 x i8] c"Read DID by ID (GM)\00"
@.str.15 = [29 x i8] c"Restore Normal Commnications\00"
@.str.16 = [16 x i8] c"Read DATA By ID\00"
@.str.17 = [23 x i8] c"Read Memory By Address\00"
@.str.18 = [25 x i8] c"Read Scalling Data by ID\00"
@.str.19 = [16 x i8] c"Security Access\00"
@.str.20 = [22 x i8] c"Communication Control\00"
@.str.21 = [29 x i8] c"Read DATA By ID Periodically\00"
@.str.22 = [18 x i8] c"Define DATA By ID\00"
@.str.23 = [17 x i8] c"Write DATA By ID\00"
@.str.24 = [27 x i8] c"Input/Output Control By ID\00"
@.str.25 = [16 x i8] c"Routine Control\00"
@.str.26 = [17 x i8] c"Request Download\00"
@.str.27 = [15 x i8] c"Request Upload\00"
@.str.28 = [14 x i8] c"Transfer DATA\00"
@.str.29 = [22 x i8] c"Request Transfer Exit\00"
@.str.30 = [22 x i8] c"Request Transfer File\00"
@.str.31 = [24 x i8] c"Write Memory By Address\00"
@.str.32 = [15 x i8] c"Tester Present\00"
@.str.33 = [14 x i8] c"Access Timing\00"
@.str.34 = [22 x i8] c"Secured DATA Transfer\00"
@.str.35 = [21 x i8] c"Control DTC Settings\00"
@.str.36 = [18 x i8] c"Response On Event\00"
@.str.37 = [13 x i8] c"Link Control\00"
@.str.38 = [22 x i8] c"Programmed State (GM)\00"
@.str.39 = [22 x i8] c"Programming Mode (GM)\00"
@.str.40 = [33 x i8] c"Read Diagnostic Information (GM)\00"
@.str.41 = [21 x i8] c"Read DATA By ID (GM)\00"
@.str.42 = [20 x i8] c"Device Control (GM)\00"
@.str.43 = [25 x i8] c"Unknown mode/sid (%02X)\0A\00"
@.str.44 = [1 x i8] zeroinitializer
define i8* @get_mode_str(i32* %0) {
%2 = alloca i8*
%3 = alloca %struct.canfd_frame
%4 = getelementptr inbounds %struct.canfd_frame, %struct.canfd_frame* %3, i32 0, i32 0
store i32* %0, i32** %4
%5 = getelementptr inbounds %struct.canfd_frame, %struct.canfd_frame* %3, i32 0, i32 0
%6 = load i32*, i32** %5
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
switch i32 %8, label %52 [
i32 1, label %9
i32 2, label %10
i32 3, label %11
i32 4, label %12
i32 5, label %13
i32 6, label %14
i32 7, label %15
i32 8, label %16
i32 9, label %17
i32 10, label %18
i32 16, label %19
i32 17, label %20
i32 20, label %21
i32 25, label %22
i32 26, label %23
i32 32, label %24
i32 34, label %25
i32 35, label %26
i32 36, label %27
i32 39, label %28
i32 40, label %29
i32 42, label %30
i32 44, label %31
i32 46, label %32
i32 47, label %33
i32 49, label %34
i32 52, label %35
i32 53, label %36
i32 54, label %37
i32 55, label %38
i32 56, label %39
i32 61, label %40
i32 62, label %41
i32 131, label %42
i32 132, label %43
i32 133, label %44
i32 134, label %45
i32 135, label %46
i32 162, label %47
i32 165, label %48
i32 169, label %49
i32 170, label %50
i32 174, label %51
]
9: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %2
br label %58
10: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %58
11: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %58
12: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %58
13: ; preds = %1
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %58
14: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %58
15: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %58
16: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %58
17: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %58
18: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %58
19: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %58
20: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %58
21: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %58
22: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %58
23: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %58
24: ; preds = %1
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %58
25: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %58
26: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %58
27: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %58
28: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %58
29: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %58
30: ; preds = %1
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %58
31: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.22, i64 0, i64 0), i8** %2
br label %58
32: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0), i8** %2
br label %58
33: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.24, i64 0, i64 0), i8** %2
br label %58
34: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0), i8** %2
br label %58
35: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.26, i64 0, i64 0), i8** %2
br label %58
36: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0), i8** %2
br label %58
37: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.28, i64 0, i64 0), i8** %2
br label %58
38: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.29, i64 0, i64 0), i8** %2
br label %58
39: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.30, i64 0, i64 0), i8** %2
br label %58
40: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.31, i64 0, i64 0), i8** %2
br label %58
41: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.32, i64 0, i64 0), i8** %2
br label %58
42: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.33, i64 0, i64 0), i8** %2
br label %58
43: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.34, i64 0, i64 0), i8** %2
br label %58
44: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.35, i64 0, i64 0), i8** %2
br label %58
45: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.36, i64 0, i64 0), i8** %2
br label %58
46: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.37, i64 0, i64 0), i8** %2
br label %58
47: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.38, i64 0, i64 0), i8** %2
br label %58
48: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.39, i64 0, i64 0), i8** %2
br label %58
49: ; preds = %1
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.40, i64 0, i64 0), i8** %2
br label %58
50: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.41, i64 0, i64 0), i8** %2
br label %58
51: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.42, i64 0, i64 0), i8** %2
br label %58
52: ; preds = %1
%53 = getelementptr inbounds %struct.canfd_frame, %struct.canfd_frame* %3, i32 0, i32 0
%54 = load i32*, i32** %53
%55 = getelementptr inbounds i32, i32* %54, i64 1
%56 = load i32, i32* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.43, i64 0, i64 0), i32 %56)
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.44, i64 0, i64 0), i8** %2
br label %58
58: ; preds = %52, %51, %50, %49, %48, %47, %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9
%59 = load i8*, i8** %2
ret i8* %59
}

LLVM IR (-O2):
@.str = [18 x i8] c"Show current Data\00"
@.str.1 = [18 x i8] c"Show freeze frame\00"
@.str.2 = [10 x i8] c"Read DTCs\00"
@.str.3 = [11 x i8] c"Clear DTCs\00"
@.str.4 = [28 x i8] c"Mode Test Results (Non-CAN)\00"
@.str.5 = [24 x i8] c"Mode Test Results (CAN)\00"
@.str.6 = [18 x i8] c"Read Pending DTCs\00"
@.str.7 = [19 x i8] c"Control Operations\00"
@.str.8 = [20 x i8] c"Vehicle Information\00"
@.str.9 = [20 x i8] c"Read Permanent DTCs\00"
@.str.10 = [19 x i8] c"Diagnostic Control\00"
@.str.11 = [10 x i8] c"ECU Reset\00"
@.str.12 = [15 x i8] c"UDS Clear DTCs\00"
@.str.13 = [14 x i8] c"UDS Read DTCs\00"
@.str.14 = [20 x i8] c"Read DID by ID (GM)\00"
@.str.15 = [29 x i8] c"Restore Normal Commnications\00"
@.str.16 = [16 x i8] c"Read DATA By ID\00"
@.str.17 = [23 x i8] c"Read Memory By Address\00"
@.str.18 = [25 x i8] c"Read Scalling Data by ID\00"
@.str.19 = [16 x i8] c"Security Access\00"
@.str.20 = [22 x i8] c"Communication Control\00"
@.str.21 = [29 x i8] c"Read DATA By ID Periodically\00"
@.str.22 = [18 x i8] c"Define DATA By ID\00"
@.str.23 = [17 x i8] c"Write DATA By ID\00"
@.str.24 = [27 x i8] c"Input/Output Control By ID\00"
@.str.25 = [16 x i8] c"Routine Control\00"
@.str.26 = [17 x i8] c"Request Download\00"
@.str.27 = [15 x i8] c"Request Upload\00"
@.str.28 = [14 x i8] c"Transfer DATA\00"
@.str.29 = [22 x i8] c"Request Transfer Exit\00"
@.str.30 = [22 x i8] c"Request Transfer File\00"
@.str.31 = [24 x i8] c"Write Memory By Address\00"
@.str.32 = [15 x i8] c"Tester Present\00"
@.str.33 = [14 x i8] c"Access Timing\00"
@.str.34 = [22 x i8] c"Secured DATA Transfer\00"
@.str.35 = [21 x i8] c"Control DTC Settings\00"
@.str.36 = [18 x i8] c"Response On Event\00"
@.str.37 = [13 x i8] c"Link Control\00"
@.str.38 = [22 x i8] c"Programmed State (GM)\00"
@.str.39 = [22 x i8] c"Programming Mode (GM)\00"
@.str.40 = [33 x i8] c"Read Diagnostic Information (GM)\00"
@.str.41 = [21 x i8] c"Read DATA By ID (GM)\00"
@.str.42 = [20 x i8] c"Device Control (GM)\00"
@.str.43 = [25 x i8] c"Unknown mode/sid (%02X)\0A\00"
@.str.44 = [1 x i8] zeroinitializer
define i8* @get_mode_str(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
switch i32 %3, label %46 [
i32 1, label %48
i32 2, label %4
i32 3, label %5
i32 4, label %6
i32 5, label %7
i32 6, label %8
i32 7, label %9
i32 8, label %10
i32 9, label %11
i32 10, label %12
i32 16, label %13
i32 17, label %14
i32 20, label %15
i32 25, label %16
i32 26, label %17
i32 32, label %18
i32 34, label %19
i32 35, label %20
i32 36, label %21
i32 39, label %22
i32 40, label %23
i32 42, label %24
i32 44, label %25
i32 46, label %26
i32 47, label %27
i32 49, label %28
i32 52, label %29
i32 53, label %30
i32 54, label %31
i32 55, label %32
i32 56, label %33
i32 61, label %34
i32 62, label %35
i32 131, label %36
i32 132, label %37
i32 133, label %38
i32 134, label %39
i32 135, label %40
i32 162, label %41
i32 165, label %42
i32 169, label %43
i32 170, label %44
i32 174, label %45
]
4: ; preds = %1
br label %48
5: ; preds = %1
br label %48
6: ; preds = %1
br label %48
7: ; preds = %1
br label %48
8: ; preds = %1
br label %48
9: ; preds = %1
br label %48
10: ; preds = %1
br label %48
11: ; preds = %1
br label %48
12: ; preds = %1
br label %48
13: ; preds = %1
br label %48
14: ; preds = %1
br label %48
15: ; preds = %1
br label %48
16: ; preds = %1
br label %48
17: ; preds = %1
br label %48
18: ; preds = %1
br label %48
19: ; preds = %1
br label %48
20: ; preds = %1
br label %48
21: ; preds = %1
br label %48
22: ; preds = %1
br label %48
23: ; preds = %1
br label %48
24: ; preds = %1
br label %48
25: ; preds = %1
br label %48
26: ; preds = %1
br label %48
27: ; preds = %1
br label %48
28: ; preds = %1
br label %48
29: ; preds = %1
br label %48
30: ; preds = %1
br label %48
31: ; preds = %1
br label %48
32: ; preds = %1
br label %48
33: ; preds = %1
br label %48
34: ; preds = %1
br label %48
35: ; preds = %1
br label %48
36: ; preds = %1
br label %48
37: ; preds = %1
br label %48
38: ; preds = %1
br label %48
39: ; preds = %1
br label %48
40: ; preds = %1
br label %48
41: ; preds = %1
br label %48
42: ; preds = %1
br label %48
43: ; preds = %1
br label %48
44: ; preds = %1
br label %48
45: ; preds = %1
br label %48
46: ; preds = %1
%47 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.43, i64 0, i64 0), i32 %3)
br label %48
48: ; preds = %1, %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4
%49 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.44, i64 0, i64 0), %46 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.42, i64 0, i64 0), %45 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.41, i64 0, i64 0), %44 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.40, i64 0, i64 0), %43 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.39, i64 0, i64 0), %42 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.38, i64 0, i64 0), %41 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.37, i64 0, i64 0), %40 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.36, i64 0, i64 0), %39 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.35, i64 0, i64 0), %38 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.34, i64 0, i64 0), %37 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.33, i64 0, i64 0), %36 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.32, i64 0, i64 0), %35 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.31, i64 0, i64 0), %34 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.30, i64 0, i64 0), %33 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.29, i64 0, i64 0), %32 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.28, i64 0, i64 0), %31 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0), %30 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.26, i64 0, i64 0), %29 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0), %28 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.24, i64 0, i64 0), %27 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0), %26 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.22, i64 0, i64 0), %25 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.21, i64 0, i64 0), %24 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), %23 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), %22 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0), %21 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), %20 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0), %19 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0), %18 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), %17 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), %16 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), %15 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), %14 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), %13 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), %12 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), %11 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([10 x i8], [10 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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %49
}