#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ _shiftl(char *, char *, int, char, int, int);
int _strlen(char *);
void _clean(char *str) {
  char *p = str;
  int len = _strlen(str);
  while (*p != '\0') {
    if (*p == '\\') {
      _shiftl(str, p, len, '\0', 1, p - str);
    }
    p++;
  }
}


x86 assembly (clang, -O0):
<_clean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1197 <_clean+0x77>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1186 <_clean+0x66>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%r9d
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1040 <_shiftl@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <_clean+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_clean>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <_strlen@plt>
mov    %eax,%r14d
xor    %ebp,%ebp
jmp    115e <_clean+0x3e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rbx,%rbp,1),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ebp,%r9d
call   1040 <_shiftl@plt>
add    $0x1,%rbp
movzbl (%rbx,%rbp,1),%eax
cmp    $0x5c,%al
je     1140 <_clean+0x20>
test   %al,%al
jne    115a <_clean+0x3a>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @_clean(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = call i32 @_strlen(i8* %6)
store i32 %7, i32* %4
br label %8
8: ; preds = %29, %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 92
br i1 %17, label %18, label %29
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = load i8*, i8** %3
%23 = load i8*, i8** %2
%24 = ptrtoint i8* %22 to i64
%25 = ptrtoint i8* %23 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = call i32 @_shiftl(i8* %19, i8* %20, i32 %21, i8 signext 0, i32 1, i32 %27)
br label %29
29: ; preds = %18, %13
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
br label %8
32: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @_clean(i8* %0) {
%2 = tail call i32 @_strlen(i8* %0)
%3 = ptrtoint i8* %0 to i64
br label %4
4: ; preds = %12, %1
%5 = phi i8* [ %0, %1 ], [ %13, %12 ]
%6 = load i8, i8* %5
switch i8 %6, label %12 [
i8 0, label %14
i8 92, label %7
]
7: ; preds = %4
%8 = ptrtoint i8* %5 to i64
%9 = sub i64 %8, %3
%10 = trunc i64 %9 to i32
%11 = tail call i32 @_shiftl(i8* %0, i8* %5, i32 %2, i8 signext 0, i32 1, i32 %10)
br label %12
12: ; preds = %4, %7
%13 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
14: ; preds = %4
ret void
}