#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_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int flags;
  struct TYPE_4__ *name;
};
typedef TYPE_1__ X509_TRUST;

/* Variables and functions */
int X509_TRUST_DYNAMIC;
int X509_TRUST_DYNAMIC_NAME;
int /*<<< orphan*/ free(TYPE_1__ *);
void trtable_free(X509_TRUST *p) {
  if (!p)
    return;
  if (p->flags & X509_TRUST_DYNAMIC) {
    if (p->flags & X509_TRUST_DYNAMIC_NAME)
      free(p->name);
    free(p);
  }
}


x86 assembly (clang, -O0):
<trtable_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <trtable_free+0x1c>
jmp    1172 <trtable_free+0x62>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2eaf(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1172 <trtable_free+0x62>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2e87(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1169 <trtable_free+0x59>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trtable_free>:
push   %rbx
test   %rdi,%rdi
je     1143 <trtable_free+0x33>
mov    %rdi,%rbx
mov    (%rdi),%eax
mov    0x2ec6(%rip),%rcx
test   %eax,(%rcx)
je     1143 <trtable_free+0x33>
mov    0x2eab(%rip),%rcx
test   %eax,(%rcx)
je     113a <trtable_free+0x2a>
mov    0x8(%rbx),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, %struct.TYPE_4__* }
@X509_TRUST_DYNAMIC = global i32 0
@X509_TRUST_DYNAMIC_NAME = global i32 0
define void @trtable_free(%struct.TYPE_4__* %0) {
%2 = alloca %struct.TYPE_4__*
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %2
%3 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%4 = icmp ne %struct.TYPE_4__* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %28
6: ; preds = %1
%7 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load i32, i32* @X509_TRUST_DYNAMIC
%11 = and i32 %9, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %6
%14 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%15 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = load i32, i32* @X509_TRUST_DYNAMIC_NAME
%18 = and i32 %16, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %13
%21 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%22 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %21, i32 0, i32 1
%23 = load %struct.TYPE_4__*, %struct.TYPE_4__** %22
%24 = call i32 @free(%struct.TYPE_4__* %23)
br label %25
25: ; preds = %20, %13
%26 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%27 = call i32 @free(%struct.TYPE_4__* %26)
br label %28
28: ; preds = %5, %25, %6
ret void
}

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