#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(char const *, int,
                                                          unsigned int, char *);
char *tracecmd_find_tracing_dir();
struct tracecmd_recorder *tracecmd_create_recorder(const char *file, int cpu,
                                                   unsigned flags) {
  char *tracing;
  tracing = tracecmd_find_tracing_dir();
  if (!tracing) {
    errno = ENODEV;
    return NULL;
  }
  return tracecmd_create_buffer_recorder(file, cpu, flags, tracing);
}


x86 assembly (clang, -O0):
<tracecmd_create_recorder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <tracecmd_find_tracing_dir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1167 <tracecmd_create_recorder+0x47>
mov    0x2e89(%rip),%rax
mov    (%rax),%ecx
mov    0x2e88(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    117e <tracecmd_create_recorder+0x5e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1030 <tracecmd_create_buffer_recorder@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tracecmd_create_recorder>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <tracecmd_find_tracing_dir@plt>
test   %rax,%rax
je     114c <tracecmd_create_recorder+0x2c>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %rax,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <tracecmd_create_buffer_recorder@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
mov    0x2e84(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
pop    %rbx
pop    %r14
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(i8* %0, i32 %1, i32 %2) {
%4 = alloca %struct.tracecmd_recorder*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = call i8* (...) @tracecmd_find_tracing_dir()
store i8* %9, i8** %8
%10 = load i8*, i8** %8
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = load i32, i32* @ENODEV
store i32 %13, i32* @errno
store %struct.tracecmd_recorder* null, %struct.tracecmd_recorder** %4
br label %20
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i8*, i8** %8
%19 = call %struct.tracecmd_recorder* @tracecmd_create_buffer_recorder(i8* %15, i32 %16, i32 %17, i8* %18)
store %struct.tracecmd_recorder* %19, %struct.tracecmd_recorder** %4
br label %20
20: ; preds = %14, %12
%21 = load %struct.tracecmd_recorder*, %struct.tracecmd_recorder** %4
ret %struct.tracecmd_recorder* %21
}

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