#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*/ add_anchor_name(char *, int);
int /*<<< orphan*/ add_html_elt(char *);
int /*<<< orphan*/ add_word_args(char *, ...);
void add_link(char *nodename, char *attributes) {
  if (nodename) {
    add_html_elt("<link ");
    add_word_args("%s", attributes);
    add_word_args(" href=\"");
    add_anchor_name(nodename, 1);
    add_word_args("\" title=\"%s\">\n", nodename);
  }
}


x86 assembly (clang, -O0):
<add_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1197 <add_link+0x67>
lea    0xeae(%rip),%rdi
call   1040 <add_html_elt@plt>
mov    -0x10(%rbp),%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <add_word_args@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1050 <add_word_args@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <add_anchor_name@plt>
mov    -0x8(%rbp),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1050 <add_word_args@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_link>:
test   %rdi,%rdi
je     118f <add_link+0x5f>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeba(%rip),%rdi
call   1040 <add_html_elt@plt>
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <add_word_args@plt>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1050 <add_word_args@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <add_anchor_name@plt>
lea    0xe94(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <add_word_args@plt>
ret

LLVM IR (-O0):
@.str = [7 x i8] c"<link \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [8 x i8] c" href=\22\00"
@.str.3 = [15 x i8] c"\22 title=\22%s\22>\0A\00"
define void @add_link(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = call i32 @add_html_elt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %4
%10 = call i32 (i8*, ...) @add_word_args(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @add_word_args(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%12 = load i8*, i8** %3
%13 = call i32 @add_anchor_name(i8* %12, i32 1)
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @add_word_args(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"<link \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [8 x i8] c" href=\22\00"
@.str.3 = [15 x i8] c"\22 title=\22%s\22>\0A\00"
define void @add_link(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i32 @add_html_elt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @add_word_args(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = tail call i32 (i8*, ...) @add_word_args(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @add_anchor_name(i8* %0, i32 1)
%9 = tail call i32 (i8*, ...) @add_word_args(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %4, %2
ret void
}