#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*/ cgi_show_footer();
int /*<<< orphan*/ cgi_show_header(char *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
void show_main_page(void) {
  cgi_show_header("#ffffff");
  printf("<center><table width=100%% height=100%% border=0><tr><td "
         "align=center valign=center>\n");
  printf("This is test CGI script that shows usage of LibCGI "
         "library.</td></tr>\n");
  printf("<tr><td align=center valign=middle><form method=get action=%s>\n",
         getenv("SCRIPT_NAME"));
  printf("<input type=hidden name=parameter1 value='value1'>");
  printf("<input type=text name=text value=''>");
  printf("<input type=text name=text value=''>");
  printf("<input type=hidden name=cmd value='gp'>");
  printf("<input type=submit value='GET form submit'></form></td></tr>\n");
  printf("<tr><td align=center valign=middle><form method=post action=%s>\n",
         getenv("SCRIPT_NAME"));
  printf("<input type=hidden name=parameter1 value='value1'>");
  printf("<input type=text name=text value=''>");
  printf("<input type=text name=text value=''>");
  printf("<input type=hidden name=cmd value='pp'>");
  printf("<input type=submit value='POST form submit'></form></td></tr>\n");
  printf("<tr><td align=center valign=middle>");
  printf("<form method=post action=%s enctype=\"multipart/form-data\">\n",
         getenv("SCRIPT_NAME"));
  printf("<input type=file name=file size=20><br>");
  printf("<input type=hidden name=parameter3 value='value3'>\n");
  printf("<input type=text name=text value=''>");
  printf("<input type=text name=text value=''>");
  printf("<input type=hidden name=cmd value='pp'><input type=submit "
         "value='multipart form POST submit'>");
  printf("</form></td></tr></table>\n");
  cgi_show_footer();
}


x86 assembly (clang, -O0):
<show_main_page>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1050 <cgi_show_header@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf72(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xfa9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf0f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xfca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xfd3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xfed(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x101e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0x1025(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x1053(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x106d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x1077(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x10c7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <cgi_show_footer@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_main_page>:
push   %r15
push   %r14
push   %rbx
lea    0xea4(%rip),%rdi
call   1060 <cgi_show_header@plt>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1103(%rip),%rdi
call   1040 <puts@plt>
lea    0xf1c(%rip),%r14
mov    %r14,%rdi
call   1030 <getenv@plt>
lea    0xecd(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf08(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf2a(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf34(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10e3(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1030 <getenv@plt>
lea    0xf3a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf4c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10cf(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <getenv@plt>
lea    0xf68(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf93(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10cc(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf8d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10d1(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <cgi_show_footer@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"#ffffff\00"
@.str.1 = [86 x i8] c"<center><table width=100%% height=100%% border=0><tr><td align=center valign=center>\0A\00"
@.str.2 = [71 x i8] c"This is test CGI script that shows usage of LibCGI library.</td></tr>\0A\00"
@.str.3 = [64 x i8] c"<tr><td align=center valign=middle><form method=get action=%s>\0A\00"
@.str.4 = [12 x i8] c"SCRIPT_NAME\00"
@.str.5 = [51 x i8] c"<input type=hidden name=parameter1 value='value1'>\00"
@.str.6 = [37 x i8] c"<input type=text name=text value=''>\00"
@.str.7 = [40 x i8] c"<input type=hidden name=cmd value='gp'>\00"
@.str.8 = [62 x i8] c"<input type=submit value='GET form submit'></form></td></tr>\0A\00"
@.str.9 = [65 x i8] c"<tr><td align=center valign=middle><form method=post action=%s>\0A\00"
@.str.10 = [40 x i8] c"<input type=hidden name=cmd value='pp'>\00"
@.str.11 = [63 x i8] c"<input type=submit value='POST form submit'></form></td></tr>\0A\00"
@.str.12 = [36 x i8] c"<tr><td align=center valign=middle>\00"
@.str.13 = [60 x i8] c"<form method=post action=%s enctype=\22multipart/form-data\22>\0A\00"
@.str.14 = [40 x i8] c"<input type=file name=file size=20><br>\00"
@.str.15 = [52 x i8] c"<input type=hidden name=parameter3 value='value3'>\0A\00"
@.str.16 = [94 x i8] c"<input type=hidden name=cmd value='pp'><input type=submit value='multipart form POST submit'>\00"
@.str.17 = [27 x i8] c"</form></td></tr></table>\0A\00"
define void @show_main_page() {
%1 = call i32 @cgi_show_header(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 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 ([64 x i8], [64 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.8, i64 0, i64 0))
%11 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.11, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0))
%19 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.13, i64 0, i64 0), i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.14, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.15, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.16, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.17, i64 0, i64 0))
%27 = call i32 (...) @cgi_show_footer()
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"#ffffff\00"
@.str.1 = [86 x i8] c"<center><table width=100%% height=100%% border=0><tr><td align=center valign=center>\0A\00"
@.str.3 = [64 x i8] c"<tr><td align=center valign=middle><form method=get action=%s>\0A\00"
@.str.4 = [12 x i8] c"SCRIPT_NAME\00"
@.str.5 = [51 x i8] c"<input type=hidden name=parameter1 value='value1'>\00"
@.str.6 = [37 x i8] c"<input type=text name=text value=''>\00"
@.str.7 = [40 x i8] c"<input type=hidden name=cmd value='gp'>\00"
@.str.9 = [65 x i8] c"<tr><td align=center valign=middle><form method=post action=%s>\0A\00"
@.str.10 = [40 x i8] c"<input type=hidden name=cmd value='pp'>\00"
@.str.12 = [36 x i8] c"<tr><td align=center valign=middle>\00"
@.str.13 = [60 x i8] c"<form method=post action=%s enctype=\22multipart/form-data\22>\0A\00"
@.str.14 = [40 x i8] c"<input type=file name=file size=20><br>\00"
@.str.16 = [94 x i8] c"<input type=hidden name=cmd value='pp'><input type=submit value='multipart form POST submit'>\00"
@str = [70 x i8] c"This is test CGI script that shows usage of LibCGI library.</td></tr>\00"
@str.18 = [61 x i8] c"<input type=submit value='GET form submit'></form></td></tr>\00"
@str.19 = [62 x i8] c"<input type=submit value='POST form submit'></form></td></tr>\00"
@str.20 = [51 x i8] c"<input type=hidden name=parameter3 value='value3'>\00"
@str.21 = [26 x i8] c"</form></td></tr></table>\00"
define void @show_main_page() {
%1 = tail call i32 @cgi_show_header(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, 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 ([64 x i8], [64 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.18, i64 0, i64 0))
%11 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), i8* %11)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.19, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0))
%19 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.13, i64 0, i64 0), i8* %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.14, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.20, i64 0, i64 0))
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @.str.16, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.21, i64 0, i64 0))
%27 = tail call i32 (...) @cgi_show_footer()
ret void
}