#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 *);
void suppress_quotes(char buf[]) {
  int len = strlen(buf);
  if (len <= 1) {
    return;
  }
  if ((buf[0] == '"' && buf[len - 1] == '"') ||
      (buf[0] == '\'' && buf[len - 1] == '\'')) {
    int i;
    for (i = 1; i < len - 1; i++) {
      buf[i - 1] = buf[i];
    }
    buf[len - 2] = '\0';
  }
}


x86 assembly (clang, -O0):
<suppress_quotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     1137 <suppress_quotes+0x27>
jmp    11dd <suppress_quotes+0xcd>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1161 <suppress_quotes+0x51>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
je     118b <suppress_quotes+0x7b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    11dd <suppress_quotes+0xcd>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x27,%eax
jne    11dd <suppress_quotes+0xcd>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11cc <suppress_quotes+0xbc>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1192 <suppress_quotes+0x82>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suppress_quotes>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     1174 <suppress_quotes+0x54>
mov    %eax,%ebx
mov    (%r14),%al
cmp    $0x27,%al
je     114a <suppress_quotes+0x2a>
cmp    $0x22,%al
jne    1174 <suppress_quotes+0x54>
lea    -0x1(%rbx),%eax
cmpb   $0x22,(%r14,%rax,1)
je     1154 <suppress_quotes+0x34>
jmp    1174 <suppress_quotes+0x54>
lea    -0x1(%rbx),%eax
cmpb   $0x27,(%r14,%rax,1)
jne    1174 <suppress_quotes+0x54>
cmp    $0x3,%ebx
jb     116d <suppress_quotes+0x4d>
lea    0x1(%r14),%rsi
add    $0xfffffffe,%ebx
mov    %r14,%rdi
mov    %rbx,%rdx
call   1040 <memmove@plt>
jmp    116f <suppress_quotes+0x4f>
xor    %ebx,%ebx
movb   $0x0,(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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