#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*/ fprintf(int /*<<< orphan*/, char *, int);
int get_paranoid_setting();
int /*<<< orphan*/ stderr;
int check_paranoid_setting(int desired, int quiet) {
  int paranoid;
  paranoid = get_paranoid_setting();
  if (paranoid > desired) {
    if (!quiet) {
      fprintf(stderr,
              "Value of %d in /proc/sys/kernel/perf_event_paranoid too high "
              "for this test to run!\n",
              paranoid);
    }
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_paranoid_setting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <get_paranoid_setting@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1172 <check_paranoid_setting+0x52>
cmpl   $0x0,-0xc(%rbp)
jne    1166 <check_paranoid_setting+0x46>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xe9f(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1179 <check_paranoid_setting+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_paranoid_setting>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <get_paranoid_setting@plt>
cmp    %ebp,%eax
jle    1157 <check_paranoid_setting+0x37>
mov    $0xffffffff,%ebx
test   %r14d,%r14d
jne    1157 <check_paranoid_setting+0x37>
mov    0x2e99(%rip),%rcx
mov    (%rcx),%edi
lea    0xeb0(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [84 x i8] c"Value of %d in /proc/sys/kernel/perf_event_paranoid too high for this test to run!\0A\00"
define i32 @check_paranoid_setting(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = call i32 (...) @get_paranoid_setting()
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = load i32, i32* %6
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %11
store i32 -1, i32* %3
br label %20
19: ; preds = %2
store i32 0, i32* %3
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [84 x i8] c"Value of %d in /proc/sys/kernel/perf_event_paranoid too high for this test to run!\0A\00"
define i32 @check_paranoid_setting(i32 %0, i32 %1) {
%3 = tail call i32 (...) @get_paranoid_setting()
%4 = icmp sgt i32 %3, %0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = icmp eq i32 %1, 0
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %10
10: ; preds = %2, %5, %7
%11 = phi i32 [ -1, %7 ], [ -1, %5 ], [ 0, %2 ]
ret i32 %11
}