#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 */
char *PHYSFS_getLastError();
scalar_t__ PHYSFS_removeFromSearchPath(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int cmd_removearchive(char *args) {
  if (*args == '\"') {
    args++;
    args[strlen(args) - 1] = '\0';
  }
  if (PHYSFS_removeFromSearchPath(args))
    printf("Successful.\n");
  else
    printf("Failure. reason: %s.\n", PHYSFS_getLastError());
  return (1);
}


x86 assembly (clang, -O0):
<cmd_removearchive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1189 <cmd_removearchive+0x49>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1060 <PHYSFS_removeFromSearchPath@plt>
cmp    $0x0,%rax
je     11af <cmd_removearchive+0x6f>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c7 <cmd_removearchive+0x87>
mov    $0x0,%al
call   1050 <PHYSFS_getLastError@plt>
mov    %rax,%rsi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_removearchive>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmpb   $0x22,(%rdi)
jne    1171 <cmd_removearchive+0x21>
lea    0x1(%rbx),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,(%rax,%rbx,1)
mov    %r14,%rbx
mov    %rbx,%rdi
call   1070 <PHYSFS_removeFromSearchPath@plt>
test   %rax,%rax
je     118c <cmd_removearchive+0x3c>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
jmp    11a4 <cmd_removearchive+0x54>
xor    %eax,%eax
call   1060 <PHYSFS_getLastError@plt>
lea    0xe66(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Successful.\0A\00"
@.str.1 = [22 x i8] c"Failure. reason: %s.\0A\00"
define i32 @cmd_removearchive(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 34
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8*, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %10, i64 %14
store i8 0, i8* %15
br label %16
16: ; preds = %7, %1
%17 = load i8*, i8** %2
%18 = call i64 @PHYSFS_removeFromSearchPath(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %25
22: ; preds = %16
%23 = call i8* (...) @PHYSFS_getLastError()
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %22, %20
ret i32 1
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"Failure. reason: %s.\0A\00"
@str = [12 x i8] c"Successful.\00"
define i32 @cmd_removearchive(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 34
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = tail call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
store i8 0, i8* %9
br label %10
10: ; preds = %4, %1
%11 = phi i8* [ %5, %4 ], [ %0, %1 ]
%12 = tail call i64 @PHYSFS_removeFromSearchPath(i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %19
16: ; preds = %10
%17 = tail call i8* (...) @PHYSFS_getLastError()
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16, %14
ret i32 1
}