#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 */
unsigned int strlen(char *);
char *econfig_trimQuotes(char *str) {
  unsigned len = strlen(str);
  if (len < 2) {
    return str;
  }
  if (str[0] != '"' || str[len - 1] != '"') {
    return str;
  }
  str[len - 1] = 0;
  str++;
  return str;
}


x86 assembly (clang, -O0):
<econfig_trimQuotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jae    113f <econfig_trimQuotes+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <econfig_trimQuotes+0x89>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1168 <econfig_trimQuotes+0x58>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
je     1175 <econfig_trimQuotes+0x65>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <econfig_trimQuotes+0x89>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<econfig_trimQuotes>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x2,%eax
jb     1134 <econfig_trimQuotes+0x24>
cmpb   $0x22,(%rbx)
jne    1134 <econfig_trimQuotes+0x24>
add    $0xffffffff,%eax
cmpb   $0x22,(%rbx,%rax,1)
jne    1134 <econfig_trimQuotes+0x24>
movb   $0x0,(%rbx,%rax,1)
add    $0x1,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @econfig_trimQuotes(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ult i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %3
store i8* %10, i8** %2
br label %37
11: ; preds = %1
%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 ne i32 %15, 34
br i1 %16, label %26, label %17
17: ; preds = %11
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = sub i32 %19, 1
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 34
br i1 %25, label %26, label %28
26: ; preds = %17, %11
%27 = load i8*, i8** %3
store i8* %27, i8** %2
br label %37
28: ; preds = %17
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sub i32 %30, 1
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
store i8 0, i8* %33
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %3
%36 = load i8*, i8** %3
store i8* %36, i8** %2
br label %37
37: ; preds = %28, %26, %9
%38 = load i8*, i8** %2
ret i8* %38
}

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