// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, (%rsp)
leaq 0x60(%rsi), %r13
movb $0x1, %r15b
cmpl $0x0, 0x60(%rsi)
jne 0xad3b
cmpl $0x0, 0x64(%rbx)
jne 0xad3b
cmpl $0x0, 0x68(%rbx)
jne 0xad3b
cmpl $0x0, 0x6c(%rbx)
setne %r15b
leaq 0x1c(%rbx), %r12
movb 0x2c(%rbx), %r14b
movups (%r13), %xmm0
movaps %xmm0, 0x10(%rsp)
movb $-0x80, 0x20(%rsp)
movw $0x0, 0x22(%rsp)
movq $0x0, 0x24(%rsp)
xorl %ebp, %ebp
testb %r15b, %r15b
je 0xadb2
testb %r14b, %r14b
je 0xad96
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x9a06
testl %eax, %eax
je 0xad96
leaq 0x10(%rsp), %rdi
xorl %ebp, %ebp
movq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x9b42
testl %eax, %eax
je 0xadb2
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0xa6e5
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movl $0x1, %ebp
xorl %r15d, %r15d
testb %r14b, %r14b
sete %al
orb %r15b, %al
jne 0xae42
movzbl 0x2c(%rbx), %eax
movl $0x80, %ecx
subl %eax, %ecx
cmpl $0x2, %ecx
movl $0x2, %edx
cmovll %ecx, %edx
leaq 0x10(%rsp), %rdi
movl $0x80, %esi
xorl %ecx, %ecx
movq %r12, %r8
movq 0x8(%rsp), %r9
callq 0x9e35
testl %eax, %eax
je 0xae53
leaq 0x845d(%rip), %r14      # 0x13258
cmpl $0x2, (%r14)
jge 0xae5a
leaq 0x10(%rsp), %rdi
callq 0x9562
cmpl $0x2, (%r14)
jge 0xae61
movq (%rsp), %rax
movl 0x8(%rax), %edi
movq (%rax), %rsi
movzbl 0x2c(%rbx), %ecx
leaq 0x10(%rsp), %rdx
movl $0x1, %r8d
callq 0xb694
testl %eax, %eax
js 0xae7d
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%r13)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3037
jmp 0xae42
callq 0x3026
jmp 0xae01
movq (%rsp), %rax
movq (%rax), %rdx
leaq 0x3310(%rip), %rsi      # 0xe17f
movl $0x2, %edi
xorl %eax, %eax
callq 0x319e
jmp 0xae11
leaq 0x330e(%rip), %rdi      # 0xe192
callq 0x22e0
jmp 0xae42