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

/* Variables and functions */
scalar_t__ isdigit(char);
int test_filter(const struct dirent *p) {
  return ((p->d_name[0] == 'T' || p->d_name[0] == 'D') &&
          isdigit(p->d_name[1]) && isdigit(p->d_name[2]));
}


x86 assembly (clang, -O0):
<test_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x54,%eax
je     1147 <test_filter+0x37>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x44,%ecx
mov    %al,-0x9(%rbp)
jne    1183 <test_filter+0x73>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1183 <test_filter+0x73>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl 0x2(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_filter>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rax
mov    (%rax),%cl
xor    %ebx,%ebx
or     $0x10,%cl
cmp    $0x54,%cl
jne    1148 <test_filter+0x38>
mov    %rdi,%r14
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1148 <test_filter+0x38>
mov    (%r14),%rax
movsbl 0x2(%rax),%edi
call   1030 <isdigit@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
define i32 @test_filter(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load %struct.dirent*, %struct.dirent** %2
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i32 0, i32 0
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 84
br i1 %9, label %18, label %10
10: ; preds = %1
%11 = load %struct.dirent*, %struct.dirent** %2
%12 = getelementptr inbounds %struct.dirent, %struct.dirent* %11, i32 0, i32 0
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 68
br i1 %17, label %18, label %34
18: ; preds = %10, %1
%19 = load %struct.dirent*, %struct.dirent** %2
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %19, i32 0, i32 0
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = call i64 @isdigit(i8 signext %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %18
%27 = load %struct.dirent*, %struct.dirent** %2
%28 = getelementptr inbounds %struct.dirent, %struct.dirent* %27, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i64 2
%31 = load i8, i8* %30
%32 = call i64 @isdigit(i8 signext %31)
%33 = icmp ne i64 %32, 0
br label %34
34: ; preds = %26, %18, %10
%35 = phi i1 [ false, %18 ], [ false, %10 ], [ %33, %26 ]
%36 = zext i1 %35 to i32
ret i32 %36
}

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