LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/dhcpv4.c
// Function: interface_dhcpv4
int
interface_dhcpv4(struct interface *interface)
{
    int i, prio;

    if(interface->type == INTERFACE_MESH)
        return 0;

    prio = interface_dhcpv4_prio(interface);
    if(prio == 0)
        return 0;

    for(i = 0; i < numneighs; i++) {
        if(neighs[i].interface == interface) {
            struct node *node = find_node(neighs[i].id, 0);
            unsigned char capa[2];
            capa[0] = 0;
            capa[1] = interface_dhcpv4_prio(interface) & 0x0F;
            if(node == NULL)
                continue;
            if((node->capabilities[1] & 0x0F) > prio) {
                return 0;
            } else if((node->capabilities[1] & 0x0F) == prio) {
                if(memcmp(node->capabilities, capa, 2) > 0) {
                    return 0;
                } else if(memcmp(node->capabilities, capa, 2) == 0) {
                    if(memcmp(node->id, myid, 4) > 0)
                        return 0;
                }
            }
        }
    }
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl $0x3, 0xc(%rdi)
je 0x7e87
leaq 0xb438(%rip), %r13      # 0x131e8
cmpl $0x0, (%r13)
je 0x7e87
movq %rdi, %r14
callq 0x343e
testl %eax, %eax
je 0x7e87
leaq 0xb4d6(%rip), %rax      # 0x132a8
movl (%rax), %eax
movl $0x1, %ebx
testl %eax, %eax
jle 0x7e87
leaq 0xc0a8(%rip), %r15      # 0x13e90
addq $0x8, %r15
xorl %ebp, %ebp
cmpq %r14, -0x8(%r15)
jne 0x7e70
movq %r15, %rdi
xorl %esi, %esi
callq 0x49a3
movq %rax, %r12
movb $0x0, 0x6(%rsp)
cmpl $0x0, (%r13)
je 0x7e18
callq 0x343e
movb $0x4, %cl
testl %eax, %eax
jne 0x7e1a
xorl %ecx, %ecx
movb %cl, 0x7(%rsp)
testq %r12, %r12
je 0x7e67
movb 0x39(%r12), %al
andb $0xf, %al
cmpb $0x4, %al
ja 0x7e85
jne 0x7e67
movzwl 0x38(%r12), %eax
movzwl 0x6(%rsp), %ecx
rolw $0x8, %ax
rolw $0x8, %cx
movzwl %ax, %eax
movzwl %cx, %ecx
subl %ecx, %eax
testl %eax, %eax
jg 0x7e85
jne 0x7e67
movl 0x8(%r12), %eax
leaq 0xb423(%rip), %rcx      # 0x13280
movl (%rcx), %ecx
bswapl %eax
bswapl %ecx
cmpl %ecx, %eax
ja 0x7e85
leaq 0xb43a(%rip), %rax      # 0x132a8
movl (%rax), %eax
incq %rbp
movslq %eax, %rcx
addq $0x40, %r15
cmpq %rcx, %rbp
jl 0x7dee
jmp 0x7e87
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/dhcpv4.c
// Function: setup_dhcpv4_socket
int
setup_dhcpv4_socket()
{
    int s, rc, one = 1;
    struct sockaddr_in sin;

    if(dhcpv4_socket >= 0) {
        close(dhcpv4_socket);
        dhcpv4_socket = -1;
    }

    s = socket(PF_INET, SOCK_DGRAM, 0);
    if(s < 0)
        return -1;

    rc = setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one));
    if(rc < 0)
        goto fail;

    rc = setsockopt(s, IPPROTO_IP, IP_PKTINFO, &one, sizeof(one));
    if(rc < 0)
        goto fail;

    rc = fcntl(s, F_GETFD, 0);
    if(rc < 0)
        goto fail;

    rc = fcntl(s, F_SETFD, rc | FD_CLOEXEC);
    if(rc < 0)
        goto fail;

    rc = fcntl(s, F_GETFL, 0);
    if(rc < 0)
        goto fail;

    rc = fcntl(s, F_SETFL, (rc | O_NONBLOCK));
    if(rc < 0)
        goto fail;

    memset(&sin, 0, sizeof(sin));
    sin.sin_family = AF_INET;
    sin.sin_port = htons(67);

    rc = bind(s, (struct sockaddr*)&sin, sizeof(sin));
    if(rc < 0)
        goto fail;

    dhcpv4_socket = s;
    return s;

fail:
    return -1;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl $0x1, 0x4(%rsp)
movl 0xb344(%rip), %edi      # 0x131f0
testl %edi, %edi
js 0x7ebf
callq 0x2190
movl $0xffffffff, 0xb331(%rip) # imm = 0xFFFFFFFF
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x2390
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7fae
movl %eax, %ebp
leaq 0x4(%rsp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x6, %edx
movl $0x4, %r8d
callq 0x20a0
testl %eax, %eax
js 0x7fae
leaq 0x4(%rsp), %rcx
movl %ebp, %edi
xorl %esi, %esi
movl $0x8, %edx
movl $0x4, %r8d
callq 0x20a0
testl %eax, %eax
js 0x7fae
movl %ebp, %edi
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20b0
testl %eax, %eax
js 0x7fae
orl $0x1, %eax
movl %ebp, %edi
movl $0x2, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20b0
testl %eax, %eax
js 0x7fae
movl %ebp, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20b0
testl %eax, %eax
js 0x7fae
orl $0x800, %eax            # imm = 0x800
movl %ebp, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20b0
testl %eax, %eax
js 0x7fae
leaq 0x8(%rsp), %rsi
movl $0x0, 0xc(%rsi)
movq $0x0, 0x4(%rsi)
movl $0x43000002, (%rsi)     # imm = 0x43000002
movl %ebp, %edi
movl $0x10, %edx
callq 0x22a0
testl %eax, %eax
js 0x7fae
movl %ebp, 0xb244(%rip)      # 0x131f0
movl %ebp, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/dhcpv4.c
// Function: find_matching_lease
static struct lease *
find_matching_lease(const unsigned char *cid, int cidlen,
                    const unsigned char *chaddr, struct prefix_list *pl)
{
    int i;

    for(i = 0; i < numleases; i++) {
        if(lease_match(cid, cidlen, chaddr, &leases[i]) &&
           (pl == NULL || prefix_list_within_v4(leases[i].ip, pl)))
            return &leases[i];
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x10(%rsp)
movl %esi, 0x4(%rsp)
movq %rdi, 0x8(%rsp)
movl 0xeabf(%rip), %r12d     # 0x17490
testl %r12d, %r12d
jle 0x8a34
movq %rcx, %rbx
movq 0xeaa8(%rip), %r14      # 0x17488
xorl %r15d, %r15d
xorl %ebp, %ebp
leaq (%r14,%r15), %r13
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
movq 0x10(%rsp), %rdx
movq %r13, %rcx
callq 0x8a4e
testl %eax, %eax
je 0x8a25
testq %rbx, %rbx
je 0x8a39
movq %r13, %rdi
movq %rbx, %rsi
callq 0x962b
movq 0xea6e(%rip), %r14      # 0x17488
testl %eax, %eax
jne 0x8a39
movl 0xea6b(%rip), %r12d     # 0x17490
incq %rbp
movslq %r12d, %rax
addq $0x30, %r15
cmpq %rax, %rbp
jl 0x89e5
xorl %r14d, %r14d
jmp 0x8a3c
addq %r15, %r14
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/dhcpv4.c
// Function: lease_match
static int
lease_match(const unsigned char *cid, int cidlen,
            const unsigned char *chaddr, const struct lease *lease)
{
    if(cidlen > 0 || lease->cidlen > 0)
        return lease->cidlen == cidlen && memcmp(lease->cid, cid, cidlen) == 0;
    else
        return memcmp(chaddr, lease->chaddr, 16) == 0;
}

// Assembly:
movq %rdi, %rax
testl %esi, %esi
setg %r8b
movl 0x20(%rcx), %edi
testl %edi, %edi
setg %r9b
orb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x8a88
cmpl %esi, %edi
jne 0x8aa3
pushq %rax
movq 0x18(%rcx), %rdi
movslq %esi, %rdx
movq %rax, %rsi
callq 0x2260
testl %eax, %eax
sete %al
addq $0x8, %rsp
jmp 0x8aa5
movdqu (%rdx), %xmm0
movdqu 0x8(%rcx), %xmm1
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %al
jmp 0x8aa5
xorl %eax, %eax
movzbl %al, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/dhcpv4.c
// Function: generate_v4
static int
generate_v4(unsigned char *ip_return, unsigned char *mask_return,
            const struct prefix_list *pl)
{
    int i, j, rc;

    for(i = 0; i < 2; i++) {
        for(j = 0; j < 20; j++) {
            unsigned char ip[4];
            struct lease *lease;
            rc = generate_random_v4(ip, pl);
            if(rc < 0)
                return -1;
            lease = find_lease(ip, 0);
            if(!lease || (i > 0 && lease->end < now.tv_sec)) {
                int plen;
                unsigned char mask[4];
                unsigned int addr;
                plen = compute_netmask(mask, ip, pl);
                if(plen < 0 || plen > 30)
                    continue;
                /* Check that we are not in the first quarter. */
                DO_NTOHL(addr, ip);
                if((addr & (3 << (30 - plen))) == 0)
                    continue;
                memcpy(ip_return, ip, 4);
                memcpy(mask_return, mask, 4);
                return 1;
            }
        }
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
movb $0x1, %al
xorl %ebx, %ebx
leaq 0x14(%rsp), %r12
leaq 0x10(%rsp), %r13
leaq 0xa797(%rip), %r15      # 0x13270
movl %eax, 0xc(%rsp)
movl $0x14, %ebp
movq %r12, %rdi
movq %r14, %rsi
callq 0x9a17
testl %eax, %eax
js 0x8b47
movq %r12, %rdi
xorl %esi, %esi
callq 0x7cb3
testq %rax, %rax
je 0x8b0e
testb $0x1, %bl
je 0x8b35
movq 0x28(%rax), %rax
cmpq (%r15), %rax
jge 0x8b35
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x8b74
cmpl $0x1e, %eax
ja 0x8b35
movl 0x14(%rsp), %edx
movl %edx, %esi
bswapl %esi
movb $0x1e, %cl
subb %al, %cl
shrl %cl, %esi
testb $0x3, %sil
jne 0x8b5b
decl %ebp
jne 0x8ae2
movb $0x1, %bl
testb $0x1, 0xc(%rsp)
movl $0x0, %eax
jne 0x8ad9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rax
movl %edx, (%rax)
movl 0x10(%rsp), %eax
movq 0x20(%rsp), %rcx
movl %eax, (%rcx)
movl $0x1, %eax
jmp 0x8b4c
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/dhcpv4.c
// Function: compute_netmask
static int
compute_netmask(unsigned char *mask,
                const unsigned char *ip, const struct prefix_list *pl)
{
    int i;
    unsigned int m;

    if(pl == NULL)
        return -1;

    for(i = 0; i < pl->numprefixes; i++) {
        if(prefix_within_v4(ip, &pl->prefixes[i])) {
            int plen;
            assert(pl->prefixes[i].plen >= 96);
            plen = pl->prefixes[i].plen - 96;
            m = 0xFFFFFFFFu << (32 - plen);
            DO_HTONL(mask, m);
            return plen;
        }
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdx, %rdx
je 0x8be2
movq %rdx, %r15
cmpw $0x0, 0x8(%rdx)
jle 0x8be2
movq %rsi, %r12
movq %rdi, %r14
xorl %r13d, %r13d
xorl %ebp, %ebp
movq (%r15), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0x958b
testl %eax, %eax
jne 0x8bc3
incq %rbp
movswq 0x8(%r15), %rax
addq $0x1c, %r13
cmpq %rax, %rbp
jl 0x8b9e
jmp 0x8be2
movq (%r15), %rax
movzbl 0x10(%rax,%r13), %ecx
cmpl $0x5f, %ecx
jbe 0x8bf3
leal -0x60(%rcx), %ebx
negb %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
bswapl %eax
movl %eax, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5277(%rip), %rdi      # 0xde71
leaq 0x519f(%rip), %rsi      # 0xdda0
leaq 0x5284(%rip), %rcx      # 0xde8c
movl $0x229, %edx            # imm = 0x229
callq 0x2150
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: format_address
char *
format_address(const struct in6_addr *a, char *buf, int buflen)
{
    char *ptr;

    if(IN6_IS_ADDR_V4MAPPED(a))
        ptr = (char*)inet_ntop(AF_INET, (char*)a + 12, buf, buflen);
    else
        ptr = (char*)inet_ntop(AF_INET6, a, buf, buflen);

    if(ptr == NULL)
        snprintf(buf, buflen, "%s", strerror(errno));
    buf[buflen - 1] = '\0';
    return ptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %rsi
cmpl $0x0, (%rdi)
jne 0x8f1e
cmpl $0x0, 0x4(%rsi)
jne 0x8f1e
cmpl $0xffff0000, 0x8(%rsi)  # imm = 0xFFFF0000
jne 0x8f1e
addq $0xc, %rsi
movl $0x2, %edi
jmp 0x8f23
movl $0xa, %edi
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x2030
movq %rax, %r14
movslq %ebp, %r15
testq %rax, %rax
jne 0x8f5b
callq 0x2060
movl (%rax), %edi
callq 0x2350
leaq 0x4e96(%rip), %rdx      # 0xdde1
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2140
movb $0x0, -0x1(%rbx,%r15)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: format_prefix_raw
char *
format_prefix_raw(const struct in6_addr *a, int plen, char *buf, int buflen)
{
    char *ptr;
    int len;
    int v4 = plen > 96 && IN6_IS_ADDR_V4MAPPED(a);

    if(v4)
        ptr = (char*)inet_ntop(AF_INET, (char*)a + 12,
                               buf, buflen);
    else
        ptr = (char*)inet_ntop(AF_INET6, a, buf, buflen);

    if(ptr == NULL)
        snprintf(buf, buflen, "%s", strerror(errno));
    buf[buflen - 1] = '\0';

    len = strlen(buf);
    snprintf(buf + len, buflen - len, "/%d", v4 ? plen - 96 : plen);
    buf[buflen - 1] = '\0';

    return ptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %rsi
cmpl $0x61, %r14d
jl 0x8fbd
cmpl $0x0, (%rsi)
jne 0x8fbd
cmpl $0x0, 0x4(%rsi)
jne 0x8fbd
cmpl $0xffff0000, 0x8(%rsi)  # imm = 0xFFFF0000
jne 0x8fbd
addq $0xc, %rsi
movl $0x2, %edi
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x2030
movq %rax, %r15
movb $0x1, %al
movl %eax, 0x4(%rsp)
jmp 0x8fd7
movl $0xa, %edi
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x2030
movq %rax, %r15
movl $0x0, 0x4(%rsp)
movslq %ebp, %r12
testq %r15, %r15
jne 0x9002
callq 0x2060
movl (%rax), %edi
callq 0x2350
leaq 0x4def(%rip), %rdx      # 0xdde1
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2140
xorl %r13d, %r13d
movb %r13b, -0x1(%rbx,%r12)
movq %rbx, %rdi
callq 0x20e0
cltq
leaq (%rbx,%rax), %rdi
subl %eax, %ebp
movslq %ebp, %rsi
leal -0x60(%r14), %ecx
cmpb $0x0, 0x4(%rsp)
cmovel %r14d, %ecx
leaq 0x4ed8(%rip), %rdx      # 0xdf09
xorl %eax, %eax
callq 0x2140
movb %r13b, -0x1(%rbx,%r12)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: debug_prefix_list
void
debug_prefix_list(const struct prefix_list *pl)
{
    int i;

    if(debug_level < 2 || !pl)
        return;

    for(i = 0; i < pl->numprefixes; i++) {
        debug_prefix(&pl->prefixes[i]);
        if(i < pl->numprefixes - 1)
            debugf(" ");
    }
}

// Assembly:
testq %rdi, %rdi
je 0x918f
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0xa134(%rip), %r15      # 0x13258
cmpl $0x2, (%r15)
jl 0x9186
movq %rdi, %rbx
cmpw $0x0, 0x8(%rdi)
jle 0x9186
leaq 0x4b99(%rip), %r14      # 0xdcd4
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%rbx), %rdi
addq %r12, %rdi
callq 0x90d1
movswl 0x8(%rbx), %eax
movslq %eax, %rcx
decq %rcx
cmpq %rcx, %r13
jge 0x9161
cmpl $0x2, (%r15)
jge 0x9171
incq %r13
cltq
addq $0x1c, %r12
cmpq %rax, %r13
jl 0x9141
jmp 0x9186
movl $0x2, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0x30a8
movswl 0x8(%rbx), %eax
jmp 0x9161
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: parse_prefix
int
parse_prefix(const char *string, struct prefix *p)
{
    char buf[INET6_ADDRSTRLEN];
    int rc, plen;
    char *slash;
    struct in_addr ina;
    struct in6_addr ina6;

    memset(p, 0, sizeof(struct prefix));

    if(strcmp(string, "default") == 0) {
        return 1;
    }

    strncpy(buf, string, INET6_ADDRSTRLEN);
    buf[INET6_ADDRSTRLEN - 1] = '\0';

    slash = strchr(buf, '/');
    if(slash == NULL) {
        plen = -1;
    } else {
        char *end;
        plen = strtol(slash + 1, &end, 0);
        if(*end != '\0' || plen < 0 || plen > 128)
            return -1;
        *slash = '\0';
    }

    rc = inet_pton(AF_INET, buf, &ina);
    if(rc > 0) {
        memcpy(&p->p, v4prefix, 12);
        memcpy((char*)&p->p + 12, &ina, 4);
        p->plen = plen < 0 ? 128 : plen + 96;
    } else {
        rc = inet_pton(AF_INET6, buf, &ina6);
        if(rc < 1)
            return -1;
        memcpy(&p->p, &ina6, 16);
        p->plen = plen < 0 ? 128 : plen;
    }
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rsi)
movups %xmm0, (%rsi)
leaq 0x4d59(%rip), %rsi      # 0xdf0d
callq 0x21c0
movl $0x1, %ebx
testl %eax, %eax
je 0x92b2
leaq 0x20(%rsp), %r12
movl $0x2e, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2080
movb $0x0, 0x2d(%r12)
movq %r12, %rdi
movl $0x2f, %esi
callq 0x2120
testq %rax, %rax
je 0x922d
movq %rax, %r12
leaq 0x1(%rax), %rdi
leaq 0x10(%rsp), %r13
movq %r13, %rsi
xorl %edx, %edx
callq 0x2200
movq %rax, %r15
movq (%r13), %rax
cmpb $0x0, (%rax)
jne 0x92ad
cmpl $0x80, %r15d
ja 0x92ad
movb $0x0, (%r12)
jmp 0x9233
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
leaq 0x20(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movl $0x2, %edi
callq 0x2220
testl %eax, %eax
jle 0x927a
movl $0xffff0000, 0x8(%r14)  # imm = 0xFFFF0000
movq $0x0, (%r14)
movl 0xc(%rsp), %eax
movl %eax, 0xc(%r14)
leal 0x60(%r15), %eax
testl %r15d, %r15d
movzbl %al, %eax
movl $0x80, %ecx
cmovnsl %eax, %ecx
movb %cl, 0x10(%r14)
jmp 0x92b2
leaq 0x20(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movl $0xa, %edi
callq 0x2220
testl %eax, %eax
jle 0x92ad
movups 0x10(%rsp), %xmm0
movups %xmm0, (%r14)
testl %r15d, %r15d
movl $0x80, %eax
cmovnsl %r15d, %eax
movb %al, 0x10(%r14)
jmp 0x92b2
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_list_cons_prefix
struct prefix_list *
prefix_list_cons_prefix(struct prefix_list *pl, const struct prefix *p)
{
    if(pl == NULL)
        pl = create_prefix_list();
    if(pl == NULL)
        return NULL;
    if(pl->numprefixes >= pl->maxprefixes) {
        struct prefix *n =
            realloc(pl->prefixes,
                    (pl->maxprefixes * 2 + 2) * sizeof(struct prefix));
        if(n == NULL)
            return NULL;
        pl->prefixes = n;
        pl->maxprefixes = pl->maxprefixes * 2 + 2;
    }
    pl->prefixes[pl->numprefixes++] = *p;
    return pl;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
testq %rdi, %rdi
je 0x9300
movq %rdi, %r14
movq (%rdi), %rax
jmp 0x9319
movl $0x1, %edi
movl $0x10, %esi
callq 0x21b0
movq %rax, %r14
xorl %eax, %eax
testq %r14, %r14
je 0x9380
movzwl 0x8(%r14), %ecx
movswq 0xa(%r14), %rdx
cmpw %dx, %cx
jl 0x9356
imulq $0x38, %rdx, %rsi
addq $0x38, %rsi
movq %rax, %rdi
callq 0x2280
testq %rax, %rax
je 0x9388
movq %rax, (%r14)
movzwl 0xa(%r14), %ecx
leal 0x2(,%rcx,2), %ecx
movw %cx, 0xa(%r14)
movzwl 0x8(%r14), %ecx
leal 0x1(%rcx), %edx
movw %dx, 0x8(%r14)
movswq %cx, %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movups (%rbx), %xmm0
movups 0xc(%rbx), %xmm1
movups %xmm1, 0xc(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
jmp 0x9380
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_list_cons
struct prefix_list *
prefix_list_cons(struct prefix_list *pl,
                 const struct in6_addr *a, int plen,
                 const unsigned char *id, unsigned int eid, int prio)
{
    struct prefix p;

    p.p = *a;
    p.plen = plen;
    if(id)
        memcpy(p.id, id, 4);
    else
        memset(p.id, 0, 4);
    p.eid = eid;
    p.prio = prio;
    return prefix_list_cons_prefix(pl, &p);
}

// Assembly:
subq $0x28, %rsp
movups (%rsi), %xmm0
movaps %xmm0, (%rsp)
movb %dl, 0x10(%rsp)
testq %rcx, %rcx
je 0x93a4
movl (%rcx), %eax
jmp 0x93a6
xorl %eax, %eax
movq %rsp, %rsi
movl %eax, 0x14(%rsi)
movl %r8d, 0x18(%rsi)
movw %r9w, 0x12(%rsi)
callq 0x92ec
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_list_remove
struct prefix_list *
prefix_list_remove(struct prefix_list *pl, int i)
{
    assert(i >= 0 && i < pl->numprefixes);
    memmove(pl->prefixes + i, pl->prefixes + i + 1,
            sizeof(struct prefix) * (pl->numprefixes - i - 1));
    pl->numprefixes--;
    MEM_UNDEFINED(pl->prefixes + pl->numprefixes,
                  sizeof(struct prefix));
    return pl;
}

// Assembly:
pushq %rbx
testl %esi, %esi
js 0x940d
movq %rdi, %rbx
movswl 0x8(%rdi), %ecx
cmpl %esi, %ecx
jle 0x940d
movq (%rbx), %rax
movl %esi, %edx
leaq (%rdx,%rdx,8), %rdi
leaq (%rdi,%rdi,2), %r8
addq %rdx, %r8
leaq (%rax,%r8), %rdi
addq %r8, %rax
addq $0x1c, %rax
notl %esi
addl %esi, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movq %rax, %rsi
callq 0x22b0
decw 0x8(%rbx)
movq %rbx, %rax
popq %rbx
retq
leaq 0x4b01(%rip), %rdi      # 0xdf15
leaq 0x4b18(%rip), %rsi      # 0xdf33
leaq 0x4b1a(%rip), %rcx      # 0xdf3c
movl $0xe3, %edx
callq 0x2150
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_list_append
struct prefix_list*
prefix_list_append(struct prefix_list *p1, struct prefix_list *p2)
{
    int i;

    if(p1 == NULL)
        return p2;

    for(i = 0; i < p2->numprefixes; i++) {
        struct prefix_list *pl = prefix_list_cons_prefix(p1, &p2->prefixes[i]);
        if(pl == NULL)
            return NULL;
    }
    destroy_prefix_list(p2);
    return p1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
testq %rdi, %rdi
je 0x947b
movq %rdi, %rbx
cmpw $0x0, 0x8(%r14)
jle 0x9471
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%r14), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x92ec
testq %rax, %rax
je 0x9480
incq %r12
movswq 0x8(%r14), %rax
addq $0x1c, %r15
cmpq %rax, %r12
jl 0x944d
movq %r14, %rdi
callq 0x92d1
jmp 0x9482
movq %r14, %rbx
jmp 0x9482
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_list_member
int
prefix_list_member(const struct prefix *p, const struct prefix_list *pl)
{
    int i;
    if(pl == NULL)
        return 0;

    for(i = 0; i < pl->numprefixes; i++) {
        struct prefix *q = &pl->prefixes[i];
        if(prefix_eq(p, q))
            return 1;
    }
    return 0;
}

// Assembly:
xorl %eax, %eax
testq %rsi, %rsi
je 0x94f8
movswq 0x8(%rsi), %rcx
testq %rcx, %rcx
jle 0x94f8
movq (%rsi), %rdx
movb 0x10(%rdi), %sil
cmpb 0x10(%rdx), %sil
jne 0x94ef
movdqu (%rdi), %xmm0
movdqu (%rdx), %xmm1
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %r8d
cmpl $0xffff, %r8d           # imm = 0xFFFF
je 0x94f9
addq $0x1c, %rdx
decq %rcx
jne 0x94cf
retq
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_within
int
prefix_within(const struct prefix *p, const struct prefix *q)
{
    unsigned char pp[16], qq[16];

    if(p->plen < q->plen)
        return 0;

    memcpy(pp, &p->p, 16);
    memcpy(qq, &q->p, 16);

    if(memcmp(pp, qq, q->plen / 8) != 0)
        return 0;

    if(q->plen % 8 == 0) {
        return 1;
    } else {
        int i = q->plen / 8 + 1;
        unsigned char mask = (0xFF << (q->plen % 8)) & 0xFF;
        if((pp[i] & mask) == (qq[i] & mask)) {
            return 1;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movzbl 0x10(%rsi), %ebx
xorl %ebp, %ebp
cmpb %bl, 0x10(%rdi)
jb 0x9580
movups (%rdi), %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movups (%rsi), %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movl %ebx, %r14d
shrl $0x3, %r14d
movq %r14, %rdx
callq 0x2260
testl %eax, %eax
jne 0x9580
andl $0x7, %ebx
je 0x957b
movb 0x1(%rsp,%r14), %al
xorb 0x11(%rsp,%r14), %al
movzbl %al, %eax
movl %ebx, %ecx
shrl %cl, %eax
xorl %ebp, %ebp
testl %eax, %eax
sete %bpl
jmp 0x9580
movl $0x1, %ebp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_within_v4
int
prefix_within_v4(const unsigned char *p4, const struct prefix *q)
{
    struct prefix p;
    memset(&p, 0, sizeof(p));
    memcpy(&p.p, v4prefix, 12);
    memcpy((char*)&p.p + 12, p4, 4);
    p.plen = 128;

    return prefix_within(&p, q);
}

// Assembly:
subq $0x28, %rsp
xorl %ecx, %ecx
leaq 0x8(%rsp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, 0x18(%rax)
movq %rcx, (%rax)
movl $0xffff0000, 0x8(%rax)  # imm = 0xFFFF0000
movl (%rdi), %ecx
movl %ecx, 0xc(%rax)
movb $-0x80, 0x10(%rax)
movq %rax, %rdi
callq 0x9521
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_list_within
int
prefix_list_within(const struct prefix *p, const struct prefix_list *pl)
{
    int i;

    if(pl == NULL)
        return 0;

    for(i = 0; i < pl->numprefixes; i++) {
        if(prefix_within(p, &pl->prefixes[i]))
            return 1;
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x961d
movswq 0x8(%rsi), %r12
testq %r12, %r12
jle 0x961d
movq %rdi, %r14
movq (%rsi), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x9521
testl %eax, %eax
jne 0x9618
addq $0x1c, %r15
decq %r12
jne 0x95fe
jmp 0x961d
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: prefix_list_overlap
int
prefix_list_overlap(const struct prefix *p, const struct prefix_list *pl,
                    int respect_precedence)
{
    unsigned char pp[16];
    int i;

    memcpy(pp, &p->p, 16);

    if(pl == NULL)
        return 0;

    for(i = 0; i < pl->numprefixes; i++) {
        struct prefix *q = &pl->prefixes[i];
        int plen = min(p->plen, q->plen);
        unsigned char qq[16];

        if(respect_precedence &&
           ((id_eq(p->id, q->id) && p->eid == q->eid) ||
            prefix_takes_precedence(p, q)))
            continue;

        memcpy(qq, &q->p, 16);

        if(memcmp(pp, qq, plen / 8) != 0)
            continue;

        if(plen % 8 == 0) {
            return 1;
        } else {
            int i = plen / 8 + 1;
            unsigned char mask = (0xFF << (plen % 8)) & 0xFF;
            if((pp[i] & mask) == (qq[i] & mask)) {
                return 1;
            }
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, 0xc(%rsp)
movups (%rdi), %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %eax, %eax
testq %rsi, %rsi
je 0x9745
movswq 0x8(%rsi), %r15
testq %r15, %r15
jle 0x9745
movq %rdi, %r14
movq (%rsi), %r12
movb 0x10(%rdi), %al
addq $0x14, %r12
movzbl %al, %ebp
movl -0x4(%r12), %r13d
cmpb %r13b, %bpl
cmovbl %ebp, %r13d
cmpl $0x0, 0xc(%rsp)
je 0x96eb
movl 0x14(%r14), %eax
cmpl (%r12), %eax
jne 0x96cc
movl 0x18(%r14), %eax
cmpl 0x4(%r12), %eax
je 0x972f
movzwl -0x2(%r12), %eax
cmpw %ax, 0x12(%r14)
ja 0x972f
jne 0x96eb
movl 0x14(%r14), %eax
movl (%r12), %ecx
bswapl %eax
bswapl %ecx
cmpl %ecx, %eax
ja 0x972f
leaq -0x14(%r12), %rax
movups (%rax), %xmm0
movaps %xmm0, 0x10(%rsp)
movzbl %r13b, %ebx
shrl $0x3, %ebx
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x2260
testl %eax, %eax
jne 0x972f
andb $0x7, %r13b
je 0x9740
movb 0x11(%rsp,%rbx), %al
xorb 0x21(%rsp,%rbx), %al
movzbl %al, %eax
movl %r13d, %ecx
shrl %cl, %eax
testl %eax, %eax
je 0x9740
addq $0x1c, %r12
decq %r15
jne 0x96a4
xorl %eax, %eax
jmp 0x9745
movl $0x1, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: filter_included
struct prefix_list *
filter_included(struct prefix_list *pl)
{
    int i, j;

    i = 0;
 again:
    while(i < pl->numprefixes) {
        for(j = 0; j < pl->numprefixes; j++) {
            if(i != j && prefix_within(&pl->prefixes[i], &pl->prefixes[j])) {
                pl = prefix_list_remove(pl, i);
                goto again;
            }
        }
        i++;
    }
    return pl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movswl 0x8(%rdi), %edx
testl %edx, %edx
jle 0x97f4
xorl %r14d, %r14d
movslq %r14d, %r14
movslq %edx, %rax
movq %rax, 0x10(%rsp)
movl %eax, %eax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %r12
addq %rax, %r12
movl %edx, 0xc(%rsp)
testl %edx, %edx
jle 0x97d0
movl %r14d, %eax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %r13
addq %rax, %r13
leaq (%r14,%r14,8), %rax
leaq (%rax,%rax,2), %r15
addq %r14, %r15
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x97c7
movq (%rbx), %rsi
leaq (%rsi,%r15), %rdi
addq %rbp, %rsi
callq 0x9521
testl %eax, %eax
jne 0x97e0
addq $0x1c, %rbp
cmpq %rbp, %r12
jne 0x97af
incq %r14
cmpq 0x10(%rsp), %r14
movl 0xc(%rsp), %edx
jl 0x9790
jmp 0x97f4
movq %rbx, %rdi
movl %r14d, %esi
callq 0x93bf
movswl 0x8(%rbx), %edx
cmpl %edx, %r14d
jl 0x9774
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: random_prefix
int
random_prefix(struct prefix *res,
              int plen, int zero_bits, int tweak_v6,
              const struct prefix *in, const struct prefix_list *out)
{
    unsigned char pp[16];
    int i;
    struct prefix p;

    if(plen > 128)
        plen = 128;

    if(in->plen + zero_bits > plen)
        return 0;

    for(i = 0; i < 20; i++) {
        memset(pp, 0, 16);
        memcpy(pp, &in->p, 16);
        random_bits(pp, in->plen + zero_bits, (plen - (in->plen + zero_bits)));
        if(tweak_v6 && in->plen <= 68)
            pp[8] &= ~3;

        memcpy(&p.p, pp, 16);
        p.plen = plen;
        if(!prefix_list_overlap(&p, out, 0)) {
            *res = p;
            return 1;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl $0x80, %r13d
cmpl %r13d, %esi
cmovll %esi, %r13d
movzbl 0x10(%r8), %eax
addl %edx, %eax
cmpl %r13d, %eax
jg 0x99c8
movq %r9, %rbx
movq %r8, %r14
movl %ecx, %ebp
movl %edx, %r15d
movq %rdi, 0x18(%rsp)
movl $0x14, %r12d
movups (%r14), %xmm0
movaps %xmm0, (%rsp)
movzbl 0x10(%r14), %esi
addl %r15d, %esi
movl %r13d, %edx
subl %esi, %edx
movq %rsp, %rdi
callq 0x9850
testl %ebp, %ebp
je 0x99a2
cmpb $0x44, 0x10(%r14)
ja 0x99a2
andb $-0x4, 0x8(%rsp)
movaps (%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movb %r13b, 0x30(%rsp)
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x9661
testl %eax, %eax
je 0x99cc
decl %r12d
jne 0x9975
xorl %eax, %eax
jmp 0x99e7
movups 0x2c(%rsp), %xmm0
movq 0x18(%rsp), %rax
movups %xmm0, 0xc(%rax)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rax)
movl $0x1, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: generate_random_v4
int
generate_random_v4(unsigned char *ip, const struct prefix_list *pl)
{
    int start, i, rc;
    struct prefix p;

    if(pl == NULL)
        return -1;

    start = random() % pl->numprefixes;

    for(i = 0; i < pl->numprefixes; i++) {
        int j = (start + i) % pl->numprefixes;
        if(prefix_v4(&pl->prefixes[j]) && pl->prefixes[j].plen <= 126) {
            rc = random_prefix(&p, 128, 0, 0, &pl->prefixes[j], NULL);
            if(rc >= 0) {
                memcpy(ip, (unsigned char*)&p.p + 12, 4);
                return 1;
            }
        }
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x9a8f
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2230
movswl 0x8(%r14), %esi
movslq %esi, %rdi
cqto
idivq %rdi
testl %edi, %edi
jle 0x9a8f
movq %rdx, %rcx
movq (%r14), %rdi
movl %esi, %r9d
movl %ecx, %eax
cltd
idivl %esi
movslq %edx, %rax
leaq (%rax,%rax,8), %rdx
leaq (%rdx,%rdx,2), %r8
addq %rax, %r8
movb 0x10(%rdi,%r8), %al
cmpb $0x60, %al
jb 0x9a88
addq %rdi, %r8
cmpl $0x0, (%r8)
jne 0x9a88
cmpl $0x0, 0x4(%r8)
jne 0x9a88
cmpb $0x7e, %al
ja 0x9a88
cmpl $0xffff0000, 0x8(%r8)   # imm = 0xFFFF0000
je 0x9a9a
incl %ecx
decl %r9d
jne 0x9a4e
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x4(%rsp), %r14
movq %r14, %rdi
movl $0x80, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x9938
movl 0xc(%r14), %eax
movl %eax, (%rbx)
movl $0x1, %ebp
jmp 0x9a8f
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: interface_v4
int
interface_v4(struct interface *interface, unsigned char *v4_return)
{
    int i;

    for(i = 0; i < interface->numassigned; i++) {
        struct in6_addr *a = &interface->assigned[i].assigned_address;
        if(IN6_IS_ADDR_V4MAPPED(a)) {
            memcpy(v4_return, (char*)a + 12, 4);
            return 1;
        }
    }
    return 0;
}

// Assembly:
movslq 0x68(%rdi), %rcx
testq %rcx, %rcx
jle 0x9af4
movq 0x60(%rdi), %rax
imulq $0x70, %rcx, %rdx
xorl %ecx, %ecx
cmpl $0x0, 0x60(%rax,%rcx)
jne 0x9aeb
cmpl $0x0, 0x64(%rax,%rcx)
jne 0x9aeb
cmpl $0xffff0000, 0x68(%rax,%rcx) # imm = 0xFFFF0000
je 0x9af7
addq $0x70, %rcx
cmpq %rcx, %rdx
jne 0x9ad3
xorl %eax, %eax
retq
movl 0x6c(%rax,%rcx), %eax
movl %eax, (%rsi)
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: all_assigned_prefixes
struct prefix_list *
all_assigned_prefixes()
{
    int i, j;
    struct prefix_list *pl = create_prefix_list(), *pl2;
    if(pl == NULL)
        return NULL;

    for(i = 0; i < numnodes; i++) {
        if(nodes[i].assigned == NULL)
            continue;
        for(j = 0; j < nodes[i].assigned->numprefixes; j++) {
            pl2 = prefix_list_cons_prefix(pl, &nodes[i].assigned->prefixes[j]);
            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
pushq %rax
movl $0x1, %edi
movl $0x10, %esi
callq 0x21b0
testq %rax, %rax
je 0x9bb7
movq %rax, %rbx
leaq 0x9774(%rip), %rax      # 0x132a4
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x9bbb
xorl %r15d, %r15d
leaq 0xad4c(%rip), %r12      # 0x14890
imulq $0x70, %r15, %rax
movq 0x50(%r12,%rax), %rdx
testq %rdx, %rdx
je 0x9b9c
cmpw $0x0, 0x8(%rdx)
jle 0x9b9c
leaq (%r12,%rax), %r13
addq $0x50, %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
movq (%rdx), %rsi
addq %rbp, %rsi
movq %rbx, %rdi
callq 0x92ec
testq %rax, %rax
je 0x9baf
incq %r14
movq (%r13), %rdx
movswq 0x8(%rdx), %rcx
addq $0x1c, %rbp
movq %rax, %rbx
cmpq %rcx, %r14
jl 0x9b66
leaq 0x970c(%rip), %rcx      # 0x132a4
movl (%rcx), %ecx
jmp 0x9b9f
movq %rbx, %rax
incq %r15
movslq %ecx, %rdx
movq %rax, %rbx
cmpq %rdx, %r15
jl 0x9b44
jmp 0x9bbe
movq %rbx, %rdi
callq 0x92d1
xorl %eax, %eax
jmp 0x9bbe
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: all_delegated_prefixes
struct prefix_list *
all_delegated_prefixes()
{
    int i, j, k;
    struct prefix_list *pl = create_prefix_list(), *pl2;
    if(pl == NULL)
        return NULL;

    for(i = 0; i < numnodes; i++) {
        for(j = 0; j < nodes[i].numexts; j++) {
            if(nodes[i].exts[j]->delegated == NULL)
                continue;
            for(k = 0; k < nodes[i].exts[j]->delegated->numprefixes; k++) {
                struct prefix *p = &nodes[i].exts[j]->delegated->prefixes[k];
                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
pushq %rax
movl $0x1, %edi
movl $0x10, %esi
callq 0x21b0
testq %rax, %rax
je 0x9e4c
movq %rax, %rbx
leaq 0x950d(%rip), %rax      # 0x132a4
movl (%rax), %eax
testl %eax, %eax
jle 0x9e4e
xorl %r15d, %r15d
leaq 0xaae5(%rip), %rsi      # 0x14890
imulq $0x70, %r15, %r13
movl 0x68(%rsi,%r13), %edx
testl %edx, %edx
jle 0x9e33
addq %rsi, %r13
movq 0x60(%r13), %rcx
xorl %ebp, %ebp
movq (%rcx,%rbp,8), %rax
cmpq $0x0, (%rax)
je 0x9e18
movq (%rcx,%rbp,8), %rax
movq (%rax), %rsi
cmpw $0x0, 0x8(%rsi)
jle 0x9e18
xorl %r14d, %r14d
xorl %r12d, %r12d
movq (%rsi), %rsi
addq %r14, %rsi
movq %rbx, %rdi
callq 0x92ec
testq %rax, %rax
je 0x9e44
incq %r12
movq 0x60(%r13), %rcx
movq (%rcx,%rbp,8), %rdx
movq (%rdx), %rsi
movswq 0x8(%rsi), %rdx
addq $0x1c, %r14
movq %rax, %rbx
cmpq %rdx, %r12
jl 0x9ddf
movl 0x68(%r13), %edx
movq %rax, %rbx
incq %rbp
movslq %edx, %rax
cmpq %rax, %rbp
jl 0x9dc1
leaq 0x947a(%rip), %rax      # 0x132a4
movl (%rax), %eax
leaq 0xaa5d(%rip), %rsi      # 0x14890
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0x9dab
jmp 0x9e4e
movq %rbx, %rdi
callq 0x92d1
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: all_node_addresses
struct prefix_list *
all_node_addresses()
{
    int i, j;
    struct prefix_list *pl = create_prefix_list(), *pl2;
    if(pl == NULL)
        return NULL;

    for(i = 0; i < numnodes; i++) {
        if(nodes[i].addresses == NULL || id_eq(nodes[i].id, myid))
            continue;
        for(j = 0; j < nodes[i].addresses->numprefixes; j++) {
            struct prefix *p = &nodes[i].addresses->prefixes[j];
            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
pushq %rax
movl $0x1, %edi
movl $0x10, %esi
callq 0x21b0
testq %rax, %rax
je 0x9f25
movq %rax, %rbx
leaq 0x9417(%rip), %rax      # 0x132a4
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x9f29
xorl %r15d, %r15d
leaq 0xa9ef(%rip), %r12      # 0x14890
leaq 0x93d8(%rip), %rsi      # 0x13280
imulq $0x70, %r15, %rbp
movq 0x58(%r12,%rbp), %rdx
testq %rdx, %rdx
je 0x9f0a
addq %r12, %rbp
movl 0x8(%rbp), %eax
cmpl (%rsi), %eax
je 0x9f0a
cmpw $0x0, 0x8(%rdx)
jle 0x9f0a
xorl %r14d, %r14d
xorl %r13d, %r13d
movq (%rdx), %rsi
addq %r14, %rsi
movq %rbx, %rdi
callq 0x92ec
testq %rax, %rax
je 0x9f1d
incq %r13
movq 0x58(%rbp), %rdx
movswq 0x8(%rdx), %rcx
addq $0x1c, %r14
movq %rax, %rbx
cmpq %rcx, %r13
jl 0x9ecd
leaq 0x93a5(%rip), %rcx      # 0x132a4
movl (%rcx), %ecx
leaq 0x9378(%rip), %rsi      # 0x13280
jmp 0x9f0d
movq %rbx, %rax
incq %r15
movslq %ecx, %rdx
movq %rax, %rbx
cmpq %rdx, %r15
jl 0x9ea8
jmp 0x9f2c
movq %rbx, %rdi
callq 0x92d1
xorl %eax, %eax
jmp 0x9f2c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: best_prefix
int
best_prefix(const struct prefix *delegated, int eid,
            const struct prefix *assigned,
            const struct prefix_list *link_assigned,
            struct prefix *best_return)
{
    struct prefix *best = NULL;
    int i;

    if(link_assigned) {
        for(i = 0; i < link_assigned->numprefixes; i++) {
            struct prefix *p = &link_assigned->prefixes[i];
            if(!prefix_within(p, delegated) && !prefix_within(delegated, p))
                continue;
            if(best && prefix_takes_precedence(best, p))
                continue;

            best = p;
        }
    }

    if(!best)
        return 0;

    if(assigned && prefix_takes_precedence(assigned, best))
        return 0;

    *best_return = *best;
    return 1;
}

// Assembly:
xorl %eax, %eax
testq %rcx, %rcx
je 0xa013
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movswq 0x8(%rcx), %r13
testq %r13, %r13
jle 0xa005
movq %rdx, %r14
movq %rdi, %r12
movq %r8, (%rsp)
movq (%rcx), %rbp
addq $0x14, %rbp
xorl %ebx, %ebx
movq %rbx, %r15
leaq -0x14(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9521
testl %eax, %eax
jne 0x9f97
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9521
testl %eax, %eax
je 0x9fa7
testq %r15, %r15
je 0x9fbd
movzwl -0x2(%rbp), %eax
cmpw %ax, 0x12(%r15)
jbe 0x9fac
movq %r15, %rbx
jmp 0x9fbd
jne 0x9fbd
movl 0x14(%r15), %eax
movl (%rbp), %ecx
bswapl %eax
bswapl %ecx
cmpl %ecx, %eax
ja 0x9fa7
addq $0x1c, %rbp
decq %r13
jne 0x9f72
xorl %eax, %eax
testq %rbx, %rbx
je 0xa005
testq %r14, %r14
movq (%rsp), %rsi
je 0x9ff2
movzwl 0x12(%rbx), %ecx
cmpw %cx, 0x12(%r14)
ja 0xa005
jne 0x9ff2
movl 0x14(%r14), %ecx
movl 0x14(%rbx), %edx
bswapl %ecx
bswapl %edx
cmpl %edx, %ecx
ja 0xa005
movups (%rbx), %xmm0
movups 0xc(%rbx), %xmm1
movups %xmm1, 0xc(%rsi)
movups %xmm0, (%rsi)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: route_externals
int
route_externals(struct external **ext, int numexternals, int add)
{
    int i, j, rc = 1;
    struct in6_addr def;
    struct in6_addr v4_def;
    memset(&def, 0, sizeof(def));
    memcpy(&v4_def, v4prefix, 16);
    for(i = 0; i < numexternals; i++) {
        for(j = 0; j < ext[i]->delegated->numprefixes; j++) {
            struct prefix *p = &ext[i]->delegated->prefixes[j];
            int rrc;
            if(prefix_v4(p)) {
                rrc = kernel_route(0, NULL, &v4_def, 96, NULL, 0, add);
                rrc = kernel_route(0, NULL, &p->p, p->plen, NULL, 0, add);
            } else {
                rrc = kernel_route(0, NULL, &def, 0, &p->p, p->plen, add);
                rrc = kernel_route(0, NULL, &p->p, p->plen, NULL, 0, add);
            }
            if(rrc < 0)
                rc = rrc;
        }
    }
    return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps 0x37b8(%rip), %xmm0     # 0xd810
movaps %xmm0, 0x20(%rsp)
testl %esi, %esi
jle 0xa13f
movl %edx, %ebx
movl %esi, %eax
movq %rax, 0x18(%rsp)
movl $0x1, %ebp
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
movq (%rax,%r15,8), %rax
movq (%rax), %rax
cmpw $0x0, 0x8(%rax)
jle 0xa12f
xorl %r12d, %r12d
xorl %r14d, %r14d
movq (%rax), %rax
leaq (%rax,%r12), %r13
movzbl 0x10(%rax,%r12), %r9d
cmpl $0x60, %r9d
jb 0xa0d9
cmpl $0x0, (%r13)
jne 0xa0d9
cmpl $0x0, 0x4(%rax,%r12)
jne 0xa0d9
cmpl $0xffff0000, 0x8(%rax,%r12) # imm = 0xFFFF0000
jne 0xa0d9
movl %ebx, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x20(%rsp), %rdx
movl $0x60, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
jmp 0xa0ea
movl %ebx, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq 0xb198
movzbl 0x10(%r13), %ecx
movl %ebx, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
movq %r13, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb198
testl %eax, %eax
cmovsl %eax, %ebp
incq %r14
movq 0x10(%rsp), %rax
movq (%rax,%r15,8), %rax
movq (%rax), %rax
movswq 0x8(%rax), %rcx
addq $0x1c, %r12
cmpq %rcx, %r14
jl 0xa093
incq %r15
cmpq 0x18(%rsp), %r15
jne 0xa076
jmp 0xa144
movl $0x1, %ebp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: destroy_assigned_address
int
destroy_assigned_address(struct interface *interface,
                         struct assigned_prefix *ap)
{
    int rc = 0;

    if(IN6_IS_ADDR_UNSPECIFIED(&ap->assigned_address))
        return 0;

    debugf("Removing address ");
    debug_address(&ap->assigned_address);
    debugf(" from %s.\n", interface->ifname);

    assert(ap->assigned.plen > 0 && ap->applied);

    if(interface->ifindex > 0) {
        rc = kernel_address(interface->ifindex, interface->ifname,
                            &ap->assigned_address, ap->assigned.plen, 0);
        if(rc < 0)
            fprintf(stderr, "Couldn't remove address.\n");
    }

    return rc;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x60(%rsi)
jne 0xa17e
cmpl $0x0, 0x64(%r14)
jne 0xa17e
cmpl $0x0, 0x68(%r14)
jne 0xa17e
cmpl $0x0, 0x6c(%r14)
je 0xa1d1
leaq 0x60(%r14), %r15
leaq 0x90cf(%rip), %r12      # 0x13258
cmpl $0x2, (%r12)
jge 0xa1e1
movq %r15, %rdi
callq 0x905d
cmpl $0x2, (%r12)
jge 0xa1e8
movzbl 0x2c(%r14), %ecx
testl %ecx, %ecx
je 0xa200
cmpl $0x0, 0x3c(%r14)
je 0xa200
movl 0x8(%rbx), %edi
testl %edi, %edi
jle 0xa1d1
movq (%rbx), %rsi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0xb0c0
movl %eax, %ebx
testl %eax, %eax
jns 0xa1d3
callq 0x2ee7
jmp 0xa1d3
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x2ed6
jmp 0xa190
movq (%rbx), %rdx
leaq 0x3d9e(%rip), %rsi      # 0xdf90
movl $0x2, %edi
xorl %eax, %eax
callq 0x30a8
jmp 0xa19f
leaq 0x3d94(%rip), %rdi      # 0xdf9b
leaq 0x3d25(%rip), %rsi      # 0xdf33
leaq 0x3dab(%rip), %rcx      # 0xdfc0
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x2150
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: destroy_assigned
int
destroy_assigned(struct interface *interface, struct assigned_prefix *ap)
{
    if(ap->applied) {
        destroy_assigned_address(interface, ap);

        debugf("Removing prefix ");
        debug_prefix(&ap->assigned);
        debugf(" from %s.\n", interface->ifname);

        assert(ap->assigned.plen > 0);
        if(interface->ifindex > 0)
            kernel_route(interface->ifindex, interface->ifname,
                         &ap->assigned.p, ap->assigned.plen, NULL, 0, 0);
        ap->applied = 0;
        ra_retract(&ap->assigned);
        schedule_ra(NULL, 1, 0);
    }
    ts_zero(&ap->apply_timer);
    publish_prefix(interface, ap, 0);
    memset(&ap->assigned, 0, sizeof(ap->assigned));
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x0, 0x3c(%rsi)
je 0xa2a9
movq %rdi, %r14
movq %rbx, %rsi
callq 0xa155
leaq 0x9016(%rip), %r12      # 0x13258
cmpl $0x2, (%r12)
jge 0xa2ce
leaq 0x1c(%rbx), %r15
movq %r15, %rdi
callq 0x90d1
cmpl $0x2, (%r12)
jge 0xa2d8
movzbl 0x2c(%rbx), %ecx
testl %ecx, %ecx
je 0xa2f3
movl 0x8(%r14), %edi
testl %edi, %edi
jle 0xa28c
movq (%r14), %rsi
movl $0x0, (%rsp)
movq %r15, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb198
movl $0x0, 0x3c(%rbx)
movq %r15, %rdi
callq 0x7455
xorl %edi, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x74b8
leaq 0x50(%rbx), %rdi
callq 0xb650
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%rbx)
movups %xmm0, 0x1c(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x2f03
jmp 0xa24d
movq (%r14), %rdx
leaq 0x3cae(%rip), %rsi      # 0xdf90
movl $0x2, %edi
xorl %eax, %eax
callq 0x30a8
jmp 0xa260
leaq 0x3d3c(%rip), %rdi      # 0xe036
leaq 0x3c32(%rip), %rsi      # 0xdf33
leaq 0x3d44(%rip), %rcx      # 0xe04c
movl $0x2f8, %edx            # imm = 0x2F8
callq 0x2150
// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/prefix.c
// Function: find_assigned
struct assigned_prefix *
find_assigned(struct interface *interface, const struct prefix *delegated,
              int create)
{
    struct assigned_prefix *new;
    int i;

    for(i = 0; i < interface->numassigned; i++) {
        if(prefix_eq(&interface->assigned[i].delegated, delegated))
            return &interface->assigned[i];
    }

    if(!create)
        return NULL;

    new = realloc(interface->assigned,
                  (interface->numassigned + 1) *
                  sizeof(struct assigned_prefix));
    if(new == NULL)
        return NULL;
    interface->assigned = new;

    memset(&interface->assigned[interface->numassigned], 0,
           sizeof(struct assigned_prefix));
    interface->assigned[interface->numassigned].delegated = *delegated;
    return &interface->assigned[interface->numassigned++];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x68(%rdi), %rcx
testq %rcx, %rcx
jle 0xa35e
movq 0x60(%rbx), %rax
movb 0x10(%r14), %sil
movq %rcx, %rdi
cmpb %sil, 0x10(%rax)
jne 0xa355
movdqu (%rax), %xmm0
movdqu (%r14), %xmm1
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %r8d
cmpl $0xffff, %r8d           # imm = 0xFFFF
je 0xa3d5
addq $0x70, %rax
decq %rdi
jne 0xa330
testl %edx, %edx
je 0xa3d3
movq 0x60(%rbx), %rdi
incl %ecx
movslq %ecx, %rax
imulq $0x70, %rax, %rsi
callq 0x2280
testq %rax, %rax
je 0xa3d3
movq %rax, %rcx
movq %rax, 0x60(%rbx)
movslq 0x68(%rbx), %rdx
imulq $0x70, %rdx, %rsi
addq %rsi, %rax
pxor %xmm0, %xmm0
movdqu %xmm0, 0x5c(%rcx,%rsi)
movdqu %xmm0, 0x4c(%rcx,%rsi)
movdqu %xmm0, 0x3c(%rcx,%rsi)
movdqu %xmm0, 0x2c(%rcx,%rsi)
movdqu %xmm0, 0x1c(%rcx,%rsi)
movl $0x0, 0x6c(%rcx,%rsi)
movdqu (%r14), %xmm0
movdqu 0xc(%r14), %xmm1
movdqu %xmm0, (%rcx,%rsi)
movdqu %xmm1, 0xc(%rcx,%rsi)
leal 0x1(%rdx), %ecx
movl %ecx, 0x68(%rbx)
jmp 0xa3d5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq