#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 *);
int /*<<< orphan*/ FixTildes(char *);
int /*<<< orphan*/ diagnostics(int, char *);
int /*<<< orphan*/ fprintRTF(char *, ...);
int /*<<< orphan*/ free(char *);
char *getBraceParam();
char *getBracketParam();
void CmdLink(int code) {
  char *anchor, *latex, *url;
  diagnostics(4, "Entering hyperlatex \\link command");
  anchor = getBraceParam();
  latex = getBracketParam();
  url = getBraceParam();
  FixTildes(url);
  fprintRTF(
      "{\\field\\fldedit{\\*\\fldinst { HYPERLINK \"%s\" \\\\* MERGEFORMAT }}",
      url);
  fprintRTF("{\\fldrslt {\\cs15\\ul\\cf2 ");
  ConvertString(anchor);
  fprintRTF("}}}");
  if (latex)
    free(latex);
  free(anchor);
  free(url);
}


x86 assembly (clang, -O0):
<CmdLink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
lea    0xe79(%rip),%rsi
call   1070 <diagnostics@plt>
mov    $0x0,%al
call   1050 <getBraceParam@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1080 <getBracketParam@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getBraceParam@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <FixTildes@plt>
mov    -0x20(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1090 <fprintRTF@plt>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1090 <fprintRTF@plt>
mov    -0x10(%rbp),%rdi
call   1060 <ConvertString@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1090 <fprintRTF@plt>
cmpq   $0x0,-0x18(%rbp)
je     1201 <CmdLink+0x91>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdLink>:
push   %r15
push   %r14
push   %rbx
lea    0xe84(%rip),%rsi
mov    $0x4,%edi
call   1070 <diagnostics@plt>
xor    %eax,%eax
call   1050 <getBraceParam@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1080 <getBracketParam@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1050 <getBraceParam@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <FixTildes@plt>
lea    0xe6f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <fprintRTF@plt>
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1090 <fprintRTF@plt>
mov    %r14,%rdi
call   1060 <ConvertString@plt>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1090 <fprintRTF@plt>
test   %r15,%r15
je     11ee <CmdLink+0x7e>
mov    %r15,%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <free@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Entering hyperlatex \\link command\00"
@.str.1 = [63 x i8] c"{\\field\\fldedit{\\*\\fldinst { HYPERLINK \22%s\22 \\\\* MERGEFORMAT }}\00"
@.str.2 = [25 x i8] c"{\\fldrslt {\\cs15\\ul\\cf2 \00"
@.str.3 = [4 x i8] c"}}}\00"
define void @CmdLink(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %2
%6 = call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i8* (...) @getBraceParam()
store i8* %7, i8** %3
%8 = call i8* (...) @getBracketParam()
store i8* %8, i8** %4
%9 = call i8* (...) @getBraceParam()
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = call i32 @FixTildes(i8* %10)
%12 = load i8*, i8** %5
%13 = call i32 (i8*, ...) @fprintRTF(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @fprintRTF(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%15 = load i8*, i8** %3
%16 = call i32 @ConvertString(i8* %15)
%17 = call i32 (i8*, ...) @fprintRTF(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = load i8*, i8** %4
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %23
20: ; preds = %1
%21 = load i8*, i8** %4
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %20, %1
%24 = load i8*, i8** %3
%25 = call i32 @free(i8* %24)
%26 = load i8*, i8** %5
%27 = call i32 @free(i8* %26)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Entering hyperlatex \\link command\00"
@.str.1 = [63 x i8] c"{\\field\\fldedit{\\*\\fldinst { HYPERLINK \22%s\22 \\\\* MERGEFORMAT }}\00"
@.str.2 = [25 x i8] c"{\\fldrslt {\\cs15\\ul\\cf2 \00"
@.str.3 = [4 x i8] c"}}}\00"
define void @CmdLink(i32 %0) {
%2 = tail call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* (...) @getBraceParam()
%4 = tail call i8* (...) @getBracketParam()
%5 = tail call i8* (...) @getBraceParam()
%6 = tail call i32 @FixTildes(i8* %5)
%7 = tail call i32 (i8*, ...) @fprintRTF(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%8 = tail call i32 (i8*, ...) @fprintRTF(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @ConvertString(i8* %3)
%10 = tail call i32 (i8*, ...) @fprintRTF(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i8* %4, null
br i1 %11, label %14, label %12
12: ; preds = %1
%13 = tail call i32 @free(i8* %4)
br label %14
14: ; preds = %12, %1
%15 = tail call i32 @free(i8* %3)
%16 = tail call i32 @free(i8* %5)
ret void
}