#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 WEXITSTATUS(int /*<<< orphan*/);
int /*<<< orphan*/ logprintf(char *, char const *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
char *strchr(char *, char);
int /*<<< orphan*/ system(char *);
void umount_lv(const char *lv) {
  char cmd[PATH_MAX];
  char *dash;
  int code;
  logprintf("0unmounting volume %s", lv);
  sprintf(cmd, "umount /mnt/%s", lv);
  do {
    code = WEXITSTATUS(system(cmd));
  } while (!code);
  dash = strchr(cmd, '-');
  if (dash == NULL)
    return;
  *dash = '/';
  do {
    code = WEXITSTATUS(system(cmd));
  } while (!code);
}


x86 assembly (clang, -O0):
<umount_lv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1070 <logprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe6f(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,%edi
call   1050 <WEXITSTATUS@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ac <umount_lv+0x5c>
mov    -0x30(%rbp),%rdi
mov    $0x2d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f9 <umount_lv+0xa9>
movl   $0x1,-0x28(%rbp)
jmp    122b <umount_lv+0xdb>
mov    -0x20(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x30(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,%edi
call   1050 <WEXITSTATUS@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1200 <umount_lv+0xb0>
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umount_lv>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe85(%rip),%rdi
mov    %r14,%rsi
call   1070 <logprintf@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1060 <sprintf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %eax,%edi
call   1050 <WEXITSTATUS@plt>
test   %eax,%eax
je     11a0 <umount_lv+0x50>
mov    %rbx,%rdi
mov    $0x2d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11e3 <umount_lv+0x93>
movb   $0x2f,(%rax)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %eax,%edi
call   1050 <WEXITSTATUS@plt>
test   %eax,%eax
je     11d0 <umount_lv+0x80>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [22 x i8] c"0unmounting volume %s\00"
@.str.1 = [15 x i8] c"umount /mnt/%s\00"
define void @umount_lv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i32, i32* @PATH_MAX
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i8, i64 %9
store i64 %9, i64* %4
%12 = load i8*, i8** %2
%13 = call i32 @logprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %2
%15 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %19, %1
%17 = call i32 @system(i8* %11)
%18 = call i32 @WEXITSTATUS(i32 %17)
store i32 %18, i32* %6
br label %19
19: ; preds = %16
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
br i1 %22, label %16, label %23
23: ; preds = %19
%24 = call i8* @strchr(i8* %11, i8 signext 45)
store i8* %24, i8** %5
%25 = load i8*, i8** %5
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 1, i32* %7
br label %38
28: ; preds = %23
%29 = load i8*, i8** %5
store i8 47, i8* %29
br label %30
30: ; preds = %33, %28
%31 = call i32 @system(i8* %11)
%32 = call i32 @WEXITSTATUS(i32 %31)
store i32 %32, i32* %6
br label %33
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
%36 = xor i1 %35, true
br i1 %36, label %30, label %37
37: ; preds = %33
store i32 0, i32* %7
br label %38
38: ; preds = %37, %27
%39 = load i8*, i8** %3
%40 = load i32, i32* %7
switch i32 %40, label %42 [
i32 0, label %41
i32 1, label %41
]
41: ; preds = %38, %38
ret void
42: ; preds = %38
unreachable
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [22 x i8] c"0unmounting volume %s\00"
@.str.1 = [15 x i8] c"umount /mnt/%s\00"
define void @umount_lv(i8* %0) {
%2 = load i32, i32* @PATH_MAX
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = tail call i32 @logprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %7, %1
%8 = call i32 @system(i8* %4)
%9 = tail call i32 @WEXITSTATUS(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %7, label %11
11: ; preds = %7
%12 = call i8* @strchr(i8* %4, i8 signext 45)
%13 = icmp eq i8* %12, null
br i1 %13, label %19, label %14
14: ; preds = %11
store i8 47, i8* %12
br label %15
15: ; preds = %15, %14
%16 = call i32 @system(i8* %4)
%17 = call i32 @WEXITSTATUS(i32 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %15, label %19
19: ; preds = %15, %11
ret void
}