#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_13__ TYPE_5__;
typedef struct TYPE_12__ TYPE_4__;
typedef struct TYPE_11__ TYPE_3__;
typedef struct TYPE_10__ TYPE_2__;
typedef struct TYPE_9__ TYPE_1__;

/* Type definitions */
struct TYPE_13__ {
  TYPE_2__ *rdi;
  TYPE_3__ *asnum;
};
struct TYPE_12__ {
  int /*<<< orphan*/ asIdsOrRanges;
};
struct TYPE_11__ {
  TYPE_4__ u;
};
struct TYPE_9__ {
  int /*<<< orphan*/ asIdsOrRanges;
};
struct TYPE_10__ {
  TYPE_1__ u;
};
typedef TYPE_5__ ASIdentifiers;

/* Variables and functions */
scalar_t__ asid_contains(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ v3_asid_inherits(TYPE_5__ *);
int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b) {
  return (
      a == NULL || a == b ||
      (b != NULL && !v3_asid_inherits(a) && !v3_asid_inherits(b) &&
       asid_contains(b->asnum->u.asIdsOrRanges, a->asnum->u.asIdsOrRanges) &&
       asid_contains(b->rdi->u.asIdsOrRanges, a->rdi->u.asIdsOrRanges)));
}


x86 assembly (clang, -O0):
<v3_asid_subset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     11e7 <v3_asid_subset+0xc7>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
je     11e7 <v3_asid_subset+0xc7>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     11e1 <v3_asid_subset+0xc1>
mov    -0x8(%rbp),%rdi
call   1040 <v3_asid_inherits@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x12(%rbp)
jne    11e1 <v3_asid_subset+0xc1>
mov    -0x10(%rbp),%rdi
call   1040 <v3_asid_inherits@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x12(%rbp)
jne    11e1 <v3_asid_subset+0xc1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
call   1030 <asid_contains@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
je     11e1 <v3_asid_subset+0xc1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
call   1030 <asid_contains@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3_asid_subset>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%r14d
test   %rdi,%rdi
je     118a <v3_asid_subset+0x6a>
mov    %rsi,%rbp
mov    %rdi,%rbx
cmp    %rsi,%rdi
je     118a <v3_asid_subset+0x6a>
xor    %r14d,%r14d
test   %rbp,%rbp
je     118a <v3_asid_subset+0x6a>
mov    %rbx,%rdi
call   1040 <v3_asid_inherits@plt>
test   %eax,%eax
jne    118a <v3_asid_subset+0x6a>
mov    %rbp,%rdi
call   1040 <v3_asid_inherits@plt>
test   %eax,%eax
jne    118a <v3_asid_subset+0x6a>
mov    0x8(%rbp),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rax
mov    (%rax),%esi
call   1030 <asid_contains@plt>
test   %rax,%rax
je     118a <v3_asid_subset+0x6a>
mov    0x0(%rbp),%rax
mov    (%rax),%edi
mov    (%rbx),%rax
mov    (%rax),%esi
call   1030 <asid_contains@plt>
xor    %r14d,%r14d
test   %rax,%rax
setne  %r14b
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_13__ = type { %struct.TYPE_10__*, %struct.TYPE_11__* }
%struct.TYPE_10__ = type { %struct.TYPE_9__ }
%struct.TYPE_9__ = type { i32 }
%struct.TYPE_11__ = type { %struct.TYPE_12__ }
%struct.TYPE_12__ = type { i32 }
define i32 @v3_asid_subset(%struct.TYPE_13__* %0, %struct.TYPE_13__* %1) {
%3 = alloca %struct.TYPE_13__*
%4 = alloca %struct.TYPE_13__*
store %struct.TYPE_13__* %0, %struct.TYPE_13__** %3
store %struct.TYPE_13__* %1, %struct.TYPE_13__** %4
%5 = load %struct.TYPE_13__*, %struct.TYPE_13__** %3
%6 = icmp eq %struct.TYPE_13__* %5, null
br i1 %6, label %54, label %7
7: ; preds = %2
%8 = load %struct.TYPE_13__*, %struct.TYPE_13__** %3
%9 = load %struct.TYPE_13__*, %struct.TYPE_13__** %4
%10 = icmp eq %struct.TYPE_13__* %8, %9
br i1 %10, label %54, label %11
11: ; preds = %7
%12 = load %struct.TYPE_13__*, %struct.TYPE_13__** %4
%13 = icmp ne %struct.TYPE_13__* %12, null
br i1 %13, label %14, label %52
14: ; preds = %11
%15 = load %struct.TYPE_13__*, %struct.TYPE_13__** %3
%16 = call i32 @v3_asid_inherits(%struct.TYPE_13__* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %52, label %18
18: ; preds = %14
%19 = load %struct.TYPE_13__*, %struct.TYPE_13__** %4
%20 = call i32 @v3_asid_inherits(%struct.TYPE_13__* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %52, label %22
22: ; preds = %18
%23 = load %struct.TYPE_13__*, %struct.TYPE_13__** %4
%24 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %23, i32 0, i32 1
%25 = load %struct.TYPE_11__*, %struct.TYPE_11__** %24
%26 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %25, i32 0, i32 0
%27 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = load %struct.TYPE_13__*, %struct.TYPE_13__** %3
%30 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %29, i32 0, i32 1
%31 = load %struct.TYPE_11__*, %struct.TYPE_11__** %30
%32 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %31, i32 0, i32 0
%33 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %32, i32 0, i32 0
%34 = load i32, i32* %33
%35 = call i64 @asid_contains(i32 %28, i32 %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %52
37: ; preds = %22
%38 = load %struct.TYPE_13__*, %struct.TYPE_13__** %4
%39 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %38, i32 0, i32 0
%40 = load %struct.TYPE_10__*, %struct.TYPE_10__** %39
%41 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %40, i32 0, i32 0
%42 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %41, i32 0, i32 0
%43 = load i32, i32* %42
%44 = load %struct.TYPE_13__*, %struct.TYPE_13__** %3
%45 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %44, i32 0, i32 0
%46 = load %struct.TYPE_10__*, %struct.TYPE_10__** %45
%47 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %46, i32 0, i32 0
%48 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %47, i32 0, i32 0
%49 = load i32, i32* %48
%50 = call i64 @asid_contains(i32 %43, i32 %49)
%51 = icmp ne i64 %50, 0
br label %52
52: ; preds = %37, %22, %18, %14, %11
%53 = phi i1 [ false, %22 ], [ false, %18 ], [ false, %14 ], [ false, %11 ], [ %51, %37 ]
br label %54
54: ; preds = %52, %7, %2
%55 = phi i1 [ true, %7 ], [ true, %2 ], [ %53, %52 ]
%56 = zext i1 %55 to i32
ret i32 %56
}

LLVM IR (-O2):
%struct.TYPE_13__ = type { %struct.TYPE_10__*, %struct.TYPE_11__* }
%struct.TYPE_10__ = type { %struct.TYPE_9__ }
%struct.TYPE_9__ = type { i32 }
%struct.TYPE_11__ = type { %struct.TYPE_12__ }
%struct.TYPE_12__ = type { i32 }
define i32 @v3_asid_subset(%struct.TYPE_13__* %0, %struct.TYPE_13__* %1) {
%3 = icmp eq %struct.TYPE_13__* %0, null
%4 = icmp eq %struct.TYPE_13__* %0, %1
%5 = or i1 %3, %4
br i1 %5, label %37, label %6
6: ; preds = %2
%7 = icmp eq %struct.TYPE_13__* %1, null
br i1 %7, label %37, label %8
8: ; preds = %6
%9 = tail call i32 @v3_asid_inherits(%struct.TYPE_13__* %0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %37
11: ; preds = %8
%12 = tail call i32 @v3_asid_inherits(%struct.TYPE_13__* %1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %37
14: ; preds = %11
%15 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %1, i64 0, i32 1
%16 = load %struct.TYPE_11__*, %struct.TYPE_11__** %15
%17 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %16, i64 0, i32 0, i32 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %0, i64 0, i32 1
%20 = load %struct.TYPE_11__*, %struct.TYPE_11__** %19
%21 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %20, i64 0, i32 0, i32 0
%22 = load i32, i32* %21
%23 = tail call i64 @asid_contains(i32 %18, i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %37, label %25
25: ; preds = %14
%26 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %1, i64 0, i32 0
%27 = load %struct.TYPE_10__*, %struct.TYPE_10__** %26
%28 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %27, i64 0, i32 0, i32 0
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %0, i64 0, i32 0
%31 = load %struct.TYPE_10__*, %struct.TYPE_10__** %30
%32 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %31, i64 0, i32 0, i32 0
%33 = load i32, i32* %32
%34 = tail call i64 @asid_contains(i32 %29, i32 %33)
%35 = icmp ne i64 %34, 0
%36 = zext i1 %35 to i32
br label %37
37: ; preds = %6, %8, %11, %14, %25, %2
%38 = phi i32 [ 1, %2 ], [ 0, %14 ], [ 0, %11 ], [ 0, %8 ], [ 0, %6 ], [ %36, %25 ]
ret i32 %38
}