#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__ *sname;
  struct TYPE_4__ *name;
};
typedef TYPE_1__ X509_PURPOSE;

/* Variables and functions */
int X509_PURPOSE_DYNAMIC;
int X509_PURPOSE_DYNAMIC_NAME;
int /*<<< orphan*/ free(TYPE_1__ *);
void xptable_free(X509_PURPOSE *p) {
  if (!p)
    return;
  if (p->flags & X509_PURPOSE_DYNAMIC) {
    if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
      free(p->name);
      free(p->sname);
    }
    free(p);
  }
}


x86 assembly (clang, -O0):
<xptable_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <xptable_free+0x1c>
jmp    117f <xptable_free+0x6f>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2e9f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     117f <xptable_free+0x6f>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2e97(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1176 <xptable_free+0x66>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <free@plt>
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):
<xptable_free>:
push   %rbx
test   %rdi,%rdi
je     114c <xptable_free+0x3c>
mov    %rdi,%rbx
mov    (%rdi),%eax
mov    0x2eb6(%rip),%rcx
test   %eax,(%rcx)
je     114c <xptable_free+0x3c>
mov    0x2ebb(%rip),%rcx
test   %eax,(%rcx)
je     1143 <xptable_free+0x33>
mov    0x10(%rbx),%rdi
call   1030 <free@plt>
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__*, %struct.TYPE_4__* }
@X509_PURPOSE_DYNAMIC = global i32 0
@X509_PURPOSE_DYNAMIC_NAME = global i32 0
define void @xptable_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 %32
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_PURPOSE_DYNAMIC
%11 = and i32 %9, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %32
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_PURPOSE_DYNAMIC_NAME
%18 = and i32 %16, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %29
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 2
%23 = load %struct.TYPE_4__*, %struct.TYPE_4__** %22
%24 = call i32 @free(%struct.TYPE_4__* %23)
%25 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%26 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %25, i32 0, i32 1
%27 = load %struct.TYPE_4__*, %struct.TYPE_4__** %26
%28 = call i32 @free(%struct.TYPE_4__* %27)
br label %29
29: ; preds = %20, %13
%30 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%31 = call i32 @free(%struct.TYPE_4__* %30)
br label %32
32: ; preds = %5, %29, %6
ret void
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, %struct.TYPE_4__*, %struct.TYPE_4__* }
@X509_PURPOSE_DYNAMIC = global i32 0
@X509_PURPOSE_DYNAMIC_NAME = global i32 0
define void @xptable_free(%struct.TYPE_4__* %0) {
%2 = icmp eq %struct.TYPE_4__* %0, null
br i1 %2, label %22, 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_PURPOSE_DYNAMIC
%7 = and i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %22, label %9
9: ; preds = %3
%10 = load i32, i32* @X509_PURPOSE_DYNAMIC_NAME
%11 = and i32 %10, %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %9
%14 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 2
%15 = load %struct.TYPE_4__*, %struct.TYPE_4__** %14
%16 = tail call i32 @free(%struct.TYPE_4__* %15)
%17 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 1
%18 = load %struct.TYPE_4__*, %struct.TYPE_4__** %17
%19 = tail call i32 @free(%struct.TYPE_4__* %18)
br label %20
20: ; preds = %13, %9
%21 = tail call i32 @free(%struct.TYPE_4__* %0)
br label %22
22: ; preds = %1, %20, %3
ret void
}