#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_8__ TYPE_3__;
typedef struct TYPE_7__ TYPE_2__;
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
typedef int u_int;
typedef int /*<<< orphan*/ nis_result;
typedef int /*<<< orphan*/ *nis_name;
typedef scalar_t__ nis_error;
typedef int /*<<< orphan*/ domainbuf;
typedef char *const_nis_name;
typedef int /*<<< orphan*/ buf;
struct TYPE_6__ {
  int gr_members_len;
  int /*<<< orphan*/ **gr_members_val;
};
struct TYPE_7__ {
  TYPE_1__ gr_members;
};
struct TYPE_8__ {
  char *zo_name;
  int /*<<< orphan*/ zo_domain;
  TYPE_2__ GR_data;
};

/* Variables and functions */
int EXPAND_NAME;
int FOLLOW_LINKS;
scalar_t__ NIS_FAIL;
scalar_t__ NIS_GROUP_OBJ;
scalar_t__ NIS_INVALIDOBJ;
int /*<<< orphan*/ NIS_MAXNAMELEN;
scalar_t__ NIS_NOMEMORY;
int NIS_RES_NUMOBJ(int /*<<< orphan*/ *);
TYPE_3__ *NIS_RES_OBJECT(int /*<<< orphan*/ *);
scalar_t__ NIS_RES_STATUS(int /*<<< orphan*/ *);
scalar_t__ NIS_SUCCESS;
scalar_t__ __type_of(TYPE_3__ *);
int /*<<< orphan*/ assert(int);
char *nis_domain_of_r(char *, char *, int);
int /*<<< orphan*/ nis_freeresult(int /*<<< orphan*/ *);
int /*<<< orphan*/ nis_leaf_of_r(char *, char *, int);
int /*<<< orphan*/ *nis_lookup(char *, int);
int /*<<< orphan*/ *nis_modify(char *, TYPE_3__ *);
char *rawmemchr(int /*<<< orphan*/, char);
int /*<<< orphan*/ **realloc(int /*<<< orphan*/ **, int);
char *stpcpy(char *, char *);
int /*<<< orphan*/ *strdup(char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int /*<<< orphan*/);
nis_error nis_addmember(const_nis_name member, const_nis_name group) {
  if (group != NULL && group[0] != '\0') {
    size_t grouplen = strlen(group);
    char buf[grouplen + 14 + NIS_MAXNAMELEN];
    char domainbuf[grouplen + 2];
    nis_result *res, *res2;
    nis_error status;
    char *cp, *cp2;
    cp = rawmemchr(nis_leaf_of_r(group, buf, sizeof(buf) - 1), '\0');
    cp = stpcpy(cp, ".groups_dir");
    cp2 = nis_domain_of_r(group, domainbuf, sizeof(domainbuf) - 1);
    if (cp2 != NULL && cp2[0] != '\0') {
      *cp++ = '.';
      stpcpy(cp, cp2);
    }
    res = nis_lookup(buf, FOLLOW_LINKS | EXPAND_NAME);
    if (NIS_RES_STATUS(res) != NIS_SUCCESS) {
      status = NIS_RES_STATUS(res);
      nis_freeresult(res);
      return status;
    }
    if (NIS_RES_NUMOBJ(res) != 1 ||
        __type_of(NIS_RES_OBJECT(res)) != NIS_GROUP_OBJ) {
      nis_freeresult(res);
      return NIS_INVALIDOBJ;
    }
    u_int gr_members_len =
        NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len;
    nis_name *new_gr_members_val =
        realloc(NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val,
                (gr_members_len + 1) * sizeof(nis_name));
    if (new_gr_members_val == NULL)
      goto nomem_out;
    NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val = new_gr_members_val;
    new_gr_members_val[gr_members_len] = strdup(member);
    if (new_gr_members_val[gr_members_len] == NULL) {
    nomem_out:
      nis_freeresult(res);
      return NIS_NOMEMORY;
    }
    ++NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len;
    assert(strlen(NIS_RES_OBJECT(res)->zo_name) + 1 < grouplen + 14);
    cp = stpcpy(buf, NIS_RES_OBJECT(res)->zo_name);
    *cp++ = '.';
    strncpy(cp, NIS_RES_OBJECT(res)->zo_domain, NIS_MAXNAMELEN);
    res2 = nis_modify(buf, NIS_RES_OBJECT(res));
    status = NIS_RES_STATUS(res2);
    nis_freeresult(res);
    nis_freeresult(res2);
    return status;
  } else
    return NIS_FAIL;
}


x86 assembly (clang, -O0):
<nis_addmember>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1584 <nis_addmember+0x384>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1584 <nis_addmember+0x384>
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    0x2d98(%rip),%rax
movslq (%rax),%rdx
lea    0xe(%rcx,%rdx,1),%rax
mov    %rsp,%rsi
mov    %rsi,-0x28(%rbp)
lea    0x1d(%rcx,%rdx,1),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x88(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    %rdi,%rcx
add    $0x2,%rcx
mov    %rcx,-0x78(%rbp)
add    $0x11,%rdi
and    $0xfffffffffffffff0,%rdi
mov    %rsp,%rdx
sub    %rdi,%rdx
mov    %rdx,-0x80(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
sub    $0x1,%rax
mov    %eax,%edx
call   1080 <nis_leaf_of_r@plt>
mov    %eax,%edi
xor    %esi,%esi
call   10a0 <rawmemchr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xd3d(%rip),%rsi
call   1060 <stpcpy@plt>
mov    -0x80(%rbp),%rsi
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
mov    %rcx,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
sub    $0x1,%rax
mov    %eax,%edx
call   1050 <nis_domain_of_r@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     1324 <nis_addmember+0x124>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1324 <nis_addmember+0x124>
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x2e,(%rax)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   1060 <stpcpy@plt>
mov    -0x88(%rbp),%rdi
mov    0x2c9e(%rip),%rax
mov    (%rax),%esi
mov    0x2c9d(%rip),%rax
or     (%rax),%esi
call   1100 <nis_lookup@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   10f0 <NIS_RES_STATUS@plt>
mov    0x2c92(%rip),%rcx
cmp    (%rcx),%rax
je     1389 <nis_addmember+0x189>
mov    -0x40(%rbp),%rdi
call   10f0 <NIS_RES_STATUS@plt>
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
call   1120 <nis_freeresult@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1578 <nis_addmember+0x378>
mov    -0x40(%rbp),%rdi
call   10c0 <NIS_RES_NUMOBJ@plt>
cmp    $0x1,%eax
jne    13bc <nis_addmember+0x1bc>
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    %rax,%rdi
call   1030 <__type_of@plt>
mov    0x2c05(%rip),%rcx
cmp    (%rcx),%rax
je     13df <nis_addmember+0x1df>
mov    -0x40(%rbp),%rdi
call   1120 <nis_freeresult@plt>
mov    0x2be4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1578 <nis_addmember+0x378>
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    0x10(%rax),%eax
mov    %eax,-0x68(%rbp)
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    0x18(%rax),%rdi
mov    -0x68(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   10d0 <realloc@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    1422 <nis_addmember+0x222>
jmp    1471 <nis_addmember+0x271>
mov    -0x70(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    -0x90(%rbp),%rcx
mov    %rcx,0x18(%rax)
mov    -0x10(%rbp),%rdi
call   1110 <strdup@plt>
mov    %rax,%rdx
mov    -0x70(%rbp),%rax
movslq -0x68(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x70(%rbp),%rax
movslq -0x68(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1494 <nis_addmember+0x294>
jmp    1471 <nis_addmember+0x271>
mov    -0x40(%rbp),%rdi
call   1120 <nis_freeresult@plt>
mov    0x2b27(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1578 <nis_addmember+0x378>
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    0x10(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x10(%rax)
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    (%rax),%rdi
call   1070 <strlen@plt>
add    $0x1,%eax
cltq
mov    -0x20(%rbp),%rcx
add    $0xe,%rcx
cmp    %rcx,%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    -0x88(%rbp),%rdi
mov    (%rax),%rsi
call   1060 <stpcpy@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x2e,(%rax)
mov    -0x58(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    -0x98(%rbp),%rdi
mov    0x8(%rax),%esi
mov    0x2ab9(%rip),%rax
mov    (%rax),%edx
call   1040 <strncpy@plt>
mov    -0x40(%rbp),%rdi
call   10e0 <NIS_RES_OBJECT@plt>
mov    -0x88(%rbp),%rdi
mov    %rax,%rsi
call   1090 <nis_modify@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
call   10f0 <NIS_RES_STATUS@plt>
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
call   1120 <nis_freeresult@plt>
mov    -0x48(%rbp),%rdi
call   1120 <nis_freeresult@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
jmp    1592 <nis_addmember+0x392>
mov    0x2a35(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nis_addmember>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %rsi,%rsi
je     142d <nis_addmember+0x21d>
mov    %rsi,%rbx
cmpb   $0x0,(%rsi)
je     142d <nis_addmember+0x21d>
mov    %rdi,-0x38(%rbp)
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %rsp,-0x30(%rbp)
movslq %eax,%r15
mov    0x2d90(%rip),%rax
movslq (%rax),%rax
lea    (%r15,%rax,1),%rdx
add    $0xe,%rdx
add    %r15,%rax
add    $0x1d,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%r14
lea    0x11(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
add    $0xffffffff,%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1090 <nis_leaf_of_r@plt>
mov    %eax,%edi
xor    %esi,%esi
call   10b0 <rawmemchr@plt>
mov    %rax,%r13
movabs $0x5f7370756f72672e,%rax
70 73 5f
mov    %rax,0x0(%r13)
movl   $0x726964,0x8(%r13)
lea    0x1(%r15),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <nis_domain_of_r@plt>
test   %rax,%rax
je     12dd <nis_addmember+0xcd>
cmpb   $0x0,(%rax)
je     12dd <nis_addmember+0xcd>
mov    %r13,%rdi
add    $0xc,%rdi
movb   $0x2e,0xb(%r13)
mov    %rax,%rsi
call   1050 <strcpy@plt>
mov    0x2cec(%rip),%rax
mov    0x2ced(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %r12,%rdi
call   1110 <nis_lookup@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1100 <NIS_RES_STATUS@plt>
mov    0x2cdf(%rip),%rcx
cmp    (%rcx),%rax
jne    1439 <nis_addmember+0x229>
mov    %r14,%rdi
call   10d0 <NIS_RES_NUMOBJ@plt>
cmp    $0x1,%eax
jne    144e <nis_addmember+0x23e>
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
mov    %rax,%rdi
call   1030 <__type_of@plt>
mov    0x2c7e(%rip),%rcx
cmp    (%rcx),%rax
jne    144e <nis_addmember+0x23e>
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
movslq 0x10(%rax),%r13
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
mov    0x18(%rax),%rdi
lea    0x8(,%r13,8),%esi
call   10e0 <realloc@plt>
test   %rax,%rax
je     1476 <nis_addmember+0x266>
mov    %rax,%rbx
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
mov    %rbx,0x18(%rax)
mov    -0x38(%rbp),%rdi
call   1120 <strdup@plt>
mov    %rax,(%rbx,%r13,8)
test   %rax,%rax
je     1476 <nis_addmember+0x266>
add    $0xe,%r15
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
addl   $0x1,0x10(%rax)
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
mov    (%rax),%rdi
call   1080 <strlen@plt>
add    $0x1,%eax
cltq
xor    %edi,%edi
cmp    %rax,%r15
seta   %dil
call   10c0 <assert@plt>
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
mov    (%rax),%rsi
mov    %r12,%rdi
call   1070 <stpcpy@plt>
movb   $0x2e,(%rax)
lea    0x1(%rax),%rbx
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
mov    0x8(%rax),%esi
mov    0x2beb(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1040 <strncpy@plt>
mov    %r14,%rdi
call   10f0 <NIS_RES_OBJECT@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   10a0 <nis_modify@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1100 <NIS_RES_STATUS@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1130 <nis_freeresult@plt>
mov    %r15,%rdi
jmp    1447 <nis_addmember+0x237>
mov    0x2b8c(%rip),%rax
mov    (%rax),%rbx
jmp    1464 <nis_addmember+0x254>
mov    %r14,%rdi
call   1100 <NIS_RES_STATUS@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1130 <nis_freeresult@plt>
jmp    1460 <nis_addmember+0x250>
mov    %r14,%rdi
call   1130 <nis_freeresult@plt>
mov    0x2b53(%rip),%rax
mov    (%rax),%rbx
mov    -0x30(%rbp),%rsp
mov    %rbx,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
call   1130 <nis_freeresult@plt>
mov    0x2b23(%rip),%rax
jmp    145d <nis_addmember+0x24d>

LLVM IR (-O0):
%struct.TYPE_8__ = type { i8*, i32, %struct.TYPE_7__ }
%struct.TYPE_7__ = type { %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i32, i32** }
@NIS_MAXNAMELEN = global i32 0
@.str = [12 x i8] c".groups_dir\00"
@FOLLOW_LINKS = global i32 0
@EXPAND_NAME = global i32 0
@NIS_SUCCESS = global i64 0
@NIS_GROUP_OBJ = global i64 0
@NIS_INVALIDOBJ = global i64 0
@NIS_NOMEMORY = global i64 0
@NIS_FAIL = global i64 0
define i64 @nis_addmember(i8* %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32**
store i8* %0, i8** %4
store i8* %1, i8** %5
%18 = load i8*, i8** %5
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %186
20: ; preds = %2
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %186
26: ; preds = %20
%27 = load i8*, i8** %5
%28 = call i32 @strlen(i8* %27)
%29 = sext i32 %28 to i64
store i64 %29, i64* %6
%30 = load i64, i64* %6
%31 = add i64 %30, 14
%32 = load i32, i32* @NIS_MAXNAMELEN
%33 = sext i32 %32 to i64
%34 = add i64 %31, %33
%35 = call i8* @llvm.stacksave()
store i8* %35, i8** %7
%36 = alloca i8, i64 %34
store i64 %34, i64* %8
%37 = load i64, i64* %6
%38 = add i64 %37, 2
%39 = alloca i8, i64 %38
store i64 %38, i64* %9
%40 = load i8*, i8** %5
%41 = sub i64 %34, 1
%42 = trunc i64 %41 to i32
%43 = call i32 @nis_leaf_of_r(i8* %40, i8* %36, i32 %42)
%44 = call i8* @rawmemchr(i32 %43, i8 signext 0)
store i8* %44, i8** %13
%45 = load i8*, i8** %13
%46 = call i8* @stpcpy(i8* %45, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %46, i8** %13
%47 = load i8*, i8** %5
%48 = sub i64 %38, 1
%49 = trunc i64 %48 to i32
%50 = call i8* @nis_domain_of_r(i8* %47, i8* %39, i32 %49)
store i8* %50, i8** %14
%51 = load i8*, i8** %14
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %65
53: ; preds = %26
%54 = load i8*, i8** %14
%55 = getelementptr inbounds i8, i8* %54, i64 0
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %65
59: ; preds = %53
%60 = load i8*, i8** %13
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %13
store i8 46, i8* %60
%62 = load i8*, i8** %13
%63 = load i8*, i8** %14
%64 = call i8* @stpcpy(i8* %62, i8* %63)
br label %65
65: ; preds = %59, %53, %26
%66 = load i32, i32* @FOLLOW_LINKS
%67 = load i32, i32* @EXPAND_NAME
%68 = or i32 %66, %67
%69 = call i32* @nis_lookup(i8* %36, i32 %68)
store i32* %69, i32** %10
%70 = load i32*, i32** %10
%71 = call i64 @NIS_RES_STATUS(i32* %70)
%72 = load i64, i64* @NIS_SUCCESS
%73 = icmp ne i64 %71, %72
br i1 %73, label %74, label %80
74: ; preds = %65
%75 = load i32*, i32** %10
%76 = call i64 @NIS_RES_STATUS(i32* %75)
store i64 %76, i64* %12
%77 = load i32*, i32** %10
%78 = call i32 @nis_freeresult(i32* %77)
%79 = load i64, i64* %12
store i64 %79, i64* %3
store i32 1, i32* %15
br label %184
80: ; preds = %65
%81 = load i32*, i32** %10
%82 = call i32 @NIS_RES_NUMOBJ(i32* %81)
%83 = icmp ne i32 %82, 1
br i1 %83, label %90, label %84
84: ; preds = %80
%85 = load i32*, i32** %10
%86 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %85)
%87 = call i64 @__type_of(%struct.TYPE_8__* %86)
%88 = load i64, i64* @NIS_GROUP_OBJ
%89 = icmp ne i64 %87, %88
br i1 %89, label %90, label %94
90: ; preds = %84, %80
%91 = load i32*, i32** %10
%92 = call i32 @nis_freeresult(i32* %91)
%93 = load i64, i64* @NIS_INVALIDOBJ
store i64 %93, i64* %3
store i32 1, i32* %15
br label %184
94: ; preds = %84
%95 = load i32*, i32** %10
%96 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %95)
%97 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %96, i32 0, i32 2
%98 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %97, i32 0, i32 0
%99 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %98, i32 0, i32 0
%100 = load i32, i32* %99
store i32 %100, i32* %16
%101 = load i32*, i32** %10
%102 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %101)
%103 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %102, i32 0, i32 2
%104 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %103, i32 0, i32 0
%105 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %104, i32 0, i32 1
%106 = load i32**, i32*** %105
%107 = load i32, i32* %16
%108 = add nsw i32 %107, 1
%109 = sext i32 %108 to i64
%110 = mul i64 %109, 8
%111 = trunc i64 %110 to i32
%112 = call i32** @realloc(i32** %106, i32 %111)
store i32** %112, i32*** %17
%113 = load i32**, i32*** %17
%114 = icmp eq i32** %113, null
br i1 %114, label %115, label %116
115: ; preds = %94
br label %136
116: ; preds = %94
%117 = load i32**, i32*** %17
%118 = load i32*, i32** %10
%119 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %118)
%120 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %119, i32 0, i32 2
%121 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %120, i32 0, i32 0
%122 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %121, i32 0, i32 1
store i32** %117, i32*** %122
%123 = load i8*, i8** %4
%124 = call i32* @strdup(i8* %123)
%125 = load i32**, i32*** %17
%126 = load i32, i32* %16
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i32*, i32** %125, i64 %127
store i32* %124, i32** %128
%129 = load i32**, i32*** %17
%130 = load i32, i32* %16
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i32*, i32** %129, i64 %131
%133 = load i32*, i32** %132
%134 = icmp eq i32* %133, null
br i1 %134, label %135, label %140
135: ; preds = %116
br label %136
136: ; preds = %135, %115
%137 = load i32*, i32** %10
%138 = call i32 @nis_freeresult(i32* %137)
%139 = load i64, i64* @NIS_NOMEMORY
store i64 %139, i64* %3
store i32 1, i32* %15
br label %184
140: ; preds = %116
%141 = load i32*, i32** %10
%142 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %141)
%143 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %142, i32 0, i32 2
%144 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %143, i32 0, i32 0
%145 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %144, i32 0, i32 0
%146 = load i32, i32* %145
%147 = add nsw i32 %146, 1
store i32 %147, i32* %145
%148 = load i32*, i32** %10
%149 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %148)
%150 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %149, i32 0, i32 0
%151 = load i8*, i8** %150
%152 = call i32 @strlen(i8* %151)
%153 = add nsw i32 %152, 1
%154 = sext i32 %153 to i64
%155 = load i64, i64* %6
%156 = add i64 %155, 14
%157 = icmp ult i64 %154, %156
%158 = zext i1 %157 to i32
%159 = call i32 @assert(i32 %158)
%160 = load i32*, i32** %10
%161 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %160)
%162 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %161, i32 0, i32 0
%163 = load i8*, i8** %162
%164 = call i8* @stpcpy(i8* %36, i8* %163)
store i8* %164, i8** %13
%165 = load i8*, i8** %13
%166 = getelementptr inbounds i8, i8* %165, i32 1
store i8* %166, i8** %13
store i8 46, i8* %165
%167 = load i8*, i8** %13
%168 = load i32*, i32** %10
%169 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %168)
%170 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %169, i32 0, i32 1
%171 = load i32, i32* %170
%172 = load i32, i32* @NIS_MAXNAMELEN
%173 = call i32 @strncpy(i8* %167, i32 %171, i32 %172)
%174 = load i32*, i32** %10
%175 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %174)
%176 = call i32* @nis_modify(i8* %36, %struct.TYPE_8__* %175)
store i32* %176, i32** %11
%177 = load i32*, i32** %11
%178 = call i64 @NIS_RES_STATUS(i32* %177)
store i64 %178, i64* %12
%179 = load i32*, i32** %10
%180 = call i32 @nis_freeresult(i32* %179)
%181 = load i32*, i32** %11
%182 = call i32 @nis_freeresult(i32* %181)
%183 = load i64, i64* %12
store i64 %183, i64* %3
store i32 1, i32* %15
br label %184
184: ; preds = %140, %136, %90, %74
%185 = load i8*, i8** %7
br label %188
186: ; preds = %20, %2
%187 = load i64, i64* @NIS_FAIL
store i64 %187, i64* %3
br label %188
188: ; preds = %186, %184
%189 = load i64, i64* %3
ret i64 %189
}

LLVM IR (-O2):
%struct.TYPE_8__ = type { i8*, i32, %struct.TYPE_7__ }
%struct.TYPE_7__ = type { %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i32, i32** }
@NIS_MAXNAMELEN = global i32 0
@.str = [12 x i8] c".groups_dir\00"
@FOLLOW_LINKS = global i32 0
@EXPAND_NAME = global i32 0
@NIS_SUCCESS = global i64 0
@NIS_GROUP_OBJ = global i64 0
@NIS_INVALIDOBJ = global i64 0
@NIS_NOMEMORY = global i64 0
@NIS_FAIL = global i64 0
define i64 @nis_addmember(i8* nocapture %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %106, label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %106, label %7
7: ; preds = %4
%8 = tail call i32 @strlen(i8* %1)
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, 14
%11 = load i32, i32* @NIS_MAXNAMELEN
%12 = sext i32 %11 to i64
%13 = add nsw i64 %10, %12
%14 = tail call i8* @llvm.stacksave()
%15 = alloca i8, i64 %13
%16 = add nsw i64 %9, 2
%17 = alloca i8, i64 %16
%18 = trunc i64 %13 to i32
%19 = add i32 %18, -1
%20 = call i32 @nis_leaf_of_r(i8* %1, i8* %15, i32 %19)
%21 = call i8* @rawmemchr(i32 %20, i8 signext 0)
%22 = getelementptr i8, i8* %21, i64 11
%23 = add i32 %8, 1
%24 = call i8* @nis_domain_of_r(i8* %1, i8* %17, i32 %23)
%25 = icmp eq i8* %24, null
br i1 %25, label %32, label %26
26: ; preds = %7
%27 = load i8, i8* %24
%28 = icmp eq i8 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = getelementptr i8, i8* %21, i64 12
store i8 46, i8* %22
%31 = call i8* @strcpy(i8* dereferenceable(1) %30, i8* %24)
br label %32
32: ; preds = %29, %26, %7
%33 = load i32, i32* @FOLLOW_LINKS
%34 = load i32, i32* @EXPAND_NAME
%35 = or i32 %34, %33
%36 = call i32* @nis_lookup(i8* %15, i32 %35)
%37 = call i64 @NIS_RES_STATUS(i32* %36)
%38 = load i64, i64* @NIS_SUCCESS
%39 = icmp eq i64 %37, %38
br i1 %39, label %43, label %40
40: ; preds = %32
%41 = call i64 @NIS_RES_STATUS(i32* %36)
%42 = call i32 @nis_freeresult(i32* %36)
br label %104
43: ; preds = %32
%44 = call i32 @NIS_RES_NUMOBJ(i32* %36)
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%48 = call i64 @__type_of(%struct.TYPE_8__* %47)
%49 = load i64, i64* @NIS_GROUP_OBJ
%50 = icmp eq i64 %48, %49
br i1 %50, label %54, label %51
51: ; preds = %46, %43
%52 = call i32 @nis_freeresult(i32* %36)
%53 = load i64, i64* @NIS_INVALIDOBJ
br label %104
54: ; preds = %46
%55 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%56 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %55, i64 0, i32 2, i32 0, i32 0
%57 = load i32, i32* %56
%58 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%59 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %58, i64 0, i32 2, i32 0, i32 1
%60 = load i32**, i32*** %59
%61 = shl i32 %57, 3
%62 = add i32 %61, 8
%63 = call i32** @realloc(i32** %60, i32 %62)
%64 = icmp eq i32** %63, null
br i1 %64, label %72, label %65
65: ; preds = %54
%66 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%67 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %66, i64 0, i32 2, i32 0, i32 1
store i32** %63, i32*** %67
%68 = call i32* @strdup(i8* %0)
%69 = sext i32 %57 to i64
%70 = getelementptr inbounds i32*, i32** %63, i64 %69
store i32* %68, i32** %70
%71 = icmp eq i32* %68, null
br i1 %71, label %72, label %75
72: ; preds = %65, %54
%73 = call i32 @nis_freeresult(i32* %36)
%74 = load i64, i64* @NIS_NOMEMORY
br label %104
75: ; preds = %65
%76 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%77 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %76, i64 0, i32 2, i32 0, i32 0
%78 = load i32, i32* %77
%79 = add nsw i32 %78, 1
store i32 %79, i32* %77
%80 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%81 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %80, i64 0, i32 0
%82 = load i8*, i8** %81
%83 = call i32 @strlen(i8* %82)
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = icmp ugt i64 %10, %85
%87 = zext i1 %86 to i32
%88 = call i32 @assert(i32 %87)
%89 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%90 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %89, i64 0, i32 0
%91 = load i8*, i8** %90
%92 = call i8* @stpcpy(i8* %15, i8* %91)
%93 = getelementptr inbounds i8, i8* %92, i64 1
store i8 46, i8* %92
%94 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%95 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %94, i64 0, i32 1
%96 = load i32, i32* %95
%97 = load i32, i32* @NIS_MAXNAMELEN
%98 = call i32 @strncpy(i8* %93, i32 %96, i32 %97)
%99 = call %struct.TYPE_8__* @NIS_RES_OBJECT(i32* %36)
%100 = call i32* @nis_modify(i8* %15, %struct.TYPE_8__* %99)
%101 = call i64 @NIS_RES_STATUS(i32* %100)
%102 = call i32 @nis_freeresult(i32* %36)
%103 = call i32 @nis_freeresult(i32* %100)
br label %104
104: ; preds = %72, %75, %51, %40
%105 = phi i64 [ %41, %40 ], [ %53, %51 ], [ %74, %72 ], [ %101, %75 ]
br label %108
106: ; preds = %4, %2
%107 = load i64, i64* @NIS_FAIL
br label %108
108: ; preds = %106, %104
%109 = phi i64 [ %105, %104 ], [ %107, %106 ]
ret i64 %109
}