#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*/ write_st(int, char *);
void send_http_header(int fd, int code) {
  write_st(fd, "HTTP/1.1 ");
  switch (code) {
  case 200:
    write_st(fd, "200 OK\r\n"
                 "Content-Type: text/html\r\n"
                 "Cache-Control: no-cache\r\n");
    break;
  case 304:
    write_st(fd, "304 Not Modified\r\n");
    break;
  case 404:
    write_st(fd, "404 Not Found\r\n");
    break;
  case 401:
    write_st(fd, "401 Unauthorized\r\nServer: AECLogger\r\nWWW-Authenticate: "
                 "Basic realm=\"AECLogger\"\r\n"
                 "Accept-Ranges: bytes");
    break;
  }
  write_st(fd, "Connection: Close\r\n\r\n");
}


x86 assembly (clang, -O0):
<send_http_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    0xed8(%rip),%rsi
call   1030 <write_st@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xc8,%eax
je     117c <send_http_header+0x6c>
jmp    1143 <send_http_header+0x33>
mov    -0xc(%rbp),%eax
sub    $0x130,%eax
je     1190 <send_http_header+0x80>
jmp    1156 <send_http_header+0x46>
mov    -0xc(%rbp),%eax
sub    $0x191,%eax
je     11b8 <send_http_header+0xa8>
jmp    1169 <send_http_header+0x59>
mov    -0xc(%rbp),%eax
sub    $0x194,%eax
je     11a4 <send_http_header+0x94>
jmp    11c7 <send_http_header+0xb7>
mov    -0x4(%rbp),%edi
lea    0xe84(%rip),%rsi
call   1030 <write_st@plt>
jmp    11c7 <send_http_header+0xb7>
mov    -0x4(%rbp),%edi
lea    0xeab(%rip),%rsi
call   1030 <write_st@plt>
jmp    11c7 <send_http_header+0xb7>
mov    -0x4(%rbp),%edi
lea    0xeaa(%rip),%rsi
call   1030 <write_st@plt>
jmp    11c7 <send_http_header+0xb7>
mov    -0x4(%rbp),%edi
lea    0xea6(%rip),%rsi
call   1030 <write_st@plt>
mov    -0x4(%rbp),%edi
lea    0xefc(%rip),%rsi
call   1030 <write_st@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_http_header>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xee2(%rip),%rsi
call   1030 <write_st@plt>
cmp    $0x190,%ebp
jg     1144 <send_http_header+0x34>
cmp    $0xc8,%ebp
je     115d <send_http_header+0x4d>
cmp    $0x130,%ebp
jne    1174 <send_http_header+0x64>
lea    0xf03(%rip),%rsi
jmp    116d <send_http_header+0x5d>
cmp    $0x191,%ebp
je     1166 <send_http_header+0x56>
cmp    $0x194,%ebp
jne    1174 <send_http_header+0x64>
lea    0xefd(%rip),%rsi
jmp    116d <send_http_header+0x5d>
lea    0xea6(%rip),%rsi
jmp    116d <send_http_header+0x5d>
lea    0xefb(%rip),%rsi
mov    %ebx,%edi
call   1030 <write_st@plt>
lea    0xf52(%rip),%rsi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write_st@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"HTTP/1.1 \00"
@.str.1 = [59 x i8] c"200 OK\0D\0AContent-Type: text/html\0D\0ACache-Control: no-cache\0D\0A\00"
@.str.2 = [19 x i8] c"304 Not Modified\0D\0A\00"
@.str.3 = [16 x i8] c"404 Not Found\0D\0A\00"
@.str.4 = [101 x i8] c"401 Unauthorized\0D\0AServer: AECLogger\0D\0AWWW-Authenticate: Basic realm=\22AECLogger\22\0D\0AAccept-Ranges: bytes\00"
@.str.5 = [22 x i8] c"Connection: Close\0D\0A\0D\0A\00"
define void @send_http_header(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @write_st(i32 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
switch i32 %7, label %20 [
i32 200, label %8
i32 304, label %11
i32 404, label %14
i32 401, label %17
]
8: ; preds = %2
%9 = load i32, i32* %3
%10 = call i32 @write_st(i32 %9, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
br label %20
11: ; preds = %2
%12 = load i32, i32* %3
%13 = call i32 @write_st(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %20
14: ; preds = %2
%15 = load i32, i32* %3
%16 = call i32 @write_st(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %20
17: ; preds = %2
%18 = load i32, i32* %3
%19 = call i32 @write_st(i32 %18, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %2, %17, %14, %11, %8
%21 = load i32, i32* %3
%22 = call i32 @write_st(i32 %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"HTTP/1.1 \00"
@.str.1 = [59 x i8] c"200 OK\0D\0AContent-Type: text/html\0D\0ACache-Control: no-cache\0D\0A\00"
@.str.2 = [19 x i8] c"304 Not Modified\0D\0A\00"
@.str.3 = [16 x i8] c"404 Not Found\0D\0A\00"
@.str.4 = [101 x i8] c"401 Unauthorized\0D\0AServer: AECLogger\0D\0AWWW-Authenticate: Basic realm=\22AECLogger\22\0D\0AAccept-Ranges: bytes\00"
@.str.5 = [22 x i8] c"Connection: Close\0D\0A\0D\0A\00"
define void @send_http_header(i32 %0, i32 %1) {
%3 = tail call i32 @write_st(i32 %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %1, label %10 [
i32 200, label %7
i32 304, label %4
i32 404, label %5
i32 401, label %6
]
4: ; preds = %2
br label %7
5: ; preds = %2
br label %7
6: ; preds = %2
br label %7
7: ; preds = %2, %4, %5, %6
%8 = phi i8* [ getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), %2 ]
%9 = tail call i32 @write_st(i32 %0, i8* %8)
br label %10
10: ; preds = %7, %2
%11 = tail call i32 @write_st(i32 %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
ret void
}