char *getDnaLink(db, gid)
int db;
char *gid;
{
  extern char link[];
  char gidb[257];
  strcpy(gidb, gid);
  if (gidb[strlen(gidb) - 1] == '+' || gidb[strlen(gidb) - 1] == '-') {
    gidb[strlen(gidb) - 1] = '\0';
  }
  if (db == 1) {
    sprintf(link,
            "<A "
            "HREF=\"http://www.ncbi.nlm.nih.gov/entrez/"
            "query.fcgi?cmd=Search&db=Nucleotide&term=%s&doptcmdl=GenBank\" "
            "TARGET=\"NUCLEOTIDE SEQUENCE SEARCH\">%s</A>",
            gidb, gid);
  } else if (db == 2) {
    sprintf(
        link,
        "<A HREF=\"http://www.plantgdb.org/search/display/data.php?Seq_ID=%s\" "
        "TARGET=\"NUCLEOTIDE SEQUENCE SEARCH\">%s</A>",
        gidb, gid);
  } else {
    sprintf(link,
            "<A "
            "HREF=\"http://www.ncbi.nlm.nih.gov/entrez/"
            "query.fcgi?cmd=Search&db=Nucleotide&term=%s&doptcmdl=GenBank\" "
            "TARGET=\"NUCLEOTIDE SEQUENCE SEARCH\">%s</A>",
            gidb, gid);
  }
  return link;
}


x86 assembly (clang, -O0):
<getDnaLink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x2b,%eax
je     1194 <getDnaLink+0x64>
lea    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x2d,%eax
jne    11ac <getDnaLink+0x7c>
lea    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%rax
movb   $0x0,-0x120(%rbp,%rax,1)
cmpl   $0x1,-0x4(%rbp)
jne    11db <getDnaLink+0xab>
lea    -0x120(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    0x2e20(%rip),%rdi
lea    0xe31(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
jmp    122f <getDnaLink+0xff>
cmpl   $0x2,-0x4(%rbp)
jne    120a <getDnaLink+0xda>
lea    -0x120(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    0x2df1(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
jmp    122a <getDnaLink+0xfa>
lea    -0x120(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    0x2dcc(%rip),%rdi
lea    0xddd(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
jmp    122f <getDnaLink+0xff>
mov    0x2db2(%rip),%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDnaLink>:
push   %rbp
push   %r14
push   %rbx
sub    $0x110,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    -0x1(%rax,%rbx,1),%cl
cmp    $0x2d,%cl
je     1161 <getDnaLink+0x31>
cmp    $0x2b,%cl
jne    1166 <getDnaLink+0x36>
movb   $0x0,-0x1(%rsp,%rax,1)
cmp    $0x2,%ebp
lea    0xf25(%rip),%rsi
lea    0xe89(%rip),%rax
cmovne %rax,%rsi
cmp    $0x1,%ebp
cmove  %rax,%rsi
mov    0x2e5f(%rip),%rbx
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@link = external global [0 x i8]
@.str = [149 x i8] c"<A HREF=\22http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Search&db=Nucleotide&term=%s&doptcmdl=GenBank\22 TARGET=\22NUCLEOTIDE SEQUENCE SEARCH\22>%s</A>\00"
@.str.1 = [111 x i8] c"<A HREF=\22http://www.plantgdb.org/search/display/data.php?Seq_ID=%s\22 TARGET=\22NUCLEOTIDE SEQUENCE SEARCH\22>%s</A>\00"
define i8* @getDnaLink(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [257 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = call i8* @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 0
%10 = call i64 @strlen(i8* %9)
%11 = sub i64 %10, 1
%12 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 43
br i1 %15, label %24, label %16
16: ; preds = %2
%17 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 0
%18 = call i64 @strlen(i8* %17)
%19 = sub i64 %18, 1
%20 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %29
24: ; preds = %16, %2
%25 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 0
%26 = call i64 @strlen(i8* %25)
%27 = sub i64 %26, 1
%28 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 %27
store i8 0, i8* %28
br label %29
29: ; preds = %24, %16
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 0
%34 = load i8*, i8** %4
%35 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @link, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i8* %33, i8* %34)
br label %48
36: ; preds = %29
%37 = load i32, i32* %3
%38 = icmp eq i32 %37, 2
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 0
%41 = load i8*, i8** %4
%42 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @link, i64 0, i64 0), i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.1, i64 0, i64 0), i8* %40, i8* %41)
br label %47
43: ; preds = %36
%44 = getelementptr inbounds [257 x i8], [257 x i8]* %5, i64 0, i64 0
%45 = load i8*, i8** %4
%46 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @link, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i8* %44, i8* %45)
br label %47
47: ; preds = %43, %39
br label %48
48: ; preds = %47, %32
ret i8* getelementptr inbounds ([0 x i8], [0 x i8]* @link, i64 0, i64 0)
}

LLVM IR (-O2):
@link = external global [0 x i8]
@.str = [149 x i8] c"<A HREF=\22http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Search&db=Nucleotide&term=%s&doptcmdl=GenBank\22 TARGET=\22NUCLEOTIDE SEQUENCE SEARCH\22>%s</A>\00"
@.str.1 = [111 x i8] c"<A HREF=\22http://www.plantgdb.org/search/display/data.php?Seq_ID=%s\22 TARGET=\22NUCLEOTIDE SEQUENCE SEARCH\22>%s</A>\00"
define i8* @getDnaLink(i32 %0, i8* %1) {
%3 = alloca [257 x i8]
%4 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 0
%5 = call i8* @strcpy(i8* %4, i8* dereferenceable(1) %1)
%6 = call i64 @strlen(i8* %4)
%7 = add i64 %6, -1
%8 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 %7
%9 = load i8, i8* %8
switch i8 %9, label %11 [
i8 43, label %10
i8 45, label %10
]
10: ; preds = %2, %2
store i8 0, i8* %8
br label %11
11: ; preds = %2, %10
%12 = icmp eq i32 %0, 2
%13 = select i1 %12, i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0)
%14 = icmp eq i32 %0, 1
%15 = select i1 %14, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i8* %13
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([0 x i8], [0 x i8]* @link, i64 0, i64 0), i8* dereferenceable(1) %15, i8* %4, i8* %1)
ret i8* getelementptr inbounds ([0 x i8], [0 x i8]* @link, i64 0, i64 0)
}