#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*/ logprintf(char *, char const *);
int /*<<< orphan*/ strcmp(char const *, char *);
int /*<<< orphan*/ sysprintf(char *, char const *);
int /*<<< orphan*/ umount_lv(char const *);
void delete_lv(const char *lv) {
  char cmd[PATH_MAX];
  int code;
  if (!strcmp(lv, "root")) {
    logprintf("2%s", "root volume may not be removed");
    return;
  }
  logprintf("0deleting volume %s", lv);
  umount_lv(lv);
  sysprintf("lvm lvremove -f store/%s", lv);
}


x86 assembly (clang, -O0):
<delete_lv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1198 <delete_lv+0x58>
lea    0xe85(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1060 <logprintf@plt>
movl   $0x1,-0x20(%rbp)
jmp    11c8 <delete_lv+0x88>
mov    -0x8(%rbp),%rsi
lea    0xe85(%rip),%rdi
call   1060 <logprintf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <umount_lv@plt>
mov    -0x8(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1040 <sysprintf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_lv>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     117b <delete_lv+0x3b>
lea    0xecd(%rip),%rdi
mov    %rbx,%rsi
call   1060 <logprintf@plt>
mov    %rbx,%rdi
call   1050 <umount_lv@plt>
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <sysprintf@plt>
lea    0xe83(%rip),%rdi
lea    0xe80(%rip),%rsi
pop    %rbx
jmp    1060 <logprintf@plt>

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [5 x i8] c"root\00"
@.str.1 = [4 x i8] c"2%s\00"
@.str.2 = [31 x i8] c"root volume may not be removed\00"
@.str.3 = [20 x i8] c"0deleting volume %s\00"
@.str.4 = [25 x i8] c"lvm lvremove -f store/%s\00"
define void @delete_lv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca i8, i64 %8
store i64 %8, i64* %4
%11 = load i8*, i8** %2
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %1
%15 = call i32 @logprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %6
br label %23
16: ; preds = %1
%17 = load i8*, i8** %2
%18 = call i32 @logprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %2
%20 = call i32 @umount_lv(i8* %19)
%21 = load i8*, i8** %2
%22 = call i32 @sysprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %21)
store i32 0, i32* %6
br label %23
23: ; preds = %16, %14
%24 = load i8*, i8** %3
%25 = load i32, i32* %6
switch i32 %25, label %27 [
i32 0, label %26
i32 1, label %26
]
26: ; preds = %23, %23
ret void
27: ; preds = %23
unreachable
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [5 x i8] c"root\00"
@.str.1 = [4 x i8] c"2%s\00"
@.str.2 = [31 x i8] c"root volume may not be removed\00"
@.str.3 = [20 x i8] c"0deleting volume %s\00"
@.str.4 = [25 x i8] c"lvm lvremove -f store/%s\00"
define void @delete_lv(i8* %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @logprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %10
6: ; preds = %1
%7 = tail call i32 @logprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%8 = tail call i32 @umount_lv(i8* %0)
%9 = tail call i32 @sysprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %6, %4
ret void
}