#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_7__ TYPE_3__;
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  TYPE_2__ *rdi;
  TYPE_1__ *asnum;
};
struct TYPE_6__ {
  scalar_t__ type;
};
struct TYPE_5__ {
  scalar_t__ type;
};
typedef TYPE_3__ ASIdentifiers;

/* Variables and functions */
scalar_t__ ASIdentifierChoice_inherit;
int v3_asid_inherits(ASIdentifiers *asid) {
  return (asid != NULL && ((asid->asnum != NULL &&
                            asid->asnum->type == ASIdentifierChoice_inherit) ||
                           (asid->rdi != NULL &&
                            asid->rdi->type == ASIdentifierChoice_inherit)));
}


x86 assembly (clang, -O0):
<v3_asid_inherits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1180 <v3_asid_inherits+0x80>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1147 <v3_asid_inherits+0x47>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rcx
mov    $0x1,%al
mov    0x2ead(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xa(%rbp)
je     117a <v3_asid_inherits+0x7a>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0xb(%rbp)
je     1174 <v3_asid_inherits+0x74>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3_asid_inherits>:
xor    %eax,%eax
test   %rdi,%rdi
je     1143 <v3_asid_inherits+0x43>
mov    0x8(%rdi),%rax
test   %rax,%rax
je     1124 <v3_asid_inherits+0x24>
mov    (%rax),%rcx
mov    0x2ece(%rip),%rdx
mov    $0x1,%eax
cmp    (%rdx),%rcx
je     1143 <v3_asid_inherits+0x43>
mov    (%rdi),%rcx
mov    $0x0,%eax
test   %rcx,%rcx
je     1143 <v3_asid_inherits+0x43>
mov    (%rcx),%rcx
mov    0x2ead(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
sete   %al
ret

LLVM IR (-O0):
%struct.TYPE_7__ = type { %struct.TYPE_6__*, %struct.TYPE_5__* }
%struct.TYPE_6__ = type { i64 }
%struct.TYPE_5__ = type { i64 }
@ASIdentifierChoice_inherit = global i64 0
define i32 @v3_asid_inherits(%struct.TYPE_7__* %0) {
%2 = alloca %struct.TYPE_7__*
store %struct.TYPE_7__* %0, %struct.TYPE_7__** %2
%3 = load %struct.TYPE_7__*, %struct.TYPE_7__** %2
%4 = icmp ne %struct.TYPE_7__* %3, null
br i1 %4, label %5, label %35
5: ; preds = %1
%6 = load %struct.TYPE_7__*, %struct.TYPE_7__** %2
%7 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %6, i32 0, i32 1
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %7
%9 = icmp ne %struct.TYPE_5__* %8, null
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = load %struct.TYPE_7__*, %struct.TYPE_7__** %2
%12 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %11, i32 0, i32 1
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = load i64, i64* @ASIdentifierChoice_inherit
%17 = icmp eq i64 %15, %16
br i1 %17, label %33, label %18
18: ; preds = %10, %5
%19 = load %struct.TYPE_7__*, %struct.TYPE_7__** %2
%20 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %19, i32 0, i32 0
%21 = load %struct.TYPE_6__*, %struct.TYPE_6__** %20
%22 = icmp ne %struct.TYPE_6__* %21, null
br i1 %22, label %23, label %31
23: ; preds = %18
%24 = load %struct.TYPE_7__*, %struct.TYPE_7__** %2
%25 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %24, i32 0, i32 0
%26 = load %struct.TYPE_6__*, %struct.TYPE_6__** %25
%27 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %26, i32 0, i32 0
%28 = load i64, i64* %27
%29 = load i64, i64* @ASIdentifierChoice_inherit
%30 = icmp eq i64 %28, %29
br label %31
31: ; preds = %23, %18
%32 = phi i1 [ false, %18 ], [ %30, %23 ]
br label %33
33: ; preds = %31, %10
%34 = phi i1 [ true, %10 ], [ %32, %31 ]
br label %35
35: ; preds = %33, %1
%36 = phi i1 [ false, %1 ], [ %34, %33 ]
%37 = zext i1 %36 to i32
ret i32 %37
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { %struct.TYPE_6__*, %struct.TYPE_5__* }
%struct.TYPE_6__ = type { i64 }
%struct.TYPE_5__ = type { i64 }
@ASIdentifierChoice_inherit = global i64 0
define i32 @v3_asid_inherits(%struct.TYPE_7__* %0) {
%2 = icmp eq %struct.TYPE_7__* %0, null
br i1 %2, label %22, label %3
3: ; preds = %1
%4 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%5 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%6 = icmp eq %struct.TYPE_5__* %5, null
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i64 0, i32 0
%9 = load i64, i64* %8
%10 = load i64, i64* @ASIdentifierChoice_inherit
%11 = icmp eq i64 %9, %10
br i1 %11, label %22, label %12
12: ; preds = %7, %3
%13 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 0
%14 = load %struct.TYPE_6__*, %struct.TYPE_6__** %13
%15 = icmp eq %struct.TYPE_6__* %14, null
br i1 %15, label %22, label %16
16: ; preds = %12
%17 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %14, i64 0, i32 0
%18 = load i64, i64* %17
%19 = load i64, i64* @ASIdentifierChoice_inherit
%20 = icmp eq i64 %18, %19
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %7, %16, %12, %1
%23 = phi i32 [ 0, %1 ], [ 1, %7 ], [ 0, %12 ], [ %21, %16 ]
ret i32 %23
}