// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: address_assignment_1
int
address_assignment_1(struct interface *interface,
                     struct assigned_prefix *ap,
                     struct prefix_list *addresses)
{
    int have_assigned = ap->assigned.plen > 0;
    int have_address = !IN6_IS_ADDR_UNSPECIFIED(&ap->assigned_address);
    struct prefix p = {.p = ap->assigned_address, .plen = 128};
    int rc;
    int republish = 0;

    if(have_address && (!have_assigned ||
                        !prefix_within(&p, &ap->assigned) ||
                        prefix_list_overlap(&p, addresses, 0))) {
        destroy_assigned_address(interface, ap);
        memset(&ap->assigned_address, 0, 16);
        have_address = 0;
        republish = 1;
    }

    if(have_address || !have_assigned)
        return republish;

    rc = random_prefix(&p, 128, min(2, 128 - ap->assigned.plen), 0,
                       &ap->assigned, addresses);
    if(rc <= 0) {
        fprintf(stderr, "Couldn't generate random address.\n");
        return republish;
    }

    debugf("Adding address ");
    debug_address(&p.p);
    debugf(" to interface %s.\n", interface->ifname);
    rc = kernel_address(interface->ifindex, interface->ifname,
                        &p.p, ap->assigned.plen, 1);
    if(rc >= 0) {
        ap->assigned_address = p.p;
        republish = 1;
    } else {
        perror("Couldn't assign address");
    }

    return republish;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x20(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1c(%rsi), %r12
movb 0x2c(%rsi), %r15b
leaq 0x60(%rsi), %r13
cmpl $0x0, 0x60(%rsi)
jne 0xa745
cmpl $0x0, 0x64(%rbx)
jne 0xa745
cmpl $0x0, 0x68(%rbx)
je 0xa83d
movups (%r13), %xmm0
movaps %xmm0, (%rsp)
movb $-0x80, 0x10(%rsp)
movw $0x0, 0x12(%rsp)
movq $0x0, 0x14(%rsp)
testb %r15b, %r15b
je 0xa790
movq %rsp, %rdi
movq %r12, %rsi
callq 0x9521
testl %eax, %eax
je 0xa790
movq %rsp, %rdi
xorl %ebp, %ebp
movq 0x20(%rsp), %rsi
xorl %edx, %edx
callq 0x9661
testl %eax, %eax
je 0xa82c
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa155
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movl $0x1, %ebp
testb %r15b, %r15b
je 0xa82c
movzbl 0x2c(%rbx), %eax
movl $0x80, %ecx
subl %eax, %ecx
cmpl $0x2, %ecx
movl $0x2, %edx
cmovll %ecx, %edx
movq %rsp, %rdi
movl $0x80, %esi
xorl %ecx, %ecx
movq %r12, %r8
movq 0x20(%rsp), %r9
callq 0x9938
testl %eax, %eax
je 0xa86c
leaq 0x8a6f(%rip), %r15      # 0x13258
cmpl $0x2, (%r15)
jge 0xa873
movq %rsp, %rdi
callq 0x905d
cmpl $0x2, (%r15)
jge 0xa87d
movl 0x8(%r14), %edi
movq (%r14), %rsi
movzbl 0x2c(%rbx), %ecx
movq %rsp, %rdx
movl $0x1, %r8d
callq 0xb0c0
testl %eax, %eax
js 0xa898
movaps (%rsp), %xmm0
movups %xmm0, (%r13)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x6c(%rbx)
movups (%r13), %xmm0
movaps %xmm0, (%rsp)
movb $-0x80, 0x10(%rsp)
movw $0x0, 0x12(%rsp)
movq $0x0, 0x14(%rsp)
jne 0xa763
xorl %ebp, %ebp
jmp 0xa7a8
callq 0x2f41
jmp 0xa82c
callq 0x2f30
jmp 0xa7f3
movq (%r14), %rdx
leaq 0x38c0(%rip), %rsi      # 0xe147
movl $0x2, %edi
xorl %eax, %eax
callq 0x30a8
jmp 0xa801
leaq 0x38bb(%rip), %rdi      # 0xe15a
callq 0x22e0
jmp 0xa82c