#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void sg_print_scsi_status(int scsi_status) {
  const char *ccp;
  scsi_status &= 0x7e;
  switch (scsi_status) {
  case 0:
    ccp = "Good";
    break;
  case 0x2:
    ccp = "Check Condition";
    break;
  case 0x4:
    ccp = "Condition Met";
    break;
  case 0x8:
    ccp = "Busy";
    break;
  case 0x10:
    ccp = "Intermediate";
    break;
  case 0x14:
    ccp = "Intermediate-Condition Met";
    break;
  case 0x18:
    ccp = "Reservation Conflict";
    break;
  case 0x22:
    ccp = "Command Terminated (obsolete)";
    break;
  case 0x28:
    ccp = "Task set Full";
    break;
  case 0x30:
    ccp = "ACA Active";
    break;
  case 0x40:
    ccp = "Task Aborted";
    break;
  default:
    ccp = "Unknown status";
    break;
  }
  fprintf(stderr, "%s ", ccp);
}


x86 assembly (clang, -O0):
<sg_print_scsi_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7e,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x40,%rax
ja     11f9 <sg_print_scsi_status+0xe9>
mov    -0x18(%rbp),%rax
lea    0xec0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfb4(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xfa9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xfc8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xf99(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xf8e(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xf8b(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xf96(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xf9b(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xfa9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xfa7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xfa2(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1204 <sg_print_scsi_status+0xf4>
lea    0xf9f(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xf96(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_print_scsi_status>:
and    $0x7e,%edi
cmp    $0x40,%edi
ja     1138 <sg_print_scsi_status+0x28>
lea    0xfe5(%rip),%rdx
lea    0xeda(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xfd3(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0x1060(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0xff0(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0xfc8(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0xfc4(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0xfc8(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0xfda(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0xfe6(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0xffb(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0x1000(%rip),%rdx
jmp    1190 <sg_print_scsi_status+0x80>
lea    0x1002(%rip),%rdx
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0x100e(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"Good\00"
@.str.1 = [16 x i8] c"Check Condition\00"
@.str.2 = [14 x i8] c"Condition Met\00"
@.str.3 = [5 x i8] c"Busy\00"
@.str.4 = [13 x i8] c"Intermediate\00"
@.str.5 = [27 x i8] c"Intermediate-Condition Met\00"
@.str.6 = [21 x i8] c"Reservation Conflict\00"
@.str.7 = [30 x i8] c"Command Terminated (obsolete)\00"
@.str.8 = [14 x i8] c"Task set Full\00"
@.str.9 = [11 x i8] c"ACA Active\00"
@.str.10 = [13 x i8] c"Task Aborted\00"
@.str.11 = [15 x i8] c"Unknown status\00"
@stderr = global i32 0
@.str.12 = [4 x i8] c"%s \00"
define void @sg_print_scsi_status(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 126
store i32 %5, i32* %2
%6 = load i32, i32* %2
switch i32 %6, label %18 [
i32 0, label %7
i32 2, label %8
i32 4, label %9
i32 8, label %10
i32 16, label %11
i32 20, label %12
i32 24, label %13
i32 34, label %14
i32 40, label %15
i32 48, label %16
i32 64, label %17
]
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
br label %19
8: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %19
9: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %19
10: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %19
11: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %19
12: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %19
13: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %19
14: ; preds = %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %19
15: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %19
16: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8** %3
br label %19
17: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8** %3
br label %19
18: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i8** %3
br label %19
19: ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %3
%22 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"Good\00"
@.str.1 = [16 x i8] c"Check Condition\00"
@.str.2 = [14 x i8] c"Condition Met\00"
@.str.3 = [5 x i8] c"Busy\00"
@.str.4 = [13 x i8] c"Intermediate\00"
@.str.5 = [27 x i8] c"Intermediate-Condition Met\00"
@.str.6 = [21 x i8] c"Reservation Conflict\00"
@.str.7 = [30 x i8] c"Command Terminated (obsolete)\00"
@.str.8 = [14 x i8] c"Task set Full\00"
@.str.9 = [11 x i8] c"ACA Active\00"
@.str.10 = [13 x i8] c"Task Aborted\00"
@.str.11 = [15 x i8] c"Unknown status\00"
@stderr = global i32 0
@.str.12 = [4 x i8] c"%s \00"
define void @sg_print_scsi_status(i32 %0) {
%2 = and i32 %0, 126
switch i32 %2, label %13 [
i32 0, label %14
i32 2, label %3
i32 4, label %4
i32 8, label %5
i32 16, label %6
i32 20, label %7
i32 24, label %8
i32 34, label %9
i32 40, label %10
i32 48, label %11
i32 64, label %12
]
3: ; preds = %1
br label %14
4: ; preds = %1
br label %14
5: ; preds = %1
br label %14
6: ; preds = %1
br label %14
7: ; preds = %1
br label %14
8: ; preds = %1
br label %14
9: ; preds = %1
br label %14
10: ; preds = %1
br label %14
11: ; preds = %1
br label %14
12: ; preds = %1
br label %14
13: ; preds = %1
br label %14
14: ; preds = %1, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
%15 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), %13 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), %12 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), %11 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), %10 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %15)
ret void
}