#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_18__ TYPE_6__;
typedef struct TYPE_17__ TYPE_5__;
typedef struct TYPE_16__ TYPE_4__;
typedef struct TYPE_15__ TYPE_3__;
typedef struct TYPE_14__ TYPE_2__;
typedef struct TYPE_13__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ nis_result;
struct TYPE_14__ {
  int /*<<< orphan*/ *gr_members_val;
  scalar_t__ gr_members_len;
};
struct TYPE_15__ {
  unsigned int gr_flags;
  TYPE_2__ gr_members;
};
struct TYPE_16__ {
  TYPE_3__ gr_data;
};
struct TYPE_17__ {
  TYPE_4__ objdata_u;
  int /*<<< orphan*/ zo_type;
};
struct TYPE_13__ {
  int /*<<< orphan*/ mtime;
  int /*<<< orphan*/ ctime;
};
struct TYPE_18__ {
  int zo_ttl;
  TYPE_5__ zo_data;
  int /*<<< orphan*/ zo_access;
  struct TYPE_18__ *zo_name;
  struct TYPE_18__ *zo_owner;
  struct TYPE_18__ *zo_group;
  int /*<<< orphan*/ *zo_domain;
  TYPE_1__ zo_oid;
};
typedef TYPE_6__ nis_object;
typedef int /*<<< orphan*/ nis_error;
typedef int /*<<< orphan*/ leafbuf;
typedef int /*<<< orphan*/ domainbuf;
typedef char *const_nis_name;

/* Variables and functions */
int /*<<< orphan*/ NIS_BADNAME;
int /*<<< orphan*/ NIS_FAIL;
int /*<<< orphan*/ NIS_GROUP_OBJ;
int /*<<< orphan*/ NIS_NOMEMORY;
int /*<<< orphan*/ NIS_RES_STATUS(int /*<<< orphan*/ *);
scalar_t__ __glibc_unlikely(int /*<<< orphan*/);
int /*<<< orphan*/ __nis_default_access(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/);
TYPE_6__ *__nis_default_group(int /*<<< orphan*/ *);
TYPE_6__ *__nis_default_owner(int /*<<< orphan*/ *);
TYPE_6__ *calloc(int, int);
int /*<<< orphan*/ free(TYPE_6__ *);
int /*<<< orphan*/ *nis_add(char *, TYPE_6__ *);
char *nis_domain_of_r(char *, char *, int);
int /*<<< orphan*/ nis_free_object(TYPE_6__ *);
int /*<<< orphan*/ nis_freeresult(int /*<<< orphan*/ *);
char *nis_leaf_of_r(char *, char *, int);
char *stpcpy(char *, char *);
void *strdup(char *);
size_t strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
nis_error nis_creategroup(const_nis_name group, unsigned int flags) {
  if (group != NULL && group[0] != '\0') {
    size_t grouplen = strlen(group);
    char buf[grouplen + 50];
    char leafbuf[grouplen + 2];
    char domainbuf[grouplen + 2];
    nis_error status;
    nis_result *res;
    char *cp, *cp2;
    nis_object *obj;
    cp = stpcpy(buf, nis_leaf_of_r(group, leafbuf, sizeof(leafbuf) - 1));
    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);
    } else
      return NIS_BADNAME;
    obj = calloc(1, sizeof(nis_object));
    if (__glibc_unlikely(obj == NULL))
      return NIS_NOMEMORY;
    obj->zo_oid.ctime = obj->zo_oid.mtime = time(NULL);
    obj->zo_name = strdup(leafbuf);
    obj->zo_owner = __nis_default_owner(NULL);
    obj->zo_group = __nis_default_group(NULL);
    obj->zo_domain = strdup(domainbuf);
    if (obj->zo_name == NULL || obj->zo_owner == NULL ||
        obj->zo_group == NULL || obj->zo_domain == NULL) {
      free(obj->zo_group);
      free(obj->zo_owner);
      free(obj->zo_name);
      free(obj);
      return NIS_NOMEMORY;
    }
    obj->zo_access = __nis_default_access(NULL, 0);
    obj->zo_ttl = 60 * 60;
    obj->zo_data.zo_type = NIS_GROUP_OBJ;
    obj->zo_data.objdata_u.gr_data.gr_flags = flags;
    obj->zo_data.objdata_u.gr_data.gr_members.gr_members_len = 0;
    obj->zo_data.objdata_u.gr_data.gr_members.gr_members_val = NULL;
    res = nis_add(buf, obj);
    nis_free_object(obj);
    if (res == NULL)
      return NIS_NOMEMORY;
    status = NIS_RES_STATUS(res);
    nis_freeresult(res);
    return status;
  }
  return NIS_FAIL;
}


x86 assembly (clang, -O0):
<nis_creategroup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1557 <nis_creategroup+0x357>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1557 <nis_creategroup+0x357>
mov    -0x10(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    %rdx,%rax
add    $0x32,%rax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
add    $0x41,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rcx
mov    %rcx,%rax
add    $0x2,%rax
add    $0x11,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x90(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x38(%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,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x1,%rax
mov    %eax,%edx
call   10a0 <nis_leaf_of_r@plt>
mov    -0x88(%rbp),%rdi
mov    %rax,%rsi
call   1060 <stpcpy@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xd1c(%rip),%rsi
call   1060 <stpcpy@plt>
mov    -0x80(%rbp),%rsi
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
mov    %rcx,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x1,%rax
mov    %eax,%edx
call   1050 <nis_domain_of_r@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     134a <nis_creategroup+0x14a>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     134a <nis_creategroup+0x14a>
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>
jmp    1362 <nis_creategroup+0x162>
mov    0x2c8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    154b <nis_creategroup+0x34b>
mov    $0x1,%edi
mov    $0x58,%esi
call   10b0 <calloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10f0 <__glibc_unlikely@plt>
cmp    $0x0,%rax
je     13a9 <nis_creategroup+0x1a9>
mov    0x2c30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    154b <nis_creategroup+0x34b>
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    -0x90(%rbp),%rdi
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
mov    %ecx,0x50(%rax)
mov    -0x68(%rbp),%rax
mov    %ecx,0x54(%rax)
call   1110 <strdup@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
mov    %rcx,0x30(%rax)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <__nis_default_owner@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
mov    %rcx,0x38(%rax)
xor    %eax,%eax
mov    %eax,%edi
call   10e0 <__nis_default_group@plt>
mov    -0x80(%rbp),%rdi
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
mov    %rcx,0x40(%rax)
call   1110 <strdup@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
mov    %rcx,0x48(%rax)
mov    -0x68(%rbp),%rax
cmpq   $0x0,0x30(%rax)
je     1451 <nis_creategroup+0x251>
mov    -0x68(%rbp),%rax
cmpq   $0x0,0x38(%rax)
je     1451 <nis_creategroup+0x251>
mov    -0x68(%rbp),%rax
cmpq   $0x0,0x40(%rax)
je     1451 <nis_creategroup+0x251>
mov    -0x68(%rbp),%rax
cmpq   $0x0,0x48(%rax)
jne    1499 <nis_creategroup+0x299>
mov    -0x68(%rbp),%rax
mov    0x40(%rax),%rdi
call   1040 <free@plt>
mov    -0x68(%rbp),%rax
mov    0x38(%rax),%rdi
call   1040 <free@plt>
mov    -0x68(%rbp),%rax
mov    0x30(%rax),%rdi
call   1040 <free@plt>
mov    -0x68(%rbp),%rdi
call   1040 <free@plt>
mov    0x2b40(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    154b <nis_creategroup+0x34b>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1070 <__nis_default_access@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
mov    %ecx,0x28(%rax)
mov    -0x68(%rbp),%rax
movl   $0xe10,(%rax)
mov    0x2b0b(%rip),%rax
mov    (%rax),%ecx
mov    -0x68(%rbp),%rax
mov    %ecx,0x20(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x68(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x68(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x68(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x68(%rbp),%rsi
call   1030 <nis_add@plt>
mov    %rax,-0x50(%rbp)
mov    -0x68(%rbp),%rdi
call   10c0 <nis_free_object@plt>
cmpq   $0x0,-0x50(%rbp)
jne    1529 <nis_creategroup+0x329>
mov    0x2ab0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    154b <nis_creategroup+0x34b>
mov    -0x50(%rbp),%rdi
call   1100 <NIS_RES_STATUS@plt>
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%rdi
call   1120 <nis_freeresult@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
jmp    1563 <nis_creategroup+0x363>
mov    0x2a7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nis_creategroup>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %rdi,%rdi
je     1303 <nis_creategroup+0xf3>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1303 <nis_creategroup+0xf3>
mov    %esi,-0x34(%rbp)
mov    %rbx,%rdi
call   1090 <strlen@plt>
mov    %rsp,-0x30(%rbp)
mov    %rsp,%r15
lea    0x41(%rax),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r15
mov    %r15,%rsp
mov    %rsp,%r14
lea    0x11(%rax),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r14
mov    %r14,%rsp
mov    %rsp,%r13
sub    %rcx,%r13
mov    %r13,%rsp
lea    0x1(%rax),%r12d
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   10b0 <nis_leaf_of_r@plt>
mov    %r15,-0x40(%rbp)
mov    %r15,%rdi
mov    %rax,%rsi
call   1070 <stpcpy@plt>
mov    %rax,%r15
movabs $0x5f7370756f72672e,%rax
70 73 5f
mov    %rax,(%r15)
movl   $0x726964,0x8(%r15)
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12d,%edx
call   1060 <nis_domain_of_r@plt>
test   %rax,%rax
je     130e <nis_creategroup+0xfe>
cmpb   $0x0,(%rax)
je     130e <nis_creategroup+0xfe>
mov    %r15,%rdi
add    $0xc,%rdi
movb   $0x2e,0xb(%r15)
mov    %rax,%rsi
call   1050 <strcpy@plt>
mov    $0x1,%edi
mov    $0x58,%esi
call   10c0 <calloc@plt>
mov    %rax,%r15
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1100 <__glibc_unlikely@plt>
test   %rax,%rax
je     132c <nis_creategroup+0x11c>
mov    0x2cc7(%rip),%rax
jmp    1315 <nis_creategroup+0x105>
mov    0x2cce(%rip),%rax
mov    (%rax),%ebx
jmp    131b <nis_creategroup+0x10b>
mov    0x2ccb(%rip),%rax
mov    (%rax),%ebx
mov    -0x30(%rbp),%rsp
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   10e0 <time@plt>
mov    %eax,0x50(%r15)
mov    %eax,0x54(%r15)
mov    %r14,%rdi
call   1120 <strdup@plt>
mov    %rax,%rbx
mov    %rax,0x30(%r15)
xor    %edi,%edi
call   10a0 <__nis_default_owner@plt>
mov    %rax,%r12
mov    %rax,0x38(%r15)
xor    %edi,%edi
call   10f0 <__nis_default_group@plt>
mov    %rax,%r14
mov    %rax,0x40(%r15)
mov    %r13,%rdi
call   1120 <strdup@plt>
mov    %rax,0x48(%r15)
test   %rbx,%rbx
je     13ed <nis_creategroup+0x1dd>
test   %r12,%r12
je     13ed <nis_creategroup+0x1dd>
test   %r14,%r14
je     13ed <nis_creategroup+0x1dd>
test   %rax,%rax
je     13ed <nis_creategroup+0x1dd>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <__nis_default_access@plt>
mov    %eax,0x28(%r15)
movl   $0xe10,(%r15)
mov    0x2c2f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%r15)
mov    -0x34(%rbp),%eax
mov    %eax,0x8(%r15)
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%r15)
mov    -0x40(%rbp),%rdi
mov    %r15,%rsi
call   1030 <nis_add@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   10d0 <nis_free_object@plt>
test   %r14,%r14
je     12fa <nis_creategroup+0xea>
mov    %r14,%rdi
call   1110 <NIS_RES_STATUS@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1130 <nis_freeresult@plt>
jmp    1317 <nis_creategroup+0x107>
mov    %r14,%rdi
call   1040 <free@plt>
mov    0x38(%r15),%rdi
call   1040 <free@plt>
mov    0x30(%r15),%rdi
call   1040 <free@plt>
mov    %r15,%rdi
call   1040 <free@plt>
mov    0x2bb2(%rip),%rax
jmp    1315 <nis_creategroup+0x105>

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

LLVM IR (-O2):
%struct.TYPE_18__ = type { i32, %struct.TYPE_17__, i32, %struct.TYPE_18__*, %struct.TYPE_18__*, %struct.TYPE_18__*, i32*, %struct.TYPE_13__ }
%struct.TYPE_17__ = type { %struct.TYPE_16__, i32 }
%struct.TYPE_16__ = type { %struct.TYPE_15__ }
%struct.TYPE_15__ = type { i32, %struct.TYPE_14__ }
%struct.TYPE_14__ = type { i32*, i64 }
%struct.TYPE_13__ = type { i32, i32 }
@.str = [12 x i8] c".groups_dir\00"
@NIS_BADNAME = global i32 0
@NIS_NOMEMORY = global i32 0
@NIS_GROUP_OBJ = global i32 0
@NIS_FAIL = global i32 0
define i32 @nis_creategroup(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %85, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %85, label %7
7: ; preds = %4
%8 = tail call i64 @strlen(i8* %0)
%9 = add i64 %8, 50
%10 = tail call i8* @llvm.stacksave()
%11 = alloca i8, i64 %9
%12 = add i64 %8, 2
%13 = alloca i8, i64 %12
%14 = alloca i8, i64 %12
%15 = trunc i64 %8 to i32
%16 = add i32 %15, 1
%17 = call i8* @nis_leaf_of_r(i8* %0, i8* %13, i32 %16)
%18 = call i8* @stpcpy(i8* %11, i8* %17)
%19 = getelementptr i8, i8* %18, i64 11
%20 = call i8* @nis_domain_of_r(i8* %0, i8* %14, i32 %16)
%21 = icmp eq i8* %20, null
br i1 %21, label %33, label %22
22: ; preds = %7
%23 = load i8, i8* %20
%24 = icmp eq i8 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %22
%26 = getelementptr i8, i8* %18, i64 12
store i8 46, i8* %19
%27 = call i8* @strcpy(i8* dereferenceable(1) %26, i8* %20)
%28 = call %struct.TYPE_18__* @calloc(i32 1, i32 88)
%29 = icmp eq %struct.TYPE_18__* %28, null
%30 = zext i1 %29 to i32
%31 = call i64 @__glibc_unlikely(i32 %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %37, label %35
33: ; preds = %22, %7
%34 = load i32, i32* @NIS_BADNAME
br label %83
35: ; preds = %25
%36 = load i32, i32* @NIS_NOMEMORY
br label %83
37: ; preds = %25
%38 = call i32 @time(i32* null)
%39 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 7, i32 0
store i32 %38, i32* %39
%40 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 7, i32 1
store i32 %38, i32* %40
%41 = call i8* @strdup(i8* %13)
%42 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 3
%43 = bitcast %struct.TYPE_18__** %42 to i8**
store i8* %41, i8** %43
%44 = call %struct.TYPE_18__* @__nis_default_owner(i32* null)
%45 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 4
store %struct.TYPE_18__* %44, %struct.TYPE_18__** %45
%46 = call %struct.TYPE_18__* @__nis_default_group(i32* null)
%47 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 5
store %struct.TYPE_18__* %46, %struct.TYPE_18__** %47
%48 = call i8* @strdup(i8* %14)
%49 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 6
%50 = bitcast i32** %49 to i8**
store i8* %48, i8** %50
%51 = icmp eq i8* %41, null
%52 = icmp eq %struct.TYPE_18__* %44, null
%53 = select i1 %51, i1 true, i1 %52
br i1 %53, label %58, label %54
54: ; preds = %37
%55 = icmp eq %struct.TYPE_18__* %46, null
%56 = icmp eq i8* %48, null
%57 = select i1 %55, i1 true, i1 %56
br i1 %57, label %58, label %66
58: ; preds = %54, %37
%59 = call i32 @free(%struct.TYPE_18__* %46)
%60 = load %struct.TYPE_18__*, %struct.TYPE_18__** %45
%61 = call i32 @free(%struct.TYPE_18__* %60)
%62 = load %struct.TYPE_18__*, %struct.TYPE_18__** %42
%63 = call i32 @free(%struct.TYPE_18__* %62)
%64 = call i32 @free(%struct.TYPE_18__* %28)
%65 = load i32, i32* @NIS_NOMEMORY
br label %83
66: ; preds = %54
%67 = call i32 @__nis_default_access(i32* null, i32 0)
%68 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 2
store i32 %67, i32* %68
%69 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 0
store i32 3600, i32* %69
%70 = load i32, i32* @NIS_GROUP_OBJ
%71 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 1, i32 1
store i32 %70, i32* %71
%72 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 1, i32 0, i32 0, i32 0
store i32 %1, i32* %72
%73 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %28, i64 0, i32 1, i32 0, i32 0, i32 1, i32 0
%74 = bitcast i32** %73 to i8*
%75 = call i32* @nis_add(i8* %11, %struct.TYPE_18__* %28)
%76 = call i32 @nis_free_object(%struct.TYPE_18__* %28)
%77 = icmp eq i32* %75, null
br i1 %77, label %78, label %80
78: ; preds = %66
%79 = load i32, i32* @NIS_NOMEMORY
br label %83
80: ; preds = %66
%81 = call i32 @NIS_RES_STATUS(i32* %75)
%82 = call i32 @nis_freeresult(i32* %75)
br label %83
83: ; preds = %80, %78, %58, %35, %33
%84 = phi i32 [ %36, %35 ], [ %65, %58 ], [ %79, %78 ], [ %81, %80 ], [ %34, %33 ]
br label %87
85: ; preds = %4, %2
%86 = load i32, i32* @NIS_FAIL
br label %87
87: ; preds = %85, %83
%88 = phi i32 [ %84, %83 ], [ %86, %85 ]
ret i32 %88
}