const char *sqlite3ErrStr(int rc) {
  const char *z;
  switch (rc & 0xff) {
  case 100:
  case 101:
  case 0:
    z = "not an error";
    break;
  case 1:
    z = "SQL logic error or missing database";
    break;
  case 3:
    z = "access permission denied";
    break;
  case 4:
    z = "callback requested query abort";
    break;
  case 5:
    z = "database is locked";
    break;
  case 6:
    z = "database table is locked";
    break;
  case 7:
    z = "out of memory";
    break;
  case 8:
    z = "attempt to write a readonly database";
    break;
  case 9:
    z = "interrupted";
    break;
  case 10:
    z = "disk I/O error";
    break;
  case 11:
    z = "database disk image is malformed";
    break;
  case 13:
    z = "database or disk is full";
    break;
  case 14:
    z = "unable to open database file";
    break;
  case 16:
    z = "table contains no data";
    break;
  case 17:
    z = "database schema has changed";
    break;
  case 18:
    z = "String or BLOB exceeded size limit";
    break;
  case 19:
    z = "constraint failed";
    break;
  case 20:
    z = "datatype mismatch";
    break;
  case 21:
    z = "library routine called out of sequence";
    break;
  case 22:
    z = "large file support is disabled";
    break;
  case 23:
    z = "authorization denied";
    break;
  case 24:
    z = "auxiliary database format error";
    break;
  case 25:
    z = "bind or column index out of range";
    break;
  case 26:
    z = "file is encrypted or is not a database";
    break;
  default:
    z = "unknown error";
    break;
  }
  return z;
}


x86 assembly (clang, -O0):
<sqlite3ErrStr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x65,%eax
ja     12ae <sqlite3ErrStr+0x1ae>
mov    -0x18(%rbp),%rax
lea    0xedb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1063(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x1060(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x1074(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x107d(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x108c(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x108f(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x1098(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x1096(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10ab(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10a7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10a6(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10b7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10c0(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10cd(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10d4(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10e0(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10f3(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10f5(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x10f7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x110e(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x111d(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x1122(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x1132(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x1144(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b9 <sqlite3ErrStr+0x1b9>
lea    0x115b(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite3ErrStr>:
cmp    $0x65,%dil
ja     112a <sqlite3ErrStr+0x2a>
lea    0x108b(%rip),%rax
movzbl %dil,%ecx
lea    0xee8(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
ret
lea    0x107c(%rip),%rax
ret
lea    0x12df(%rip),%rax
ret
lea    0x1090(%rip),%rax
ret
lea    0x10a1(%rip),%rax
ret
lea    0x10b8(%rip),%rax
ret
lea    0x10c3(%rip),%rax
ret
lea    0x10d4(%rip),%rax
ret
lea    0x10da(%rip),%rax
ret
lea    0x10f7(%rip),%rax
ret
lea    0x10fb(%rip),%rax
ret
lea    0x1102(%rip),%rax
ret
lea    0x111b(%rip),%rax
ret
lea    0x112c(%rip),%rax
ret
lea    0x1141(%rip),%rax
ret
lea    0x1150(%rip),%rax
ret
lea    0x1164(%rip),%rax
ret
lea    0x117f(%rip),%rax
ret
lea    0x1189(%rip),%rax
ret
lea    0x1193(%rip),%rax
ret
lea    0x11b2(%rip),%rax
ret
lea    0x11c9(%rip),%rax
ret
lea    0x11d6(%rip),%rax
ret
lea    0x11ee(%rip),%rax
ret
lea    0x1208(%rip),%rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"not an error\00"
@.str.1 = [36 x i8] c"SQL logic error or missing database\00"
@.str.2 = [25 x i8] c"access permission denied\00"
@.str.3 = [31 x i8] c"callback requested query abort\00"
@.str.4 = [19 x i8] c"database is locked\00"
@.str.5 = [25 x i8] c"database table is locked\00"
@.str.6 = [14 x i8] c"out of memory\00"
@.str.7 = [37 x i8] c"attempt to write a database\00"
@.str.8 = [12 x i8] c"interrupted\00"
@.str.9 = [15 x i8] c"disk I/O error\00"
@.str.10 = [33 x i8] c"database disk image is malformed\00"
@.str.11 = [25 x i8] c"database or disk is full\00"
@.str.12 = [29 x i8] c"unable to open database file\00"
@.str.13 = [23 x i8] c"table contains no data\00"
@.str.14 = [28 x i8] c"database schema has changed\00"
@.str.15 = [35 x i8] c"String or BLOB exceeded size limit\00"
@.str.16 = [18 x i8] c"constraint failed\00"
@.str.17 = [18 x i8] c"datatype mismatch\00"
@.str.18 = [39 x i8] c"library routine called out of sequence\00"
@.str.19 = [31 x i8] c"large file support is disabled\00"
@.str.20 = [21 x i8] c"authorization denied\00"
@.str.21 = [32 x i8] c"auxiliary database format error\00"
@.str.22 = [34 x i8] c"bind or column index out of range\00"
@.str.23 = [39 x i8] c"file is encrypted or is not a database\00"
@.str.24 = [14 x i8] c"unknown error\00"
define i8* @sqlite3ErrStr(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 255
switch i32 %5, label %30 [
i32 100, label %6
i32 101, label %6
i32 0, label %6
i32 1, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 8, label %13
i32 9, label %14
i32 10, label %15
i32 11, label %16
i32 13, label %17
i32 14, label %18
i32 16, label %19
i32 17, label %20
i32 18, label %21
i32 19, label %22
i32 20, label %23
i32 21, label %24
i32 22, label %25
i32 23, label %26
i32 24, label %27
i32 25, label %28
i32 26, label %29
]
6: ; preds = %1, %1, %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %3
br label %31
7: ; preds = %1
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %31
8: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %31
9: ; preds = %1
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %31
10: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %31
11: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %31
12: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %31
13: ; preds = %1
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %31
14: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %31
15: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8** %3
br label %31
16: ; preds = %1
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i8** %3
br label %31
17: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i8** %3
br label %31
18: ; preds = %1
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8** %3
br label %31
19: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i8** %3
br label %31
20: ; preds = %1
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i8** %3
br label %31
21: ; preds = %1
store i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.15, i64 0, i64 0), i8** %3
br label %31
22: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), i8** %3
br label %31
23: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i8** %3
br label %31
24: ; preds = %1
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0), i8** %3
br label %31
25: ; preds = %1
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.19, i64 0, i64 0), i8** %3
br label %31
26: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i8** %3
br label %31
27: ; preds = %1
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.21, i64 0, i64 0), i8** %3
br label %31
28: ; preds = %1
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.22, i64 0, i64 0), i8** %3
br label %31
29: ; preds = %1
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.23, i64 0, i64 0), i8** %3
br label %31
30: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0), i8** %3
br label %31
31: ; preds = %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
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
@.str = [13 x i8] c"not an error\00"
@.str.1 = [36 x i8] c"SQL logic error or missing database\00"
@.str.2 = [25 x i8] c"access permission denied\00"
@.str.3 = [31 x i8] c"callback requested query abort\00"
@.str.4 = [19 x i8] c"database is locked\00"
@.str.5 = [25 x i8] c"database table is locked\00"
@.str.6 = [14 x i8] c"out of memory\00"
@.str.7 = [37 x i8] c"attempt to write a database\00"
@.str.8 = [12 x i8] c"interrupted\00"
@.str.9 = [15 x i8] c"disk I/O error\00"
@.str.10 = [33 x i8] c"database disk image is malformed\00"
@.str.11 = [25 x i8] c"database or disk is full\00"
@.str.12 = [29 x i8] c"unable to open database file\00"
@.str.13 = [23 x i8] c"table contains no data\00"
@.str.14 = [28 x i8] c"database schema has changed\00"
@.str.15 = [35 x i8] c"String or BLOB exceeded size limit\00"
@.str.16 = [18 x i8] c"constraint failed\00"
@.str.17 = [18 x i8] c"datatype mismatch\00"
@.str.18 = [39 x i8] c"library routine called out of sequence\00"
@.str.19 = [31 x i8] c"large file support is disabled\00"
@.str.20 = [21 x i8] c"authorization denied\00"
@.str.21 = [32 x i8] c"auxiliary database format error\00"
@.str.22 = [34 x i8] c"bind or column index out of range\00"
@.str.23 = [39 x i8] c"file is encrypted or is not a database\00"
@.str.24 = [14 x i8] c"unknown error\00"
define i8* @sqlite3ErrStr(i32 %0) {
%2 = trunc i32 %0 to i8
switch i8 %2, label %26 [
i8 100, label %27
i8 101, label %27
i8 0, label %27
i8 1, label %3
i8 3, label %4
i8 4, label %5
i8 5, label %6
i8 6, label %7
i8 7, label %8
i8 8, label %9
i8 9, label %10
i8 10, label %11
i8 11, label %12
i8 13, label %13
i8 14, label %14
i8 16, label %15
i8 17, label %16
i8 18, label %17
i8 19, label %18
i8 20, label %19
i8 21, label %20
i8 22, label %21
i8 23, label %22
i8 24, label %23
i8 25, label %24
i8 26, label %25
]
3: ; preds = %1
br label %27
4: ; preds = %1
br label %27
5: ; preds = %1
br label %27
6: ; preds = %1
br label %27
7: ; preds = %1
br label %27
8: ; preds = %1
br label %27
9: ; preds = %1
br label %27
10: ; preds = %1
br label %27
11: ; preds = %1
br label %27
12: ; preds = %1
br label %27
13: ; preds = %1
br label %27
14: ; preds = %1
br label %27
15: ; preds = %1
br label %27
16: ; preds = %1
br label %27
17: ; preds = %1
br label %27
18: ; preds = %1
br label %27
19: ; preds = %1
br label %27
20: ; preds = %1
br label %27
21: ; preds = %1
br label %27
22: ; preds = %1
br label %27
23: ; preds = %1
br label %27
24: ; preds = %1
br label %27
25: ; preds = %1
br label %27
26: ; preds = %1
br label %27
27: ; preds = %1, %1, %1, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
%28 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0), %26 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.23, i64 0, i64 0), %25 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.22, i64 0, i64 0), %24 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.21, i64 0, i64 0), %23 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), %22 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.19, i64 0, i64 0), %21 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0), %20 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), %19 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), %18 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.15, i64 0, i64 0), %17 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), %16 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), %15 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), %14 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), %13 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), %12 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), %11 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), %10 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %28
}