const char *httpd_get_error(struct httpd_session_data *sd, int *status) {
  const char *msg;
  switch (*status) {
  case 200:
    msg = "OK";
    break;
  case 206:
    msg = "Partial Content";
    break;
  case 304:
    msg = "Not Modified";
    break;
  case 400:
    msg = "Bad Request";
    break;
  case 401:
    msg = "Unauthorized";
    break;
  case 403:
    msg = "Forbidden";
    break;
  case 404:
    msg = "Not Found";
    break;
  case 408:
    msg = "Request Timedout";
    break;
  case 411:
    msg = "Length Required";
    break;
  case 412:
    msg = "Precondition failed";
    break;
  case 413:
    msg = "Request Entity Too Large";
    break;
  case 414:
    msg = "Request-URI Too Long";
    break;
  case 416:
    msg = "Requested Range Not Satisfiable";
    break;
  case 503:
    msg = "Service Unavailable";
    break;
  default:
    *status = 500;
    msg = "Internal Server Error";
    break;
  }
  return msg;
}


x86 assembly (clang, -O0):
<httpd_get_error>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0xc8,%eax
je     121c <httpd_get_error+0x11c>
jmp    1125 <httpd_get_error+0x25>
mov    -0x1c(%rbp),%eax
sub    $0xce,%eax
je     122c <httpd_get_error+0x12c>
jmp    1138 <httpd_get_error+0x38>
mov    -0x1c(%rbp),%eax
sub    $0x130,%eax
je     123c <httpd_get_error+0x13c>
jmp    114b <httpd_get_error+0x4b>
mov    -0x1c(%rbp),%eax
sub    $0x190,%eax
je     124c <httpd_get_error+0x14c>
jmp    115e <httpd_get_error+0x5e>
mov    -0x1c(%rbp),%eax
sub    $0x191,%eax
je     125c <httpd_get_error+0x15c>
jmp    1171 <httpd_get_error+0x71>
mov    -0x1c(%rbp),%eax
sub    $0x193,%eax
je     126c <httpd_get_error+0x16c>
jmp    1184 <httpd_get_error+0x84>
mov    -0x1c(%rbp),%eax
sub    $0x194,%eax
je     127c <httpd_get_error+0x17c>
jmp    1197 <httpd_get_error+0x97>
mov    -0x1c(%rbp),%eax
sub    $0x198,%eax
je     128c <httpd_get_error+0x18c>
jmp    11aa <httpd_get_error+0xaa>
mov    -0x1c(%rbp),%eax
sub    $0x19b,%eax
je     129c <httpd_get_error+0x19c>
jmp    11bd <httpd_get_error+0xbd>
mov    -0x1c(%rbp),%eax
sub    $0x19c,%eax
je     12ac <httpd_get_error+0x1ac>
jmp    11d0 <httpd_get_error+0xd0>
mov    -0x1c(%rbp),%eax
sub    $0x19d,%eax
je     12bc <httpd_get_error+0x1bc>
jmp    11e3 <httpd_get_error+0xe3>
mov    -0x1c(%rbp),%eax
sub    $0x19e,%eax
je     12cc <httpd_get_error+0x1cc>
jmp    11f6 <httpd_get_error+0xf6>
mov    -0x1c(%rbp),%eax
sub    $0x1a0,%eax
je     12dc <httpd_get_error+0x1dc>
jmp    1209 <httpd_get_error+0x109>
mov    -0x1c(%rbp),%eax
sub    $0x1f7,%eax
je     12ec <httpd_get_error+0x1ec>
jmp    12fc <httpd_get_error+0x1fc>
lea    0xddd(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdd0(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdd0(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdcd(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdc9(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdc6(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdc0(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdba(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdbb(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdbb(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdbf(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdc8(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xdcd(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
lea    0xddd(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <httpd_get_error+0x211>
mov    -0x10(%rbp),%rax
movl   $0x1f4,(%rax)
lea    0xdd7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<httpd_get_error>:
mov    (%rsi),%eax
cmp    $0x18f,%eax
jle    112f <httpd_get_error+0x2f>
add    $0xfffffe70,%eax
cmp    $0x67,%eax
ja     11ac <httpd_get_error+0xac>
lea    0xee2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1092(%rip),%rax
ret
cmp    $0xc8,%eax
je     119c <httpd_get_error+0x9c>
cmp    $0xce,%eax
je     11a4 <httpd_get_error+0xa4>
cmp    $0x130,%eax
jne    11ac <httpd_get_error+0xac>
lea    0x1068(%rip),%rax
ret
lea    0x1079(%rip),%rax
ret
lea    0x107e(%rip),%rax
ret
lea    0x1080(%rip),%rax
ret
lea    0x1082(%rip),%rax
ret
lea    0x108b(%rip),%rax
ret
lea    0x1093(%rip),%rax
ret
lea    0x109f(%rip),%rax
ret
lea    0x10b0(%rip),%rax
ret
lea    0x10bd(%rip),%rax
ret
lea    0x10d5(%rip),%rax
ret
lea    0xffd(%rip),%rax
ret
lea    0xff8(%rip),%rax
ret
movl   $0x1f4,(%rsi)
lea    0x10cb(%rip),%rax
ret

LLVM IR (-O0):
%struct.httpd_session_data = type opaque
@.str = [3 x i8] c"OK\00"
@.str.1 = [16 x i8] c"Partial Content\00"
@.str.2 = [13 x i8] c"Not Modified\00"
@.str.3 = [12 x i8] c"Bad Request\00"
@.str.4 = [13 x i8] c"Unauthorized\00"
@.str.5 = [10 x i8] c"Forbidden\00"
@.str.6 = [10 x i8] c"Not Found\00"
@.str.7 = [17 x i8] c"Request Timedout\00"
@.str.8 = [16 x i8] c"Length Required\00"
@.str.9 = [20 x i8] c"Precondition failed\00"
@.str.10 = [25 x i8] c"Request Entity Too Large\00"
@.str.11 = [21 x i8] c"Request-URI Too Long\00"
@.str.12 = [32 x i8] c"Requested Range Not Satisfiable\00"
@.str.13 = [20 x i8] c"Service Unavailable\00"
@.str.14 = [22 x i8] c"Internal Server Error\00"
define i8* @httpd_get_error(%struct.httpd_session_data* %0, i32* %1) {
%3 = alloca %struct.httpd_session_data*
%4 = alloca i32*
%5 = alloca i8*
store %struct.httpd_session_data* %0, %struct.httpd_session_data** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
switch i32 %7, label %22 [
i32 200, label %8
i32 206, label %9
i32 304, label %10
i32 400, label %11
i32 401, label %12
i32 403, label %13
i32 404, label %14
i32 408, label %15
i32 411, label %16
i32 412, label %17
i32 413, label %18
i32 414, label %19
i32 416, label %20
i32 503, label %21
]
8: ; preds = %2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5
br label %24
9: ; preds = %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %24
10: ; preds = %2
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %24
11: ; preds = %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %24
12: ; preds = %2
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %5
br label %24
13: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %5
br label %24
14: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %5
br label %24
15: ; preds = %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8** %5
br label %24
16: ; preds = %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8** %5
br label %24
17: ; preds = %2
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8** %5
br label %24
18: ; preds = %2
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8** %5
br label %24
19: ; preds = %2
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i8** %5
br label %24
20: ; preds = %2
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i8** %5
br label %24
21: ; preds = %2
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), i8** %5
br label %24
22: ; preds = %2
%23 = load i32*, i32** %4
store i32 500, i32* %23
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i8** %5
br label %24
24: ; preds = %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8
%25 = load i8*, i8** %5
ret i8* %25
}

LLVM IR (-O2):
%struct.httpd_session_data = type opaque
@.str = [3 x i8] c"OK\00"
@.str.1 = [16 x i8] c"Partial Content\00"
@.str.2 = [13 x i8] c"Not Modified\00"
@.str.3 = [12 x i8] c"Bad Request\00"
@.str.4 = [13 x i8] c"Unauthorized\00"
@.str.5 = [10 x i8] c"Forbidden\00"
@.str.6 = [10 x i8] c"Not Found\00"
@.str.7 = [17 x i8] c"Request Timedout\00"
@.str.8 = [16 x i8] c"Length Required\00"
@.str.9 = [20 x i8] c"Precondition failed\00"
@.str.10 = [25 x i8] c"Request Entity Too Large\00"
@.str.11 = [21 x i8] c"Request-URI Too Long\00"
@.str.12 = [32 x i8] c"Requested Range Not Satisfiable\00"
@.str.13 = [20 x i8] c"Service Unavailable\00"
@.str.14 = [22 x i8] c"Internal Server Error\00"
define i8* @httpd_get_error(%struct.httpd_session_data* nocapture readnone %0, i32* nocapture %1) {
%3 = load i32, i32* %1
switch i32 %3, label %17 [
i32 200, label %18
i32 206, label %4
i32 304, label %5
i32 400, label %6
i32 401, label %7
i32 403, label %8
i32 404, label %9
i32 408, label %10
i32 411, label %11
i32 412, label %12
i32 413, label %13
i32 414, label %14
i32 416, label %15
i32 503, label %16
]
4: ; preds = %2
br label %18
5: ; preds = %2
br label %18
6: ; preds = %2
br label %18
7: ; preds = %2
br label %18
8: ; preds = %2
br label %18
9: ; preds = %2
br label %18
10: ; preds = %2
br label %18
11: ; preds = %2
br label %18
12: ; preds = %2
br label %18
13: ; preds = %2
br label %18
14: ; preds = %2
br label %18
15: ; preds = %2
br label %18
16: ; preds = %2
br label %18
17: ; preds = %2
store i32 500, i32* %1
br label %18
18: ; preds = %2, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4
%19 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), %17 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), %16 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), %15 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), %14 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), %13 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), %11 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %19
}