// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: link_assigned_prefixes
struct prefix_list *
link_assigned_prefixes(struct interface *interface,
                       const struct prefix *overlaps)
{
    int i, j;
    struct prefix_list *pl;

    if(interface->type == INTERFACE_ADHOC || interface->type == INTERFACE_MESH)
        return NULL;

    pl = create_prefix_list();
    if(pl == NULL)
        return NULL;

    for(i = 0; i < numneighs; i++) {
        struct node *node;
        unsigned int his_id = ~0;
        if(neighs[i].interface->ifindex != interface->ifindex)
            continue;
        node = find_node(neighs[i].id, 0);
        if(node == NULL || node->neighs == NULL || node->assigned == NULL)
            continue;
        for(j = 0; j < node->numneighs; j++)
            if(id_eq(node->neighs[j].neigh, myid)) {
                his_id = node->neighs[j].lei;
                break;
            }
        if(j == node->numneighs)
            continue;

        for(j = 0; j < node->assigned->numprefixes; j++) {
            struct prefix *p;
            if(node->assigned == NULL)
                continue;
            p = &node->assigned->prefixes[j];
            if(p->eid == his_id &&
               (!overlaps || prefix_overlaps(p, overlaps))) {
                struct prefix_list *pl2;
                pl2 = prefix_list_cons_prefix(pl, p);
                if(pl2 == NULL) {
                    destroy_prefix_list(pl);
                    return NULL;
                }
                pl = pl2;
            }
        }
    }
    return pl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl 0xc(%rdi), %eax
andl $-0x2, %eax
cmpl $0x2, %eax
je 0x9d4f
movq %rsi, %rbx
movl $0x1, %edi
movl $0x10, %esi
callq 0x21b0
testq %rax, %rax
je 0x9d4f
movq %rax, (%rsp)
leaq 0x9693(%rip), %rax      # 0x132a8
cmpl $0x0, (%rax)
jle 0x9d57
movq %rbx, 0x18(%rsp)
xorl %ebp, %ebp
leaq 0xa264(%rip), %r13      # 0x13e90
leaq 0x964d(%rip), %r12      # 0x13280
movq %rbp, %rdi
shlq $0x6, %rdi
movq (%r13,%rdi), %rax
movl 0x8(%rax), %eax
movq 0x20(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x9d2f
addq %r13, %rdi
addq $0x8, %rdi
xorl %esi, %esi
callq 0x49a3
testq %rax, %rax
je 0x9d2f
movq 0x40(%rax), %rcx
testq %rcx, %rcx
je 0x9d2f
movq 0x50(%rax), %r14
testq %r14, %r14
je 0x9d2f
movslq 0x48(%rax), %rdi
xorl %edx, %edx
testq %rdi, %rdi
jle 0x9ca5
movl (%rcx), %esi
cmpl (%r12), %esi
je 0x9cac
incq %rdx
addq $0xc, %rcx
cmpq %rdx, %rdi
jne 0x9c8c
jmp 0x9d2f
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x9caf
movl 0x8(%rcx), %ecx
cmpl %edi, %edx
je 0x9d2f
cmpw $0x0, 0x8(%r14)
jle 0x9d2f
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
xorl %ebx, %ebx
movl %ecx, 0xc(%rsp)
movq %r13, %r12
movq (%r14), %r13
cmpl %ecx, 0x18(%r13,%r15)
jne 0x9d14
addq %r15, %r13
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x9cef
movq %r13, %rdi
callq 0x95c1
testl %eax, %eax
je 0x9d10
movq (%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x92ec
testq %rax, %rax
je 0x9d47
movq 0x10(%rsp), %rcx
movq 0x50(%rcx), %r14
movq %rax, (%rsp)
movl 0xc(%rsp), %ecx
incq %rbx
movswq 0x8(%r14), %rax
addq $0x1c, %r15
cmpq %rax, %rbx
movq %r12, %r13
leaq 0x9553(%rip), %r12      # 0x13280
jl 0x9cc9
incq %rbp
leaq 0x956f(%rip), %rax      # 0x132a8
movslq (%rax), %rax
cmpq %rax, %rbp
jl 0x9c33
jmp 0x9d57
movq %r14, %rdi
callq 0x92d1
movq $0x0, (%rsp)
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq