// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
je 0xd384
movq -0x10(%rbp), %rax
cmpl $0x3, 0xc(%rax)
jne 0xd391
movq $0x0, -0x8(%rbp)
jmp 0xd56c
callq 0xc2b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xd3ae
movq $0x0, -0x8(%rbp)
jmp 0xd56c
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
leaq 0x8ef9(%rip), %rcx      # 0x162b8
cmpl (%rcx), %eax
jge 0xd564
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movslq -0x1c(%rbp), %rcx
leaq 0x9ac7(%rip), %rax      # 0x16ea0
shlq $0x6, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0xd3f4
jmp 0xd556
movslq -0x1c(%rbp), %rax
leaq 0x9aa1(%rip), %rdi      # 0x16ea0
shlq $0x6, %rax
addq %rax, %rdi
addq $0x8, %rdi
xorl %esi, %esi
callq 0x4c80
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xd432
movq -0x30(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0xd432
movq -0x30(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0xd437
jmp 0xd556
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jge 0xd496
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rdi
movslq -0x20(%rbp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
leaq 0x8e2c(%rip), %rsi      # 0x16290
callq 0xcba0
cmpl $0x0, %eax
je 0xd489
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x20(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x34(%rbp)
jmp 0xd496
jmp 0xd48b
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xd43e
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jne 0xd4a7
jmp 0xd556
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %rcx
movq 0x50(%rcx), %rcx
movswl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jge 0xd554
movq -0x30(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0xd4d2
jmp 0xd546
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0xd544
cmpq $0x0, -0x18(%rbp)
je 0xd511
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc8b0
cmpl $0x0, %eax
je 0xd544
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xc300
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xd53c
movq -0x28(%rbp), %rdi
callq 0xc2d0
movq $0x0, -0x8(%rbp)
jmp 0xd56c
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xd546
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xd4ae
jmp 0xd556
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xd3b5
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)