#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 MCL_CURRENT;
int MCL_FUTURE;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int mlockall(int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void lock_memory() {
  if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
    do {
      fprintf(stderr,
              "mlockall"
              ": %s\n",
              strerror(errno));
      fflush(stderr);
      abort();
    } while (0);
}


x86 assembly (clang, -O0):
<lock_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    0x2e88(%rip),%rax
or     (%rax),%edi
call   1060 <mlockall@plt>
cmp    $0xffffffff,%eax
jne    11be <lock_memory+0x6e>
jmp    117d <lock_memory+0x2d>
mov    0x2e54(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lock_memory>:
push   %r14
push   %rbx
push   %rax
mov    0x2e6d(%rip),%rax
mov    0x2e8e(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1060 <mlockall@plt>
cmp    $0xffffffff,%eax
je     1178 <lock_memory+0x28>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e59(%rip),%r14
mov    (%r14),%ebx
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe69(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    (%r14),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"mlockall: %s\0A\00"
@errno = global i32 0
define void @lock_memory() {
%1 = load i32, i32* @MCL_CURRENT
%2 = load i32, i32* @MCL_FUTURE
%3 = or i32 %1, %2
%4 = call i32 @mlockall(i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %16
6: ; preds = %0
br label %7
7: ; preds = %6
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = call i8* @strerror(i32 %9)
%11 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @stderr
%13 = call i32 @fflush(i32 %12)
%14 = call i32 (...) @abort()
unreachable
15: ; No predecessors!
br label %16
16: ; preds = %15, %0
ret void
}

LLVM IR (-O2):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"mlockall: %s\0A\00"
@errno = global i32 0
define void @lock_memory() {
%1 = load i32, i32* @MCL_CURRENT
%2 = load i32, i32* @MCL_FUTURE
%3 = or i32 %2, %1
%4 = tail call i32 @mlockall(i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @stderr
%12 = tail call i32 @fflush(i32 %11)
%13 = tail call i32 (...) @abort()
unreachable
14: ; preds = %0
ret void
}