#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*/ strcpy(char *, char *);
char *http_reason(char *buffer, const int status) {
  switch (status) {
  case 200:
    strcpy(buffer, "OK");
    break;
  case 400:
    strcpy(buffer, "Bad Request");
    break;
  case 404:
    strcpy(buffer, "Not Found");
    break;
  }
  return buffer;
}


x86 assembly (clang, -O0):
<http_reason>:
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    $0xc8,%eax
je     115b <http_reason+0x4b>
jmp    1135 <http_reason+0x25>
mov    -0x10(%rbp),%eax
sub    $0x190,%eax
je     1170 <http_reason+0x60>
jmp    1148 <http_reason+0x38>
mov    -0x10(%rbp),%eax
sub    $0x194,%eax
je     1185 <http_reason+0x75>
jmp    1195 <http_reason+0x85>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1195 <http_reason+0x85>
mov    -0x8(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1195 <http_reason+0x85>
mov    -0x8(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_reason>:
push   %rbx
mov    %rdi,%rbx
cmp    $0xc8,%esi
je     1135 <http_reason+0x25>
cmp    $0x194,%esi
je     113e <http_reason+0x2e>
cmp    $0x190,%esi
jne    114d <http_reason+0x3d>
lea    0xed0(%rip),%rsi
jmp    1145 <http_reason+0x35>
lea    0xec4(%rip),%rsi
jmp    1145 <http_reason+0x35>
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"OK\00"
@.str.1 = [12 x i8] c"Bad Request\00"
@.str.2 = [10 x i8] c"Not Found\00"
define i8* @http_reason(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 %15 [
i32 200, label %6
i32 400, label %9
i32 404, label %12
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %15
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %15
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %2, %12, %9, %6
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"OK\00"
@.str.1 = [12 x i8] c"Bad Request\00"
@.str.2 = [10 x i8] c"Not Found\00"
define i8* @http_reason(i8* returned %0, i32 %1) {
switch i32 %1, label %8 [
i32 200, label %5
i32 400, label %3
i32 404, label %4
]
3: ; preds = %2
br label %5
4: ; preds = %2
br label %5
5: ; preds = %2, %3, %4
%6 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %2 ]
%7 = tail call i32 @strcpy(i8* %0, i8* %6)
br label %8
8: ; preds = %5, %2
ret i8* %0
}