#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 */
struct mg_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mg_printf(struct mg_connection *, char *, ...);
void mg_send_response_line(struct mg_connection *nc, int status_code,
                           const char *extra_headers) {
  const char *status_message = "OK";
  switch (status_code) {
  case 206:
    status_message = "Partial Content";
    break;
  case 301:
    status_message = "Moved";
    break;
  case 302:
    status_message = "Found";
    break;
  case 416:
    status_message = "Requested range not satisfiable";
    break;
  case 418:
    status_message = "I'm a teapot";
    break;
  }
  mg_printf(nc, "HTTP/1.1 %d %s\r\n", status_code, status_message);
  if (extra_headers != NULL) {
    mg_printf(nc, "%s\r\n", extra_headers);
  }
}


x86 assembly (clang, -O0):
<mg_send_response_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0xce,%eax
je     1190 <mg_send_response_line+0x80>
jmp    1144 <mg_send_response_line+0x34>
mov    -0x24(%rbp),%eax
sub    $0x12d,%eax
je     11a0 <mg_send_response_line+0x90>
jmp    1157 <mg_send_response_line+0x47>
mov    -0x24(%rbp),%eax
sub    $0x12e,%eax
je     11b0 <mg_send_response_line+0xa0>
jmp    116a <mg_send_response_line+0x5a>
mov    -0x24(%rbp),%eax
sub    $0x1a0,%eax
je     11c0 <mg_send_response_line+0xb0>
jmp    117d <mg_send_response_line+0x6d>
mov    -0x24(%rbp),%eax
sub    $0x1a2,%eax
je     11d0 <mg_send_response_line+0xc0>
jmp    11db <mg_send_response_line+0xcb>
lea    0xe6c(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11db <mg_send_response_line+0xcb>
lea    0xe6c(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11db <mg_send_response_line+0xcb>
lea    0xe62(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11db <mg_send_response_line+0xcb>
lea    0xe58(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11db <mg_send_response_line+0xcb>
lea    0xe68(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1030 <mg_printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     1215 <mg_send_response_line+0x105>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <mg_printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_send_response_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xedd(%rip),%rcx
cmp    $0x12d,%esi
jle    114c <mg_send_response_line+0x3c>
cmp    $0x12e,%edx
je     1165 <mg_send_response_line+0x55>
cmp    $0x1a0,%edx
je     116e <mg_send_response_line+0x5e>
cmp    $0x1a2,%edx
jne    117e <mg_send_response_line+0x6e>
lea    0xef5(%rip),%rcx
jmp    117e <mg_send_response_line+0x6e>
cmp    $0xce,%edx
je     1177 <mg_send_response_line+0x67>
cmp    $0x12d,%edx
jne    117e <mg_send_response_line+0x6e>
lea    0xeb0(%rip),%rcx
jmp    117e <mg_send_response_line+0x6e>
lea    0xead(%rip),%rcx
jmp    117e <mg_send_response_line+0x6e>
lea    0xeaa(%rip),%rcx
jmp    117e <mg_send_response_line+0x6e>
lea    0xe85(%rip),%rcx
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <mg_printf@plt>
test   %r14,%r14
je     11af <mg_send_response_line+0x9f>
lea    0xebd(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <mg_printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
@.str = [3 x i8] c"OK\00"
@.str.1 = [16 x i8] c"Partial Content\00"
@.str.2 = [6 x i8] c"Moved\00"
@.str.3 = [6 x i8] c"Found\00"
@.str.4 = [32 x i8] c"Requested range not satisfiable\00"
@.str.5 = [13 x i8] c"I'm a teapot\00"
@.str.6 = [17 x i8] c"HTTP/1.1 %d %s\0D\0A\00"
@.str.7 = [5 x i8] c"%s\0D\0A\00"
define void @mg_send_response_line(%struct.mg_connection* %0, i32 %1, i8* %2) {
%4 = alloca %struct.mg_connection*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store %struct.mg_connection* %0, %struct.mg_connection** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = load i32, i32* %5
switch i32 %8, label %14 [
i32 206, label %9
i32 301, label %10
i32 302, label %11
i32 416, label %12
i32 418, label %13
]
9: ; preds = %3
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %7
br label %14
10: ; preds = %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %7
br label %14
11: ; preds = %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %7
br label %14
12: ; preds = %3
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8** %7
br label %14
13: ; preds = %3
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %7
br label %14
14: ; preds = %3, %13, %12, %11, %10, %9
%15 = load %struct.mg_connection*, %struct.mg_connection** %4
%16 = load i32, i32* %5
%17 = load i8*, i8** %7
%18 = call i32 (%struct.mg_connection*, i8*, ...) @mg_printf(%struct.mg_connection* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %16, i8* %17)
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = load %struct.mg_connection*, %struct.mg_connection** %4
%23 = load i8*, i8** %6
%24 = call i32 (%struct.mg_connection*, i8*, ...) @mg_printf(%struct.mg_connection* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %21, %14
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
@.str = [3 x i8] c"OK\00"
@.str.1 = [16 x i8] c"Partial Content\00"
@.str.2 = [6 x i8] c"Moved\00"
@.str.3 = [6 x i8] c"Found\00"
@.str.4 = [32 x i8] c"Requested range not satisfiable\00"
@.str.5 = [13 x i8] c"I'm a teapot\00"
@.str.6 = [17 x i8] c"HTTP/1.1 %d %s\0D\0A\00"
@.str.7 = [5 x i8] c"%s\0D\0A\00"
define void @mg_send_response_line(%struct.mg_connection* %0, i32 %1, i8* %2) {
switch i32 %1, label %9 [
i32 206, label %4
i32 301, label %5
i32 302, label %6
i32 416, label %7
i32 418, label %8
]
4: ; preds = %3
br label %9
5: ; preds = %3
br label %9
6: ; preds = %3
br label %9
7: ; preds = %3
br label %9
8: ; preds = %3
br label %9
9: ; preds = %3, %8, %7, %6, %5, %4
%10 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %4 ]
%11 = tail call i32 (%struct.mg_connection*, i8*, ...) @mg_printf(%struct.mg_connection* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %1, i8* %10)
%12 = icmp eq i8* %2, null
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 (%struct.mg_connection*, i8*, ...) @mg_printf(%struct.mg_connection* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %2)
br label %15
15: ; preds = %13, %9
ret void
}