#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 strlen(char *);
char *unquote(char *p) {
  if (p[0] == '"') {
    if (p[strlen(p) - 1] == '"')
      p[strlen(p) - 1] = '\0';
    p++;
  }
  return p;
}


x86 assembly (clang, -O0):
<unquote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1183 <unquote+0x73>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    1177 <unquote+0x67>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unquote>:
push   %rbx
mov    %rdi,%rbx
cmpb   $0x22,(%rdi)
jne    113d <unquote+0x2d>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x22,-0x1(%rax,%rbx,1)
jne    1139 <unquote+0x29>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
add    $0x1,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @unquote(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, 34
br i1 %7, label %8, label %28
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i8*, i8** %2
%11 = call i32 @strlen(i8* %10)
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %9, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 34
br i1 %17, label %18, label %25
18: ; preds = %8
%19 = load i8*, i8** %2
%20 = load i8*, i8** %2
%21 = call i32 @strlen(i8* %20)
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %19, i64 %23
store i8 0, i8* %24
br label %25
25: ; preds = %18, %8
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %2
br label %28
28: ; preds = %25, %1
%29 = load i8*, i8** %2
ret i8* %29
}

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