#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 stripEndQuotes(char *s) {
  char *t;
  if (*s == '\'' || *s == '"') {
    memmove(s, s + 1, strlen(s + 1) + 1);
    t = s + strlen(s) - 1;
    if (*t == '\'' || *t == '"')
      *t = '\0';
  }
  return (0);
}


x86 assembly (clang, -O0):
<stripEndQuotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
je     114c <stripEndQuotes+0x2c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11d0 <stripEndQuotes+0xb0>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
je     11c4 <stripEndQuotes+0xa4>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11cb <stripEndQuotes+0xab>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    11d0 <stripEndQuotes+0xb0>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripEndQuotes>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x27,%al
je     1131 <stripEndQuotes+0x11>
cmp    $0x22,%al
jne    1168 <stripEndQuotes+0x48>
lea    0x1(%rbx),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <memmove@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
mov    -0x1(%rbx,%rax,1),%cl
cmp    $0x27,%cl
je     1163 <stripEndQuotes+0x43>
cmp    $0x22,%cl
jne    1168 <stripEndQuotes+0x48>
movb   $0x0,-0x1(%rbx,%rax,1)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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