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

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int my_scandirat(int /*<<< orphan*/, char const *, struct bionic_dirent ***,
                 int (*)(struct bionic_dirent const *),
                 int (*)(struct bionic_dirent const **,
                         struct bionic_dirent const **));
int my_scandir(const char *dir, struct bionic_dirent ***namelist,
               int (*filter)(const struct bionic_dirent *),
               int (*compar)(const struct bionic_dirent **,
                             const struct bionic_dirent **)) {
  return my_scandirat(AT_FDCWD, dir, namelist, filter, compar);
}


x86 assembly (clang, -O0):
<my_scandir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <my_scandirat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_scandir>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
jmp    1030 <my_scandirat@plt>

LLVM IR (-O0):
%struct.bionic_dirent = type { i32 }
@AT_FDCWD = global i32 0
define i32 @my_scandir(i8* %0, %struct.bionic_dirent*** %1, i32 (%struct.bionic_dirent*)* %2, i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)* %3) {
%5 = alloca i8*
%6 = alloca %struct.bionic_dirent***
%7 = alloca i32 (%struct.bionic_dirent*)*
%8 = alloca i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)*
store i8* %0, i8** %5
store %struct.bionic_dirent*** %1, %struct.bionic_dirent**** %6
store i32 (%struct.bionic_dirent*)* %2, i32 (%struct.bionic_dirent*)** %7
store i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)* %3, i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)** %8
%9 = load i32, i32* @AT_FDCWD
%10 = load i8*, i8** %5
%11 = load %struct.bionic_dirent***, %struct.bionic_dirent**** %6
%12 = load i32 (%struct.bionic_dirent*)*, i32 (%struct.bionic_dirent*)** %7
%13 = load i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)*, i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)** %8
%14 = call i32 @my_scandirat(i32 %9, i8* %10, %struct.bionic_dirent*** %11, i32 (%struct.bionic_dirent*)* %12, i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)* %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.bionic_dirent = type { i32 }
@AT_FDCWD = global i32 0
define i32 @my_scandir(i8* %0, %struct.bionic_dirent*** %1, i32 (%struct.bionic_dirent*)* %2, i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)* %3) {
%5 = load i32, i32* @AT_FDCWD
%6 = tail call i32 @my_scandirat(i32 %5, i8* %0, %struct.bionic_dirent*** %1, i32 (%struct.bionic_dirent*)* %2, i32 (%struct.bionic_dirent**, %struct.bionic_dirent**)* %3)
ret i32 %6
}