#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 direct {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int file_select(struct direct *entry) {
  if (strcmp(entry->d_name, "..") == 0) {
    return (0);
  } else if (strcmp(entry->d_name, ".") == 0) {
    return (0);
  } else {
    return (1);
  }
}


x86 assembly (clang, -O0):
<file_select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1144 <file_select+0x34>
movl   $0x0,-0x4(%rbp)
jmp    1173 <file_select+0x63>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    116c <file_select+0x5c>
movl   $0x0,-0x4(%rbp)
jmp    1173 <file_select+0x63>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_select>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
lea    0xee3(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1142 <file_select+0x32>
mov    (%rbx),%edi
lea    0xed1(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.direct = type { i32 }
@.str = [3 x i8] c"..\00"
@.str.1 = [2 x i8] c".\00"
define i32 @file_select(%struct.direct* %0) {
%2 = alloca i32
%3 = alloca %struct.direct*
store %struct.direct* %0, %struct.direct** %3
%4 = load %struct.direct*, %struct.direct** %3
%5 = getelementptr inbounds %struct.direct, %struct.direct* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i64 @strcmp(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %18
10: ; preds = %1
%11 = load %struct.direct*, %struct.direct** %3
%12 = getelementptr inbounds %struct.direct, %struct.direct* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i64 @strcmp(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 0, i32* %2
br label %18
17: ; preds = %10
store i32 1, i32* %2
br label %18
18: ; preds = %17, %16, %9
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.direct = type { i32 }
@.str = [3 x i8] c"..\00"
@.str.1 = [2 x i8] c".\00"
define i32 @file_select(%struct.direct* nocapture %0) {
%2 = getelementptr inbounds %struct.direct, %struct.direct* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i64 @strcmp(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = tail call i64 @strcmp(i32 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %6, %1
%12 = phi i32 [ 0, %1 ], [ %10, %6 ]
ret i32 %12
}