#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 */
long strlen(char *);
long stripquotes(char *str) {
  long len, offset;
  if (str == 0)
    return (0);
  len = strlen(str);
  if (str[0] == '"' && str[len - 1] == '"')
    str[len - 1] = 0, offset = 1;
  else
    offset = 0;
  return (offset);
}


x86 assembly (clang, -O0):
<stripquotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <stripquotes+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1197 <stripquotes+0x87>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1187 <stripquotes+0x77>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    1187 <stripquotes+0x77>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
movq   $0x1,-0x20(%rbp)
jmp    118f <stripquotes+0x7f>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripquotes>:
push   %rbx
test   %rdi,%rdi
je     1139 <stripquotes+0x29>
mov    %rdi,%rbx
cmpb   $0x22,(%rdi)
jne    1139 <stripquotes+0x29>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmpb   $0x22,-0x1(%rax,%rbx,1)
jne    1139 <stripquotes+0x29>
movb   $0x0,-0x1(%rbx,%rax,1)
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

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