#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 */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
void main(void) {
  printf("Content‐type:text/html\n\n");
  printf("<HTML>\n<HEAD>\n<TITLE>CGI.c</TITLE>\n</HEAD>\n");
  printf("<BODY BGCOLOR=\"#FFFFFF\">\n<P ALIGN=CENTER>\n");
  printf("<BR>SERVER_NAME=%s\n", getenv("SERVER_NAME"));
  printf("<BR>SERVER_SOFTWARE=%s\n", getenv("SERVER_SOFTWARE"));
  printf("<BR>REQUEST_METHOD=%s\n", getenv("REQUEST_METHOD"));
  printf("<BR>HTTP_REFERED=%s\n", getenv("HTTP_REFERED"));
  printf("<BR>SCRIPT_NAME=%s\n", getenv("SCRIPT_NAME"));
  printf("<BR>QUERY_STRING=%s\n", getenv("QUERY_STRING"));
  printf("<BR>REMOTE_HOST=%s\n", getenv("REMOTE_HOST"));
  printf("</P>\n</BODY>\n</HTML>");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf31(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf38(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf42(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf49(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf4d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf51(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf55(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xfcf(%rip),%rdi
call   1040 <puts@plt>
lea    0xfdd(%rip),%rdi
call   1040 <puts@plt>
lea    0xffc(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe98(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebf(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe9b(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec9(%rip),%rdi
call   1030 <getenv@plt>
lea    0xea6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed0(%rip),%rdi
call   1030 <getenv@plt>
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <getenv@plt>
lea    0xeb4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <getenv@plt>
lea    0xebc(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Content\E2\80\90type:text/html\0A\0A\00"
@.str.1 = [44 x i8] c"<HTML>\0A<HEAD>\0A<TITLE>CGI.c</TITLE>\0A</HEAD>\0A\00"
@.str.2 = [43 x i8] c"<BODY BGCOLOR=\22#FFFFFF\22>\0A<P ALIGN=CENTER>\0A\00"
@.str.3 = [20 x i8] c"<BR>SERVER_NAME=%s\0A\00"
@.str.4 = [12 x i8] c"SERVER_NAME\00"
@.str.5 = [24 x i8] c"<BR>SERVER_SOFTWARE=%s\0A\00"
@.str.6 = [16 x i8] c"SERVER_SOFTWARE\00"
@.str.7 = [23 x i8] c"<BR>REQUEST_METHOD=%s\0A\00"
@.str.8 = [15 x i8] c"REQUEST_METHOD\00"
@.str.9 = [21 x i8] c"<BR>HTTP_REFERED=%s\0A\00"
@.str.10 = [13 x i8] c"HTTP_REFERED\00"
@.str.11 = [20 x i8] c"<BR>SCRIPT_NAME=%s\0A\00"
@.str.12 = [12 x i8] c"SCRIPT_NAME\00"
@.str.13 = [21 x i8] c"<BR>QUERY_STRING=%s\0A\00"
@.str.14 = [13 x i8] c"QUERY_STRING\00"
@.str.15 = [20 x i8] c"<BR>REMOTE_HOST=%s\0A\00"
@.str.16 = [12 x i8] c"REMOTE_HOST\00"
@.str.17 = [21 x i8] c"</P>\0A</BODY>\0A</HTML>\00"
define void @main() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%4 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%6 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%8 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %8)
%10 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* %10)
%12 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i8* %12)
%14 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i8* %14)
%16 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.3 = [20 x i8] c"<BR>SERVER_NAME=%s\0A\00"
@.str.4 = [12 x i8] c"SERVER_NAME\00"
@.str.5 = [24 x i8] c"<BR>SERVER_SOFTWARE=%s\0A\00"
@.str.6 = [16 x i8] c"SERVER_SOFTWARE\00"
@.str.7 = [23 x i8] c"<BR>REQUEST_METHOD=%s\0A\00"
@.str.8 = [15 x i8] c"REQUEST_METHOD\00"
@.str.9 = [21 x i8] c"<BR>HTTP_REFERED=%s\0A\00"
@.str.10 = [13 x i8] c"HTTP_REFERED\00"
@.str.11 = [20 x i8] c"<BR>SCRIPT_NAME=%s\0A\00"
@.str.12 = [12 x i8] c"SCRIPT_NAME\00"
@.str.13 = [21 x i8] c"<BR>QUERY_STRING=%s\0A\00"
@.str.14 = [13 x i8] c"QUERY_STRING\00"
@.str.15 = [20 x i8] c"<BR>REMOTE_HOST=%s\0A\00"
@.str.16 = [12 x i8] c"REMOTE_HOST\00"
@.str.17 = [21 x i8] c"</P>\0A</BODY>\0A</HTML>\00"
@str = [26 x i8] c"Content\E2\80\90type:text/html\0A\00"
@str.18 = [43 x i8] c"<HTML>\0A<HEAD>\0A<TITLE>CGI.c</TITLE>\0A</HEAD>\00"
@str.19 = [42 x i8] c"<BODY BGCOLOR=\22#FFFFFF\22>\0A<P ALIGN=CENTER>\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.18, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.19, i64 0, i64 0))
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%6 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %8)
%10 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* %10)
%12 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i8* %12)
%14 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i8* %14)
%16 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
ret void
}