#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 *);
int /*<<< orphan*/ timlib_strcpy(char *, char *, int);
char *timlib_trim_double_quotes(char *s) {
  int str_len;
  if (!s)
    return (char *)0;
  if (*s == '"')
    timlib_strcpy(s, s + 1, 131072);
  str_len = strlen(s);
  if (str_len && *(s + str_len - 1) == '"') {
    *(s + str_len - 1) = '\0';
  }
  return s;
}


x86 assembly (clang, -O0):
<timlib_trim_double_quotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <timlib_trim_double_quotes+0x24>
movq   $0x0,-0x8(%rbp)
jmp    11ab <timlib_trim_double_quotes+0x8b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    116a <timlib_trim_double_quotes+0x4a>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
mov    $0x20000,%edx
call   1040 <timlib_strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11a3 <timlib_trim_double_quotes+0x83>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl -0x1(%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    11a3 <timlib_trim_double_quotes+0x83>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,-0x1(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timlib_trim_double_quotes>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1159 <timlib_trim_double_quotes+0x39>
cmpb   $0x22,(%rbx)
jne    113f <timlib_trim_double_quotes+0x1f>
lea    0x1(%rbx),%rsi
mov    %rbx,%rdi
mov    $0x20000,%edx
call   1040 <timlib_strcpy@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
je     1159 <timlib_trim_double_quotes+0x39>
cltq
cmpb   $0x22,-0x1(%rbx,%rax,1)
jne    1159 <timlib_trim_double_quotes+0x39>
movb   $0x0,-0x1(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
ret

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

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