char *unescape(start)
char *start;
{
  char *end;
  char *next;
  char *p;
  end = start + strlen(start);
  next = start;
  while (next = strstr(next + 1, "\\-")) {
    p = next;
    while (p < end)
      *(p++) = *(p + 1);
    end--;
  }
  return start;
}


x86 assembly (clang, -O0):
<unescape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
lea    0xe9e(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11b9 <unescape+0x99>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11a8 <unescape+0x88>
mov    -0x20(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    117d <unescape+0x5d>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1153 <unescape+0x33>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unescape>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%r15
lea    0x1(%r14),%rdi
lea    0xeb1(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     11a8 <unescape+0x78>
mov    %rax,%rbx
add    %r14,%r15
lea    0xe9a(%rip),%r12
mov    %r15,%r13
jmp    118f <unescape+0x5f>
nopl   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%r13
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strstr@plt>
mov    %rax,%rbx
add    $0xffffffffffffffff,%r15
test   %rax,%rax
je     11a8 <unescape+0x78>
cmp    %r13,%rbx
jae    1170 <unescape+0x40>
lea    0x1(%rbx),%rsi
mov    %r15,%rdx
sub    %rbx,%rdx
mov    %rbx,%rdi
call   1040 <memmove@plt>
jmp    1170 <unescape+0x40>
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\\-\00"
define i8* @unescape(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
%9 = getelementptr inbounds i8, i8* %6, i64 %8
store i8* %9, i8** %3
%10 = load i8*, i8** %2
store i8* %10, i8** %4
br label %11
11: ; preds = %28, %1
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = call i8* @strstr(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %31
16: ; preds = %11
%17 = load i8*, i8** %4
store i8* %17, i8** %5
br label %18
18: ; preds = %22, %16
%19 = load i8*, i8** %5
%20 = load i8*, i8** %3
%21 = icmp ult i8* %19, %20
br i1 %21, label %22, label %28
22: ; preds = %18
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %5
store i8 %25, i8* %26
br label %18
28: ; preds = %18
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 -1
store i8* %30, i8** %3
br label %11
31: ; preds = %11
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"\\-\00"
define i8* @unescape(i8* returned %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = tail call i8* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %26, label %6
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 %2
%8 = ptrtoint i8* %0 to i64
%9 = add i64 %2, %8
br label %10
10: ; preds = %6, %20
%11 = phi i64 [ 0, %6 ], [ %25, %20 ]
%12 = phi i8* [ %4, %6 ], [ %23, %20 ]
%13 = phi i8* [ %7, %6 ], [ %21, %20 ]
%14 = icmp ult i8* %12, %13
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = ptrtoint i8* %12 to i64
%17 = getelementptr i8, i8* %12, i64 1
%18 = add i64 %11, %16
%19 = sub i64 %9, %18
br label %20
20: ; preds = %15, %10
%21 = getelementptr inbounds i8, i8* %13, i64 -1
%22 = getelementptr inbounds i8, i8* %12, i64 1
%23 = tail call i8* @strstr(i8* %22, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i8* %23, null
%25 = add i64 %11, 1
br i1 %24, label %26, label %10
26: ; preds = %20, %1
ret i8* %0
}