#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 */
unsigned long MS_PRIVATE;
unsigned long MS_REC;
unsigned long MS_SHARED;
unsigned long MS_SLAVE;
int file_bind(char *, char *, unsigned long, unsigned long, unsigned long);
int eslib_file_bind(char *src, char *dest, unsigned long mntflags,
                    unsigned long esflags) {
  unsigned long propflags;
  if (esflags & 2)
    propflags = MS_SLAVE;
  else if (esflags & 1)
    propflags = MS_SHARED;
  else
    propflags = MS_PRIVATE;
  if (!(esflags & 4))
    propflags |= MS_REC;
  return file_bind(src, dest, mntflags, propflags, esflags);
}


x86 assembly (clang, -O0):
<eslib_file_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     114d <eslib_file_bind+0x3d>
mov    0x2e87(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1185 <eslib_file_bind+0x75>
mov    -0x20(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1172 <eslib_file_bind+0x62>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1180 <eslib_file_bind+0x70>
mov    0x2e57(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1185 <eslib_file_bind+0x75>
mov    -0x20(%rbp),%rax
and    $0x4,%rax
cmp    $0x0,%rax
jne    11a9 <eslib_file_bind+0x99>
mov    0x2e42(%rip),%rax
mov    (%rax),%rax
or     -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <file_bind@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eslib_file_bind>:
mov    %rcx,%r8
test   $0x1,%r8b
jne    1128 <eslib_file_bind+0x18>
mov    0x2eb0(%rip),%rax
test   $0x2,%r8b
jne    1135 <eslib_file_bind+0x25>
jmp    113c <eslib_file_bind+0x2c>
mov    0x2eb9(%rip),%rax
test   $0x2,%r8b
je     113c <eslib_file_bind+0x2c>
mov    0x2e8c(%rip),%rax
test   $0x4,%r8b
jne    1154 <eslib_file_bind+0x44>
mov    0x2e97(%rip),%rcx
mov    (%rcx),%rcx
or     (%rax),%rcx
jmp    1030 <file_bind@plt>
xor    %ecx,%ecx
or     (%rax),%rcx
jmp    1030 <file_bind@plt>

LLVM IR (-O0):
@MS_SLAVE = global i64 0
@MS_SHARED = global i64 0
@MS_PRIVATE = global i64 0
@MS_REC = global i64 0
define i32 @eslib_file_bind(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i64, i64* %8
%11 = and i64 %10, 2
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = load i64, i64* @MS_SLAVE
store i64 %14, i64* %9
br label %24
15: ; preds = %4
%16 = load i64, i64* %8
%17 = and i64 %16, 1
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i64, i64* @MS_SHARED
store i64 %20, i64* %9
br label %23
21: ; preds = %15
%22 = load i64, i64* @MS_PRIVATE
store i64 %22, i64* %9
br label %23
23: ; preds = %21, %19
br label %24
24: ; preds = %23, %13
%25 = load i64, i64* %8
%26 = and i64 %25, 4
%27 = icmp ne i64 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i64, i64* @MS_REC
%30 = load i64, i64* %9
%31 = or i64 %30, %29
store i64 %31, i64* %9
br label %32
32: ; preds = %28, %24
%33 = load i8*, i8** %5
%34 = load i8*, i8** %6
%35 = load i64, i64* %7
%36 = load i64, i64* %9
%37 = load i64, i64* %8
%38 = call i32 @file_bind(i8* %33, i8* %34, i64 %35, i64 %36, i64 %37)
ret i32 %38
}

LLVM IR (-O2):
@MS_SLAVE = global i64 0
@MS_SHARED = global i64 0
@MS_PRIVATE = global i64 0
@MS_REC = global i64 0
define i32 @eslib_file_bind(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = and i64 %3, 2
%6 = icmp eq i64 %5, 0
%7 = and i64 %3, 1
%8 = icmp eq i64 %7, 0
%9 = load i64, i64* @MS_PRIVATE
%10 = load i64, i64* @MS_SHARED
%11 = select i1 %8, i64 %9, i64 %10
%12 = load i64, i64* @MS_SLAVE
%13 = select i1 %6, i64 %11, i64 %12
%14 = and i64 %3, 4
%15 = icmp eq i64 %14, 0
%16 = load i64, i64* @MS_REC
%17 = select i1 %15, i64 %16, i64 0
%18 = or i64 %17, %13
%19 = tail call i32 @file_bind(i8* %0, i8* %1, i64 %2, i64 %18, i64 %3)
ret i32 %19
}