#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 */
typedef int /*<<< orphan*/ cmd;

/* Variables and functions */
int PATH_MAX;
char *get_lv_fstype(char const *);
int /*<<< orphan*/ logprintf(char *, char const *);
int /*<<< orphan*/ mkdir(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ sysprintf(char *, char *, char const *, char const *);
void mount_lv(const char *lv) {
  char cmd[PATH_MAX];
  char *type;
  int code;
  logprintf("0mounting volume %s", lv);
  snprintf(cmd, sizeof(cmd), "/mnt/%s", lv);
  mkdir(cmd, 0755);
  type = get_lv_fstype(lv);
  sysprintf("mount -t %s /dev/store/%s /mnt/%s", type, lv, lv);
}


x86 assembly (clang, -O0):
<mount_lv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x38(%rbp)
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    0xe69(%rip),%rdi
call   1070 <logprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    %eax,%esi
mov    -0x8(%rbp),%rcx
lea    0xe7d(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x30(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
mov    -0x8(%rbp),%rdi
call   1040 <get_lv_fstype@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe30(%rip),%rdi
call   1060 <sysprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mount_lv>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    0x2e8c(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%rbx
mov    %r14,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe7e(%rip),%rdi
mov    %r15,%rsi
call   1070 <logprintf@plt>
lea    0xe9d(%rip),%rdx
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r15,%rcx
call   1050 <snprintf@plt>
mov    %rbx,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
mov    %r15,%rdi
call   1040 <get_lv_fstype@plt>
lea    0xe59(%rip),%rdi
mov    %rax,%rsi
mov    %r15,%rdx
mov    %r15,%rcx
call   1060 <sysprintf@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [20 x i8] c"0mounting volume %s\00"
@.str.1 = [8 x i8] c"/mnt/%s\00"
@.str.2 = [34 x i8] c"mount -t %s /dev/store/%s /mnt/%s\00"
define void @mount_lv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%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 @logprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = trunc i64 %8 to i32
%14 = load i8*, i8** %2
%15 = call i32 @snprintf(i8* %10, i32 %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = call i32 @mkdir(i8* %10, i32 493)
%17 = load i8*, i8** %2
%18 = call i8* @get_lv_fstype(i8* %17)
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = load i8*, i8** %2
%21 = load i8*, i8** %2
%22 = call i32 @sysprintf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %19, i8* %20, i8* %21)
%23 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [20 x i8] c"0mounting volume %s\00"
@.str.1 = [8 x i8] c"/mnt/%s\00"
@.str.2 = [34 x i8] c"mount -t %s /dev/store/%s /mnt/%s\00"
define void @mount_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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = call i32 @snprintf(i8* %4, i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = call i32 @mkdir(i8* %4, i32 493)
%8 = call i8* @get_lv_fstype(i8* %0)
%9 = call i32 @sysprintf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %0, i8* %0)
ret void
}