#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 *, char *);
int /*<<< orphan*/ puts(char *);
void print_doc_end(char *text) {
  char *w;
  puts("<p><hr>");
  if (text && *text)
    puts(text);
  else if ((w = getenv("WEBMASTER")))
    printf("<address>%s</address>\n", w);
}


x86 assembly (clang, -O0):
<print_doc_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
cmpq   $0x0,-0x8(%rbp)
je     1171 <print_doc_end+0x41>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1171 <print_doc_end+0x41>
mov    -0x8(%rbp),%rdi
call   1040 <puts@plt>
jmp    11a0 <print_doc_end+0x70>
lea    0xe90(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     119b <print_doc_end+0x6b>
mov    -0x10(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
jmp    11a0 <print_doc_end+0x70>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_doc_end>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
test   %rbx,%rbx
je     1153 <print_doc_end+0x23>
cmpb   $0x0,(%rbx)
je     1153 <print_doc_end+0x23>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <puts@plt>
lea    0xeae(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1174 <print_doc_end+0x44>
lea    0xea7(%rip),%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1050 <printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"<p><hr>\00"
@.str.1 = [10 x i8] c"WEBMASTER\00"
@.str.2 = [23 x i8] c"<address>%s</address>\0A\00"
define void @print_doc_end(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = call i32 @puts(i8* %13)
br label %22
15: ; preds = %7, %1
%16 = call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i8* %16, i8** %3
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i8*, i8** %3
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %15
br label %22
22: ; preds = %21, %12
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"<p><hr>\00"
@.str.1 = [10 x i8] c"WEBMASTER\00"
@.str.2 = [23 x i8] c"<address>%s</address>\0A\00"
define void @print_doc_end(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @puts(i8* %0)
br label %14
9: ; preds = %4, %1
%10 = tail call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %14
14: ; preds = %9, %12, %7
ret void
}