int MySearchPath(char *installDir, char *name, char *fullname) {
  name = ExpandPathName(name);
  if (name && name[0] == '/')
    safeStrCpy(fullname, name, 512);
  else {
    sprintf(fullname, "%s%c%s", installDir, '/', name);
  }
  return 1;
}


x86 assembly (clang, -O0):
<MySearchPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <ExpandPathName@plt>
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1189 <MySearchPath+0x59>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1189 <MySearchPath+0x59>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x200,%edx
mov    $0x0,%al
call   1040 <safeStrCpy@plt>
jmp    11a8 <MySearchPath+0x78>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xe64(%rip),%rsi
mov    $0x2f,%ecx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MySearchPath>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <ExpandPathName@plt>
movslq %eax,%r8
test   %r8d,%r8d
je     1166 <MySearchPath+0x36>
cmpb   $0x2f,(%r8)
jne    1166 <MySearchPath+0x36>
mov    %rbx,%rdi
mov    %r8,%rsi
mov    $0x200,%edx
xor    %eax,%eax
call   1040 <safeStrCpy@plt>
jmp    117f <MySearchPath+0x4f>
lea    0xe93(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    $0x2f,%ecx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s%c%s\00"
define i32 @MySearchPath(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @ExpandPathName to i32 (i8*, ...)*)(i8* %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %23
13: ; preds = %3
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 47
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = load i8*, i8** %6
%21 = load i8*, i8** %5
%22 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @safeStrCpy to i32 (i8*, i8*, i32, ...)*)(i8* %20, i8* %21, i32 512)
br label %28
23: ; preds = %13, %3
%24 = load i8*, i8** %6
%25 = load i8*, i8** %4
%26 = load i8*, i8** %5
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %25, i32 47, i8* %26)
br label %28
28: ; preds = %23, %19
ret i32 1
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s%c%s\00"
define i32 @MySearchPath(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @ExpandPathName to i32 (i8*, ...)*)(i8* %1)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i32 %4, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 47
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @safeStrCpy to i32 (i8*, i8*, i32, ...)*)(i8* %2, i8* %6, i32 512)
br label %15
13: ; preds = %8, %3
%14 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 47, i8* %6)
br label %15
15: ; preds = %13, %11
ret i32 1
}