// File: /workspace/github_c_makefile_star2_O2/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 0x9a76
cmpl $0x0, 0x64(%rbx)
jne 0x9a76
cmpl $0x0, 0x68(%rbx)
je 0x9b6f
movups (%r13), %xmm0
movaps %xmm0, (%rsp)
movb $-0x80, 0x10(%rsp)
andw $0x0, 0x12(%rsp)
andq $0x0, 0x14(%rsp)
testb %r15b, %r15b
je 0x9abd
movq %rsp, %rdi
movq %r12, %rsi
callq 0x8869
testl %eax, %eax
je 0x9abd
movq %rsp, %rdi
xorl %ebp, %ebp
movq 0x20(%rsp), %rsi
xorl %edx, %edx
callq 0x89b8
testl %eax, %eax
je 0x9b5e
pushq $0x1
popq %rbp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x940a
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
testb %r15b, %r15b
je 0x9b5e
movzbl 0x2c(%rbx), %eax
movl $0x80, %ecx
subl %eax, %ecx
cmpl $0x2, %ecx
pushq $0x2
popq %rdx
cmovll %ecx, %edx
movq %rsp, %rdi
movl $0x80, %esi
xorl %ecx, %ecx
movq %r12, %r8
movq 0x20(%rsp), %r9
callq 0x8c5b
testl %eax, %eax
je 0x9b9b
leaq 0x7742(%rip), %r15      # 0x11258
cmpl $0x2, (%r15)
jge 0x9bb9
movq %rsp, %rdi
callq 0x83dc
cmpl $0x2, (%r15)
jge 0x9bcf
movl 0x8(%r14), %edi
movq (%r14), %rsi
movzbl 0x2c(%rbx), %ecx
movq %rsp, %rdx
pushq $0x1
popq %rbx
movl %ebx, %r8d
callq 0xa3bc
testl %eax, %eax
js 0x9be8
movaps (%rsp), %xmm0
movups %xmm0, (%r13)
movl %ebx, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x6c(%rbx), %eax
movups (%r13), %xmm0
andw $0x0, 0x12(%rsp)
andq $0x0, 0x14(%rsp)
movaps %xmm0, (%rsp)
movb $-0x80, 0x10(%rsp)
testl %eax, %eax
jne 0x9a90
xorl %ebp, %ebp
jmp 0x9ad3
movq 0x7456(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x3548(%rip), %rdi      # 0xd0f4
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x2340
jmp 0x9b5e
leaq 0x3557(%rip), %rsi      # 0xd117
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x23c0
jmp 0x9b20
movq (%r14), %rdx
leaq 0x354e(%rip), %rsi      # 0xd127
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x23c0
jmp 0x9b32
leaq 0x354b(%rip), %rdi      # 0xd13a
callq 0x22f0
jmp 0x9b5e