#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 get_system_attribute(char *, char *, int *, int *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sysattr_is_readable(char *);
int get_smt_snooze_delay(int *delay, int *inconsistent) {
  if (!sysattr_is_readable("smt_snooze_delay")) {
    perror("Cannot retrieve smt snooze delay");
    return -2;
  }
  return get_system_attribute("smt_snooze_delay", "%d", delay, inconsistent);
}


x86 assembly (clang, -O0):
<get_smt_snooze_delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <sysattr_is_readable@plt>
cmp    $0x0,%eax
jne    116d <get_smt_snooze_delay+0x3d>
lea    0xeb5(%rip),%rdi
call   1040 <perror@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    118b <get_smt_snooze_delay+0x5b>
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe84(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1050 <get_system_attribute@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_smt_snooze_delay>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
call   1030 <sysattr_is_readable@plt>
test   %eax,%eax
je     116a <get_smt_snooze_delay+0x3a>
lea    0xeaf(%rip),%rdi
lea    0xeda(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <get_system_attribute@plt>
lea    0xea0(%rip),%rdi
call   1040 <perror@plt>
mov    $0xfffffffe,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"smt_snooze_delay\00"
@.str.1 = [33 x i8] c"Cannot retrieve smt snooze delay\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @get_smt_snooze_delay(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = call i32 @sysattr_is_readable(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
store i32 -2, i32* %3
br label %14
10: ; preds = %2
%11 = load i32*, i32** %4
%12 = load i32*, i32** %5
%13 = call i32 @get_system_attribute(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %11, i32* %12)
store i32 %13, i32* %3
br label %14
14: ; preds = %10, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [17 x i8] c"smt_snooze_delay\00"
@.str.1 = [33 x i8] c"Cannot retrieve smt snooze delay\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @get_smt_snooze_delay(i32* %0, i32* %1) {
%3 = tail call i32 @sysattr_is_readable(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 @get_system_attribute(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %0, i32* %1)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %8, %7 ], [ -2, %5 ]
ret i32 %10
}