#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 removeticks(char *string) {
  if ((string[0] == 39) || (string[0] == 34))
    memmove(string, string + 1, strlen(string));
  if ((string[(strlen(string) - 1)] == 39) ||
      (string[(strlen(string) - 1)] == 34))
    string[(strlen(string) - 1)] = 0;
  return 0;
}


x86 assembly (clang, -O0):
<removeticks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
je     114c <removeticks+0x2c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1178 <removeticks+0x58>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x27,%eax
je     11cc <removeticks+0xac>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    11ed <removeticks+0xcd>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeticks>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x27,%al
je     1131 <removeticks+0x11>
cmp    $0x22,%al
jne    114a <removeticks+0x2a>
lea    0x1(%rbx),%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <memmove@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x27,-0x1(%rax,%rbx,1)
je     116c <removeticks+0x4c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x22,-0x1(%rax,%rbx,1)
jne    117b <removeticks+0x5b>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @removeticks(i8* %0) {
%2 = load i8, i8* %0
switch i8 %2, label %7 [
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* %0)
%6 = tail call i32 @memmove(i8* %0, i8* %4, i32 %5)
br label %7
7: ; preds = %1, %3
%8 = tail call i32 @strlen(i8* %0)
%9 = add nsw i32 %8, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 39
br i1 %13, label %21, label %14
14: ; preds = %7
%15 = tail call i32 @strlen(i8* %0)
%16 = add nsw i32 %15, -1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 34
br i1 %20, label %21, label %26
21: ; preds = %14, %7
%22 = tail call i32 @strlen(i8* %0)
%23 = add nsw i32 %22, -1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
store i8 0, i8* %25
br label %26
26: ; preds = %21, %14
ret i32 0
}