#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ gl_pathc;
};
typedef TYPE_1__ glob_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ findServiceEntries(char const *, char const *, int, TYPE_1__ *);
int /*<<< orphan*/ globfree(TYPE_1__ *);
int isConfigured(const char *RUNLEVELS, const char *name, int level) {
  glob_t globres;
  if (findServiceEntries(RUNLEVELS, name, level, &globres))
    exit(1);
  if (!globres.gl_pathc)
    return 0;
  globfree(&globres);
  return 1;
}


x86 assembly (clang, -O0):
<isConfigured>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    -0x20(%rbp),%rcx
call   1040 <findServiceEntries@plt>
cmp    $0x0,%rax
je     116b <isConfigured+0x3b>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x0,-0x20(%rbp)
jne    1181 <isConfigured+0x51>
movl   $0x0,-0x4(%rbp)
jmp    1191 <isConfigured+0x61>
lea    -0x20(%rbp),%rdi
call   1030 <globfree@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isConfigured>:
push   %rax
mov    %rsp,%rcx
call   1040 <findServiceEntries@plt>
test   %rax,%rax
jne    1157 <isConfigured+0x27>
cmpl   $0x0,(%rsp)
je     1153 <isConfigured+0x23>
mov    %rsp,%rdi
call   1030 <globfree@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32 }
define i32 @isConfigured(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.TYPE_4__
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = call i64 @findServiceEntries(i8* %9, i8* %10, i32 %11, %struct.TYPE_4__* %8)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %3
%17 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 0
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store i32 0, i32* %4
br label %23
21: ; preds = %16
%22 = call i32 @globfree(%struct.TYPE_4__* %8)
store i32 1, i32* %4
br label %23
23: ; preds = %21, %20
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32 }
define i32 @isConfigured(i8* %0, i8* %1, i32 %2) {
%4 = alloca %struct.TYPE_4__
%5 = bitcast %struct.TYPE_4__* %4 to i8*
%6 = call i64 @findServiceEntries(i8* %0, i8* %1, i32 %2, %struct.TYPE_4__* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %3
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 @globfree(%struct.TYPE_4__* %4)
br label %16
16: ; preds = %10, %14
%17 = phi i32 [ 1, %14 ], [ 0, %10 ]
ret i32 %17
}