#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 */
struct tracecmd_recorder {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENODEV;
int /*<<< orphan*/ errno;
struct tracecmd_recorder *tracecmd_create_buffer_recorder_maxkb(char const *,
                                                                int,
                                                                unsigned int,
                                                                char *, int);
char *tracecmd_find_tracing_dir();
struct tracecmd_recorder *tracecmd_create_recorder_maxkb(const char *file,
                                                         int cpu,
                                                         unsigned flags,
                                                         int maxkb) {
  char *tracing;
  tracing = tracecmd_find_tracing_dir();
  if (!tracing) {
    errno = ENODEV;
    return NULL;
  }
  return tracecmd_create_buffer_recorder_maxkb(file, cpu, flags, tracing,
                                               maxkb);
}


x86 assembly (clang, -O0):
<tracecmd_create_recorder_maxkb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <tracecmd_find_tracing_dir@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116a <tracecmd_create_recorder_maxkb+0x4a>
mov    0x2e86(%rip),%rax
mov    (%rax),%ecx
mov    0x2e85(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1185 <tracecmd_create_recorder_maxkb+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1030 <tracecmd_create_buffer_recorder_maxkb@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tracecmd_create_recorder_maxkb>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%rbp
xor    %eax,%eax
call   1040 <tracecmd_find_tracing_dir@plt>
test   %rax,%rax
je     115b <tracecmd_create_recorder_maxkb+0x3b>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %rax,%rcx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <tracecmd_create_buffer_recorder_maxkb@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    0x2e75(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tracecmd_recorder = type { i32 }
@ENODEV = global i32 0
@errno = global i32 0
define %struct.tracecmd_recorder* @tracecmd_create_recorder_maxkb(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.tracecmd_recorder*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = call i8* (...) @tracecmd_find_tracing_dir()
store i8* %11, i8** %10
%12 = load i8*, i8** %10
%13 = icmp ne i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %4
%15 = load i32, i32* @ENODEV
store i32 %15, i32* @errno
store %struct.tracecmd_recorder* null, %struct.tracecmd_recorder** %5
br label %23
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load i8*, i8** %10
%21 = load i32, i32* %9
%22 = call %struct.tracecmd_recorder* @tracecmd_create_buffer_recorder_maxkb(i8* %17, i32 %18, i32 %19, i8* %20, i32 %21)
store %struct.tracecmd_recorder* %22, %struct.tracecmd_recorder** %5
br label %23
23: ; preds = %16, %14
%24 = load %struct.tracecmd_recorder*, %struct.tracecmd_recorder** %5
ret %struct.tracecmd_recorder* %24
}

LLVM IR (-O2):
%struct.tracecmd_recorder = type { i32 }
@ENODEV = global i32 0
@errno = global i32 0
define %struct.tracecmd_recorder* @tracecmd_create_recorder_maxkb(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i8* (...) @tracecmd_find_tracing_dir()
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = load i32, i32* @ENODEV
store i32 %8, i32* @errno
br label %11
9: ; preds = %4
%10 = tail call %struct.tracecmd_recorder* @tracecmd_create_buffer_recorder_maxkb(i8* %0, i32 %1, i32 %2, i8* %5, i32 %3)
br label %11
11: ; preds = %9, %7
%12 = phi %struct.tracecmd_recorder* [ %10, %9 ], [ null, %7 ]
ret %struct.tracecmd_recorder* %12
}