#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;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  char *cookie = getenv("HTTP_COOKIE");
  time_t the_time;
  the_time = time((time_t *)0);
  printf("Content-type:text/html\r\n\r\n");
  printf("<html><head><title>SYSTEM TIME</title>"
         "<meta http-equiv='Content-Type' content='text/html;"
         " charset=utf-8'/></head>");
  printf("<body><div width=900px><div align=center>"
         "<h1>SYSTEM TIME</h1></div><hr> <div>\n");
  printf("The time is %s<br><br><br>", ctime(&the_time));
  printf("cookie %s<br>", cookie);
  printf("</div><hr></body></html>\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x1c(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1c(%rbp),%rdi
call   1040 <ctime@plt>
mov    %rax,%rsi
lea    0xf39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xf42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xf31(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf31(%rip),%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%rdi
call   1050 <ctime@plt>
lea    0xed8(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xee2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf47(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"HTTP_COOKIE\00"
@.str.1 = [27 x i8] c"Content-type:text/html\0D\0A\0D\0A\00"
@.str.2 = [114 x i8] c"<html><head><title>SYSTEM TIME</title><meta http-equiv='Content-Type' content='text/html; charset=utf-8'/></head>\00"
@.str.3 = [79 x i8] c"<body><div width=900px><div align=center><h1>SYSTEM TIME</h1></div><hr> <div>\0A\00"
@.str.4 = [27 x i8] c"The time is %s<br><br><br>\00"
@.str.5 = [14 x i8] c"cookie %s<br>\00"
@.str.6 = [26 x i8] c"</div><hr></body></html>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %6
%9 = call i32 @time(i32* null)
store i32 %9, i32* %7
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%13 = call i8* @ctime(i32* %7)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"HTTP_COOKIE\00"
@.str.2 = [114 x i8] c"<html><head><title>SYSTEM TIME</title><meta http-equiv='Content-Type' content='text/html; charset=utf-8'/></head>\00"
@.str.4 = [27 x i8] c"The time is %s<br><br><br>\00"
@.str.5 = [14 x i8] c"cookie %s<br>\00"
@str = [26 x i8] c"Content-type:text/html\0D\0A\0D\00"
@str.7 = [78 x i8] c"<body><div width=900px><div align=center><h1>SYSTEM TIME</h1></div><hr> <div>\00"
@str.8 = [25 x i8] c"</div><hr></body></html>\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 @time(i32* null)
store i32 %6, i32* %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.7, i64 0, i64 0))
%10 = call i8* @ctime(i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0))
ret i32 0
}