#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 group {
  char **gr_mem;
  int /*<<< orphan*/ gr_gid;
};

/* Variables and functions */
int /*<<< orphan*/ beginRunsv(char *, int /*<<< orphan*/);
struct group *getgrnam(char *);
int /*<<< orphan*/ printf(char *);
int scanUsers() {
  struct group *grp;
  char **sName;
  grp = getgrnam("svusers");
  if (grp == NULL) {
    printf("No group name "
           "svusers"
           " exists.\n");
    return 1;
  }
  printf("Scanning "
         "svusers"
         " group...\n");
  for (sName = grp->gr_mem; *sName; sName++) {
    beginRunsv(*sName, grp->gr_gid);
  }
}


x86 assembly (clang, -O0):
<scanUsers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
call   1050 <getgrnam@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116b <scanUsers+0x3b>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <scanUsers+0x84>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     11b4 <scanUsers+0x84>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
call   1030 <beginRunsv@plt>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1182 <scanUsers+0x52>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scanUsers>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
call   1050 <getgrnam@plt>
test   %rax,%rax
je     1187 <scanUsers+0x57>
mov    %rax,%r14
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%rbx
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1193 <scanUsers+0x63>
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x8(%r14),%esi
call   1040 <beginRunsv@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1170 <scanUsers+0x40>
jmp    1193 <scanUsers+0x63>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.group = type { i8**, i32 }
@.str = [8 x i8] c"svusers\00"
@.str.1 = [31 x i8] c"No group name svusers exists.\0A\00"
@.str.2 = [27 x i8] c"Scanning svusers group...\0A\00"
define i32 @scanUsers() {
%1 = alloca i32
%2 = alloca %struct.group*
%3 = alloca i8**
%4 = call %struct.group* @getgrnam(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store %struct.group* %4, %struct.group** %2
%5 = load %struct.group*, %struct.group** %2
%6 = icmp eq %struct.group* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %28
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%11 = load %struct.group*, %struct.group** %2
%12 = getelementptr inbounds %struct.group, %struct.group* %11, i32 0, i32 0
%13 = load i8**, i8*** %12
store i8** %13, i8*** %3
br label %14
14: ; preds = %25, %9
%15 = load i8**, i8*** %3
%16 = load i8*, i8** %15
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i8**, i8*** %3
%20 = load i8*, i8** %19
%21 = load %struct.group*, %struct.group** %2
%22 = getelementptr inbounds %struct.group, %struct.group* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = call i32 @beginRunsv(i8* %20, i32 %23)
br label %25
25: ; preds = %18
%26 = load i8**, i8*** %3
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %3
br label %14
28: ; preds = %7, %14
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
%struct.group = type { i8**, i32 }
@.str = [8 x i8] c"svusers\00"
@str = [26 x i8] c"Scanning svusers group...\00"
@str.3 = [30 x i8] c"No group name svusers exists.\00"
define i32 @scanUsers() {
%1 = tail call %struct.group* @getgrnam(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq %struct.group* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.3, i64 0, i64 0))
br label %21
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%7 = getelementptr inbounds %struct.group, %struct.group* %1, i64 0, i32 0
%8 = load i8**, i8*** %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %21, label %11
11: ; preds = %5
%12 = getelementptr inbounds %struct.group, %struct.group* %1, i64 0, i32 1
br label %13
13: ; preds = %11, %13
%14 = phi i8* [ %9, %11 ], [ %19, %13 ]
%15 = phi i8** [ %8, %11 ], [ %18, %13 ]
%16 = load i32, i32* %12
%17 = tail call i32 @beginRunsv(i8* %14, i32 %16)
%18 = getelementptr inbounds i8*, i8** %15, i64 1
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %13
21: ; preds = %13, %5, %3
ret i32 1
}