#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*/ filesend(char *, int /*<<< orphan*/);
char *getenv(char *);
int /*<<< orphan*/ html_puts(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdout;
void html_header(const char *title) {
  char *path = getenv("PTMS_HEADER");
  if (path)
    filesend(path, stdout);
  else {
    puts("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "
         "\"http://www.w3.org/TR/html4/loose.dtd\">");
    puts("<html>");
    puts("<head>");
    printf("<title>");
    html_puts(title, stdout);
    puts("</title>");
    puts("</head>");
  }
  puts("<body>");
  printf("<h2>");
  html_puts(title, stdout);
  puts("</h2>");
}


x86 assembly (clang, -O0):
<html_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118e <html_header+0x3e>
mov    -0x10(%rbp),%rdi
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
call   1060 <filesend@plt>
jmp    11e8 <html_header+0x98>
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
lea    0xed2(%rip),%rdi
call   1040 <puts@plt>
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
lea    0xec8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e17(%rip),%rax
mov    (%rax),%esi
call   1070 <html_puts@plt>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1040 <puts@plt>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2dd5(%rip),%rax
mov    (%rax),%esi
call   1070 <html_puts@plt>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_header>:
push   %rbx
mov    %rdi,%rbx
lea    0xea5(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1178 <html_header+0x28>
mov    0x2e74(%rip),%rcx
mov    (%rcx),%esi
mov    %rax,%rdi
call   1060 <filesend@plt>
jmp    11d1 <html_header+0x81>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
lea    0xee8(%rip),%rdi
call   1040 <puts@plt>
lea    0xee3(%rip),%rdi
call   1040 <puts@plt>
lea    0xede(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <html_puts@plt>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <html_puts@plt>
lea    0xea5(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"PTMS_HEADER\00"
@stdout = global i32 0
@.str.1 = [103 x i8] c"<!DOCTYPE HTML PUBLIC \22-//W3C//DTD HTML 4.01 Transitional//EN\22 \22http://www.w3.org/TR/html4/loose.dtd\22>\00"
@.str.2 = [7 x i8] c"<html>\00"
@.str.3 = [7 x i8] c"<head>\00"
@.str.4 = [8 x i8] c"<title>\00"
@.str.5 = [9 x i8] c"</title>\00"
@.str.6 = [8 x i8] c"</head>\00"
@.str.7 = [7 x i8] c"<body>\00"
@.str.8 = [5 x i8] c"<h2>\00"
@.str.9 = [6 x i8] c"</h2>\00"
define void @html_header(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i32, i32* @stdout
%10 = call i32 @filesend(i8* %8, i32 %9)
br label %21
11: ; preds = %1
%12 = call i32 @puts(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%16 = load i8*, i8** %2
%17 = load i32, i32* @stdout
%18 = call i32 @html_puts(i8* %16, i32 %17)
%19 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %11, %7
%22 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%24 = load i8*, i8** %2
%25 = load i32, i32* @stdout
%26 = call i32 @html_puts(i8* %24, i32 %25)
%27 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"PTMS_HEADER\00"
@stdout = global i32 0
@.str.1 = [103 x i8] c"<!DOCTYPE HTML PUBLIC \22-//W3C//DTD HTML 4.01 Transitional//EN\22 \22http://www.w3.org/TR/html4/loose.dtd\22>\00"
@.str.2 = [7 x i8] c"<html>\00"
@.str.3 = [7 x i8] c"<head>\00"
@.str.4 = [8 x i8] c"<title>\00"
@.str.5 = [9 x i8] c"</title>\00"
@.str.6 = [8 x i8] c"</head>\00"
@.str.7 = [7 x i8] c"<body>\00"
@.str.8 = [5 x i8] c"<h2>\00"
@.str.9 = [6 x i8] c"</h2>\00"
define void @html_header(i8* %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @stdout
%6 = tail call i32 @filesend(i8* %2, i32 %5)
br label %16
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = tail call i32 @html_puts(i8* %0, i32 %12)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %16
16: ; preds = %7, %4
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%19 = load i32, i32* @stdout
%20 = tail call i32 @html_puts(i8* %0, i32 %19)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret void
}