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

/* Variables and functions */
int AccessUserIsInThisGroup(int /*<<< orphan*/);
struct group *getgrnam(char const *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char const *, char *);
int ConfigIsForGroup(const char *group, int verbose) {
  struct group *grp;
  if (strcmp(group, "*") == 0) {
    if (verbose >= 2)
      (void)printf("--- Apply restrictions for all groups ---\n");
    return (1);
  }
  if ((grp = getgrnam(group)) != NULL)
    if (AccessUserIsInThisGroup(grp->gr_gid) == 1) {
      if (verbose >= 2)
        (void)printf("--- Apply restrictions for group '%s' ---\n", group);
      return (1);
    }
  return (0);
}


x86 assembly (clang, -O0):
<ConfigIsForGroup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    118d <ConfigIsForGroup+0x4d>
cmpl   $0x2,-0x14(%rbp)
jl     1181 <ConfigIsForGroup+0x41>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ec <ConfigIsForGroup+0xac>
mov    -0x10(%rbp),%rdi
call   1060 <getgrnam@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11e5 <ConfigIsForGroup+0xa5>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1030 <AccessUserIsInThisGroup@plt>
cmp    $0x1,%eax
jne    11e0 <ConfigIsForGroup+0xa0>
cmpl   $0x2,-0x14(%rbp)
jl     11d4 <ConfigIsForGroup+0x94>
mov    -0x10(%rbp),%rsi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ec <ConfigIsForGroup+0xac>
jmp    11e5 <ConfigIsForGroup+0xa5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConfigIsForGroup>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xe9f(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11a4 <ConfigIsForGroup+0x54>
mov    %rbx,%rdi
call   1070 <getgrnam@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     11bb <ConfigIsForGroup+0x6b>
mov    (%rax),%edi
call   1030 <AccessUserIsInThisGroup@plt>
cmp    $0x1,%eax
jne    11bb <ConfigIsForGroup+0x6b>
mov    $0x1,%ebp
cmp    $0x2,%r14d
jl     11bb <ConfigIsForGroup+0x6b>
lea    0xe6a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11bb <ConfigIsForGroup+0x6b>
mov    $0x1,%ebp
cmp    $0x2,%r14d
jl     11bb <ConfigIsForGroup+0x6b>
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.group = type { i32 }
@.str = [2 x i8] c"*\00"
@.str.1 = [43 x i8] c"--- Apply restrictions for all groups ---\0A\00"
@.str.2 = [43 x i8] c"--- Apply restrictions for group '%s' ---\0A\00"
define i32 @ConfigIsForGroup(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.group*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp sge i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
store i32 1, i32* %3
br label %35
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = call %struct.group* @getgrnam(i8* %17)
store %struct.group* %18, %struct.group** %6
%19 = icmp ne %struct.group* %18, null
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = load %struct.group*, %struct.group** %6
%22 = getelementptr inbounds %struct.group, %struct.group* %21, i32 0, i32 0
%23 = load i32, i32* %22
%24 = call i32 @AccessUserIsInThisGroup(i32 %23)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %33
26: ; preds = %20
%27 = load i32, i32* %5
%28 = icmp sge i32 %27, 2
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i8*, i8** %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %29, %26
store i32 1, i32* %3
br label %35
33: ; preds = %20
br label %34
34: ; preds = %33, %16
store i32 0, i32* %3
br label %35
35: ; preds = %34, %32, %15
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
%struct.group = type { i32 }
@.str = [2 x i8] c"*\00"
@.str.2 = [43 x i8] c"--- Apply restrictions for group '%s' ---\0A\00"
@str = [42 x i8] c"--- Apply restrictions for all groups ---\00"
define i32 @ConfigIsForGroup(i8* %0, i32 %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = icmp sgt i32 %1, 1
br i1 %6, label %7, label %21
7: ; preds = %5
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br label %21
9: ; preds = %2
%10 = tail call %struct.group* @getgrnam(i8* %0)
%11 = icmp eq %struct.group* %10, null
br i1 %11, label %21, label %12
12: ; preds = %9
%13 = getelementptr inbounds %struct.group, %struct.group* %10, i64 0, i32 0
%14 = load i32, i32* %13
%15 = tail call i32 @AccessUserIsInThisGroup(i32 %14)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = icmp sgt i32 %1, 1
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %21
21: ; preds = %9, %12, %17, %19, %5, %7
%22 = phi i32 [ 1, %7 ], [ 1, %5 ], [ 1, %19 ], [ 1, %17 ], [ 0, %12 ], [ 0, %9 ]
ret i32 %22
}