#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 dirent64 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __opendirat(int, char const *);
int __scandir64_tail(int /*<<< orphan*/, struct dirent64 ***,
                     int (*)(struct dirent64 const *),
                     int (*)(struct dirent64 const **,
                             struct dirent64 const **));
int scandirat64(int dfd, const char *dir, struct dirent64 ***namelist,
                int (*select)(const struct dirent64 *),
                int (*cmp)(const struct dirent64 **,
                           const struct dirent64 **)) {
  return __scandir64_tail(__opendirat(dfd, dir), namelist, select, cmp);
}


x86 assembly (clang, -O0):
<scandirat64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <__opendirat@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <__scandir64_tail@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scandirat64>:
push   %r15
push   %r14
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
call   1030 <__opendirat@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <__scandir64_tail@plt>

LLVM IR (-O0):
%struct.dirent64 = type { i32 }
define i32 @scandirat64(i32 %0, i8* %1, %struct.dirent64*** %2, i32 (%struct.dirent64*)* %3, i32 (%struct.dirent64**, %struct.dirent64**)* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.dirent64***
%9 = alloca i32 (%struct.dirent64*)*
%10 = alloca i32 (%struct.dirent64**, %struct.dirent64**)*
store i32 %0, i32* %6
store i8* %1, i8** %7
store %struct.dirent64*** %2, %struct.dirent64**** %8
store i32 (%struct.dirent64*)* %3, i32 (%struct.dirent64*)** %9
store i32 (%struct.dirent64**, %struct.dirent64**)* %4, i32 (%struct.dirent64**, %struct.dirent64**)** %10
%11 = load i32, i32* %6
%12 = load i8*, i8** %7
%13 = call i32 @__opendirat(i32 %11, i8* %12)
%14 = load %struct.dirent64***, %struct.dirent64**** %8
%15 = load i32 (%struct.dirent64*)*, i32 (%struct.dirent64*)** %9
%16 = load i32 (%struct.dirent64**, %struct.dirent64**)*, i32 (%struct.dirent64**, %struct.dirent64**)** %10
%17 = call i32 @__scandir64_tail(i32 %13, %struct.dirent64*** %14, i32 (%struct.dirent64*)* %15, i32 (%struct.dirent64**, %struct.dirent64**)* %16)
ret i32 %17
}

LLVM IR (-O2):
%struct.dirent64 = type { i32 }
define i32 @scandirat64(i32 %0, i8* %1, %struct.dirent64*** %2, i32 (%struct.dirent64*)* %3, i32 (%struct.dirent64**, %struct.dirent64**)* %4) {
%6 = tail call i32 @__opendirat(i32 %0, i8* %1)
%7 = tail call i32 @__scandir64_tail(i32 %6, %struct.dirent64*** %2, i32 (%struct.dirent64*)* %3, i32 (%struct.dirent64**, %struct.dirent64**)* %4)
ret i32 %7
}