#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 MS_LAZYTIME;
int MS_NOATIME;
int MS_NODEV;
int MS_NOEXEC;
int MS_NOSUID;
scalar_t__ mount(char *, char const *, char *, int const, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int mount_tmpfs(const char *dir) {
  const int flags = MS_LAZYTIME | MS_NOATIME | MS_NODEV | MS_NOSUID | MS_NOEXEC;
  if (mount("tmpfs", dir, "tmpfs", flags, NULL) != 0) {
    perror("mount tmpfs");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<mount_tmpfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    0x2eac(%rip),%rcx
or     (%rcx),%eax
mov    0x2eab(%rip),%rcx
or     (%rcx),%eax
mov    0x2e82(%rip),%rcx
or     (%rcx),%eax
mov    0x2e61(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
lea    0xe9c(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rdx,%rdi
call   1030 <mount@plt>
cmp    $0x0,%rax
je     1199 <mount_tmpfs+0x79>
lea    0xe78(%rip),%rdi
call   1040 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a0 <mount_tmpfs+0x80>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mount_tmpfs>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2eb6(%rip),%rax
or     (%rax),%ecx
mov    0x2e8d(%rip),%rax
or     (%rax),%ecx
mov    %rdi,%rsi
mov    0x2e69(%rip),%rax
or     (%rax),%ecx
lea    0xeae(%rip),%rdi
xor    %ebx,%ebx
mov    %rdi,%rdx
xor    %r8d,%r8d
call   1030 <mount@plt>
test   %rax,%rax
jne    116e <mount_tmpfs+0x4e>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe8b(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%ebx
jmp    116a <mount_tmpfs+0x4a>

LLVM IR (-O0):
@MS_LAZYTIME = global i32 0
@MS_NOATIME = global i32 0
@MS_NODEV = global i32 0
@MS_NOSUID = global i32 0
@MS_NOEXEC = global i32 0
@.str = [6 x i8] c"tmpfs\00"
@.str.1 = [12 x i8] c"mount tmpfs\00"
define i32 @mount_tmpfs(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i32, i32* @MS_LAZYTIME
%6 = load i32, i32* @MS_NOATIME
%7 = or i32 %5, %6
%8 = load i32, i32* @MS_NODEV
%9 = or i32 %7, %8
%10 = load i32, i32* @MS_NOSUID
%11 = or i32 %9, %10
%12 = load i32, i32* @MS_NOEXEC
%13 = or i32 %11, %12
store i32 %13, i32* %4
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15, i32* null)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %1
%19 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %21
20: ; preds = %1
store i32 0, i32* %2
br label %21
21: ; preds = %20, %18
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@MS_LAZYTIME = global i32 0
@MS_NOATIME = global i32 0
@MS_NODEV = global i32 0
@MS_NOSUID = global i32 0
@MS_NOEXEC = global i32 0
@.str = [6 x i8] c"tmpfs\00"
@.str.1 = [12 x i8] c"mount tmpfs\00"
define i32 @mount_tmpfs(i8* %0) {
%2 = load i32, i32* @MS_LAZYTIME
%3 = load i32, i32* @MS_NOATIME
%4 = or i32 %3, %2
%5 = load i32, i32* @MS_NODEV
%6 = or i32 %4, %5
%7 = load i32, i32* @MS_NOSUID
%8 = or i32 %6, %7
%9 = load i32, i32* @MS_NOEXEC
%10 = or i32 %8, %9
%11 = tail call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10, i32* null)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %1
%14 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %1, %13
%16 = phi i32 [ 1, %13 ], [ 0, %1 ]
ret i32 %16
}