#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 /*<<< orphan*/ PR_GET_DUMPABLE;
int /*<<< orphan*/ PR_SET_DUMPABLE;
int prctl(int /*<<< orphan*/, int, int /*<<< orphan*/, int /*<<< orphan*/,
          int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int ret;
  ret = prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
  printf("PR_GET_DUMPABLE returned %d\n", ret);
  ret = prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
  printf("PR_SET_DUMPABLE returned %d\n", ret);
  ret = prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
  printf("PR_GET_DUMPABLE returned %d\n", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
xor    %r8d,%r8d
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <prctl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <prctl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
xor    %r8d,%r8d
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <prctl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%r14
mov    (%r14),%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <prctl@plt>
lea    0xebd(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <prctl@plt>
lea    0xeaf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%r14),%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <prctl@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@PR_GET_DUMPABLE = global i32 0
@.str = [29 x i8] c"PR_GET_DUMPABLE returned %d\0A\00"
@PR_SET_DUMPABLE = global i32 0
@.str.1 = [29 x i8] c"PR_SET_DUMPABLE returned %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @PR_GET_DUMPABLE
%4 = call i32 @prctl(i32 %3, i32 0, i32 0, i32 0, i32 0)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @PR_SET_DUMPABLE
%8 = call i32 @prctl(i32 %7, i32 1, i32 0, i32 0, i32 0)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @PR_GET_DUMPABLE
%12 = call i32 @prctl(i32 %11, i32 0, i32 0, i32 0, i32 0)
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@PR_GET_DUMPABLE = global i32 0
@.str = [29 x i8] c"PR_GET_DUMPABLE returned %d\0A\00"
@PR_SET_DUMPABLE = global i32 0
@.str.1 = [29 x i8] c"PR_SET_DUMPABLE returned %d\0A\00"
define i32 @main() {
%1 = load i32, i32* @PR_GET_DUMPABLE
%2 = tail call i32 @prctl(i32 %1, i32 0, i32 0, i32 0, i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @PR_SET_DUMPABLE
%5 = tail call i32 @prctl(i32 %4, i32 1, i32 0, i32 0, i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @PR_GET_DUMPABLE
%8 = tail call i32 @prctl(i32 %7, i32 0, i32 0, i32 0, i32 0)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}