#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 MNT_DETACH;
int MNT_EXPIRE;
int MNT_FORCE;
int UMOUNT_NOFOLLOW;
int /*<<< orphan*/ sc_string_append(char *, size_t, char const *);
int /*<<< orphan*/ sc_string_init(char *, size_t);
const char *sc_umount_cmd(char *buf, size_t buf_size, const char *target,
                          int flags) {
  sc_string_init(buf, buf_size);
  sc_string_append(buf, buf_size, "umount");
  if (flags & MNT_FORCE) {
    sc_string_append(buf, buf_size, " --force");
  }
  if (flags & MNT_DETACH) {
    sc_string_append(buf, buf_size, " --lazy");
  }
  if (flags & MNT_EXPIRE) {
    sc_string_append(buf, buf_size, " --expire");
  }
  if (flags & UMOUNT_NOFOLLOW) {
    sc_string_append(buf, buf_size, " --no-follow");
  }
  if (target != NULL) {
    sc_string_append(buf, buf_size, " ");
    sc_string_append(buf, buf_size, target);
  }
  return buf;
}


x86 assembly (clang, -O0):
<sc_umount_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <sc_string_init@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xead(%rip),%rdx
call   1030 <sc_string_append@plt>
mov    -0x1c(%rbp),%eax
mov    0x2e7e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1181 <sc_umount_cmd+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe8b(%rip),%rdx
call   1030 <sc_string_append@plt>
mov    -0x1c(%rbp),%eax
mov    0x2e3d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11aa <sc_umount_cmd+0x8a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe6b(%rip),%rdx
call   1030 <sc_string_append@plt>
mov    -0x1c(%rbp),%eax
mov    0x2e1c(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11d3 <sc_umount_cmd+0xb3>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe4a(%rip),%rdx
call   1030 <sc_string_append@plt>
mov    -0x1c(%rbp),%eax
mov    0x2e0b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11fc <sc_umount_cmd+0xdc>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe2b(%rip),%rdx
call   1030 <sc_string_append@plt>
cmpq   $0x0,-0x18(%rbp)
je     122c <sc_umount_cmd+0x10c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe19(%rip),%rdx
call   1030 <sc_string_append@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <sc_string_append@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc_umount_cmd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <sc_string_init@plt>
lea    0xec2(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <sc_string_append@plt>
mov    0x2e90(%rip),%rax
test   %ebp,(%rax)
je     1166 <sc_umount_cmd+0x46>
lea    0xeac(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <sc_string_append@plt>
mov    0x2e5b(%rip),%rax
test   %ebp,(%rax)
je     1183 <sc_umount_cmd+0x63>
lea    0xe98(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <sc_string_append@plt>
mov    0x2e46(%rip),%rax
test   %ebp,(%rax)
je     11a0 <sc_umount_cmd+0x80>
lea    0xe83(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <sc_string_append@plt>
mov    0x2e41(%rip),%rax
test   %ebp,(%rax)
je     11bd <sc_umount_cmd+0x9d>
lea    0xe70(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <sc_string_append@plt>
test   %r14,%r14
je     11e2 <sc_umount_cmd+0xc2>
lea    0xe66(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <sc_string_append@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <sc_string_append@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"umount\00"
@MNT_FORCE = global i32 0
@.str.1 = [9 x i8] c" --force\00"
@MNT_DETACH = global i32 0
@.str.2 = [8 x i8] c" --lazy\00"
@MNT_EXPIRE = global i32 0
@.str.3 = [10 x i8] c" --expire\00"
@UMOUNT_NOFOLLOW = global i32 0
@.str.4 = [13 x i8] c" --no-follow\00"
@.str.5 = [2 x i8] c" \00"
define i8* @sc_umount_cmd(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @sc_string_init(i8* %9, i64 %10)
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = call i32 @sc_string_append(i8* %12, i64 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %8
%16 = load i32, i32* @MNT_FORCE
%17 = and i32 %15, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %4
%20 = load i8*, i8** %5
%21 = load i64, i64* %6
%22 = call i32 @sc_string_append(i8* %20, i64 %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %19, %4
%24 = load i32, i32* %8
%25 = load i32, i32* @MNT_DETACH
%26 = and i32 %24, %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i8*, i8** %5
%30 = load i64, i64* %6
%31 = call i32 @sc_string_append(i8* %29, i64 %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %28, %23
%33 = load i32, i32* %8
%34 = load i32, i32* @MNT_EXPIRE
%35 = and i32 %33, %34
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i8*, i8** %5
%39 = load i64, i64* %6
%40 = call i32 @sc_string_append(i8* %38, i64 %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %37, %32
%42 = load i32, i32* %8
%43 = load i32, i32* @UMOUNT_NOFOLLOW
%44 = and i32 %42, %43
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %41
%47 = load i8*, i8** %5
%48 = load i64, i64* %6
%49 = call i32 @sc_string_append(i8* %47, i64 %48, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %50
50: ; preds = %46, %41
%51 = load i8*, i8** %7
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %61
53: ; preds = %50
%54 = load i8*, i8** %5
%55 = load i64, i64* %6
%56 = call i32 @sc_string_append(i8* %54, i64 %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%57 = load i8*, i8** %5
%58 = load i64, i64* %6
%59 = load i8*, i8** %7
%60 = call i32 @sc_string_append(i8* %57, i64 %58, i8* %59)
br label %61
61: ; preds = %53, %50
%62 = load i8*, i8** %5
ret i8* %62
}

LLVM IR (-O2):
@.str = [7 x i8] c"umount\00"
@MNT_FORCE = global i32 0
@.str.1 = [9 x i8] c" --force\00"
@MNT_DETACH = global i32 0
@.str.2 = [8 x i8] c" --lazy\00"
@MNT_EXPIRE = global i32 0
@.str.3 = [10 x i8] c" --expire\00"
@UMOUNT_NOFOLLOW = global i32 0
@.str.4 = [13 x i8] c" --no-follow\00"
@.str.5 = [2 x i8] c" \00"
define i8* @sc_umount_cmd(i8* returned %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i32 @sc_string_init(i8* %0, i64 %1)
%6 = tail call i32 @sc_string_append(i8* %0, i64 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @MNT_FORCE
%8 = and i32 %7, %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = tail call i32 @sc_string_append(i8* %0, i64 %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %4
%13 = load i32, i32* @MNT_DETACH
%14 = and i32 %13, %3
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = tail call i32 @sc_string_append(i8* %0, i64 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* @MNT_EXPIRE
%20 = and i32 %19, %3
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = tail call i32 @sc_string_append(i8* %0, i64 %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
%25 = load i32, i32* @UMOUNT_NOFOLLOW
%26 = and i32 %25, %3
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = tail call i32 @sc_string_append(i8* %0, i64 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %24
%31 = icmp eq i8* %2, null
br i1 %31, label %35, label %32
32: ; preds = %30
%33 = tail call i32 @sc_string_append(i8* %0, i64 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%34 = tail call i32 @sc_string_append(i8* %0, i64 %1, i8* %2)
br label %35
35: ; preds = %32, %30
ret i8* %0
}