#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 stat {
  int /*<<< orphan*/ st_mode;
};
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int strlen(int /*<<< orphan*/);
scalar_t__ strncmp(int /*<<< orphan*/, char *, int);
int ignore_entry(struct stat *stat, struct dirent *dirent) {
  int isdot, isdotdot, length;
  length = strlen(dirent->d_name);
  isdot = strncmp(dirent->d_name, ".", length) == 0;
  isdotdot = strncmp(dirent->d_name, "..", length) == 0;
  return S_ISDIR(stat->st_mode) && (isdot || isdotdot);
}


x86 assembly (clang, -O0):
<ignore_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xea3(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xe7e(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1050 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1d(%rbp)
je     11d2 <ignore_entry+0xa2>
mov    $0x1,%al
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x1e(%rbp)
jne    11cc <ignore_entry+0x9c>
cmpl   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ignore_entry>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%edi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
lea    0xeb2(%rip),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%r15
mov    (%rbx),%edi
lea    0xe9e(%rip),%rsi
mov    %ebp,%edx
call   1030 <strncmp@plt>
mov    %rax,%rbx
mov    (%r14),%edi
call   1050 <S_ISDIR@plt>
test   %rax,%rax
setne  %al
test   %rbx,%rbx
sete   %cl
test   %r15,%r15
sete   %dl
or     %cl,%dl
and    %al,%dl
movzbl %dl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.dirent = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
define i32 @ignore_entry(%struct.stat* %0, %struct.dirent* %1) {
%3 = alloca %struct.stat*
%4 = alloca %struct.dirent*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store %struct.stat* %0, %struct.stat** %3
store %struct.dirent* %1, %struct.dirent** %4
%8 = load %struct.dirent*, %struct.dirent** %4
%9 = getelementptr inbounds %struct.dirent, %struct.dirent* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @strlen(i32 %10)
store i32 %11, i32* %7
%12 = load %struct.dirent*, %struct.dirent** %4
%13 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = load i32, i32* %7
%16 = call i64 @strncmp(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
store i32 %18, i32* %5
%19 = load %struct.dirent*, %struct.dirent** %4
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = load i32, i32* %7
%23 = call i64 @strncmp(i32 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
store i32 %25, i32* %6
%26 = load %struct.stat*, %struct.stat** %3
%27 = getelementptr inbounds %struct.stat, %struct.stat* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = call i64 @S_ISDIR(i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %2
%32 = load i32, i32* %5
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load i32, i32* %6
%36 = icmp ne i32 %35, 0
br label %37
37: ; preds = %34, %31
%38 = phi i1 [ true, %31 ], [ %36, %34 ]
br label %39
39: ; preds = %37, %2
%40 = phi i1 [ false, %2 ], [ %38, %37 ]
%41 = zext i1 %40 to i32
ret i32 %41
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
define i32 @ignore_entry(%struct.stat* nocapture %0, %struct.dirent* nocapture %1) {
%3 = getelementptr inbounds %struct.dirent, %struct.dirent* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = tail call i32 @strlen(i32 %4)
%6 = load i32, i32* %3
%7 = tail call i64 @strncmp(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %5)
%8 = load i32, i32* %3
%9 = tail call i64 @strncmp(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%10 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%11 = load i32, i32* %10
%12 = tail call i64 @S_ISDIR(i32 %11)
%13 = icmp ne i64 %12, 0
%14 = icmp eq i64 %9, 0
%15 = icmp eq i64 %7, 0
%16 = select i1 %15, i1 true, i1 %14
%17 = select i1 %13, i1 %16, i1 false
%18 = zext i1 %17 to i32
ret i32 %18
}