#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*/ ConvertString(char const *);
int /*<<< orphan*/ fprintRTF(char *);
int /*<<< orphan*/ putHtmlRTF(char const *);
int /*<<< orphan*/ putRtfStrEscaped(char *);
int /*<<< orphan*/ safe_free(char *);
char *strdup_together(char const *, char const *);
void InsertRtfHyperlink(const char *text, const char *url, const char *baseurl,
                        const char *style) {
  char *fullurl = strdup_together(baseurl, url);
  fprintRTF("{");
  putHtmlRTF(style);
  fprintRTF("\\field{\\*\\fldinst{ HYPERLINK \"");
  putRtfStrEscaped(fullurl);
  fprintRTF("\" }{{}}}{\\fldrslt{");
  ConvertString(text);
  fprintRTF("}}}");
  safe_free(fullurl);
}


x86 assembly (clang, -O0):
<InsertRtfHyperlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strdup_together@plt>
mov    %rax,-0x28(%rbp)
lea    0xea0(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    -0x20(%rbp),%rdi
call   1030 <putHtmlRTF@plt>
lea    0xe5b(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    -0x28(%rbp),%rdi
call   1050 <putRtfStrEscaped@plt>
lea    0xe65(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ConvertString@plt>
lea    0xe63(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    -0x28(%rbp),%rdi
call   1060 <safe_free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InsertRtfHyperlink>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r15
mov    %rdi,%r14
mov    %rdx,%rdi
call   1080 <strdup_together@plt>
mov    %rax,%rbx
lea    0xeb3(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    %r15,%rdi
call   1030 <putHtmlRTF@plt>
lea    0xe6f(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    %rbx,%rdi
call   1050 <putRtfStrEscaped@plt>
lea    0xe7a(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    %r14,%rdi
call   1040 <ConvertString@plt>
lea    0xe79(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <safe_free@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"{\00"
@.str.1 = [31 x i8] c"\\field{\\*\\fldinst{ HYPERLINK \22\00"
@.str.2 = [19 x i8] c"\22 }{{}}}{\\fldrslt{\00"
@.str.3 = [4 x i8] c"}}}\00"
define void @InsertRtfHyperlink(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %7
%11 = load i8*, i8** %6
%12 = call i8* @strdup_together(i8* %10, i8* %11)
store i8* %12, i8** %9
%13 = call i32 @fprintRTF(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %8
%15 = call i32 @putHtmlRTF(i8* %14)
%16 = call i32 @fprintRTF(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%17 = load i8*, i8** %9
%18 = call i32 @putRtfStrEscaped(i8* %17)
%19 = call i32 @fprintRTF(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%20 = load i8*, i8** %5
%21 = call i32 @ConvertString(i8* %20)
%22 = call i32 @fprintRTF(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%23 = load i8*, i8** %9
%24 = call i32 @safe_free(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"{\00"
@.str.1 = [31 x i8] c"\\field{\\*\\fldinst{ HYPERLINK \22\00"
@.str.2 = [19 x i8] c"\22 }{{}}}{\\fldrslt{\00"
@.str.3 = [4 x i8] c"}}}\00"
define void @InsertRtfHyperlink(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i8* @strdup_together(i8* %2, i8* %1)
%6 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @putHtmlRTF(i8* %3)
%8 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @putRtfStrEscaped(i8* %5)
%10 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @ConvertString(i8* %0)
%12 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 @safe_free(i8* %5)
ret void
}