LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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 0x9a65
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 0x9a65
andl $0x7, %ebx
je 0x9a60
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 0x9a65
movl $0x1, %ebp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %rax
movups %xmm0, 0xc(%rax)
movq $0x0, (%rax)
movl $0xffff0000, 0x8(%rax)  # imm = 0xFFFF0000
movl (%rdi), %ecx
movl %ecx, 0xc(%rax)
movb $-0x80, 0x10(%rax)
movq %rax, %rdi
callq 0x9a06
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x9b00
movswq 0x8(%rsi), %r12
testq %r12, %r12
jle 0x9b00
movq %rdi, %r14
movq (%rsi), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x9a06
testl %eax, %eax
jne 0x9afb
addq $0x1c, %r15
decq %r12
jne 0x9ae1
jmp 0x9b00
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/prefix.c
// Function: prefix_list_within_v4
int
prefix_list_within_v4(const unsigned char *p4, const struct prefix_list *pl)
{
    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_list_within(&p, pl);
}

// Assembly:
subq $0x28, %rsp
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %rax
movups %xmm0, 0xc(%rax)
movq $0x0, (%rax)
movl $0xffff0000, 0x8(%rax)  # imm = 0xFFFF0000
movl (%rdi), %ecx
movl %ecx, 0xc(%rax)
movb $-0x80, 0x10(%rax)
movq %rax, %rdi
callq 0x9ac2
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x9c42
movswq 0x8(%rsi), %r15
testq %r15, %r15
jle 0x9c42
movq %rdi, %r14
movq (%rsi), %r12
movzbl 0x10(%rdi), %ebp
addq $0x14, %r12
movzbl -0x4(%r12), %r13d
cmpl %r13d, %ebp
cmovll %ebp, %r13d
cmpl $0x0, 0xc(%rsp)
je 0x9bd5
movl 0x14(%r14), %eax
cmpl (%r12), %eax
jne 0x9bb1
movl 0x18(%r14), %eax
movl $0x4, %ecx
cmpl 0x4(%r12), %eax
je 0x9c27
movzwl -0x2(%r12), %eax
movl $0x4, %ecx
cmpw %ax, 0x12(%r14)
ja 0x9c27
jne 0x9bd5
movl 0x14(%r14), %eax
movl (%r12), %edx
bswapl %eax
bswapl %edx
cmpl %edx, %eax
ja 0x9c27
leaq -0x14(%r12), %rax
movups (%rax), %xmm0
movaps %xmm0, 0x10(%rsp)
movl %r13d, %ebx
shrl $0x3, %ebx
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x2260
movl $0x4, %ecx
testl %eax, %eax
jne 0x9c27
andl $0x7, %r13d
je 0x9c22
movb 0x11(%rsp,%rbx), %al
xorb 0x21(%rsp,%rbx), %al
movzbl %al, %eax
movl %r13d, %ecx
shrl %cl, %eax
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
jmp 0x9c27
movl $0x1, %ecx
testb $0x3, %cl
jne 0x9c3d
addq $0x1c, %r12
decq %r15
jne 0x9b83
xorl %eax, %eax
jmp 0x9c42
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_O1/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 0x9cf1
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 0x9ccd
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 0x9cc4
movq (%rbx), %rsi
leaq (%rsi,%r15), %rdi
addq %rbp, %rsi
callq 0x9a06
testl %eax, %eax
jne 0x9cdd
addq $0x1c, %rbp
cmpq %rbp, %r12
jne 0x9cac
incq %r14
cmpq 0x10(%rsp), %r14
movl 0xc(%rsp), %edx
jl 0x9c8d
jmp 0x9cf1
movq %rbx, %rdi
movl %r14d, %esi
callq 0x98a4
movswl 0x8(%rbx), %edx
cmpl %edx, %r14d
jl 0x9c71
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_O1/jech[P]shncpd/prefix.c
// Function: random_bits
void
random_bits(unsigned char *buf, int first, int len)
{
    int i;

    if(first % 8 != 0) {
        unsigned char mask = (0xFF >> (first % 8)) ^ 0xFF;
        buf[first / 8] &= mask;
        buf[first / 8] |= random() & (0xFF ^ mask);
    }

    for(i = (first + 7) / 8; i < (first + len) / 8; i++)
        buf[i] = random() % 0xFF;

    if((first + len) % 8 != 0) {
        unsigned char mask = 0xFF >> ((first + len) % 8);
        buf[(first + len) / 8] &= mask;
        buf[(first + len) / 8] |= random() & (0xFF ^ mask);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
leal 0x7(%r15), %r12d
testl %esi, %esi
movl %esi, %eax
cmovsl %r12d, %eax
movl %eax, %ecx
andl $-0x8, %ecx
movl %esi, %ebp
subl %ecx, %ebp
je 0x9d9f
sarl $0x3, %eax
movl $0xffffff00, %edx       # imm = 0xFFFFFF00
movl %ebp, %ecx
sarl %cl, %edx
movslq %eax, %r13
andb %dl, (%rbx,%r13)
callq 0x2230
movl $0xff, %edx
movl %ebp, %ecx
shrl %cl, %edx
andl %edx, %eax
orb %al, (%rbx,%r13)
leal 0xe(%r15), %eax
testl %r12d, %r12d
cmovnsl %r12d, %eax
sarl $0x3, %eax
movl %r14d, %ebp
addl %r15d, %ebp
leal 0x7(%r14,%r15), %ecx
cmovnsl %ebp, %ecx
movl %ecx, %edx
sarl $0x3, %edx
andl $-0x8, %ecx
subl %ecx, %ebp
movslq %edx, %r14
cmpl %edx, %eax
jge 0x9e01
movslq %eax, %r15
movabsq $-0x7f7f7f7f7f7f7f7f, %r12 # imm = 0x8080808080808081
callq 0x2230
movq %rax, %rcx
imulq %r12
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrl $0x7, %edx
addl %eax, %edx
addl %edx, %ecx
movb %cl, (%rbx,%r15)
incq %r15
cmpq %r15, %r14
jne 0x9dd9
testl %ebp, %ebp
je 0x9e26
movl $0xff, %eax
movl %ebp, %ecx
shrl %cl, %eax
andb %al, (%rbx,%r14)
callq 0x2230
movl $0xffffff00, %edx       # imm = 0xFFFFFF00
movl %ebp, %ecx
sarl %cl, %edx
andl %edx, %eax
orb %al, (%rbx,%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x9ec5
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 0x9d4d
testl %ebp, %ebp
je 0x9e9f
cmpb $0x44, 0x10(%r14)
ja 0x9e9f
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 0x9b42
testl %eax, %eax
je 0x9ec9
decl %r12d
jne 0x9e72
xorl %eax, %eax
jmp 0x9ee4
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_O1/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 0x9fbf
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2230
movswl 0x8(%r14), %esi
movslq %esi, %rdi
cqto
idivq %rdi
testl %edi, %edi
jle 0x9fbf
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), %rdx
addq %rax, %rdx
leaq (%rdi,%rdx), %r8
movb 0x10(%rdi,%rdx), %al
cmpb $0x60, %al
jb 0x9f7b
cmpl $0x0, (%r8)
jne 0x9f7b
cmpl $0x0, 0x4(%r8)
je 0x9f8e
xorl %edx, %edx
cmpb $0x7e, %al
ja 0x9f85
testb %dl, %dl
jne 0x9f9b
incl %ecx
decl %r9d
jne 0x9f4f
jmp 0x9fbf
cmpl $0xffff0000, 0x8(%r8)   # imm = 0xFFFF0000
sete %dl
jmp 0x9f7d
leaq 0x4(%rsp), %r14
movq %r14, %rdi
movl $0x80, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x9e35
movl 0xc(%r14), %eax
movl %eax, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x9ffe
movq 0x60(%rdi), %rax
imulq $0x70, %rcx, %rdx
xorl %ecx, %ecx
cmpl $0x0, 0x60(%rax,%rcx)
jne 0x9ff5
cmpl $0x0, 0x64(%rax,%rcx)
jne 0x9ff5
cmpl $0xffff0000, 0x68(%rax,%rcx) # imm = 0xFFFF0000
je 0xa001
addq $0x70, %rcx
cmpq %rcx, %rdx
jne 0x9fdd
xorl %eax, %eax
retq
movl 0x6c(%rax,%rcx), %eax
movl %eax, (%rsi)
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xa0c0
movq %rax, %rbx
leaq 0x926a(%rip), %rax      # 0x132a4
cmpl $0x0, (%rax)
jle 0xa0c4
xorl %r15d, %r15d
leaq 0xa843(%rip), %r12      # 0x14890
imulq $0x70, %r15, %rax
cmpq $0x0, 0x50(%r12,%rax)
je 0xa09e
leaq (%r12,%rax), %r13
addq $0x50, %r13
movq (%r13), %rcx
cmpw $0x0, 0x8(%rcx)
jle 0xa09e
xorl %ebp, %ebp
xorl %r14d, %r14d
movq (%rcx), %rsi
addq %rbp, %rsi
movq %rbx, %rdi
callq 0x97de
testq %rax, %rax
je 0xa0b8
incq %r14
movq (%r13), %rcx
movswq 0x8(%rcx), %rdx
addq $0x1c, %rbp
movq %rax, %rbx
cmpq %rdx, %r14
jl 0xa071
jmp 0xa0a1
movq %rbx, %rax
incq %r15
leaq 0x91f9(%rip), %rcx      # 0x132a4
movslq (%rcx), %rcx
movq %rax, %rbx
cmpq %rcx, %r15
jl 0xa04d
jmp 0xa0c7
movq %rbx, %rdi
callq 0x97c3
xorl %eax, %eax
jmp 0xa0c7
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_O1/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 0xa3d2
movq %rax, %rbx
leaq 0x8fa7(%rip), %rax      # 0x132a4
cmpl $0x0, (%rax)
jle 0xa3d6
leaq 0xa583(%rip), %rcx      # 0x14890
xorl %edx, %edx
movq %rdx, (%rsp)
imulq $0x70, %rdx, %rbp
cmpl $0x0, 0x68(%rcx,%rbp)
jle 0xa3a9
addq %rcx, %rbp
xorl %r15d, %r15d
movq 0x60(%rbp), %rax
movq (%rax,%r15,8), %rax
cmpq $0x0, (%rax)
je 0xa395
movq 0x60(%rbp), %rax
movq (%rax,%r15,8), %rax
movq (%rax), %rcx
cmpw $0x0, 0x8(%rcx)
jle 0xa395
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%rcx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
callq 0x97de
movq %rax, %r14
testq %rax, %rax
jne 0xa36f
movq %rbx, %rdi
callq 0x97c3
movq %rbx, %rax
testq %r14, %r14
je 0xa3d2
incq %r13
movq 0x60(%rbp), %rcx
movq (%rcx,%r15,8), %rcx
movq (%rcx), %rcx
movswq 0x8(%rcx), %rdx
addq $0x1c, %r12
movq %rax, %rbx
cmpq %rdx, %r13
jl 0xa34e
jmp 0xa398
movq %rbx, %rax
incq %r15
movslq 0x68(%rbp), %rcx
movq %rax, %rbx
cmpq %rcx, %r15
jl 0xa328
jmp 0xa3ac
movq %rbx, %rax
movq (%rsp), %rdx
incq %rdx
leaq 0x8eea(%rip), %rcx      # 0x132a4
movslq (%rcx), %rcx
movq %rax, %rbx
cmpq %rcx, %rdx
leaq 0xa4c6(%rip), %rcx      # 0x14890
jl 0xa30f
jmp 0xa3d9
xorl %eax, %eax
jmp 0xa3d9
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_O1/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 0xa4bb
movq %rax, %rbx
leaq 0x8e8f(%rip), %rax      # 0x132a4
cmpl $0x0, (%rax)
jle 0xa4bf
leaq 0xa46b(%rip), %rcx      # 0x14890
xorl %ebp, %ebp
imulq $0x70, %rbp, %r13
cmpq $0x0, 0x58(%rcx,%r13)
je 0xa496
addq %rcx, %r13
movl 0x8(%r13), %eax
leaq 0x8e3f(%rip), %rcx      # 0x13280
cmpl (%rcx), %eax
je 0xa496
movq 0x58(%r13), %rcx
cmpw $0x0, 0x8(%rcx)
jle 0xa496
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rcx), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x97de
movq %rax, %r14
testq %rax, %rax
jne 0xa477
movq %rbx, %rdi
callq 0x97c3
movq %rbx, %rax
testq %r14, %r14
je 0xa4bb
incq %r12
movq 0x58(%r13), %rcx
movswq 0x8(%rcx), %rdx
addq $0x1c, %r15
movq %rax, %rbx
cmpq %rdx, %r12
jl 0xa456
jmp 0xa499
movq %rbx, %rax
incq %rbp
leaq 0x8e01(%rip), %rcx      # 0x132a4
movslq (%rcx), %rcx
movq %rax, %rbx
cmpq %rcx, %rbp
leaq 0xa3dd(%rip), %rcx      # 0x14890
jl 0xa427
jmp 0xa4c2
xorl %eax, %eax
jmp 0xa4c2
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_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, (%rsp)
movq %rdx, %r15
testq %rcx, %rcx
je 0xa54c
movswq 0x8(%rcx), %r14
testq %r14, %r14
jle 0xa54c
movq %rdi, %r12
movq (%rcx), %rbx
addq $0x14, %rbx
xorl %ebp, %ebp
leaq -0x14(%rbx), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x9a06
testl %eax, %eax
jne 0xa520
movq %r12, %rdi
movq %r13, %rsi
callq 0x9a06
testl %eax, %eax
je 0xa541
testq %rbp, %rbp
je 0xa53e
movzwl -0x2(%rbx), %eax
cmpw %ax, 0x12(%rbp)
ja 0xa541
jne 0xa53e
movl 0x14(%rbp), %eax
movl (%rbx), %ecx
bswapl %eax
bswapl %ecx
cmpl %ecx, %eax
ja 0xa541
movq %r13, %rbp
addq $0x1c, %rbx
decq %r14
jne 0xa4fe
jmp 0xa54e
xorl %ebp, %ebp
testq %rbp, %rbp
je 0xa593
testq %r15, %r15
movl $0x0, %eax
je 0xa579
movzwl 0x12(%rbp), %ecx
cmpw %cx, 0x12(%r15)
ja 0xa595
jne 0xa579
movl 0x14(%r15), %edx
movl 0x14(%rbp), %ecx
bswapl %edx
bswapl %ecx
cmpl %ecx, %edx
ja 0xa595
movups (%rbp), %xmm0
movups 0xc(%rbp), %xmm1
movq (%rsp), %rax
movups %xmm1, 0xc(%rax)
movups %xmm0, (%rax)
movl $0x1, %eax
jmp 0xa595
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x3248(%rip), %xmm0     # 0xd830
movaps %xmm0, 0x20(%rsp)
testl %esi, %esi
jle 0xa6cf
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 0xa6bf
xorl %r12d, %r12d
xorl %r14d, %r14d
movq (%rax), %rax
leaq (%rax,%r12), %r13
movzbl 0x10(%rax,%r12), %r9d
cmpl $0x60, %r9d
jb 0xa669
cmpl $0x0, (%r13)
jne 0xa669
cmpl $0x0, 0x4(%rax,%r12)
jne 0xa669
cmpl $0xffff0000, 0x8(%rax,%r12) # imm = 0xFFFF0000
jne 0xa669
movl %ebx, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x20(%rsp), %rdx
movl $0x60, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
jmp 0xa67a
movl %ebx, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq 0xb76c
movzbl 0x10(%r13), %ecx
movl %ebx, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
movq %r13, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb76c
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 0xa623
incq %r15
cmpq 0x18(%rsp), %r15
jne 0xa606
jmp 0xa6d4
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_O1/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 0xa70e
cmpl $0x0, 0x64(%r14)
jne 0xa70e
cmpl $0x0, 0x68(%r14)
jne 0xa70e
cmpl $0x0, 0x6c(%r14)
je 0xa761
leaq 0x60(%r14), %r15
leaq 0x8b3f(%rip), %r12      # 0x13258
cmpl $0x2, (%r12)
jge 0xa771
movq %r15, %rdi
callq 0x9562
cmpl $0x2, (%r12)
jge 0xa778
movzbl 0x2c(%r14), %ecx
testl %ecx, %ecx
je 0xa790
cmpl $0x0, 0x3c(%r14)
je 0xa790
movl 0x8(%rbx), %edi
testl %edi, %edi
jle 0xa761
movq (%rbx), %rsi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0xb694
movl %eax, %ebx
testl %eax, %eax
jns 0xa763
callq 0x2fdd
jmp 0xa763
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x2fcc
jmp 0xa720
movq (%rbx), %rdx
leaq 0x3846(%rip), %rsi      # 0xdfc8
movl $0x2, %edi
xorl %eax, %eax
callq 0x319e
jmp 0xa72f
leaq 0x383c(%rip), %rdi      # 0xdfd3
leaq 0x37cd(%rip), %rsi      # 0xdf6b
leaq 0x3853(%rip), %rcx      # 0xdff8
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/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 0xa839
movq %rdi, %r14
movq %rbx, %rsi
callq 0xa6e5
leaq 0x8a86(%rip), %r12      # 0x13258
cmpl $0x2, (%r12)
jge 0xa85e
leaq 0x1c(%rbx), %r15
movq %r15, %rdi
callq 0x95d6
cmpl $0x2, (%r12)
jge 0xa868
movzbl 0x2c(%rbx), %ecx
testl %ecx, %ecx
je 0xa883
movl 0x8(%r14), %edi
testl %edi, %edi
jle 0xa81c
movq (%r14), %rsi
movl $0x0, (%rsp)
movq %r15, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb76c
movl $0x0, 0x3c(%rbx)
movq %r15, %rdi
callq 0x77bc
xorl %edi, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x781f
leaq 0x50(%rbx), %rdi
callq 0xbc1e
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 0x2ff9
jmp 0xa7dd
movq (%r14), %rdx
leaq 0x3756(%rip), %rsi      # 0xdfc8
movl $0x2, %edi
xorl %eax, %eax
callq 0x319e
jmp 0xa7f0
leaq 0x37e4(%rip), %rdi      # 0xe06e
leaq 0x36da(%rip), %rsi      # 0xdf6b
leaq 0x37ec(%rip), %rcx      # 0xe084
movl $0x2f8, %edx            # imm = 0x2F8
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/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 0xa8ee
movq 0x60(%rbx), %rax
movb 0x10(%r14), %sil
movq %rcx, %rdi
cmpb %sil, 0x10(%rax)
jne 0xa8e5
movdqu (%rax), %xmm0
movdqu (%r14), %xmm1
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %r8d
cmpl $0xffff, %r8d           # imm = 0xFFFF
je 0xa965
addq $0x70, %rax
decq %rdi
jne 0xa8c0
testl %edx, %edx
je 0xa963
movq 0x60(%rbx), %rdi
incl %ecx
movslq %ecx, %rax
imulq $0x70, %rax, %rsi
callq 0x2280
testq %rax, %rax
je 0xa963
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 0xa965
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/prefix.c
// Function: flush_assigned
void
flush_assigned(struct interface *interface, struct assigned_prefix *ap)
{
    int n = ap - interface->assigned;
    assert(n >= 0 && n < interface->numassigned);

    destroy_assigned(interface, ap);
    if(n < interface->numassigned - 1)
        interface->assigned[n] =
            interface->assigned[interface->numassigned - 1];
    interface->numassigned--;

    if(interface->numassigned == 0) {
        free(interface->assigned);
        interface->assigned = NULL;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
subq 0x60(%rdi), %rax
sarq $0x4, %rax
movabsq $0x6db6db6db6db6db7, %r14 # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %r14
testl %r14d, %r14d
js 0xa9eb
movq %rdi, %rbx
cmpl %r14d, 0x68(%rdi)
jle 0xa9eb
movq %rbx, %rdi
callq 0xa7af
movl 0x68(%rbx), %eax
decl %eax
cmpl %r14d, %eax
jle 0xa9cd
movq 0x60(%rbx), %rcx
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
imulq $0x70, %r14, %rdi
addq %rcx, %rdi
movl %eax, %eax
imulq $0x70, %rax, %rsi
addq %rcx, %rsi
movl $0xe, %ecx
rep  movsq (%rsi), %es:(%rdi)
decl 0x68(%rbx)
jne 0xa9e3
movq 0x60(%rbx), %rdi
callq 0x2040
movq $0x0, 0x60(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x36d5(%rip), %rdi      # 0xe0c7
leaq 0x3572(%rip), %rsi      # 0xdf6b
leaq 0x36ec(%rip), %rcx      # 0xe0ec
movl $0x326, %edx            # imm = 0x326
callq 0x2150
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/prefix.c
// Function: prefix_assignment_cleanup
void
prefix_assignment_cleanup()
{
    int i;
    for(i = 0; i < numinterfaces; i++) {
        while(interfaces[i].numassigned > 0)
            flush_assigned(&interfaces[i], &interfaces[i].assigned[0]);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x808a(%rip), %r14      # 0x132a0
cmpl $0x0, (%r14)
jle 0xb255
xorl %r15d, %r15d
leaq 0x808a(%rip), %r12      # 0x132b0
imulq $0x98, %r15, %rbx
cmpl $0x0, 0x68(%r12,%rbx)
jle 0xb24a
addq %r12, %rbx
movq 0x60(%rbx), %rsi
movq %rbx, %rdi
callq 0xa96d
cmpl $0x0, 0x68(%rbx)
jg 0xb238
incq %r15
movslq (%r14), %rax
cmpq %rax, %r15
jl 0xb226
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/local.c
// Function: run_local_script
int
run_local_script(int up)
{
    pid_t pid;
    if(local_script == NULL || local_script[0] == '\0')
        return 0;

    debugf("Calling local configuration script (%d).\n", up);

    pid = fork();
    if(pid < 0)
        return pid;

    if(pid == 0) {
        char buf[20];
        snprintf(buf, 20, "%d", debug_level);
        setenv("HNCP_DEBUG_LEVEL", buf, 1);
        if(up) {
            struct prefix_list *pl;
            pl = all_dhcp_data(0, 1, 0);
            set_config_var("HNCP_IPv4_NAMESERVERS", pl, 1);
            destroy_prefix_list(pl);
            pl = all_dhcp_data(0, 0, 1);
            set_config_var("HNCP_IPv6_NAMESERVERS", pl, 0);
            destroy_prefix_list(pl);
            pl = all_dhcp_data(1, 1, 0);
            set_config_var("HNCP_IPv4_NTP_SERVERS", pl, 1);
            destroy_prefix_list(pl);
            pl = all_dhcp_data(1, 0, 1);
            set_config_var("HNCP_IPv6_NTP_SERVERS", pl, 0);
            destroy_prefix_list(pl);
        }
        execl(local_script, local_script, up ? "up" : "down" , NULL);
        perror("exec(local_script)");
        exit(42);
    } else {
        int status;
    again:
        pid = waitpid(pid, &status, 0);
        if(pid < 0) {
            if(errno == EINTR)
                goto again;
            perror("wait");
            return -1;
        } else if(!WIFEXITED(status)) {
            fprintf(stderr, "Configuration script died violently (%d)\n",
                    status);
            return 0;
        } else if(WEXITSTATUS(status) != 0) {
            fprintf(stderr, "Configuration script erred out %d\n",
                    WEXITSTATUS(status));
            return 0;
        }
        return 1;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq 0xc225(%rip), %rax      # 0x17498
xorl %ebx, %ebx
testq %rax, %rax
je 0xb2e8
cmpb $0x0, (%rax)
je 0xb2e8
movl %edi, %ebp
leaq 0x7fd0(%rip), %rax      # 0x13258
cmpl $0x2, (%rax)
jge 0xb2f3
callq 0x2380
movl %eax, %ebx
testl %eax, %eax
js 0xb2e8
je 0xb339
movq %rsp, %r14
movl %ebx, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x22c0
testl %eax, %eax
jns 0xb2d0
movl %eax, %ebx
callq 0x2060
cmpl $0x4, (%rax)
je 0xb2a1
leaq 0x2fbb(%rip), %rdi      # 0xe27f
callq 0x22e0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xb2e8
movl (%rsp), %edx
testb $0x7f, %dl
jne 0xb30a
shrl $0x8, %edx
movl $0x1, %ebx
andl $0xff, %edx
jne 0xb31d
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2ed7(%rip), %rsi      # 0xe1d1
movl $0x2, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x319e
jmp 0xb28d
movq 0x7ce7(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
leaq 0x2f69(%rip), %rsi      # 0xe284
jmp 0xb32e
movq 0x7cd4(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
leaq 0x2f80(%rip), %rsi      # 0xe2ae
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x21d0
jmp 0xb2e8
movq %rsp, %rdi
movl %ebp, %esi
callq 0x308c
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/local.c
// Function: set_config_var
static int
set_config_var(const char *name, const struct prefix_list *pl, int v4)
{
    char buf[(INET6_ADDRSTRLEN + 1) * 20];

    if(pl && pl->prefixes > 0) {
        int i;
        buf[0] = '\0';
        for(i = 0; i < pl->numprefixes; i++) {
            char a[INET6_ADDRSTRLEN];
            if(v4)
                inet_ntop(AF_INET, (char*)&pl->prefixes[i].p + 12,
                          a, sizeof(a));
            else
                inet_ntop(AF_INET6, &pl->prefixes[i].p, a, sizeof(a));
            if(i > 0)
                strncat(buf, " ", sizeof(buf) - strlen(a));
            strncat(buf, a, sizeof(buf) - strlen(a));
        }
        return setenv(name, buf, 1);
    }
    return 0;
}

// Assembly:
testq %rsi, %rsi
je 0xb430
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rsi, %r14
cmpq $0x0, (%rsi)
je 0xb41f
movq %rdi, 0x8(%rsp)
movb $0x0, 0x40(%rsp)
cmpw $0x0, 0x8(%r14)
jle 0xb40b
movl %edx, %ebp
xorl %ebx, %ebx
leaq 0x10(%rsp), %r15
leaq 0x40(%rsp), %r12
xorl %r13d, %r13d
movq (%r14), %rsi
testl %ebp, %ebp
je 0xb3a6
addq %rbx, %rsi
addq $0xc, %rsi
movl $0x2, %edi
jmp 0xb3ae
addq %rbx, %rsi
movl $0xa, %edi
movq %r15, %rdx
movl $0x2e, %ecx
callq 0x2030
testq %rbx, %rbx
je 0xb3df
movq %r15, %rdi
callq 0x20e0
movl $0x3ac, %edx            # imm = 0x3AC
subq %rax, %rdx
movq %r12, %rdi
leaq 0x291a(%rip), %rsi      # 0xdcf4
callq 0x2180
movq %r15, %rdi
callq 0x20e0
movl $0x3ac, %edx            # imm = 0x3AC
subq %rax, %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2180
incq %r13
movswq 0x8(%r14), %rax
addq $0x1c, %rbx
cmpq %rax, %r13
jl 0xb391
leaq 0x40(%rsp), %rsi
movq 0x8(%rsp), %rdi
movl $0x1, %edx
callq 0x20d0
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/trickle.c
// Function: trickle_init
void
trickle_init(struct trickle_state *s, int I_min, int I_max, int k)
{
    memset(s, 0, sizeof(*s));
    s->I_min = I_min;
    s->I_max = I_max;
    s->k = k;

    s->I = I_min + (random() % (I_max - I_min));
    trickle_new_interval(s);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movl %esi, (%rdi)
movl %edx, 0x4(%rdi)
movl %ecx, 0x8(%rdi)
callq 0x2230
subl %r14d, %ebp
movslq %ebp, %rcx
cqto
idivq %rcx
addl %r14d, %edx
movl %edx, 0xc(%rbx)
xorl %ebp, %ebp
movl %ebp, 0x10(%rbx)
movl %edx, %r14d
shrl $0x1f, %r14d
addl %edx, %r14d
sarl %r14d
callq 0x2230
movl 0xc(%rbx), %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
movslq %edx, %rcx
cqto
idivq %rcx
addl %r14d, %edx
movl %edx, 0x14(%rbx)
leaq 0x7dcc(%rip), %rax      # 0x13270
movups (%rax), %xmm0
movups %xmm0, 0x20(%rbx)
movl %ebp, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/trickle.c
// Function: trickle_new_interval
void
trickle_new_interval(struct trickle_state *s)
{
    s->c = 0;
    trickle_new_t(s);
    s->I_start = now;
    s->triggered = 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %ebp, %ebp
movl %ebp, 0x10(%rdi)
movl 0xc(%rdi), %eax
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
callq 0x2230
movl 0xc(%rbx), %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
movslq %edx, %rcx
cqto
idivq %rcx
addl %r14d, %edx
movl %edx, 0x14(%rbx)
leaq 0x7d7b(%rip), %rax      # 0x13270
movups (%rax), %xmm0
movups %xmm0, 0x20(%rbx)
movl %ebp, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/trickle.c
// Function: trickle_trigger
int
trickle_trigger(struct trickle_state *s)
{
    if(!s->triggered) {
        struct timespec tt;
        ts_add_msec(&tt, &s->I_start, s->t);
        if(ts_compare(&now, &tt) >= 0) {
            s->triggered = 1;
            return s->c < s->k;
        }
    } else {
        struct timespec tI;
        ts_add_msec(&tI, &s->I_start, s->I);
        if(ts_compare(&now, &tI) >= 0) {
            s->I = min(2 * s->I, s->I_max);
            trickle_new_interval(s);
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
cmpl $0x0, 0x18(%rdi)
je 0xb5e3
movl 0xc(%rbx), %edx
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xbae6
leaq 0x7cee(%rip), %r15      # 0x13270
movq %r15, %rdi
movq %r12, %rsi
callq 0xba38
testl %eax, %eax
js 0xb621
movl 0x4(%rbx), %eax
movl 0xc(%rbx), %ecx
addl %ecx, %ecx
cmpl %eax, %ecx
cmovgel %eax, %ecx
movl %ecx, 0xc(%rbx)
xorl %ebp, %ebp
movl %ebp, 0x10(%rbx)
movl %ecx, %r12d
shrl $0x1f, %r12d
addl %ecx, %r12d
sarl %r12d
callq 0x2230
movl 0xc(%rbx), %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
movslq %edx, %rcx
cqto
idivq %rcx
addl %r12d, %edx
movl %edx, 0x14(%rbx)
movups (%r15), %xmm0
movups %xmm0, (%r14)
movl %ebp, 0x18(%rbx)
jmp 0xb621
movl 0x14(%rbx), %edx
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xbae6
leaq 0x7c75(%rip), %rdi      # 0x13270
movq %r15, %rsi
callq 0xba38
movl %eax, %ecx
testl %eax, %eax
js 0xb61d
movl $0x1, 0x18(%rbx)
movl 0x10(%rbx), %edx
xorl %eax, %eax
cmpl 0x8(%rbx), %edx
setl %al
jmp 0xb61d
testl %ecx, %ecx
jns 0xb623
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/trickle.c
// Function: trickle_reset
void
trickle_reset(struct trickle_state *s, int consistent)
{
    if(consistent) {
        s->c++;
    } else if(s->I > s->I_min) {
        s->I = s->I_min;
        trickle_new_interval(s);
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
je 0xb640
incl 0x10(%rbx)
jmp 0xb68c
movl (%rbx), %eax
cmpl %eax, 0xc(%rbx)
jle 0xb68c
movl %eax, 0xc(%rbx)
xorl %ebp, %ebp
movl %ebp, 0x10(%rbx)
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
callq 0x2230
movl 0xc(%rbx), %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
movslq %edx, %rcx
cqto
idivq %rcx
addl %r14d, %edx
movl %edx, 0x14(%rbx)
leaq 0x7bee(%rip), %rax      # 0x13270
movups (%rax), %xmm0
movups %xmm0, 0x20(%rbx)
movl %ebp, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/kernel.c
// Function: kernel_address
int
kernel_address(int ifindex, const char *ifname,
               const struct in6_addr *address, int plen,
               int add)
{
    char b[INET6_ADDRSTRLEN];
    char c[INET6_ADDRSTRLEN + 80];
    int rc;

    if(memcmp(address, v4prefix, 12) == 0) {
        inet_ntop(AF_INET, (char*)address + 12, b, sizeof(b));
        plen -= 96;
    } else {
        inet_ntop(AF_INET6, address, b, sizeof(b));
    }

    rc = snprintf(c, sizeof(c), "ip addr %s %s/%d dev %s",
                  add ? "add" : "del", b, plen, ifname);
    if(rc < 1 || rc >= sizeof(c)) {
        errno = ENOSPC;
        return -1;
    }

    rc = system(c);
    if(rc >= 0 && WIFEXITED(rc) && WEXITSTATUS(rc) == 0)
        return 1;

    return -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xc0, %rsp
movl %r8d, %ebp
movl %ecx, %ebx
movq %rsi, %r14
movl 0x8(%rdx), %eax
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
xorq %rax, %rcx
orq (%rdx), %rcx
je 0xb6d3
leaq 0x10(%rsp), %rax
movl $0xa, %edi
movq %rdx, %rsi
movq %rax, %rdx
movl $0x2e, %ecx
callq 0x2030
jmp 0xb6f4
addq $0xc, %rdx
leaq 0x10(%rsp), %rax
movl $0x2, %edi
movq %rdx, %rsi
movq %rax, %rdx
movl $0x2e, %ecx
callq 0x2030
addl $-0x60, %ebx
testl %ebp, %ebp
leaq 0x2c0f(%rip), %rax      # 0xe30c
leaq 0x2c04(%rip), %rcx      # 0xe308
cmoveq %rax, %rcx
movq %r14, (%rsp)
leaq 0x2bdd(%rip), %rdx      # 0xe2f0
xorl %ebp, %ebp
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %r8
movl $0x7e, %esi
movl %ebx, %r9d
xorl %eax, %eax
callq 0x2140
addl $-0x7e, %eax
cmpl $-0x7e, %eax
ja 0xb748
callq 0x2060
movl $0x1c, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xb75e
leaq 0x40(%rsp), %rdi
callq 0x2100
andl $0x8000ff7f, %eax       # imm = 0x8000FF7F
negl %eax
sbbl %ebp, %ebp
orl $0x1, %ebp
movl %ebp, %eax
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/kernel.c
// Function: kernel_router
int
kernel_router()
{
    char buf[100];
    int fd, rc;
    int router;

    fd = open("/proc/sys/net/ipv6/conf/all/forwarding", O_RDONLY);
    if(fd < 0)
        return -1;

    rc = read(fd, buf, 99);
    if(rc < 0) {
        close(fd);
        return -1;
    }
    close(fd);

    buf[rc] = '\0';

    router = atoi(buf);

    if(!router)
        return 0;

    rc = system("ip -6 route show | grep -q '^default '");
    return WIFEXITED(rc) && WEXITSTATUS(rc) == 1 ? 1 : 2;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
leaq 0x2a31(%rip), %rdi      # 0xe383
xorl %esi, %esi
xorl %eax, %eax
callq 0x22d0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0xb9bd
movl %eax, %ebp
movq %rsp, %rsi
movl $0x63, %edx
movl %eax, %edi
callq 0x21a0
movq %rax, %r14
movl %ebp, %edi
callq 0x2190
testl %r14d, %r14d
js 0xb9bd
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movb $0x0, (%rsp,%r14)
movq %rsp, %rdi
callq 0x2310
testl %eax, %eax
je 0xb9bb
leaq 0x2a07(%rip), %rdi      # 0xe3aa
callq 0x2100
andl $0xff7f, %eax           # imm = 0xFF7F
xorl %ebx, %ebx
cmpl $0x100, %eax            # imm = 0x100
setne %bl
incl %ebx
jmp 0xb9bd
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/util.c
// Function: read_random_bytes
int
read_random_bytes(void *buf, int len)
{
    int fd, rc;

    fd = open("/dev/urandom", O_RDONLY);
    if(fd < 0) {
        errno = ENOSYS;
        return -1;
    }

    rc = read(fd, buf, len);
    if(rc < len)
        rc = -1;

    close(fd);

    return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
leaq 0x29f6(%rip), %rdi      # 0xe3d1
xorl %esi, %esi
xorl %eax, %eax
callq 0x22d0
testl %eax, %eax
js 0xba0e
movl %eax, %ebx
movslq %ebp, %r15
movl %eax, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x21a0
cmpl %r15d, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmovgel %eax, %ebp
movl %ebx, %edi
callq 0x2190
jmp 0xba1e
callq 0x2060
movl $0x26, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/util.c
// Function: ts_compare
int
ts_compare(const struct timespec *s1, const struct timespec *s2)
{
    if(s1->tv_sec < s2->tv_sec)
        return -1;
    else if(s1->tv_sec > s2->tv_sec)
        return 1;
    else if(s1->tv_nsec < s2->tv_nsec)
        return -1;
    else if(s1->tv_nsec > s2->tv_nsec)
        return 1;
    else
        return 0;
}

// Assembly:
movq (%rsi), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rcx, (%rdi)
jl 0xba61
movl $0x1, %eax
jg 0xba61
movq 0x8(%rsi), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rcx, 0x8(%rdi)
jl 0xba61
setg %al
movzbl %al, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/util.c
// Function: ts_min
void
ts_min(struct timespec *d, const struct timespec *s)
{
    if(s->tv_sec == 0)
        return;

    if(d->tv_sec == 0 || ts_compare(d, s) > 0) {
        *d = *s;
    }
}

// Assembly:
movq (%rsi), %rax
testq %rax, %rax
je 0xba89
movq (%rdi), %rcx
testq %rcx, %rcx
je 0xba83
cmpq %rax, %rcx
jl 0xba89
jg 0xba83
movq 0x8(%rdi), %rax
cmpq 0x8(%rsi), %rax
jle 0xba89
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/util.c
// Function: ts_minus
void
ts_minus(struct timespec *d,
         const struct timespec *s1, const struct timespec *s2)
{
    if(s1->tv_nsec >= s2->tv_nsec) {
        d->tv_nsec = s1->tv_nsec - s2->tv_nsec;
        d->tv_sec = s1->tv_sec - s2->tv_sec;
    } else {
        d->tv_nsec = s1->tv_nsec + 1000000000 - s2->tv_nsec;
        d->tv_sec = s1->tv_sec - s2->tv_sec - 1;
    }
}

// Assembly:
movq 0x8(%rsi), %rax
subq 0x8(%rdx), %rax
jge 0xbaa9
addq $0x3b9aca00, %rax       # imm = 0x3B9ACA00
movq %rax, 0x8(%rdi)
movq (%rdx), %rax
notq %rax
addq (%rsi), %rax
jmp 0xbab3
movq %rax, 0x8(%rdi)
movq (%rsi), %rax
subq (%rdx), %rax
movq %rax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/util.c
// Function: ts_add_nsec
static void
ts_add_nsec(struct timespec *d, const struct timespec *s, long long nsecs)
{
    *d = *s;

    while(nsecs + d->tv_nsec > 1000000000) {
        d->tv_sec += 1;
        nsecs -= 1000000000LL;
    }

    while(nsecs + d->tv_nsec < 0) {
        d->tv_sec -= 1;
        nsecs += 1000000000LL;
    }

    d->tv_nsec += nsecs;
}

// Assembly:
movq %rdx, %rcx
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
movq 0x8(%rdi), %rsi
leaq (%rsi,%rdx), %rax
cmpq $0x3b9aca01, %rax       # imm = 0x3B9ACA01
jl 0xbb4d
leaq (%rsi,%rcx), %rax
addq $-0x3b9aca01, %rax      # imm = 0xC46535FF
shrq $0x9, %rax
movabsq $0x44b82fa09b5a53, %rdx # imm = 0x44B82FA09B5A53
mulq %rdx
shrq $0xb, %rdx
imulq $-0x3b9aca00, %rdx, %rax # imm = 0xC4653600
movq (%rdi), %r8
addq %r8, %rdx
incq %rdx
movq $-0x3b9aca00, %r8       # imm = 0xC4653600
addq %rcx, %r8
addq %rax, %r8
movq %rdx, (%rdi)
movq %r8, %rcx
movq %rcx, %rax
addq %rsi, %rax
jns 0xbbae
leaq (%rcx,%rsi), %r8
addq %rsi, %rcx
addq $0x3b9aca00, %rcx       # imm = 0x3B9ACA00
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
addq $-0x3b9aca00, %rax      # imm = 0xC4653600
xorl %ecx, %ecx
cmpq %r8, %rax
setne %cl
subq %r8, %rax
subq %rcx, %rax
shrq $0x9, %rax
movabsq $0x44b82fa09b5a53, %rdx # imm = 0x44B82FA09B5A53
mulq %rdx
shrq $0xb, %rdx
addq %rcx, %rdx
imulq $0x3b9aca00, %rdx, %rax # imm = 0x3B9ACA00
notq %rdx
addq %r8, %rax
addq $0x3b9aca00, %rax       # imm = 0x3B9ACA00
addq %rdx, (%rdi)
movq %rax, 0x8(%rdi)
retq