#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 *);
char *get_unquoted_filename(char *file) {
  char *ret;
  if (*file == '"') {
    ret = file + 1;
    if (file[strlen(file) - 1] == '"')
      file[strlen(file) - 1] = 0;
    return ret;
  }
  return file;
}


x86 assembly (clang, -O0):
<get_unquoted_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1190 <get_unquoted_filename+0x80>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    1183 <get_unquoted_filename+0x73>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1198 <get_unquoted_filename+0x88>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_unquoted_filename>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmpb   $0x22,(%rdi)
jne    1142 <get_unquoted_filename+0x32>
lea    0x1(%rbx),%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x22,-0x1(%rax,%rbx,1)
jne    1145 <get_unquoted_filename+0x35>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
jmp    1145 <get_unquoted_filename+0x35>
mov    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @get_unquoted_filename(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 34
br i1 %3, label %4, label %17
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = tail call i32 @strlen(i8* %0)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%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 %17
12: ; preds = %4
%13 = tail call i32 @strlen(i8* %0)
%14 = add nsw i32 %13, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 0, i8* %16
br label %17
17: ; preds = %1, %4, %12
%18 = phi i8* [ %5, %12 ], [ %5, %4 ], [ %0, %1 ]
ret i8* %18
}