#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 PATH_MAX;
int /*<<< orphan*/ get_storage_path(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *);
int /*<<< orphan*/ unlink(char *);
void remove_persistent_storage(const char *tag) {
  char buf[PATH_MAX];
  char path[PATH_MAX];
  get_storage_path(buf);
  snprintf(path, PATH_MAX - 1, "%s_%s", buf, tag);
  path[PATH_MAX - 1] = '\0';
  unlink(path);
}


x86 assembly (clang, -O0):
<remove_persistent_storage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rdi
sub    %rdx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rcx,-0x18(%rbp)
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
call   1040 <get_storage_path@plt>
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%rdi
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
mov    -0x8(%rbp),%r8
lea    0xe56(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x28(%rbp),%rdi
mov    0x2e36(%rip),%rax
mov    (%rax),%eax
sub    $0x1,%eax
cltq
movb   $0x0,(%rdi,%rax,1)
call   1030 <unlink@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_persistent_storage>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
mov    0x2eab(%rip),%r12
mov    (%r12),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r15,%rdi
call   1040 <get_storage_path@plt>
mov    (%r12),%esi
add    $0xffffffff,%esi
lea    0xe87(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
call   1050 <snprintf@plt>
movslq (%r12),%rax
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [6 x i8] c"%s_%s\00"
define void @remove_persistent_storage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %2
%6 = load i32, i32* @PATH_MAX
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = load i32, i32* @PATH_MAX
%11 = zext i32 %10 to i64
%12 = alloca i8, i64 %11
store i64 %11, i64* %5
%13 = call i32 @get_storage_path(i8* %9)
%14 = load i32, i32* @PATH_MAX
%15 = sub nsw i32 %14, 1
%16 = load i8*, i8** %2
%17 = call i32 @snprintf(i8* %12, i32 %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %16)
%18 = load i32, i32* @PATH_MAX
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %12, i64 %20
store i8 0, i8* %21
%22 = call i32 @unlink(i8* %12)
%23 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [6 x i8] c"%s_%s\00"
define void @remove_persistent_storage(i8* %0) {
%2 = load i32, i32* @PATH_MAX
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = alloca i8, i64 %3
%6 = call i32 @get_storage_path(i8* %4)
%7 = load i32, i32* @PATH_MAX
%8 = add nsw i32 %7, -1
%9 = call i32 @snprintf(i8* %5, i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %0)
%10 = load i32, i32* @PATH_MAX
%11 = add nsw i32 %10, -1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %5, i64 %12
store i8 0, i8* %13
%14 = call i32 @unlink(i8* %5)
ret void
}