#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;
scalar_t__ alloc_noswap(int);
int /*<<< orphan*/ free_noswap(int *, int);
int mlockall(int);
int /*<<< orphan*/ munlockall();
int /*<<< orphan*/ perror(char *);
int main() {
  int *p, ret;
  ret = mlockall(MCL_CURRENT | MCL_FUTURE);
  if (ret < 0)
    perror("mlockall ");
  p = (int *)alloc_noswap(100);
  free_noswap(p, 100);
  munlockall();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    0x2e81(%rip),%rax
or     (%rax),%edi
call   1040 <mlockall@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    118f <main+0x3f>
lea    0xe76(%rip),%rdi
call   1050 <perror@plt>
mov    $0x64,%edi
call   1070 <alloc_noswap@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x64,%esi
call   1030 <free_noswap@plt>
mov    $0x0,%al
call   1060 <munlockall@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2e80(%rip),%rax
mov    0x2e91(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1040 <mlockall@plt>
test   %eax,%eax
js     118e <main+0x3e>
mov    $0x64,%edi
call   1070 <alloc_noswap@plt>
mov    %rax,%rdi
mov    $0x64,%esi
call   1030 <free_noswap@plt>
xor    %eax,%eax
call   1060 <munlockall@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe6b(%rip),%rdi
call   1050 <perror@plt>
jmp    116c <main+0x1c>

LLVM IR (-O0):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [10 x i8] c"mlockall \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @MCL_CURRENT
%5 = load i32, i32* @MCL_FUTURE
%6 = or i32 %4, %5
%7 = call i32 @mlockall(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = call i64 @alloc_noswap(i32 100)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %2
%15 = load i32*, i32** %2
%16 = call i32 @free_noswap(i32* %15, i32 100)
%17 = call i32 (...) @munlockall()
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [10 x i8] c"mlockall \00"
define i32 @main() {
%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 slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = tail call i64 @alloc_noswap(i32 100)
%10 = inttoptr i64 %9 to i32*
%11 = tail call i32 @free_noswap(i32* %10, i32 100)
%12 = tail call i32 (...) @munlockall()
ret i32 0
}