#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 prefix_list {
  int dummy;
};
struct prefix {
  int dummy;
};

/* Variables and functions */
scalar_t__ prefix_list_overlap(struct prefix const *,
                               struct prefix_list const *, int);
int prefix_valid(const struct prefix *p, const struct prefix_list *pl1,
                 const struct prefix_list *pl2) {
  if (pl1 && prefix_list_overlap(p, pl1, 1))
    return 0;
  if (pl2 && prefix_list_overlap(p, pl2, 1))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<prefix_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1157 <prefix_valid+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <prefix_list_overlap@plt>
cmp    $0x0,%rax
je     1157 <prefix_valid+0x47>
movl   $0x0,-0x4(%rbp)
jmp    1191 <prefix_valid+0x81>
cmpq   $0x0,-0x20(%rbp)
je     118a <prefix_valid+0x7a>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1030 <prefix_list_overlap@plt>
cmp    $0x0,%rax
je     118a <prefix_valid+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    1191 <prefix_valid+0x81>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix_valid>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
test   %rsi,%rsi
je     1136 <prefix_valid+0x26>
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <prefix_list_overlap@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    115a <prefix_valid+0x4a>
test   %r14,%r14
je     1155 <prefix_valid+0x45>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <prefix_list_overlap@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    115a <prefix_valid+0x4a>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.prefix = type { i32 }
%struct.prefix_list = type { i32 }
define i32 @prefix_valid(%struct.prefix* %0, %struct.prefix_list* %1, %struct.prefix_list* %2) {
%4 = alloca i32
%5 = alloca %struct.prefix*
%6 = alloca %struct.prefix_list*
%7 = alloca %struct.prefix_list*
store %struct.prefix* %0, %struct.prefix** %5
store %struct.prefix_list* %1, %struct.prefix_list** %6
store %struct.prefix_list* %2, %struct.prefix_list** %7
%8 = load %struct.prefix_list*, %struct.prefix_list** %6
%9 = icmp ne %struct.prefix_list* %8, null
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load %struct.prefix*, %struct.prefix** %5
%12 = load %struct.prefix_list*, %struct.prefix_list** %6
%13 = call i64 @prefix_list_overlap(%struct.prefix* %11, %struct.prefix_list* %12, i32 1)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %10
store i32 0, i32* %4
br label %26
16: ; preds = %10, %3
%17 = load %struct.prefix_list*, %struct.prefix_list** %7
%18 = icmp ne %struct.prefix_list* %17, null
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load %struct.prefix*, %struct.prefix** %5
%21 = load %struct.prefix_list*, %struct.prefix_list** %7
%22 = call i64 @prefix_list_overlap(%struct.prefix* %20, %struct.prefix_list* %21, i32 1)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 0, i32* %4
br label %26
25: ; preds = %19, %16
store i32 1, i32* %4
br label %26
26: ; preds = %25, %24, %15
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
%struct.prefix = type { i32 }
%struct.prefix_list = type { i32 }
define i32 @prefix_valid(%struct.prefix* %0, %struct.prefix_list* %1, %struct.prefix_list* %2) {
%4 = icmp eq %struct.prefix_list* %1, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i64 @prefix_list_overlap(%struct.prefix* %0, %struct.prefix_list* %1, i32 1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %5, %3
%9 = icmp eq %struct.prefix_list* %2, null
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = tail call i64 @prefix_list_overlap(%struct.prefix* %0, %struct.prefix_list* %2, i32 1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10, %8
br label %14
14: ; preds = %10, %5, %13
%15 = phi i32 [ 1, %13 ], [ 0, %5 ], [ 0, %10 ]
ret i32 %15
}