#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 remove_quotes(char *str) {
  int i;
  if (str == 0)
    return;
  if (strlen(str) > 2) {
    if (str[0] == '"') {
      for (i = 1; i < strlen(str); i++)
        str[i - 1] = str[i];
      str[i - 1] = 0;
      for (i = strlen(str) - 1; i >= 0; i--) {
        if (str[i] == '"') {
          str[i] = 0;
          break;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<remove_quotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <remove_quotes+0x1c>
jmp    1207 <remove_quotes+0xf7>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jle    1207 <remove_quotes+0xf7>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1202 <remove_quotes+0xf2>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    119a <remove_quotes+0x8a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <remove_quotes+0x45>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11fd <remove_quotes+0xed>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    11ea <remove_quotes+0xda>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11fd <remove_quotes+0xed>
jmp    11ef <remove_quotes+0xdf>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11ba <remove_quotes+0xaa>
jmp    1202 <remove_quotes+0xf2>
jmp    1207 <remove_quotes+0xf7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_quotes>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     11aa <remove_quotes+0x9a>
mov    %rdi,%r14
call   1030 <strlen@plt>
cmp    $0x3,%eax
jl     11aa <remove_quotes+0x9a>
cmpb   $0x22,(%r14)
jne    11aa <remove_quotes+0x9a>
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     1173 <remove_quotes+0x63>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%eax
mov    %al,-0x1(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1150 <remove_quotes+0x40>
add    $0xffffffffffffffff,%rbx
jmp    1175 <remove_quotes+0x65>
xor    %ebx,%ebx
movb   $0x0,(%r14,%rbx,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %eax,%eax
jle    11aa <remove_quotes+0x9a>
lea    -0x1(%rax),%rcx
cmpb   $0x22,-0x1(%r14,%rax,1)
mov    %rcx,%rax
jne    1190 <remove_quotes+0x80>
mov    %ecx,%eax
movb   $0x0,(%r14,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @remove_quotes(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %42, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 2
br i1 %5, label %6, label %42
6: ; preds = %3
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 34
br i1 %8, label %9, label %42
9: ; preds = %6
%10 = tail call i32 @strlen(i8* %0)
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %25
12: ; preds = %9, %12
%13 = phi i64 [ %18, %12 ], [ 1, %9 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = add nsw i64 %13, -1
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 %15, i8* %17
%18 = add nuw nsw i64 %13, 1
%19 = tail call i32 @strlen(i8* %0)
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %12, label %22
22: ; preds = %12
%23 = shl i64 %13, 32
%24 = ashr exact i64 %23, 32
br label %25
25: ; preds = %22, %9
%26 = phi i64 [ 0, %9 ], [ %24, %22 ]
%27 = getelementptr inbounds i8, i8* %0, i64 %26
store i8 0, i8* %27
%28 = tail call i32 @strlen(i8* %0)
%29 = zext i32 %28 to i64
br label %30
30: ; preds = %35, %25
%31 = phi i64 [ %32, %35 ], [ %29, %25 ]
%32 = add nsw i64 %31, -1
%33 = trunc i64 %31 to i32
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %42
35: ; preds = %30
%36 = getelementptr inbounds i8, i8* %0, i64 %32
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 34
br i1 %38, label %39, label %30
39: ; preds = %35
%40 = and i64 %32, 4294967295
%41 = getelementptr inbounds i8, i8* %0, i64 %40
store i8 0, i8* %41
br label %42
42: ; preds = %30, %3, %39, %6, %1
ret void
}