const char *getStatusText(int status) {
  if (status >= 0)
    return "Success";
  switch (status) {
  case -2:
    return "No free blcok found";
  case -3:
    return "No free file descriptor found";
  case -4:
    return "Block read error";
  case -5:
    return "Block write error";
  case -6:
    return "No free dir entry found";
  case -7:
    return "No dir entry found";
  case -8:
    return "No free OFT itrem found";
  case -9:
    return "File not opened";
  case -10:
    return "Bad OFT index";
  default:
    return "No such return status";
  }
}


x86 assembly (clang, -O0):
<getStatusText>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1121 <getStatusText+0x21>
lea    0xf0c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x8,%eax
ja     11da <getStatusText+0xda>
mov    -0x18(%rbp),%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xedf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xeed(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xeee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xef0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xef8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xefb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xf03(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xf03(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <getStatusText+0xe5>
lea    0xf01(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getStatusText>:
test   %edi,%edi
js     110c <getStatusText+0xc>
lea    0xef5(%rip),%rax
ret
add    $0xa,%edi
cmp    $0x8,%edi
ja     1126 <getStatusText+0x26>
movslq %edi,%rax
lea    0xfb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xf91(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Success\00"
@.str.1 = [20 x i8] c"No free blcok found\00"
@.str.2 = [30 x i8] c"No free file descriptor found\00"
@.str.3 = [17 x i8] c"Block read error\00"
@.str.4 = [18 x i8] c"Block write error\00"
@.str.5 = [24 x i8] c"No free dir entry found\00"
@.str.6 = [19 x i8] c"No dir entry found\00"
@.str.7 = [24 x i8] c"No free OFT itrem found\00"
@.str.8 = [16 x i8] c"File not opened\00"
@.str.9 = [14 x i8] c"Bad OFT index\00"
@.str.10 = [22 x i8] c"No such return status\00"
define i8* @getStatusText(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
7: ; preds = %1
%8 = load i32, i32* %3
switch i32 %8, label %18 [
i32 -2, label %9
i32 -3, label %10
i32 -4, label %11
i32 -5, label %12
i32 -6, label %13
i32 -7, label %14
i32 -8, label %15
i32 -9, label %16
i32 -10, label %17
]
9: ; preds = %7
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %19
10: ; preds = %7
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %19
11: ; preds = %7
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %19
12: ; preds = %7
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %19
13: ; preds = %7
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %19
14: ; preds = %7
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %19
15: ; preds = %7
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %19
16: ; preds = %7
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %7
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %19
18: ; preds = %7
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %19
19: ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %6
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [8 x i8] c"Success\00"
@.str.1 = [20 x i8] c"No free blcok found\00"
@.str.2 = [30 x i8] c"No free file descriptor found\00"
@.str.3 = [17 x i8] c"Block read error\00"
@.str.4 = [18 x i8] c"Block write error\00"
@.str.5 = [24 x i8] c"No free dir entry found\00"
@.str.6 = [19 x i8] c"No dir entry found\00"
@.str.7 = [24 x i8] c"No free OFT itrem found\00"
@.str.8 = [16 x i8] c"File not opened\00"
@.str.9 = [14 x i8] c"Bad OFT index\00"
@.str.10 = [22 x i8] c"No such return status\00"
@reltable.getStatusText = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.9 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.8 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.7 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.6 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.5 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.3 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str.2 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.1 to i64), i64 ptrtoint ([9 x i32]* @reltable.getStatusText to i64)) to i32)]
define i8* @getStatusText(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = add i32 %0, 10
%5 = icmp ult i32 %4, 9
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.getStatusText to i8*), i64 %8)
br label %10
10: ; preds = %3, %6, %1
%11 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ], [ %9, %6 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), %3 ]
ret i8* %11
}