#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*/ puts(char *);
int /*<<< orphan*/ stdout;
void html_footer(const char *footer) {
  char *path = getenv("PTMS_FOOTER");
  if (footer) {
    puts("<hr noshade size=1>");
    html_puts(footer, stdout);
  }
  if (path)
    filesend(path, stdout);
  else {
    puts("</body>");
    puts("</html>");
  }
}


x86 assembly (clang, -O0):
<html_footer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1185 <html_footer+0x45>
lea    0xe9e(%rip),%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
call   1060 <html_puts@plt>
cmpq   $0x0,-0x10(%rbp)
je     11a7 <html_footer+0x67>
mov    -0x10(%rbp),%rdi
mov    0x2e45(%rip),%rax
mov    (%rax),%esi
call   1050 <filesend@plt>
jmp    11bf <html_footer+0x7f>
lea    0xe72(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_footer>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb2(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1178 <html_footer+0x38>
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1060 <html_puts@plt>
test   %r14,%r14
je     1195 <html_footer+0x55>
mov    0x2e5c(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <filesend@plt>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
lea    0xe80(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"PTMS_FOOTER\00"
@.str.1 = [20 x i8] c"<hr noshade size=1>\00"
@stdout = global i32 0
@.str.2 = [8 x i8] c"</body>\00"
@.str.3 = [8 x i8] c"</html>\00"
define void @html_footer(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** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = load i32, i32* @stdout
%11 = call i32 @html_puts(i8* %9, i32 %10)
br label %12
12: ; preds = %7, %1
%13 = load i8*, i8** %3
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = load i32, i32* @stdout
%18 = call i32 @filesend(i8* %16, i32 %17)
br label %22
19: ; preds = %12
%20 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %19, %15
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"PTMS_FOOTER\00"
@.str.1 = [20 x i8] c"<hr noshade size=1>\00"
@stdout = global i32 0
@.str.2 = [8 x i8] c"</body>\00"
@.str.3 = [8 x i8] c"</html>\00"
define void @html_footer(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* %0, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = tail call i32 @html_puts(i8* %0, i32 %6)
br label %8
8: ; preds = %4, %1
%9 = icmp eq i8* %2, null
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = load i32, i32* @stdout
%12 = tail call i32 @filesend(i8* %2, i32 %11)
br label %16
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %13, %10
ret void
}