#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 *);
int StrUtil_rmQuotes(char *str) {
  int len = strlen(str);
  if (str[0] == '\"' || str[0] == '\'') {
    len--;
    memmove(str, &(str[1]), len);
    if (str[len - 1] == '\"' || str[len - 1] == '\'') {
      str[len - 1] = '\0';
      len--;
    }
  }
  return len;
}


x86 assembly (clang, -O0):
<StrUtil_rmQuotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
je     1158 <StrUtil_rmQuotes+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    11c8 <StrUtil_rmQuotes+0xa8>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    -0xc(%rbp),%edx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
je     11a9 <StrUtil_rmQuotes+0x89>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x27,%eax
jne    11c3 <StrUtil_rmQuotes+0xa3>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11c8 <StrUtil_rmQuotes+0xa8>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrUtil_rmQuotes>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%r14d
mov    (%rbx),%al
cmp    $0x27,%al
je     113c <StrUtil_rmQuotes+0x1c>
mov    %r14d,%ebp
cmp    $0x22,%al
jne    1169 <StrUtil_rmQuotes+0x49>
lea    -0x1(%r14),%ebp
lea    0x1(%rbx),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1040 <memmove@plt>
movslq %r14d,%rax
mov    -0x2(%rbx,%rax,1),%cl
cmp    $0x27,%cl
je     115f <StrUtil_rmQuotes+0x3f>
cmp    $0x22,%cl
jne    1169 <StrUtil_rmQuotes+0x49>
add    $0xfffffffffffffffe,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %eax,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @StrUtil_rmQuotes(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 34
br i1 %10, label %17, label %11
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 39
br i1 %16, label %17, label %51
17: ; preds = %11, %1
%18 = load i32, i32* %3
%19 = add nsw i32 %18, -1
store i32 %19, i32* %3
%20 = load i8*, i8** %2
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i32, i32* %3
%24 = call i32 @memmove(i8* %20, i8* %22, i32 %23)
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %25, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 34
br i1 %32, label %42, label %33
33: ; preds = %17
%34 = load i8*, i8** %2
%35 = load i32, i32* %3
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 39
br i1 %41, label %42, label %50
42: ; preds = %33, %17
%43 = load i8*, i8** %2
%44 = load i32, i32* %3
%45 = sub nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %43, i64 %46
store i8 0, i8* %47
%48 = load i32, i32* %3
%49 = add nsw i32 %48, -1
store i32 %49, i32* %3
br label %50
50: ; preds = %42, %33
br label %51
51: ; preds = %50, %11
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
define i32 @StrUtil_rmQuotes(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = load i8, i8* %0
switch i8 %3, label %13 [
i8 34, label %4
i8 39, label %4
]
4: ; preds = %1, %1
%5 = add nsw i32 %2, -1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = tail call i32 @memmove(i8* %0, i8* %6, i32 %5)
%8 = add nsw i32 %2, -2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
switch i8 %11, label %13 [
i8 34, label %12
i8 39, label %12
]
12: ; preds = %4, %4
store i8 0, i8* %10
br label %13
13: ; preds = %4, %1, %12
%14 = phi i32 [ %8, %12 ], [ %2, %1 ], [ %5, %4 ]
ret i32 %14
}