dtildepr(home, dir) register char *home, *dir;
{
  if (!(strcmp(home, "/") == 0) && prefix(home, dir))
    shprintf("~%s", dir + strlen(home));
  else
    shprintf("%s", dir);
}


x86 assembly (clang, -O0):
<dtildepr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     11ac <dtildepr+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <prefix@plt>
cmp    $0x0,%eax
je     11ac <dtildepr+0x6c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rsi
add    %rax,%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <shprintf@plt>
jmp    11be <dtildepr+0x7e>
mov    -0x18(%rbp),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <shprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtildepr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeaf(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     117f <dtildepr+0x3f>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <prefix@plt>
test   %eax,%eax
je     117f <dtildepr+0x3f>
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    %rax,%r14
lea    0xe85(%rip),%rdi
jmp    1186 <dtildepr+0x46>
lea    0xe7d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <shprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [4 x i8] c"~%s\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @dtildepr(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %20, label %9
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @prefix to i32 (i8*, i8*, ...)*)(i8* %10, i8* %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i8*, i8** %5
%16 = load i8*, i8** %4
%17 = call i64 @strlen(i8* %16)
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %23
20: ; preds = %9, %2
%21 = load i8*, i8** %5
%22 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %14
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [4 x i8] c"~%s\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @dtildepr(i8* %0, i8* %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @prefix to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %14
12: ; preds = %5, %2
%13 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %14
14: ; preds = %12, %8
ret i32 undef
}