#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*/ strncpy(char *, char *, int);
void http_status(char *message, int code) {
  switch (code) {
  case 400:
    strncpy(message, "BAD REQUEST", 100);
    break;
  case 403:
    strncpy(message, "FORBIDDEN", 100);
    break;
  case 404:
    strncpy(message, "NOT FOUND", 100);
    break;
  case 500:
    strncpy(message, "INTERNAL_ERROR", 100);
    break;
  case 501:
    strncpy(message, "NOT IMPLEMENTED", 100);
    break;
  default:
    strncpy(message, "OK", 100);
  }
}


x86 assembly (clang, -O0):
<http_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x190,%eax
je     1181 <http_status+0x71>
jmp    1135 <http_status+0x25>
mov    -0x10(%rbp),%eax
sub    $0x193,%eax
je     119b <http_status+0x8b>
jmp    1148 <http_status+0x38>
mov    -0x10(%rbp),%eax
sub    $0x194,%eax
je     11b5 <http_status+0xa5>
jmp    115b <http_status+0x4b>
mov    -0x10(%rbp),%eax
sub    $0x1f4,%eax
je     11cf <http_status+0xbf>
jmp    116e <http_status+0x5e>
mov    -0x10(%rbp),%eax
sub    $0x1f5,%eax
je     11e9 <http_status+0xd9>
jmp    1203 <http_status+0xf3>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
jmp    1218 <http_status+0x108>
mov    -0x8(%rbp),%rdi
lea    0xe66(%rip),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
jmp    1218 <http_status+0x108>
mov    -0x8(%rbp),%rdi
lea    0xe56(%rip),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
jmp    1218 <http_status+0x108>
mov    -0x8(%rbp),%rdi
lea    0xe46(%rip),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
jmp    1218 <http_status+0x108>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
jmp    1218 <http_status+0x108>
mov    -0x8(%rbp),%rdi
lea    0xe31(%rip),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_status>:
cmp    $0x193,%esi
jle    1141 <http_status+0x31>
cmp    $0x194,%esi
je     1162 <http_status+0x52>
cmp    $0x1f4,%esi
je     1173 <http_status+0x63>
cmp    $0x1f5,%esi
jne    1195 <http_status+0x85>
lea    0xef8(%rip),%rsi
mov    $0x64,%edx
jmp    1030 <strncpy@plt>
cmp    $0x190,%esi
je     1184 <http_status+0x74>
cmp    $0x193,%esi
jne    1195 <http_status+0x85>
lea    0xeb4(%rip),%rsi
mov    $0x64,%edx
jmp    1030 <strncpy@plt>
lea    0xead(%rip),%rsi
mov    $0x64,%edx
jmp    1030 <strncpy@plt>
lea    0xea6(%rip),%rsi
mov    $0x64,%edx
jmp    1030 <strncpy@plt>
lea    0xe75(%rip),%rsi
mov    $0x64,%edx
jmp    1030 <strncpy@plt>
lea    0xea3(%rip),%rsi
mov    $0x64,%edx
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"BAD REQUEST\00"
@.str.1 = [10 x i8] c"FORBIDDEN\00"
@.str.2 = [10 x i8] c"NOT FOUND\00"
@.str.3 = [15 x i8] c"INTERNAL_ERROR\00"
@.str.4 = [16 x i8] c"NOT IMPLEMENTED\00"
@.str.5 = [3 x i8] c"OK\00"
define void @http_status(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %21 [
i32 400, label %6
i32 403, label %9
i32 404, label %12
i32 500, label %15
i32 501, label %18
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 @strncpy(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 100)
br label %24
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @strncpy(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 100)
br label %24
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 100)
br label %24
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 @strncpy(i8* %16, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 100)
br label %24
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = call i32 @strncpy(i8* %19, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 100)
br label %24
21: ; preds = %2
%22 = load i8*, i8** %3
%23 = call i32 @strncpy(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 100)
br label %24
24: ; preds = %21, %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"BAD REQUEST\00"
@.str.1 = [10 x i8] c"FORBIDDEN\00"
@.str.2 = [10 x i8] c"NOT FOUND\00"
@.str.3 = [15 x i8] c"INTERNAL_ERROR\00"
@.str.4 = [16 x i8] c"NOT IMPLEMENTED\00"
@.str.5 = [3 x i8] c"OK\00"
define void @http_status(i8* %0, i32 %1) {
switch i32 %1, label %7 [
i32 400, label %8
i32 403, label %3
i32 404, label %4
i32 500, label %5
i32 501, label %6
]
3: ; preds = %2
br label %8
4: ; preds = %2
br label %8
5: ; preds = %2
br label %8
6: ; preds = %2
br label %8
7: ; preds = %2
br label %8
8: ; preds = %2, %7, %6, %5, %4, %3
%9 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %2 ]
%10 = tail call i32 @strncpy(i8* %0, i8* %9, i32 100)
ret void
}