#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 /*<<< orphan*/ memmove(char *, char *, int /*<<< orphan*/);
size_t strlen(char *);
void unquote_str(char *str) {
  size_t l;
  if (!str || ((l = strlen(str)) < 2))
    return;
  if (*str == '\"')
    memmove(str, str + 1, l--);
  if (str[--l] == '\"')
    str[l] = 0;
}


x86 assembly (clang, -O0):
<unquote_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114e <unquote_str+0x2e>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x2,%rax
jae    1153 <unquote_str+0x33>
jmp    11b2 <unquote_str+0x92>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1185 <unquote_str+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%edx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
movsbl -0x1(%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    11b2 <unquote_str+0x92>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unquote_str>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1160 <unquote_str+0x40>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x2,%rax
jb     1160 <unquote_str+0x40>
cmpb   $0x22,(%rbx)
jne    1154 <unquote_str+0x34>
lea    0x1(%rbx),%rsi
mov    %rax,%r14
add    $0xffffffffffffffff,%r14
mov    %rbx,%rdi
mov    %eax,%edx
call   1040 <memmove@plt>
mov    %r14,%rax
cmpb   $0x22,-0x1(%rax,%rbx,1)
jne    1160 <unquote_str+0x40>
movb   $0x0,-0x1(%rbx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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