#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*/ memmove(char *, char *, size_t);
scalar_t__ starts_with(char *, char *);
size_t strlen(char *);
void fuse_strip_mount_metadata(char string[]) {
  size_t prefix_len;
  if (starts_with(string, "FUSE_MOUNT|")) {
    prefix_len = (sizeof("FUSE_MOUNT|") / sizeof(("FUSE_MOUNT|")[0])) - 1;
  } else if (starts_with(string, "FUSE_MOUNT2|")) {
    prefix_len = (sizeof("FUSE_MOUNT2|") / sizeof(("FUSE_MOUNT2|")[0])) - 1;
  } else {
    prefix_len = 0;
  }
  if (prefix_len != 0) {
    size_t new_len = strlen(string) - prefix_len;
    memmove(string, string + prefix_len, new_len + 1);
  }
}


x86 assembly (clang, -O0):
<fuse_strip_mount_metadata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <starts_with@plt>
cmp    $0x0,%rax
je     1163 <fuse_strip_mount_metadata+0x33>
movq   $0xb,-0x10(%rbp)
jmp    1197 <fuse_strip_mount_metadata+0x67>
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1050 <starts_with@plt>
cmp    $0x0,%rax
je     118a <fuse_strip_mount_metadata+0x5a>
movq   $0xc,-0x10(%rbp)
jmp    1192 <fuse_strip_mount_metadata+0x62>
movq   $0x0,-0x10(%rbp)
jmp    1197 <fuse_strip_mount_metadata+0x67>
cmpq   $0x0,-0x10(%rbp)
je     11cc <fuse_strip_mount_metadata+0x9c>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
call   1040 <memmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fuse_strip_mount_metadata>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec2(%rip),%rsi
call   1050 <starts_with@plt>
mov    $0xb,%r14d
test   %rax,%rax
jne    1168 <fuse_strip_mount_metadata+0x38>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1050 <starts_with@plt>
mov    $0xc,%r14d
test   %rax,%rax
je     118a <fuse_strip_mount_metadata+0x5a>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    (%rbx,%r14,1),%rsi
sub    %r14,%rax
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <memmove@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"FUSE_MOUNT|\00"
@.str.1 = [13 x i8] c"FUSE_MOUNT2|\00"
define void @fuse_strip_mount_metadata(i8* %0) {
%2 = tail call i64 @starts_with(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i64 @starts_with(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %4
%8 = phi i64 [ 12, %4 ], [ 11, %1 ]
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = getelementptr inbounds i8, i8* %0, i64 %8
%11 = sub nsw i64 1, %8
%12 = add i64 %11, %9
%13 = tail call i32 @memmove(i8* %0, i8* %10, i64 %12)
br label %14
14: ; preds = %7, %4
ret void
}