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

/* Variables and functions */
scalar_t__ DT_DIR;
scalar_t__ DT_SOCK;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int resolve_existing_entry(char *);
int /*<<< orphan*/ stdout;
int show_table_entry(const struct dirent *eEntry) {
  if (eEntry && eEntry->d_type == DT_SOCK) {
    int connected = resolve_existing_entry(eEntry->d_name);
    if (connected == -1)
      fprintf(stdout, "%s\n", eEntry->d_name);
    return 0;
  } else if (eEntry && eEntry->d_type == DT_DIR)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<show_table_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1191 <show_table_entry+0x71>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
jne    1191 <show_table_entry+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <resolve_existing_entry@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1185 <show_table_entry+0x65>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe80(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c6 <show_table_entry+0xa6>
cmpq   $0x0,-0x10(%rbp)
je     11bf <show_table_entry+0x9f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2e36(%rip),%rcx
cmp    (%rcx),%rax
jne    11bf <show_table_entry+0x9f>
movl   $0x0,-0x4(%rbp)
jmp    11c6 <show_table_entry+0xa6>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_table_entry>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1173 <show_table_entry+0x53>
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%rax
jne    1165 <show_table_entry+0x45>
mov    0x8(%rbx),%rdi
call   1040 <resolve_existing_entry@plt>
xor    %ebp,%ebp
cmp    $0xffffffff,%eax
jne    1178 <show_table_entry+0x58>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1178 <show_table_entry+0x58>
mov    0x2e74(%rip),%rcx
xor    %ebp,%ebp
cmp    (%rcx),%rax
je     1178 <show_table_entry+0x58>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i64, i8* }
@DT_SOCK = global i64 0
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@DT_DIR = global i64 0
define i32 @show_table_entry(%struct.dirent* %0) {
%2 = alloca i32
%3 = alloca %struct.dirent*
%4 = alloca i32
store %struct.dirent* %0, %struct.dirent** %3
%5 = load %struct.dirent*, %struct.dirent** %3
%6 = icmp ne %struct.dirent* %5, null
br i1 %6, label %7, label %27
7: ; preds = %1
%8 = load %struct.dirent*, %struct.dirent** %3
%9 = getelementptr inbounds %struct.dirent, %struct.dirent* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = load i64, i64* @DT_SOCK
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %7
%14 = load %struct.dirent*, %struct.dirent** %3
%15 = getelementptr inbounds %struct.dirent, %struct.dirent* %14, i32 0, i32 1
%16 = load i8*, i8** %15
%17 = call i32 @resolve_existing_entry(i8* %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = load i32, i32* @stdout
%22 = load %struct.dirent*, %struct.dirent** %3
%23 = getelementptr inbounds %struct.dirent, %struct.dirent* %22, i32 0, i32 1
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %20, %13
store i32 0, i32* %2
br label %38
27: ; preds = %7, %1
%28 = load %struct.dirent*, %struct.dirent** %3
%29 = icmp ne %struct.dirent* %28, null
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = load %struct.dirent*, %struct.dirent** %3
%32 = getelementptr inbounds %struct.dirent, %struct.dirent* %31, i32 0, i32 0
%33 = load i64, i64* %32
%34 = load i64, i64* @DT_DIR
%35 = icmp eq i64 %33, %34
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 0, i32* %2
br label %38
37: ; preds = %30, %27
store i32 1, i32* %2
br label %38
38: ; preds = %37, %36, %26
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
%struct.dirent = type { i64, i8* }
@DT_SOCK = global i64 0
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@DT_DIR = global i64 0
define i32 @show_table_entry(%struct.dirent* %0) {
%2 = icmp eq %struct.dirent* %0, null
br i1 %2, label %20, 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 %17
8: ; preds = %3
%9 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 1
%10 = load i8*, i8** %9
%11 = tail call i32 @resolve_existing_entry(i8* %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %21
13: ; preds = %8
%14 = load i32, i32* @stdout
%15 = load i8*, i8** %9
%16 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %21
17: ; preds = %3
%18 = load i64, i64* @DT_DIR
%19 = icmp eq i64 %5, %18
br i1 %19, label %21, label %20
20: ; preds = %1, %17
br label %21
21: ; preds = %17, %8, %13, %20
%22 = phi i32 [ 1, %20 ], [ 0, %13 ], [ 0, %8 ], [ 0, %17 ]
ret i32 %22
}