#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_mem;
  scalar_t__ gr_gid;
  int /*<<< orphan*/ *gr_passwd;
  int /*<<< orphan*/ *gr_name;
};
typedef scalar_t__ gid_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ strsplit_free(int /*<<< orphan*/ *);
void exfiles_group_destroy(struct group *grbuf) {
  if (NULL != grbuf) {
    if (NULL != grbuf->gr_name) {
      free(grbuf->gr_name);
      grbuf->gr_name = NULL;
    }
    if (NULL != grbuf->gr_passwd) {
      free(grbuf->gr_passwd);
      grbuf->gr_passwd = NULL;
    }
    grbuf->gr_gid = (gid_t)-1;
    if (NULL != grbuf->gr_mem) {
      strsplit_free(grbuf->gr_mem);
      grbuf->gr_mem = NULL;
    }
  }
}


x86 assembly (clang, -O0):
<exfiles_group_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     11c1 <exfiles_group_destroy+0xa1>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    0x18(%rcx),%rax
je     1161 <exfiles_group_destroy+0x41>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    0x10(%rcx),%rax
je     118a <exfiles_group_destroy+0x6a>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rax
movq   $0xffffffffffffffff,0x8(%rax)
ff
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    (%rcx),%rax
je     11bc <exfiles_group_destroy+0x9c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strsplit_free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
jmp    11c1 <exfiles_group_destroy+0xa1>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exfiles_group_destroy>:
push   %rbx
test   %rdi,%rdi
je     1171 <exfiles_group_destroy+0x51>
mov    %rdi,%rbx
mov    0x18(%rdi),%rdi
test   %rdi,%rdi
je     113f <exfiles_group_destroy+0x1f>
call   1030 <free@plt>
movq   $0x0,0x18(%rbx)
mov    0x10(%rbx),%rdi
test   %rdi,%rdi
je     1155 <exfiles_group_destroy+0x35>
call   1030 <free@plt>
movq   $0x0,0x10(%rbx)
movq   $0xffffffffffffffff,0x8(%rbx)
ff
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1171 <exfiles_group_destroy+0x51>
call   1040 <strsplit_free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.group = type { i32*, i64, i32*, i32* }
define void @exfiles_group_destroy(%struct.group* %0) {
%2 = alloca %struct.group*
store %struct.group* %0, %struct.group** %2
%3 = load %struct.group*, %struct.group** %2
%4 = icmp ne %struct.group* null, %3
br i1 %4, label %5, label %44
5: ; preds = %1
%6 = load %struct.group*, %struct.group** %2
%7 = getelementptr inbounds %struct.group, %struct.group* %6, i32 0, i32 3
%8 = load i32*, i32** %7
%9 = icmp ne i32* null, %8
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load %struct.group*, %struct.group** %2
%12 = getelementptr inbounds %struct.group, %struct.group* %11, i32 0, i32 3
%13 = load i32*, i32** %12
%14 = call i32 @free(i32* %13)
%15 = load %struct.group*, %struct.group** %2
%16 = getelementptr inbounds %struct.group, %struct.group* %15, i32 0, i32 3
store i32* null, i32** %16
br label %17
17: ; preds = %10, %5
%18 = load %struct.group*, %struct.group** %2
%19 = getelementptr inbounds %struct.group, %struct.group* %18, i32 0, i32 2
%20 = load i32*, i32** %19
%21 = icmp ne i32* null, %20
br i1 %21, label %22, label %29
22: ; preds = %17
%23 = load %struct.group*, %struct.group** %2
%24 = getelementptr inbounds %struct.group, %struct.group* %23, i32 0, i32 2
%25 = load i32*, i32** %24
%26 = call i32 @free(i32* %25)
%27 = load %struct.group*, %struct.group** %2
%28 = getelementptr inbounds %struct.group, %struct.group* %27, i32 0, i32 2
store i32* null, i32** %28
br label %29
29: ; preds = %22, %17
%30 = load %struct.group*, %struct.group** %2
%31 = getelementptr inbounds %struct.group, %struct.group* %30, i32 0, i32 1
store i64 -1, i64* %31
%32 = load %struct.group*, %struct.group** %2
%33 = getelementptr inbounds %struct.group, %struct.group* %32, i32 0, i32 0
%34 = load i32*, i32** %33
%35 = icmp ne i32* null, %34
br i1 %35, label %36, label %43
36: ; preds = %29
%37 = load %struct.group*, %struct.group** %2
%38 = getelementptr inbounds %struct.group, %struct.group* %37, i32 0, i32 0
%39 = load i32*, i32** %38
%40 = call i32 @strsplit_free(i32* %39)
%41 = load %struct.group*, %struct.group** %2
%42 = getelementptr inbounds %struct.group, %struct.group* %41, i32 0, i32 0
store i32* null, i32** %42
br label %43
43: ; preds = %36, %29
br label %44
44: ; preds = %43, %1
ret void
}

LLVM IR (-O2):
%struct.group = type { i32*, i64, i32*, i32* }
define void @exfiles_group_destroy(%struct.group* %0) {
%2 = icmp eq %struct.group* %0, null
br i1 %2, label %22, label %3
3: ; preds = %1
%4 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 3
%5 = load i32*, i32** %4
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @free(i32* %5)
store i32* null, i32** %4
br label %9
9: ; preds = %7, %3
%10 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 2
%11 = load i32*, i32** %10
%12 = icmp eq i32* %11, null
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 @free(i32* %11)
store i32* null, i32** %10
br label %15
15: ; preds = %13, %9
%16 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 1
store i64 -1, i64* %16
%17 = getelementptr inbounds %struct.group, %struct.group* %0, i64 0, i32 0
%18 = load i32*, i32** %17
%19 = icmp eq i32* %18, null
br i1 %19, label %22, label %20
20: ; preds = %15
%21 = tail call i32 @strsplit_free(i32* %18)
store i32* null, i32** %17
br label %22
22: ; preds = %15, %20, %1
ret void
}