#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 */
typedef int /*<<< orphan*/ time_t;
typedef int /*<<< orphan*/ tbuffer;
struct tm {
  int dummy;
};
struct http_response_t {
  int dummy;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ response_add_header(struct http_response_t *, char *,
                                       char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void response_add_common_headers(struct http_response_t *response) {
  char tbuffer[80];
  time_t now = time(NULL);
  struct tm gmt = *gmtime(&now);
  strftime(tbuffer, sizeof(tbuffer), "%a, %d %b %Y %H:%M:%S %Z", &gmt);
  response_add_header(response, "Connection", "closed");
  response_add_header(response, "Server", "μHTTPd Webserver");
  response_add_header(response, "Date", tbuffer);
}


x86 assembly (clang, -O0):
<response_add_common_headers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x64(%rbp)
lea    -0x64(%rbp),%rdi
call   1060 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
lea    0xe8a(%rip),%rdx
lea    -0x68(%rbp),%rcx
call   1050 <strftime@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
lea    0xe93(%rip),%rdx
call   1030 <response_add_header@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
lea    0xe8a(%rip),%rdx
call   1030 <response_add_header@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1030 <response_add_header@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<response_add_common_headers>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1060 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
lea    0xe94(%rip),%rdx
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
mov    $0x50,%esi
call   1050 <strftime@plt>
lea    0xe8f(%rip),%rsi
lea    0xe93(%rip),%rdx
mov    %rbx,%rdi
call   1030 <response_add_header@plt>
lea    0xe8b(%rip),%rsi
lea    0xe8b(%rip),%rdx
mov    %rbx,%rdi
call   1030 <response_add_header@plt>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <response_add_header@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.http_response_t = type { i32 }
%struct.tm = type { i32 }
@.str = [25 x i8] c"%a, %d %b %Y %H:%M:%S %Z\00"
@.str.1 = [11 x i8] c"Connection\00"
@.str.2 = [7 x i8] c"closed\00"
@.str.3 = [7 x i8] c"Server\00"
@.str.4 = [18 x i8] c"\CE\BCHTTPd Webserver\00"
@.str.5 = [5 x i8] c"Date\00"
define void @response_add_common_headers(%struct.http_response_t* %0) {
%2 = alloca %struct.http_response_t*
%3 = alloca [80 x i8]
%4 = alloca i32
%5 = alloca %struct.tm
store %struct.http_response_t* %0, %struct.http_response_t** %2
%6 = call i32 @time(i32* null)
store i32 %6, i32* %4
%7 = call %struct.tm* @gmtime(i32* %4)
%8 = bitcast %struct.tm* %5 to i8*
%9 = bitcast %struct.tm* %7 to i8*
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%11 = call i32 @strftime(i8* %10, i32 80, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%12 = load %struct.http_response_t*, %struct.http_response_t** %2
%13 = call i32 @response_add_header(%struct.http_response_t* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%14 = load %struct.http_response_t*, %struct.http_response_t** %2
%15 = call i32 @response_add_header(%struct.http_response_t* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%16 = load %struct.http_response_t*, %struct.http_response_t** %2
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%18 = call i32 @response_add_header(%struct.http_response_t* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %17)
ret void
}

LLVM IR (-O2):
%struct.http_response_t = type { i32 }
%struct.tm = type { i32 }
@.str = [25 x i8] c"%a, %d %b %Y %H:%M:%S %Z\00"
@.str.1 = [11 x i8] c"Connection\00"
@.str.2 = [7 x i8] c"closed\00"
@.str.3 = [7 x i8] c"Server\00"
@.str.4 = [18 x i8] c"\CE\BCHTTPd Webserver\00"
@.str.5 = [5 x i8] c"Date\00"
define void @response_add_common_headers(%struct.http_response_t* %0) {
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca %struct.tm
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @time(i32* null)
store i32 %7, i32* %3
%8 = bitcast %struct.tm* %4 to i8*
%9 = call %struct.tm* @gmtime(i32* %3)
%10 = getelementptr %struct.tm, %struct.tm* %9, i64 0, i32 0
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%12 = load i32, i32* %10
store i32 %12, i32* %11
%13 = call i32 @strftime(i8* %5, i32 80, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
%14 = call i32 @response_add_header(%struct.http_response_t* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @response_add_header(%struct.http_response_t* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @response_add_header(%struct.http_response_t* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %5)
ret void
}