#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*/ die(char *, char *);
int set_ftrace_enable(char const *, int);
int set_ftrace_proc(int set) {
  const char *path = "/proc/sys/kernel/ftrace_enabled";
  int ret;
  ret = set_ftrace_enable(path, set);
  if (ret == -1)
    die("Can't %s ftrace", set ? "enable" : "disable");
  return ret;
}


x86 assembly (clang, -O0):
<set_ftrace_proc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <set_ftrace_enable@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1173 <set_ftrace_proc+0x53>
mov    -0x4(%rbp),%ecx
lea    0xede(%rip),%rsi
lea    0xed0(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xeb2(%rip),%rdi
call   1030 <die@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ftrace_proc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xed4(%rip),%rdi
mov    %ebp,%esi
call   1040 <set_ftrace_enable@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    115a <set_ftrace_proc+0x3a>
test   %ebp,%ebp
lea    0xef4(%rip),%rax
lea    0xee6(%rip),%rsi
cmove  %rax,%rsi
lea    0xecb(%rip),%rdi
call   1030 <die@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"/proc/sys/kernel/ftrace_enabled\00"
@.str.1 = [16 x i8] c"Can't %s ftrace\00"
@.str.2 = [7 x i8] c"enable\00"
@.str.3 = [8 x i8] c"disable\00"
define i32 @set_ftrace_proc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i32 %0, i32* %2
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* %2
%7 = call i32 @set_ftrace_enable(i8* %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %16
10: ; preds = %1
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0)
%15 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %10, %1
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
@.str = [32 x i8] c"/proc/sys/kernel/ftrace_enabled\00"
@.str.1 = [16 x i8] c"Can't %s ftrace\00"
@.str.2 = [7 x i8] c"enable\00"
@.str.3 = [8 x i8] c"disable\00"
define i32 @set_ftrace_proc(i32 %0) {
%2 = tail call i32 @set_ftrace_enable(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = icmp eq i32 %0, 0
%6 = select i1 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %4, %1
ret i32 %2
}