#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 trace_seq {
  int dummy;
};

/* Variables and functions */
char const *scsi_trace_misc(struct trace_seq *, unsigned char *, int);
char const *scsi_trace_rw10(struct trace_seq *, unsigned char *, int);
char const *scsi_trace_rw12(struct trace_seq *, unsigned char *, int);
char const *scsi_trace_rw16(struct trace_seq *, unsigned char *, int);
char const *scsi_trace_rw6(struct trace_seq *, unsigned char *, int);
char const *scsi_trace_service_action_in(struct trace_seq *, unsigned char *,
                                         int);
char const *scsi_trace_unmap(struct trace_seq *, unsigned char *, int);
char const *scsi_trace_varlen(struct trace_seq *, unsigned char *, int);
const char *scsi_trace_parse_cdb(struct trace_seq *p, unsigned char *cdb,
                                 int len) {
  switch (cdb[0]) {
  case 0x08:
  case 0x0a:
    return scsi_trace_rw6(p, cdb, len);
  case 0x28:
  case 0x2f:
  case 0x2a:
  case 0x41:
    return scsi_trace_rw10(p, cdb, len);
  case 0xa8:
  case 0xaf:
  case 0xaa:
    return scsi_trace_rw12(p, cdb, len);
  case 0x88:
  case 0x8f:
  case 0x8a:
  case 0x93:
    return scsi_trace_rw16(p, cdb, len);
  case 0x42:
    return scsi_trace_unmap(p, cdb, len);
  case 0x9e:
    return scsi_trace_service_action_in(p, cdb, len);
  case 0x7f:
    return scsi_trace_varlen(p, cdb, len);
  default:
    return scsi_trace_misc(p, cdb, len);
  }
}


x86 assembly (clang, -O0):
<scsi_trace_parse_cdb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x8,%eax
je     12ba <scsi_trace_parse_cdb+0x13a>
jmp    11ab <scsi_trace_parse_cdb+0x2b>
mov    -0x20(%rbp),%eax
sub    $0xa,%eax
je     12ba <scsi_trace_parse_cdb+0x13a>
jmp    11bc <scsi_trace_parse_cdb+0x3c>
mov    -0x20(%rbp),%eax
sub    $0x28,%eax
je     12d3 <scsi_trace_parse_cdb+0x153>
jmp    11cd <scsi_trace_parse_cdb+0x4d>
mov    -0x20(%rbp),%eax
sub    $0x2a,%eax
je     12d3 <scsi_trace_parse_cdb+0x153>
jmp    11de <scsi_trace_parse_cdb+0x5e>
mov    -0x20(%rbp),%eax
sub    $0x2f,%eax
je     12d3 <scsi_trace_parse_cdb+0x153>
jmp    11ef <scsi_trace_parse_cdb+0x6f>
mov    -0x20(%rbp),%eax
sub    $0x41,%eax
je     12d3 <scsi_trace_parse_cdb+0x153>
jmp    1200 <scsi_trace_parse_cdb+0x80>
mov    -0x20(%rbp),%eax
sub    $0x42,%eax
je     131e <scsi_trace_parse_cdb+0x19e>
jmp    1211 <scsi_trace_parse_cdb+0x91>
mov    -0x20(%rbp),%eax
sub    $0x7f,%eax
je     1350 <scsi_trace_parse_cdb+0x1d0>
jmp    1222 <scsi_trace_parse_cdb+0xa2>
mov    -0x20(%rbp),%eax
sub    $0x88,%eax
je     1305 <scsi_trace_parse_cdb+0x185>
jmp    1235 <scsi_trace_parse_cdb+0xb5>
mov    -0x20(%rbp),%eax
sub    $0x8a,%eax
je     1305 <scsi_trace_parse_cdb+0x185>
jmp    1248 <scsi_trace_parse_cdb+0xc8>
mov    -0x20(%rbp),%eax
sub    $0x8f,%eax
je     1305 <scsi_trace_parse_cdb+0x185>
jmp    125b <scsi_trace_parse_cdb+0xdb>
mov    -0x20(%rbp),%eax
sub    $0x93,%eax
je     1305 <scsi_trace_parse_cdb+0x185>
jmp    126e <scsi_trace_parse_cdb+0xee>
mov    -0x20(%rbp),%eax
sub    $0x9e,%eax
je     1337 <scsi_trace_parse_cdb+0x1b7>
jmp    1281 <scsi_trace_parse_cdb+0x101>
mov    -0x20(%rbp),%eax
sub    $0xa8,%eax
je     12ec <scsi_trace_parse_cdb+0x16c>
jmp    1294 <scsi_trace_parse_cdb+0x114>
mov    -0x20(%rbp),%eax
sub    $0xaa,%eax
je     12ec <scsi_trace_parse_cdb+0x16c>
jmp    12a7 <scsi_trace_parse_cdb+0x127>
mov    -0x20(%rbp),%eax
sub    $0xaf,%eax
je     12ec <scsi_trace_parse_cdb+0x16c>
jmp    1369 <scsi_trace_parse_cdb+0x1e9>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1090 <scsi_trace_rw6@plt>
mov    %rax,-0x8(%rbp)
jmp    137d <scsi_trace_parse_cdb+0x1fd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1060 <scsi_trace_rw10@plt>
mov    %rax,-0x8(%rbp)
jmp    137d <scsi_trace_parse_cdb+0x1fd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <scsi_trace_rw12@plt>
mov    %rax,-0x8(%rbp)
jmp    137d <scsi_trace_parse_cdb+0x1fd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <scsi_trace_rw16@plt>
mov    %rax,-0x8(%rbp)
jmp    137d <scsi_trace_parse_cdb+0x1fd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <scsi_trace_unmap@plt>
mov    %rax,-0x8(%rbp)
jmp    137d <scsi_trace_parse_cdb+0x1fd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1070 <scsi_trace_service_action_in@plt>
mov    %rax,-0x8(%rbp)
jmp    137d <scsi_trace_parse_cdb+0x1fd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1080 <scsi_trace_varlen@plt>
mov    %rax,-0x8(%rbp)
jmp    137d <scsi_trace_parse_cdb+0x1fd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   10a0 <scsi_trace_misc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scsi_trace_parse_cdb>:
mov    (%rsi),%r8b
lea    0x78(%r8),%ecx
cmp    $0x27,%cl
ja     11bf <scsi_trace_parse_cdb+0x3f>
movzbl %cl,%ecx
mov    $0x885,%eax
bt     %rcx,%rax
jb     11af <scsi_trace_parse_cdb+0x2f>
movabs $0x8500000000,%rax
bt     %rcx,%rax
jae    11b4 <scsi_trace_parse_cdb+0x34>
jmp    1040 <scsi_trace_rw12@plt>
jmp    1050 <scsi_trace_rw16@plt>
cmp    $0x16,%rcx
jne    11bf <scsi_trace_parse_cdb+0x3f>
jmp    1070 <scsi_trace_service_action_in@plt>
lea    -0x8(%r8),%ecx
cmp    $0x3a,%cl
ja     11fb <scsi_trace_parse_cdb+0x7b>
movzbl %cl,%ecx
movabs $0x200008500000000,%rax
bt     %rcx,%rax
jae    11e0 <scsi_trace_parse_cdb+0x60>
jmp    1060 <scsi_trace_rw10@plt>
mov    $0x5,%eax
bt     %rcx,%rax
jae    11f0 <scsi_trace_parse_cdb+0x70>
jmp    1090 <scsi_trace_rw6@plt>
cmp    $0x3a,%rcx
jne    11fb <scsi_trace_parse_cdb+0x7b>
jmp    1030 <scsi_trace_unmap@plt>
cmp    $0x7f,%r8b
jne    1206 <scsi_trace_parse_cdb+0x86>
jmp    1080 <scsi_trace_varlen@plt>
jmp    10a0 <scsi_trace_misc@plt>

LLVM IR (-O0):
%struct.trace_seq = type { i32 }
define i8* @scsi_trace_parse_cdb(%struct.trace_seq* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca %struct.trace_seq*
%6 = alloca i8*
%7 = alloca i32
store %struct.trace_seq* %0, %struct.trace_seq** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %6
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
switch i32 %11, label %47 [
i32 8, label %12
i32 10, label %12
i32 40, label %17
i32 47, label %17
i32 42, label %17
i32 65, label %17
i32 168, label %22
i32 175, label %22
i32 170, label %22
i32 136, label %27
i32 143, label %27
i32 138, label %27
i32 147, label %27
i32 66, label %32
i32 158, label %37
i32 127, label %42
]
12: ; preds = %3, %3
%13 = load %struct.trace_seq*, %struct.trace_seq** %5
%14 = load i8*, i8** %6
%15 = load i32, i32* %7
%16 = call i8* @scsi_trace_rw6(%struct.trace_seq* %13, i8* %14, i32 %15)
store i8* %16, i8** %4
br label %52
17: ; preds = %3, %3, %3, %3
%18 = load %struct.trace_seq*, %struct.trace_seq** %5
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = call i8* @scsi_trace_rw10(%struct.trace_seq* %18, i8* %19, i32 %20)
store i8* %21, i8** %4
br label %52
22: ; preds = %3, %3, %3
%23 = load %struct.trace_seq*, %struct.trace_seq** %5
%24 = load i8*, i8** %6
%25 = load i32, i32* %7
%26 = call i8* @scsi_trace_rw12(%struct.trace_seq* %23, i8* %24, i32 %25)
store i8* %26, i8** %4
br label %52
27: ; preds = %3, %3, %3, %3
%28 = load %struct.trace_seq*, %struct.trace_seq** %5
%29 = load i8*, i8** %6
%30 = load i32, i32* %7
%31 = call i8* @scsi_trace_rw16(%struct.trace_seq* %28, i8* %29, i32 %30)
store i8* %31, i8** %4
br label %52
32: ; preds = %3
%33 = load %struct.trace_seq*, %struct.trace_seq** %5
%34 = load i8*, i8** %6
%35 = load i32, i32* %7
%36 = call i8* @scsi_trace_unmap(%struct.trace_seq* %33, i8* %34, i32 %35)
store i8* %36, i8** %4
br label %52
37: ; preds = %3
%38 = load %struct.trace_seq*, %struct.trace_seq** %5
%39 = load i8*, i8** %6
%40 = load i32, i32* %7
%41 = call i8* @scsi_trace_service_action_in(%struct.trace_seq* %38, i8* %39, i32 %40)
store i8* %41, i8** %4
br label %52
42: ; preds = %3
%43 = load %struct.trace_seq*, %struct.trace_seq** %5
%44 = load i8*, i8** %6
%45 = load i32, i32* %7
%46 = call i8* @scsi_trace_varlen(%struct.trace_seq* %43, i8* %44, i32 %45)
store i8* %46, i8** %4
br label %52
47: ; preds = %3
%48 = load %struct.trace_seq*, %struct.trace_seq** %5
%49 = load i8*, i8** %6
%50 = load i32, i32* %7
%51 = call i8* @scsi_trace_misc(%struct.trace_seq* %48, i8* %49, i32 %50)
store i8* %51, i8** %4
br label %52
52: ; preds = %47, %42, %37, %32, %27, %22, %17, %12
%53 = load i8*, i8** %4
ret i8* %53
}

LLVM IR (-O2):
%struct.trace_seq = type { i32 }
define i8* @scsi_trace_parse_cdb(%struct.trace_seq* %0, i8* %1, i32 %2) {
%4 = load i8, i8* %1
switch i8 %4, label %19 [
i8 8, label %5
i8 10, label %5
i8 40, label %7
i8 47, label %7
i8 42, label %7
i8 65, label %7
i8 -88, label %9
i8 -81, label %9
i8 -86, label %9
i8 -120, label %11
i8 -113, label %11
i8 -118, label %11
i8 -109, label %11
i8 66, label %13
i8 -98, label %15
i8 127, label %17
]
5: ; preds = %3, %3
%6 = tail call i8* @scsi_trace_rw6(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
7: ; preds = %3, %3, %3, %3
%8 = tail call i8* @scsi_trace_rw10(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
9: ; preds = %3, %3, %3
%10 = tail call i8* @scsi_trace_rw12(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
11: ; preds = %3, %3, %3, %3
%12 = tail call i8* @scsi_trace_rw16(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
13: ; preds = %3
%14 = tail call i8* @scsi_trace_unmap(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
15: ; preds = %3
%16 = tail call i8* @scsi_trace_service_action_in(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
17: ; preds = %3
%18 = tail call i8* @scsi_trace_varlen(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
19: ; preds = %3
%20 = tail call i8* @scsi_trace_misc(%struct.trace_seq* %0, i8* %1, i32 %2)
br label %21
21: ; preds = %19, %17, %15, %13, %11, %9, %7, %5
%22 = phi i8* [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ]
ret i8* %22
}