#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 dirent {
  scalar_t__ *d_name;
};

/* Variables and functions */
int /*<<< orphan*/ strtol(scalar_t__ *, char **, int);
int select_numeric_dir(const struct dirent *d) {
  char *endptr = (char *)d->d_name;
  strtol(d->d_name, &endptr, 10);
  if (*(d->d_name) && *endptr)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<select_numeric_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmpq   $0x0,(%rax)
je     1169 <select_numeric_dir+0x59>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1169 <select_numeric_dir+0x59>
movl   $0x0,-0x4(%rbp)
jmp    1170 <select_numeric_dir+0x60>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_numeric_dir>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    (%rbx),%rax
cmpq   $0x0,(%rax)
je     1144 <select_numeric_dir+0x34>
mov    0x8(%rsp),%rcx
xor    %eax,%eax
cmpb   $0x0,(%rcx)
jne    1149 <select_numeric_dir+0x39>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.dirent = type { i64* }
define i32 @select_numeric_dir(%struct.dirent* %0) {
%2 = alloca i32
%3 = alloca %struct.dirent*
%4 = alloca i8*
store %struct.dirent* %0, %struct.dirent** %3
%5 = load %struct.dirent*, %struct.dirent** %3
%6 = getelementptr inbounds %struct.dirent, %struct.dirent* %5, i32 0, i32 0
%7 = load i64*, i64** %6
%8 = bitcast i64* %7 to i8*
store i8* %8, i8** %4
%9 = load %struct.dirent*, %struct.dirent** %3
%10 = getelementptr inbounds %struct.dirent, %struct.dirent* %9, i32 0, i32 0
%11 = load i64*, i64** %10
%12 = call i32 @strtol(i64* %11, i8** %4, i32 10)
%13 = load %struct.dirent*, %struct.dirent** %3
%14 = getelementptr inbounds %struct.dirent, %struct.dirent* %13, i32 0, i32 0
%15 = load i64*, i64** %14
%16 = load i64, i64* %15
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %1
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 0, i32* %2
br label %25
24: ; preds = %18, %1
store i32 1, i32* %2
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
%struct.dirent = type { i64* }
define i32 @select_numeric_dir(%struct.dirent* nocapture %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%5 = bitcast %struct.dirent* %0 to i8**
%6 = load i8*, i8** %5
store i8* %6, i8** %2
%7 = bitcast i8* %6 to i64*
%8 = call i32 @strtol(i64* %7, i8** %2, i32 10)
%9 = load i64*, i64** %4
%10 = load i64, i64* %9
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12, %1
br label %17
17: ; preds = %12, %16
%18 = phi i32 [ 1, %16 ], [ 0, %12 ]
ret i32 %18
}