#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 *, ...);
int main(int argc, char **argv) {
  char *s;
  s = getenv("SERVER_ADDR");
  printf("Content-type: text/html\n\n");
  printf("<html><head><title>LP1 software upgrade</title></head><body>\n");
  printf("<h1>LP1 upgrade page</h1>");
  printf("<p>");
  printf("<form action=\"http://%s:8080/doupgrade\" method=\"POST\" "
         "enctype=\"multipart/form-data\">",
         s);
  printf("Upload file: <INPUT type=\"file\" name=\"upgrade\" size=50>");
  printf("<INPUT TYPE=SUBMIT NAME=\"SEND\" VALUE=\"SEND\">");
  printf("</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    0xec3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xf9d(%rip),%rdi
call   1040 <puts@plt>
lea    0xfaa(%rip),%rdi
call   1040 <puts@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xef3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf1d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf92(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"SERVER_ADDR\00"
@.str.1 = [26 x i8] c"Content-type: text/html\0A\0A\00"
@.str.2 = [62 x i8] c"<html><head><title>LP1 software upgrade</title></head><body>\0A\00"
@.str.3 = [26 x i8] c"<h1>LP1 upgrade page</h1>\00"
@.str.4 = [4 x i8] c"<p>\00"
@.str.5 = [85 x i8] c"<form action=\22http://%s:8080/doupgrade\22 method=\22POST\22 enctype=\22multipart/form-data\22>\00"
@.str.6 = [56 x i8] c"Upload file: <INPUT type=\22file\22 name=\22upgrade\22 size=50>\00"
@.str.7 = [45 x i8] c"<INPUT TYPE=SUBMIT NAME=\22SEND\22 VALUE=\22SEND\22>\00"
@.str.8 = [16 x i8] c"</body></html>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%12 = load i8*, i8** %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.5, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"SERVER_ADDR\00"
@.str.3 = [26 x i8] c"<h1>LP1 upgrade page</h1>\00"
@.str.4 = [4 x i8] c"<p>\00"
@.str.5 = [85 x i8] c"<form action=\22http://%s:8080/doupgrade\22 method=\22POST\22 enctype=\22multipart/form-data\22>\00"
@.str.6 = [56 x i8] c"Upload file: <INPUT type=\22file\22 name=\22upgrade\22 size=50>\00"
@.str.7 = [45 x i8] c"<INPUT TYPE=SUBMIT NAME=\22SEND\22 VALUE=\22SEND\22>\00"
@str = [25 x i8] c"Content-type: text/html\0A\00"
@str.9 = [61 x i8] c"<html><head><title>LP1 software upgrade</title></head><body>\00"
@str.10 = [15 x i8] c"</body></html>\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}