#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 *);
char *noquotes(char *string) {
  char *start = string;
  while (*start == '"')
    start++;
  int end = strlen(start);
  if (start != string) {
    memmove(string, start, end);
    string[end] = '\0';
  }
  while (*(string + end - 1) == '"')
    end--;
  string[end] = '\0';
  return string;
}


x86 assembly (clang, -O0):
<noquotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1155 <noquotes+0x35>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <noquotes+0x14>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     118b <noquotes+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1190 <noquotes+0x70>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl -0x1(%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    11b4 <noquotes+0x94>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <noquotes+0x70>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noquotes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
cmpb   $0x22,(%rbx,%rbp,1)
lea    0x1(%rbp),%rbp
je     1130 <noquotes+0x10>
lea    (%rbx,%rbp,1),%r15
add    $0xffffffffffffffff,%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
cmp    $0x1,%rbp
je     116a <noquotes+0x4a>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1040 <memmove@plt>
movslq %r14d,%rax
movb   $0x0,(%rbx,%rax,1)
jmp    116d <noquotes+0x4d>
movslq %r14d,%rax
add    %rbx,%rax
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x22,-0x2(%rax)
lea    -0x1(%rax),%rax
je     1180 <noquotes+0x60>
movb   $0x0,(%rax)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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