int MSN_status2int(status)
char *status;
{
  int ret;
  if (strncmp(status, "BSY", 3) == 0)
    ret = 1;
  else if (strncmp(status, "IDL", 3) == 0)
    ret = 2;
  else if (strncmp(status, "AWY", 3) == 0)
    ret = 3;
  else if (strncmp(status, "PHN", 3) == 0)
    ret = 4;
  else if (strncmp(status, "LUN", 3) == 0)
    ret = 5;
  else if (strncmp(status, "BRB", 3) == 0)
    ret = 6;
  else if (strncmp(status, "HDN", 3) == 0)
    ret = 7;
  else
    ret = 0;
  return ret;
}


x86 assembly (clang, -O0):
<MSN_status2int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1146 <MSN_status2int+0x36>
movl   $0x1,-0xc(%rbp)
jmp    1267 <MSN_status2int+0x157>
mov    -0x8(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1170 <MSN_status2int+0x60>
movl   $0x2,-0xc(%rbp)
jmp    1262 <MSN_status2int+0x152>
mov    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    119a <MSN_status2int+0x8a>
movl   $0x3,-0xc(%rbp)
jmp    125d <MSN_status2int+0x14d>
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11c4 <MSN_status2int+0xb4>
movl   $0x4,-0xc(%rbp)
jmp    1258 <MSN_status2int+0x148>
mov    -0x8(%rbp),%rdi
lea    0xe41(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11ee <MSN_status2int+0xde>
movl   $0x5,-0xc(%rbp)
jmp    1253 <MSN_status2int+0x143>
mov    -0x8(%rbp),%rdi
lea    0xe1b(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1218 <MSN_status2int+0x108>
movl   $0x6,-0xc(%rbp)
jmp    124e <MSN_status2int+0x13e>
mov    -0x8(%rbp),%rdi
lea    0xdf5(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1242 <MSN_status2int+0x132>
movl   $0x7,-0xc(%rbp)
jmp    1249 <MSN_status2int+0x139>
movl   $0x0,-0xc(%rbp)
jmp    124e <MSN_status2int+0x13e>
jmp    1253 <MSN_status2int+0x143>
jmp    1258 <MSN_status2int+0x148>
jmp    125d <MSN_status2int+0x14d>
jmp    1262 <MSN_status2int+0x152>
jmp    1267 <MSN_status2int+0x157>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MSN_status2int>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11cb <MSN_status2int+0xbb>
lea    0xed0(%rip),%rsi
mov    $0x3,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11d2 <MSN_status2int+0xc2>
lea    0xeb8(%rip),%rsi
mov    $0x3,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11d9 <MSN_status2int+0xc9>
lea    0xea4(%rip),%rsi
mov    $0x3,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11e0 <MSN_status2int+0xd0>
lea    0xe90(%rip),%rsi
mov    $0x3,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11e7 <MSN_status2int+0xd7>
lea    0xe7c(%rip),%rsi
mov    $0x3,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11ee <MSN_status2int+0xde>
lea    0xe68(%rip),%rsi
mov    $0x3,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
mov    $0x7,%eax
cmovne %ecx,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret
mov    $0x4,%eax
pop    %rbx
ret
mov    $0x5,%eax
pop    %rbx
ret
mov    $0x6,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"BSY\00"
@.str.1 = [4 x i8] c"IDL\00"
@.str.2 = [4 x i8] c"AWY\00"
@.str.3 = [4 x i8] c"PHN\00"
@.str.4 = [4 x i8] c"LUN\00"
@.str.5 = [4 x i8] c"BRB\00"
@.str.6 = [4 x i8] c"HDN\00"
define i32 @MSN_status2int(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %3
br label %45
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 3)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 2, i32* %3
br label %44
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = call i32 @strncmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 3)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 3, i32* %3
br label %43
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 3)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 4, i32* %3
br label %42
23: ; preds = %18
%24 = load i8*, i8** %2
%25 = call i32 @strncmp(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64 3)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 5, i32* %3
br label %41
28: ; preds = %23
%29 = load i8*, i8** %2
%30 = call i32 @strncmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i64 3)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 6, i32* %3
br label %40
33: ; preds = %28
%34 = load i8*, i8** %2
%35 = call i32 @strncmp(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 3)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 7, i32* %3
br label %39
38: ; preds = %33
store i32 0, i32* %3
br label %39
39: ; preds = %38, %37
br label %40
40: ; preds = %39, %32
br label %41
41: ; preds = %40, %27
br label %42
42: ; preds = %41, %22
br label %43
43: ; preds = %42, %17
br label %44
44: ; preds = %43, %12
br label %45
45: ; preds = %44, %7
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [4 x i8] c"BSY\00"
@.str.1 = [4 x i8] c"IDL\00"
@.str.2 = [4 x i8] c"AWY\00"
@.str.3 = [4 x i8] c"PHN\00"
@.str.4 = [4 x i8] c"LUN\00"
@.str.5 = [4 x i8] c"BRB\00"
@.str.6 = [4 x i8] c"HDN\00"
define i32 @MSN_status2int(i8* nocapture %0) {
%2 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3)
%3 = icmp eq i32 %2, 0
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64 3)
%15 = icmp eq i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i64 3)
%18 = icmp eq i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 3)
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i32 7, i32 0
br label %23
23: ; preds = %19, %16, %13, %10, %7, %4, %1
%24 = phi i32 [ 1, %1 ], [ 2, %4 ], [ 3, %7 ], [ 4, %10 ], [ 5, %13 ], [ 6, %16 ], [ %22, %19 ]
ret i32 %24
}