xmv(f1, f2) register char *f1, *f2;
{
  register int ret;
  (void)unlink(subfile(f2));
  if (link(subfile(f1), subfile(f2)) < 0) {
    ret = xcp(f1, f2);
    if (ret == 0)
      unlink(subfile(f1));
    return ret;
  }
  (void)unlink(subfile(f1));
  return 0;
}


x86 assembly (clang, -O0):
<xmv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1050 <subfile@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1030 <unlink@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <subfile@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1050 <subfile@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1060 <link@plt>
cmp    $0x0,%eax
jge    11cd <xmv+0x8d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <xcp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11c2 <xmv+0x82>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <subfile@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1030 <unlink@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e8 <xmv+0xa8>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <subfile@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1030 <unlink@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmv>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
xor    %eax,%eax
call   1050 <subfile@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <unlink@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <subfile@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <subfile@plt>
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <link@plt>
test   %eax,%eax
jns    1193 <xmv+0x53>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <xcp@plt>
test   %eax,%eax
jne    11a8 <xmv+0x68>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <subfile@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <unlink@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @xmv(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %7)
%9 = call i32 (i32, ...) bitcast (i32 (...)* @unlink to i32 (i32, ...)*)(i32 %8)
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %10)
%12 = load i8*, i8** %5
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %12)
%14 = call i32 (i32, i32, ...) bitcast (i32 (...)* @link to i32 (i32, i32, ...)*)(i32 %11, i32 %13)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %28
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @xcp to i32 (i8*, i8*, ...)*)(i8* %17, i8* %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %16
%23 = load i8*, i8** %4
%24 = call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %23)
%25 = call i32 (i32, ...) bitcast (i32 (...)* @unlink to i32 (i32, ...)*)(i32 %24)
br label %26
26: ; preds = %22, %16
%27 = load i32, i32* %6
store i32 %27, i32* %3
br label %32
28: ; preds = %2
%29 = load i8*, i8** %4
%30 = call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %29)
%31 = call i32 (i32, ...) bitcast (i32 (...)* @unlink to i32 (i32, ...)*)(i32 %30)
store i32 0, i32* %3
br label %32
32: ; preds = %28, %26
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @xmv(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %1)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @unlink to i32 (i32, ...)*)(i32 %3)
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %0)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %1)
%7 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @link to i32 (i32, i32, ...)*)(i32 %5, i32 %6)
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @xcp to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2, %9
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @subfile to i32 (i8*, ...)*)(i8* %0)
%14 = tail call i32 (i32, ...) bitcast (i32 (...)* @unlink to i32 (i32, ...)*)(i32 %13)
br label %15
15: ; preds = %12, %9
%16 = phi i32 [ %10, %9 ], [ 0, %12 ]
ret i32 %16
}