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

/* Variables and functions */
scalar_t__ DT_SOCK;
scalar_t__ check_daemon_regex(int /*<<< orphan*/);
int resolve_existing_entry(int /*<<< orphan*/);
int regex_table_entry(const struct dirent *eEntry) {
  if (eEntry && eEntry->d_type == DT_SOCK &&
      check_daemon_regex(eEntry->d_name)) {
    return (resolve_existing_entry(eEntry->d_name) == -1) ? 1 : 0;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<regex_table_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1187 <regex_table_entry+0x67>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%rax
jne    1187 <regex_table_entry+0x67>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
call   1030 <check_daemon_regex@plt>
cmp    $0x0,%rax
je     1187 <regex_table_entry+0x67>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <resolve_existing_entry@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0xffffffff,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    118e <regex_table_entry+0x6e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regex_table_entry>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     115a <regex_table_entry+0x3a>
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%rax
jne    115a <regex_table_entry+0x3a>
mov    0x8(%rbx),%edi
call   1030 <check_daemon_regex@plt>
test   %rax,%rax
je     115a <regex_table_entry+0x3a>
mov    0x8(%rbx),%edi
call   1040 <resolve_existing_entry@plt>
xor    %ebp,%ebp
cmp    $0xffffffff,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i64, i32 }
@DT_SOCK = global i64 0
define i32 @regex_table_entry(%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 = icmp ne %struct.dirent* %4, null
br i1 %5, label %6, label %26
6: ; preds = %1
%7 = load %struct.dirent*, %struct.dirent** %3
%8 = getelementptr inbounds %struct.dirent, %struct.dirent* %7, i32 0, i32 0
%9 = load i64, i64* %8
%10 = load i64, i64* @DT_SOCK
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %6
%13 = load %struct.dirent*, %struct.dirent** %3
%14 = getelementptr inbounds %struct.dirent, %struct.dirent* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = call i64 @check_daemon_regex(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %12
%19 = load %struct.dirent*, %struct.dirent** %3
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %19, i32 0, i32 1
%21 = load i32, i32* %20
%22 = call i32 @resolve_existing_entry(i32 %21)
%23 = icmp eq i32 %22, -1
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 1, i32 0
store i32 %25, i32* %2
br label %27
26: ; preds = %12, %6, %1
store i32 0, i32* %2
br label %27
27: ; preds = %26, %18
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
%struct.dirent = type { i64, i32 }
@DT_SOCK = global i64 0
define i32 @regex_table_entry(%struct.dirent* %0) {
%2 = icmp eq %struct.dirent* %0, null
br i1 %2, label %18, label %3
3: ; preds = %1
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%5 = load i64, i64* %4
%6 = load i64, i64* @DT_SOCK
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %18
8: ; preds = %3
%9 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 1
%10 = load i32, i32* %9
%11 = tail call i64 @check_daemon_regex(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %8
%14 = load i32, i32* %9
%15 = tail call i32 @resolve_existing_entry(i32 %14)
%16 = icmp eq i32 %15, -1
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %1, %3, %8, %13
%19 = phi i32 [ %17, %13 ], [ 0, %8 ], [ 0, %3 ], [ 0, %1 ]
ret i32 %19
}