#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 /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strlen(char *);
int system(char *);
int cleanup_lupkg(char *lupkg_dir) {
  int status;
  char *cmd = malloc(strlen(lupkg_dir) + 15);
  if (cmd == NULL) {
    return 1;
  }
  sprintf(cmd, "fusermount -u %s", lupkg_dir);
  status = system(cmd);
  free(cmd);
  rmdir(lupkg_dir);
  return status;
}


x86 assembly (clang, -O0):
<cleanup_lupkg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0xf,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    119c <cleanup_lupkg+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    11d4 <cleanup_lupkg+0x74>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe55(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <system@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1040 <rmdir@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_lupkg>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0xf(%rax),%rdi
call   1070 <malloc@plt>
test   %rax,%rax
je     11ad <cleanup_lupkg+0x4d>
mov    %rax,%rbx
lea    0xe7c(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1040 <rmdir@plt>
mov    %ebp,%eax
jmp    11b2 <cleanup_lupkg+0x52>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"fusermount -u %s\00"
define i32 @cleanup_lupkg(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = add nsw i64 %7, 15
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %2
br label %24
13: ; preds = %1
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %5
%18 = call i32 @system(i8* %17)
store i32 %18, i32* %4
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 @rmdir(i8* %21)
%23 = load i32, i32* %4
store i32 %23, i32* %2
br label %24
24: ; preds = %13, %12
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [17 x i8] c"fusermount -u %s\00"
define i32 @cleanup_lupkg(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 15
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = tail call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 @system(i8* %4)
%9 = tail call i32 @free(i8* %4)
%10 = tail call i32 @rmdir(i8* %0)
br label %11
11: ; preds = %1, %6
%12 = phi i32 [ %8, %6 ], [ 1, %1 ]
ret i32 %12
}