#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*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ SIG_SETMASK;
scalar_t__ chdir(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execl(char *, char *, char *, char *, char *, char const *,
                         char *, char const *, char const *, char const *,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ geteuid();
char *mkdtemp(char *);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int waitpid(int, int *, int /*<<< orphan*/);
int add_mount_legacy(const char *progname, const char *fsname, const char *mnt,
                     const char *type, const char *opts) {
  int res;
  int status;
  sigset_t blockmask;
  sigset_t oldmask;
  sigemptyset(&blockmask);
  sigaddset(&blockmask, SIGCHLD);
  res = sigprocmask(SIG_BLOCK, &blockmask, &oldmask);
  if (res == -1) {
    fprintf(stderr, "%s: sigprocmask: %s\n", progname, strerror(errno));
    return -1;
  }
  res = fork();
  if (res == -1) {
    fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno));
    goto out_restore;
  }
  if (res == 0) {
    char templ[] = "/tmp/fusermountXXXXXX";
    char *tmp;
    sigprocmask(SIG_SETMASK, &oldmask, NULL);
    setuid(geteuid());
    tmp = mkdtemp(templ);
    if (!tmp) {
      fprintf(stderr, "%s: failed to create temporary directory\n", progname);
      exit(1);
    }
    if (chdir(tmp)) {
      fprintf(stderr, "%s: failed to chdir to %s: %s\n", progname, tmp,
              strerror(errno));
      exit(1);
    }
    rmdir(tmp);
    execl("/bin/mount", "/bin/mount", "-i", "-f", "-t", type, "-o", opts,
          fsname, mnt, NULL);
    fprintf(stderr, "%s: failed to execute /bin/mount: %s\n", progname,
            strerror(errno));
    exit(1);
  }
  res = waitpid(res, &status, 0);
  if (res == -1)
    fprintf(stderr, "%s: waitpid: %s\n", progname, strerror(errno));
  if (status != 0)
    res = -1;
out_restore:
  sigprocmask(SIG_SETMASK, &oldmask, NULL);
  return res;
}


x86 assembly (clang, -O0):
<add_mount_legacy>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xe8,%rsp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
lea    -0x44(%rbp),%rdi
call   1080 <sigemptyset@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
lea    -0x44(%rbp),%rdi
call   10f0 <sigaddset@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    -0x44(%rbp),%rsi
lea    -0x48(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1284 <add_mount_legacy+0xa4>
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %rax,%rcx
lea    0xd8f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0xc(%rbp)
jmp    152c <add_mount_legacy+0x34c>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    12dd <add_mount_legacy+0xfd>
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %rax,%rcx
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1510 <add_mount_legacy+0x330>
cmpl   $0x0,-0x3c(%rbp)
jne    1499 <add_mount_legacy+0x2b9>
mov    0xdd2(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xdcf(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xdcd(%rip),%eax
mov    %eax,-0x50(%rbp)
mov    0xdc7(%rip),%ax
mov    %ax,-0x4c(%rbp)
mov    0x2cd0(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    $0x0,%al
call   1060 <geteuid@plt>
mov    %eax,%edi
call   10c0 <setuid@plt>
lea    -0x60(%rbp),%rdi
call   1090 <mkdtemp@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    1372 <add_mount_legacy+0x192>
mov    0x2c7c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xcc2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x68(%rbp),%rdi
call   1050 <chdir@plt>
cmp    $0x0,%rax
je     13e7 <add_mount_legacy+0x207>
mov    0x2c44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    0x2c17(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rdx
mov    -0x90(%rbp),%rcx
mov    %rax,%r8
lea    0xc77(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x68(%rbp),%rdi
call   1040 <rmdir@plt>
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%r11
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
lea    0xc65(%rip),%rsi
lea    0xc69(%rip),%rdx
lea    0xc65(%rip),%rcx
lea    0xc61(%rip),%r8
lea    0xc5d(%rip),%rbx
xor    %edi,%edi
mov    %rsi,%rdi
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
call   10e0 <execl@plt>
mov    0x2b80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    0x2b5e(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0xac(%rbp),%edi
mov    -0xa8(%rbp),%rdx
mov    %rax,%rcx
lea    0xbfb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x3c(%rbp),%edi
lea    -0x40(%rbp),%rsi
xor    %edx,%edx
call   10a0 <waitpid@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    14fa <add_mount_legacy+0x31a>
mov    0x2b15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    0x2af3(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0xbc(%rbp),%edi
mov    -0xb8(%rbp),%rdx
mov    %rax,%rcx
lea    0xbb6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
cmpl   $0x0,-0x40(%rbp)
je     150b <add_mount_legacy+0x32b>
movl   $0xffffffff,-0x3c(%rbp)
jmp    1510 <add_mount_legacy+0x330>
mov    0x2ad1(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xe8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_mount_legacy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%r15
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <sigemptyset@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   10f0 <sigaddset@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rdx
mov    %rbp,%rsi
call   1030 <sigprocmask@plt>
cmp    $0xffffffff,%eax
je     129e <add_mount_legacy+0xbe>
xor    %eax,%eax
call   1100 <fork@plt>
cmp    $0xffffffff,%eax
je     12d2 <add_mount_legacy+0xf2>
test   %eax,%eax
je     132a <add_mount_legacy+0x14a>
lea    0x10(%rsp),%rsi
xor    %r14d,%r14d
mov    %eax,%edi
xor    %edx,%edx
call   10a0 <waitpid@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1293 <add_mount_legacy+0xb3>
mov    0x2d63(%rip),%rax
mov    (%rax),%ebp
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xe25(%rip),%rsi
mov    %ebp,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
cmp    0x10(%rsp),%r14d
sbb    %ebp,%ebp
or     %ebx,%ebp
jmp    1304 <add_mount_legacy+0x124>
mov    0x2d2b(%rip),%rax
mov    (%rax),%ebx
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xd44(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    1319 <add_mount_legacy+0x139>
mov    0x2cf7(%rip),%rax
mov    (%rax),%ebx
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xd25(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movaps 0xd8f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x58585858585874,%rax
mov    %rax,0x1e(%rsp)
mov    0x2c9c(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
xor    %eax,%eax
call   1060 <geteuid@plt>
mov    %eax,%edi
call   10c0 <setuid@plt>
lea    0x10(%rsp),%rdi
call   1090 <mkdtemp@plt>
test   %rax,%rax
jne    139b <add_mount_legacy+0x1bb>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
lea    0xc9c(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1050 <chdir@plt>
test   %rax,%rax
jne    1429 <add_mount_legacy+0x249>
mov    %rbp,%rdi
call   1040 <rmdir@plt>
sub    $0x8,%rsp
lea    0xcc2(%rip),%rax
lea    0xca7(%rip),%rdi
lea    0xcab(%rip),%rdx
lea    0xca7(%rip),%rcx
lea    0xca3(%rip),%r8
mov    %rdi,%rsi
mov    %rbx,%r9
push   $0x0
push   %r13
push   %r12
push   %r14
push   %rax
call   10e0 <execl@plt>
add    $0x30,%rsp
mov    0x2bd7(%rip),%rax
mov    (%rax),%ebx
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xc73(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x2ba0(%rip),%rax
mov    (%rax),%ebx
mov    0x2b8f(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xc06(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@SIGCHLD = global i32 0
@SIG_BLOCK = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"%s: sigprocmask: %s\0A\00"
@errno = global i32 0
@.str.1 = [14 x i8] c"%s: fork: %s\0A\00"
@__const.add_mount_legacy.templ = [22 x i8] c"/tmp/fusermountXXXXXX\00"
@SIG_SETMASK = global i32 0
@.str.2 = [42 x i8] c"%s: failed to create temporary directory\0A\00"
@.str.3 = [31 x i8] c"%s: failed to chdir to %s: %s\0A\00"
@.str.4 = [11 x i8] c"/bin/mount\00"
@.str.5 = [3 x i8] c"-i\00"
@.str.6 = [3 x i8] c"-f\00"
@.str.7 = [3 x i8] c"-t\00"
@.str.8 = [3 x i8] c"-o\00"
@.str.9 = [38 x i8] c"%s: failed to execute /bin/mount: %s\0A\00"
@.str.10 = [17 x i8] c"%s: waitpid: %s\0A\00"
define i32 @add_mount_legacy(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [22 x i8]
%17 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
%18 = call i32 @sigemptyset(i32* %14)
%19 = load i32, i32* @SIGCHLD
%20 = call i32 @sigaddset(i32* %14, i32 %19)
%21 = load i32, i32* @SIG_BLOCK
%22 = call i32 @sigprocmask(i32 %21, i32* %14, i32* %15)
store i32 %22, i32* %12
%23 = load i32, i32* %12
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %31
25: ; preds = %5
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %7
%28 = load i32, i32* @errno
%29 = call i8* @strerror(i32 %28)
%30 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %27, i8* %29)
store i32 -1, i32* %6
br label %105
31: ; preds = %5
%32 = call i32 (...) @fork()
store i32 %32, i32* %12
%33 = load i32, i32* %12
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %41
35: ; preds = %31
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %7
%38 = load i32, i32* @errno
%39 = call i8* @strerror(i32 %38)
%40 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %37, i8* %39)
br label %101
41: ; preds = %31
%42 = load i32, i32* %12
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %85
44: ; preds = %41
%45 = bitcast [22 x i8]* %16 to i8*
%46 = load i32, i32* @SIG_SETMASK
%47 = call i32 @sigprocmask(i32 %46, i32* %15, i32* null)
%48 = call i32 (...) @geteuid()
%49 = call i32 @setuid(i32 %48)
%50 = getelementptr inbounds [22 x i8], [22 x i8]* %16, i64 0, i64 0
%51 = call i8* @mkdtemp(i8* %50)
store i8* %51, i8** %17
%52 = load i8*, i8** %17
%53 = icmp ne i8* %52, null
br i1 %53, label %59, label %54
54: ; preds = %44
%55 = load i32, i32* @stderr
%56 = load i8*, i8** %7
%57 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %44
%60 = load i8*, i8** %17
%61 = call i64 @chdir(i8* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %71
63: ; preds = %59
%64 = load i32, i32* @stderr
%65 = load i8*, i8** %7
%66 = load i8*, i8** %17
%67 = load i32, i32* @errno
%68 = call i8* @strerror(i32 %67)
%69 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %65, i8* %66, i8* %68)
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %59
%72 = load i8*, i8** %17
%73 = call i32 @rmdir(i8* %72)
%74 = load i8*, i8** %10
%75 = load i8*, i8** %11
%76 = load i8*, i8** %8
%77 = load i8*, i8** %9
%78 = call i32 @execl(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %75, i8* %76, i8* %77, i32* null)
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %7
%81 = load i32, i32* @errno
%82 = call i8* @strerror(i32 %81)
%83 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %80, i8* %82)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %41
%86 = load i32, i32* %12
%87 = call i32 @waitpid(i32 %86, i32* %13, i32 0)
store i32 %87, i32* %12
%88 = load i32, i32* %12
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %96
90: ; preds = %85
%91 = load i32, i32* @stderr
%92 = load i8*, i8** %7
%93 = load i32, i32* @errno
%94 = call i8* @strerror(i32 %93)
%95 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %92, i8* %94)
br label %96
96: ; preds = %90, %85
%97 = load i32, i32* %13
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %100
99: ; preds = %96
store i32 -1, i32* %12
br label %100
100: ; preds = %99, %96
br label %101
101: ; preds = %100, %35
%102 = load i32, i32* @SIG_SETMASK
%103 = call i32 @sigprocmask(i32 %102, i32* %15, i32* null)
%104 = load i32, i32* %12
store i32 %104, i32* %6
br label %105
105: ; preds = %101, %25
%106 = load i32, i32* %6
ret i32 %106
}

LLVM IR (-O2):
@SIGCHLD = global i32 0
@SIG_BLOCK = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"%s: sigprocmask: %s\0A\00"
@errno = global i32 0
@.str.1 = [14 x i8] c"%s: fork: %s\0A\00"
@__const.add_mount_legacy.templ = [22 x i8] c"/tmp/fusermountXXXXXX\00"
@SIG_SETMASK = global i32 0
@.str.2 = [42 x i8] c"%s: failed to create temporary directory\0A\00"
@.str.3 = [31 x i8] c"%s: failed to chdir to %s: %s\0A\00"
@.str.4 = [11 x i8] c"/bin/mount\00"
@.str.5 = [3 x i8] c"-i\00"
@.str.6 = [3 x i8] c"-f\00"
@.str.7 = [3 x i8] c"-t\00"
@.str.8 = [3 x i8] c"-o\00"
@.str.9 = [38 x i8] c"%s: failed to execute /bin/mount: %s\0A\00"
@.str.10 = [17 x i8] c"%s: waitpid: %s\0A\00"
define i32 @add_mount_legacy(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [22 x i8]
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = bitcast i32* %8 to i8*
%13 = call i32 @sigemptyset(i32* %7)
%14 = load i32, i32* @SIGCHLD
%15 = call i32 @sigaddset(i32* %7, i32 %14)
%16 = load i32, i32* @SIG_BLOCK
%17 = call i32 @sigprocmask(i32 %16, i32* %7, i32* %8)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %24
19: ; preds = %5
%20 = load i32, i32* @stderr
%21 = load i32, i32* @errno
%22 = call i8* @strerror(i32 %21)
%23 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %22)
br label %76
24: ; preds = %5
%25 = call i32 (...) @fork()
switch i32 %25, label %60 [
i32 -1, label %26
i32 0, label %31
]
26: ; preds = %24
%27 = load i32, i32* @stderr
%28 = load i32, i32* @errno
%29 = call i8* @strerror(i32 %28)
%30 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %29)
br label %72
31: ; preds = %24
%32 = getelementptr inbounds [22 x i8], [22 x i8]* %9, i64 0, i64 0
%33 = load i32, i32* @SIG_SETMASK
%34 = call i32 @sigprocmask(i32 %33, i32* %8, i32* null)
%35 = call i32 (...) @geteuid()
%36 = call i32 @setuid(i32 %35)
%37 = call i8* @mkdtemp(i8* %32)
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %43
39: ; preds = %31
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %31
%44 = call i64 @chdir(i8* %37)
%45 = icmp eq i64 %44, 0
br i1 %45, label %52, label %46
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %37, i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %43
%53 = call i32 @rmdir(i8* %37)
%54 = call i32 @execl(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %4, i8* %1, i8* %2, i32* null)
%55 = load i32, i32* @stderr
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %0, i8* %57)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %24
%61 = call i32 @waitpid(i32 %25, i32* %6, i32 0)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %68
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %0, i8* %66)
br label %68
68: ; preds = %63, %60
%69 = load i32, i32* %6
%70 = icmp eq i32 %69, 0
%71 = select i1 %70, i32 %61, i32 -1
br label %72
72: ; preds = %68, %26
%73 = phi i32 [ -1, %26 ], [ %71, %68 ]
%74 = load i32, i32* @SIG_SETMASK
%75 = call i32 @sigprocmask(i32 %74, i32* %8, i32* null)
br label %76
76: ; preds = %72, %19
%77 = phi i32 [ -1, %19 ], [ %73, %72 ]
ret i32 %77
}