#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 *, int);
int strlen(char const *);
int /*<<< orphan*/ strncmp(char *, char const *, int);
void sigma_deprefix(char *str, const char *prefix) {
  int l;
  l = strlen(prefix);
  if (!strncmp(str, prefix, l))
    memmove(str, str + l, strlen(str + l) + 1);
}


x86 assembly (clang, -O0):
<sigma_deprefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    119e <sigma_deprefix+0x6e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1050 <memmove@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigma_deprefix>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     115a <sigma_deprefix+0x2a>
pop    %rbx
pop    %r14
pop    %rbp
ret
movslq %ebp,%rbx
add    %r14,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <memmove@plt>

LLVM IR (-O0):
define void @sigma_deprefix(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @strncmp(i8* %8, i8* %9, i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %26, label %13
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = call i32 @strlen(i8* %22)
%24 = add nsw i32 %23, 1
%25 = call i32 @memmove(i8* %14, i8* %18, i32 %24)
br label %26
26: ; preds = %13, %2
ret void
}

LLVM IR (-O2):
define void @sigma_deprefix(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 @strlen(i8* %8)
%10 = add nsw i32 %9, 1
%11 = tail call i32 @memmove(i8* %0, i8* %8, i32 %10)
br label %12
12: ; preds = %6, %2
ret void
}