#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 dummy;
};
typedef int gid_t;
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int ENOENT;
int NSS_STATUS_NOTFOUND;
int fill_group(struct group *const, char *const, size_t const, int *const);
enum nss_status _nss_puavoadmins_getgrgid_r(const gid_t gid,
                                            struct group *const gr,
                                            char *const buf,
                                            const size_t bufsize,
                                            int *const errnop) {
  if (gid != 555) {
    *errnop = ENOENT;
    return NSS_STATUS_NOTFOUND;
  }
  return fill_group(gr, buf, bufsize, errnop);
}


x86 assembly (clang, -O0):
<_nss_puavoadmins_getgrgid_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x22b,-0x8(%rbp)
je     1158 <_nss_puavoadmins_getgrgid_r+0x48>
mov    0x2e91(%rip),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <_nss_puavoadmins_getgrgid_r+0x60>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <fill_group@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_puavoadmins_getgrgid_r>:
cmp    $0x22b,%edi
jne    1129 <_nss_puavoadmins_getgrgid_r+0x19>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%rcx
jmp    1030 <fill_group@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%r8)
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.group = type { i32 }
@ENOENT = global i32 0
@NSS_STATUS_NOTFOUND = global i32 0
define i32 @_nss_puavoadmins_getgrgid_r(i32 %0, %struct.group* %1, i8* %2, i64 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.group*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
store i32 %0, i32* %7
store %struct.group* %1, %struct.group** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i32* %4, i32** %11
%12 = load i32, i32* %7
%13 = icmp ne i32 %12, 555
br i1 %13, label %14, label %18
14: ; preds = %5
%15 = load i32, i32* @ENOENT
%16 = load i32*, i32** %11
store i32 %15, i32* %16
%17 = load i32, i32* @NSS_STATUS_NOTFOUND
store i32 %17, i32* %6
br label %24
18: ; preds = %5
%19 = load %struct.group*, %struct.group** %8
%20 = load i8*, i8** %9
%21 = load i64, i64* %10
%22 = load i32*, i32** %11
%23 = call i32 @fill_group(%struct.group* %19, i8* %20, i64 %21, i32* %22)
store i32 %23, i32* %6
br label %24
24: ; preds = %18, %14
%25 = load i32, i32* %6
ret i32 %25
}

LLVM IR (-O2):
%struct.group = type { i32 }
@ENOENT = global i32 0
@NSS_STATUS_NOTFOUND = global i32 0
define i32 @_nss_puavoadmins_getgrgid_r(i32 %0, %struct.group* %1, i8* %2, i64 %3, i32* %4) {
%6 = icmp eq i32 %0, 555
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = load i32, i32* @ENOENT
store i32 %8, i32* %4
%9 = load i32, i32* @NSS_STATUS_NOTFOUND
br label %12
10: ; preds = %5
%11 = tail call i32 @fill_group(%struct.group* %1, i8* %2, i64 %3, i32* %4)
br label %12
12: ; preds = %10, %7
%13 = phi i32 [ %9, %7 ], [ %11, %10 ]
ret i32 %13
}