#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*/ http_date();
int /*<<< orphan*/ http_header(int, char *, ...);
int http_error(int socket, int code, char *message) {
  http_header(socket, "HTTP/1.1 %d %s", code, message);
  http_header(socket, "Date: %s", http_date());
  http_header(socket, "Server: undb");
  http_header(socket, "Connection: close");
  http_header(socket, "Content-Type: text/plain");
  http_header(socket, "Content-Length: 0");
  http_header(socket, NULL);
}


x86 assembly (clang, -O0):
<http_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <http_header@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <http_date@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%edx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <http_header@plt>
mov    -0x8(%rbp),%edi
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1030 <http_header@plt>
mov    -0x8(%rbp),%edi
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1030 <http_header@plt>
mov    -0x8(%rbp),%edi
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1030 <http_header@plt>
mov    -0x8(%rbp),%edi
lea    0xea9(%rip),%rsi
mov    $0x0,%al
call   1030 <http_header@plt>
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <http_header@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_error>:
push   %rbx
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%ebx
lea    0xed1(%rip),%rsi
xor    %eax,%eax
call   1030 <http_header@plt>
xor    %eax,%eax
call   1040 <http_date@plt>
lea    0xecb(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <http_header@plt>
lea    0xec2(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <http_header@plt>
lea    0xebf(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <http_header@plt>
lea    0xec1(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <http_header@plt>
lea    0xeca(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <http_header@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <http_header@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"HTTP/1.1 %d %s\00"
@.str.1 = [9 x i8] c"Date: %s\00"
@.str.2 = [13 x i8] c"Server: undb\00"
@.str.3 = [18 x i8] c"Connection: close\00"
@.str.4 = [25 x i8] c"Content-Type: text/plain\00"
@.str.5 = [18 x i8] c"Content-Length: 0\00"
define i32 @http_error(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load i8*, i8** %7
%11 = call i32 (i32, i8*, ...) @http_header(i32 %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10)
%12 = load i32, i32* %5
%13 = call i32 (...) @http_date()
%14 = call i32 (i32, i8*, ...) @http_header(i32 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %5
%16 = call i32 (i32, i8*, ...) @http_header(i32 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %5
%18 = call i32 (i32, i8*, ...) @http_header(i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%19 = load i32, i32* %5
%20 = call i32 (i32, i8*, ...) @http_header(i32 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%21 = load i32, i32* %5
%22 = call i32 (i32, i8*, ...) @http_header(i32 %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%23 = load i32, i32* %5
%24 = call i32 (i32, i8*, ...) @http_header(i32 %23, i8* null)
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@.str = [15 x i8] c"HTTP/1.1 %d %s\00"
@.str.1 = [9 x i8] c"Date: %s\00"
@.str.2 = [13 x i8] c"Server: undb\00"
@.str.3 = [18 x i8] c"Connection: close\00"
@.str.4 = [25 x i8] c"Content-Type: text/plain\00"
@.str.5 = [18 x i8] c"Content-Length: 0\00"
define i32 @http_error(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 (i32, i8*, ...) @http_header(i32 %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
%5 = tail call i32 (...) @http_date()
%6 = tail call i32 (i32, i8*, ...) @http_header(i32 %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 (i32, i8*, ...) @http_header(i32 %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (i32, i8*, ...) @http_header(i32 %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 (i32, i8*, ...) @http_header(i32 %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 (i32, i8*, ...) @http_header(i32 %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 (i32, i8*, ...) @http_header(i32 %0, i8* null)
ret i32 undef
}