#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 */
int is_hidden(const struct dirent *dir) {
  if (dir->d_name[0] != '.')
    return 1;
  if ((dir->d_name[1] == '.') && (dir->d_name[2] == '\0'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_hidden>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     1127 <is_hidden+0x27>
movl   $0x1,-0x4(%rbp)
jmp    1162 <is_hidden+0x62>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    115b <is_hidden+0x5b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
jne    115b <is_hidden+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    1162 <is_hidden+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_hidden>:
mov    (%rdi),%rcx
mov    $0x1,%eax
cmpb   $0x2e,(%rcx)
jne    111b <is_hidden+0x1b>
cmpb   $0x2e,0x1(%rcx)
jne    1119 <is_hidden+0x19>
cmpb   $0x0,0x2(%rcx)
je     111b <is_hidden+0x1b>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @is_hidden(%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
%5 = icmp eq i8 %4, 46
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 46
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %3, i64 2
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10, %6
br label %15
15: ; preds = %10, %1, %14
%16 = phi i32 [ 0, %14 ], [ 1, %1 ], [ 1, %10 ]
ret i32 %16
}