#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 set_ftrace_enable(char *, int);
int set_ftrace_proc(int);
char *tracecmd_get_tracing_file(char *);
int /*<<< orphan*/ tracecmd_put_tracing_file(char *);
int set_ftrace(int set, int use_proc) {
  char *path;
  int ret;
  path = tracecmd_get_tracing_file("options/function-trace");
  ret = set_ftrace_enable(path, set);
  tracecmd_put_tracing_file(path);
  if (ret < 0 || set || use_proc)
    ret = set_ftrace_proc(set);
  return 0;
}


x86 assembly (clang, -O0):
<set_ftrace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xeab(%rip),%rdi
call   1050 <tracecmd_get_tracing_file@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1060 <set_ftrace_enable@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <tracecmd_put_tracing_file@plt>
cmpl   $0x0,-0x14(%rbp)
jl     1194 <set_ftrace+0x54>
cmpl   $0x0,-0x4(%rbp)
jne    1194 <set_ftrace+0x54>
cmpl   $0x0,-0x8(%rbp)
je     119f <set_ftrace+0x5f>
mov    -0x4(%rbp),%edi
call   1040 <set_ftrace_proc@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ftrace>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%r15d
lea    0xead(%rip),%rdi
call   1050 <tracecmd_get_tracing_file@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15d,%esi
call   1060 <set_ftrace_enable@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <tracecmd_put_tracing_file@plt>
or     %r15d,%ebp
jne    117b <set_ftrace+0x3b>
test   %r14d,%r14d
jns    1183 <set_ftrace+0x43>
mov    %r15d,%edi
call   1040 <set_ftrace_proc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"options/function-trace\00"
define i32 @set_ftrace(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i8* @tracecmd_get_tracing_file(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i32, i32* %3
%10 = call i32 @set_ftrace_enable(i8* %8, i32 %9)
store i32 %10, i32* %6
%11 = load i8*, i8** %5
%12 = call i32 @tracecmd_put_tracing_file(i8* %11)
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %2
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18, %15, %2
%22 = load i32, i32* %3
%23 = call i32 @set_ftrace_proc(i32 %22)
store i32 %23, i32* %6
br label %24
24: ; preds = %21, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"options/function-trace\00"
define i32 @set_ftrace(i32 %0, i32 %1) {
%3 = tail call i8* @tracecmd_get_tracing_file(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @set_ftrace_enable(i8* %3, i32 %0)
%5 = tail call i32 @tracecmd_put_tracing_file(i8* %3)
%6 = icmp slt i32 %4, 0
%7 = or i32 %1, %0
%8 = icmp ne i32 %7, 0
%9 = or i1 %8, %6
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @set_ftrace_proc(i32 %0)
br label %12
12: ; preds = %2, %10
ret i32 0
}