#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*/ str_clearcopy(char *, char *, size_t);
void http_response_set_msg_from_code(int code, char *msg, size_t len) {
  char *tmp_msg;
  switch (code) {
  case -1:
    tmp_msg = "Unknown";
    break;
  case 200:
    tmp_msg = "OK";
    break;
  case 400:
    tmp_msg = "Bad Request";
    break;
  case 403:
    tmp_msg = "Forbidden";
    break;
  case 404:
    tmp_msg = "Not Found";
    break;
  case 500:
    tmp_msg = "Internal Server Error";
    break;
  default:
    tmp_msg = "Response Code Error";
    break;
  }
  str_clearcopy(msg, tmp_msg, len);
}


x86 assembly (clang, -O0):
<http_response_set_msg_from_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0xffffffff,%eax
je     1196 <http_response_set_msg_from_code+0x86>
jmp    1137 <http_response_set_msg_from_code+0x27>
mov    -0x24(%rbp),%eax
sub    $0xc8,%eax
je     11a6 <http_response_set_msg_from_code+0x96>
jmp    114a <http_response_set_msg_from_code+0x3a>
mov    -0x24(%rbp),%eax
sub    $0x190,%eax
je     11b6 <http_response_set_msg_from_code+0xa6>
jmp    115d <http_response_set_msg_from_code+0x4d>
mov    -0x24(%rbp),%eax
sub    $0x193,%eax
je     11c6 <http_response_set_msg_from_code+0xb6>
jmp    1170 <http_response_set_msg_from_code+0x60>
mov    -0x24(%rbp),%eax
sub    $0x194,%eax
je     11d6 <http_response_set_msg_from_code+0xc6>
jmp    1183 <http_response_set_msg_from_code+0x73>
mov    -0x24(%rbp),%eax
sub    $0x1f4,%eax
je     11e6 <http_response_set_msg_from_code+0xd6>
jmp    11f6 <http_response_set_msg_from_code+0xe6>
lea    0xe63(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1201 <http_response_set_msg_from_code+0xf1>
lea    0xe5b(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1201 <http_response_set_msg_from_code+0xf1>
lea    0xe4e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1201 <http_response_set_msg_from_code+0xf1>
lea    0xe4a(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1201 <http_response_set_msg_from_code+0xf1>
lea    0xe44(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1201 <http_response_set_msg_from_code+0xf1>
lea    0xe3e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1201 <http_response_set_msg_from_code+0xf1>
lea    0xe44(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <str_clearcopy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_response_set_msg_from_code>:
mov    %rsi,%rax
cmp    $0x192,%edi
jg     113f <http_response_set_msg_from_code+0x2f>
cmp    $0xffffffff,%edi
je     1166 <http_response_set_msg_from_code+0x56>
cmp    $0xc8,%edi
je     1175 <http_response_set_msg_from_code+0x65>
cmp    $0x190,%edi
jne    11a2 <http_response_set_msg_from_code+0x92>
lea    0xed4(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <str_clearcopy@plt>
cmp    $0x193,%edi
je     1184 <http_response_set_msg_from_code+0x74>
cmp    $0x194,%edi
je     1193 <http_response_set_msg_from_code+0x83>
cmp    $0x1f4,%edi
jne    11a2 <http_response_set_msg_from_code+0x92>
lea    0xecd(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <str_clearcopy@plt>
lea    0xe93(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <str_clearcopy@plt>
lea    0xe8c(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <str_clearcopy@plt>
lea    0xe8c(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <str_clearcopy@plt>
lea    0xe87(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <str_clearcopy@plt>
lea    0xe98(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <str_clearcopy@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [12 x i8] c"Bad Request\00"
@.str.3 = [10 x i8] c"Forbidden\00"
@.str.4 = [10 x i8] c"Not Found\00"
@.str.5 = [22 x i8] c"Internal Server Error\00"
@.str.6 = [20 x i8] c"Response Code Error\00"
define void @http_response_set_msg_from_code(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i32, i32* %4
switch i32 %8, label %15 [
i32 -1, label %9
i32 200, label %10
i32 400, label %11
i32 403, label %12
i32 404, label %13
i32 500, label %14
]
9: ; preds = %3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %7
br label %16
10: ; preds = %3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %7
br label %16
11: ; preds = %3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %7
br label %16
12: ; preds = %3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %7
br label %16
13: ; preds = %3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %7
br label %16
14: ; preds = %3
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8** %7
br label %16
15: ; preds = %3
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8** %7
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %9
%17 = load i8*, i8** %5
%18 = load i8*, i8** %7
%19 = load i64, i64* %6
%20 = call i32 @str_clearcopy(i8* %17, i8* %18, i64 %19)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [12 x i8] c"Bad Request\00"
@.str.3 = [10 x i8] c"Forbidden\00"
@.str.4 = [10 x i8] c"Not Found\00"
@.str.5 = [22 x i8] c"Internal Server Error\00"
@.str.6 = [20 x i8] c"Response Code Error\00"
define void @http_response_set_msg_from_code(i32 %0, i8* %1, i64 %2) {
switch i32 %0, label %9 [
i32 -1, label %10
i32 200, label %4
i32 400, label %5
i32 403, label %6
i32 404, label %7
i32 500, label %8
]
4: ; preds = %3
br label %10
5: ; preds = %3
br label %10
6: ; preds = %3
br label %10
7: ; preds = %3
br label %10
8: ; preds = %3
br label %10
9: ; preds = %3
br label %10
10: ; preds = %3, %9, %8, %7, %6, %5, %4
%11 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %3 ]
%12 = tail call i32 @str_clearcopy(i8* %1, i8* %11, i64 %2)
ret void
}