#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 */
typedef char *const_nis_name;
typedef int /*<<< orphan*/ bool_t;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int internal_ismember(char *, char *);
bool_t nis_ismember(const_nis_name principal, const_nis_name group) {
  if (group != NULL && group[0] != '\0' && principal != NULL)
    return internal_ismember(principal, group) == 1 ? TRUE : FALSE;
  else
    return FALSE;
}


x86 assembly (clang, -O0):
<nis_ismember>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1184 <nis_ismember+0x74>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1184 <nis_ismember+0x74>
cmpq   $0x0,-0x10(%rbp)
je     1184 <nis_ismember+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <internal_ismember@plt>
cmp    $0x1,%eax
jne    116d <nis_ismember+0x5d>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
jmp    1179 <nis_ismember+0x69>
mov    0x2e64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1190 <nis_ismember+0x80>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nis_ismember>:
push   %rax
test   %rsi,%rsi
je     1133 <nis_ismember+0x23>
test   %rdi,%rdi
je     1133 <nis_ismember+0x23>
cmpb   $0x0,(%rsi)
je     1133 <nis_ismember+0x23>
call   1030 <internal_ismember@plt>
cmp    $0x1,%eax
jne    1133 <nis_ismember+0x23>
mov    0x2eb7(%rip),%rax
jmp    113a <nis_ismember+0x2a>
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@TRUE = global i32 0
@FALSE = global i32 0
define i32 @nis_ismember(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = icmp ne i8 %5, 0
%7 = icmp ne i8* %0, null
%8 = and i1 %7, %6
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = tail call i32 @internal_ismember(i8* %0, i8* %1)
%11 = icmp eq i32 %10, 1
%12 = load i32, i32* @TRUE
%13 = load i32, i32* @FALSE
%14 = select i1 %11, i32 %12, i32 %13
br label %17
15: ; preds = %4, %2
%16 = load i32, i32* @FALSE
br label %17
17: ; preds = %15, %9
%18 = phi i32 [ %14, %9 ], [ %16, %15 ]
ret i32 %18
}