// File: /workspace/github_c_makefile_star2_O1/jech[P]shncpd/send.c
// Function: format_my_state
int
format_my_state(unsigned char *buf, int buflen)
{
    int i = 0, j, k;
    struct node *node = find_node(myid, 0);
    int dlen, n_dns6, dns6_len, n_dns4, dns4_len;

    MEM_UNDEFINED(buf, buflen);

    for(j = 0; j < numneighs; j++) {
        CHECK(12);
        SHORT(8);
        SHORT(12);
        BYTES(neighs[j].id, 4);
        LONG(neighs[j].eid);
        LONG(neighs[j].interface->ifindex);
        PAD();
    }

    CHECK(11);
    SHORT(32);
    SHORT(12);
    SHORT(0);
    BYTE(0);
    BYTE(interface_dhcpv4_prio(neighs[j].interface) & 0x0F);

    BYTES("SHNCPD/0", 8);
    PAD();

    for(j = 0; j < numinterfaces; j++) {
        for(k = 0; k < interfaces[j].numassigned; k++) {
            const struct assigned_prefix *aa = &interfaces[j].assigned[k];
            int pbytes = (aa->assigned.plen + 7) / 8;
            if(aa->published) {
                assert(aa->assigned.plen > 0);
                CHECK(10 + pbytes);
                SHORT(35);
                SHORT(6 + pbytes);
                LONG(interfaces[j].ifindex);
                BYTE((aa->assigned.prio & 0x0F));
                BYTE(aa->assigned.plen);
                BYTES(&aa->assigned.p, pbytes);
                PAD();
            }
            if(!IN6_IS_ADDR_UNSPECIFIED(&aa->assigned_address)) {
                CHECK(24);
                SHORT(36);
                SHORT(20);
                LONG(interfaces[j].ifindex);
                BYTES(&aa->assigned_address, 16);
                PAD();
            }
        }
    }

    dlen = n_dns6 = n_dns4 = 0;
    for(j = 0; j < node->numexts; j++) {
        if(node->exts[j]->delegated) {
            for(k = 0; k < node->exts[j]->delegated->numprefixes; k++) {
                struct prefix *p = &node->exts[j]->delegated->prefixes[k];
                dlen += 4 + 9 + (p->plen + 7) / 8;
            }
        }
        if(node->exts[j]->dns) {
            for(k = 0; k < node->exts[j]->dns->numprefixes; k++) {
                struct prefix *p = &node->exts[j]->dns->prefixes[k];
                if(!prefix_v4(p))
                    n_dns6++;
                else
                    n_dns4++;
            }
        }
    }

    dns6_len = n_dns6 > 0 ? 4 + 4 + 16 * n_dns6 : 0;
    dns4_len = n_dns4 > 0 ? 4 + 2 + 4 * n_dns4 : 0;

    for(j = 0; j < node->numexts; j++) {
        CHECK(4);
        SHORT(33);
        SHORT(dlen + (-dlen & 3) +
              dns6_len + (-dns6_len & 3) +
              dns4_len + (-dns4_len & 3));
        if(node->exts[j]->delegated) {
            for(k = 0; k < node->exts[j]->delegated->numprefixes; k++) {
                struct prefix *p = &node->exts[j]->delegated->prefixes[k];
                CHECK(4 + 9 + (p->plen + 7) / 8 + 4);
                SHORT(34);
                SHORT(9 + (p->plen + 7) / 8);
                LONG(3600);
                LONG(1800);
                BYTE(p->plen);
                BYTES(&p->p, (p->plen + 7) / 8);
                PAD();
            }
        }
        if(n_dns6 > 0) {
            CHECK(4 + 4 + 16 * n_dns6 + 4);
            SHORT(37);
            SHORT(4 + 16 * n_dns6);
            SHORT(23);
            SHORT(16 * n_dns6);
            for(k = 0; k < node->exts[j]->dns->numprefixes; k++) {
                struct prefix *p = &node->exts[j]->dns->prefixes[k];
                if(!prefix_v4(p)) {
                    BYTES(&p->p, 16);
                }
            }
            PAD();
        }
        if(n_dns4 > 0) {
            CHECK(4 + 2 + 4 * n_dns4 + 4);
            SHORT(38);
            SHORT(2 + 4 * n_dns4);
            BYTE(6);
            BYTE(4 * n_dns4);
            for(k = 0; k < node->exts[j]->dns->numprefixes; k++) {
                struct prefix *p = &node->exts[j]->dns->prefixes[k];
                if(prefix_v4(p)) {
                    BYTES((char*)&p->p + 12, 4);
                }
            }
            PAD();
        }
    }

    return i;

 fail:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, 0x4(%rsp)
movq %rdi, %rbp
leaq 0xdb94(%rip), %rdi      # 0x13280
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x4b4e
leaq 0xdbac(%rip), %r15      # 0x132a8
cmpl $0x0, (%r15)
movq %rax, 0x18(%rsp)
jle 0x57b0
xorl %r12d, %r12d
leaq 0xe77b(%rip), %r13      # 0x13e90
xorl %ebx, %ebx
movslq %ebx, %rax
leaq 0xc(%rax), %rcx
cmpl 0x4(%rsp), %ecx
jg 0x57be
movl $0xc000800, (%rbp,%rax) # imm = 0xC000800
movq %r12, %rdx
shlq $0x6, %rdx
movl 0x8(%r13,%rdx), %esi
movl %esi, 0x4(%rbp,%rax)
movl 0xc(%r13,%rdx), %esi
bswapl %esi
movl %esi, 0x8(%rbp,%rax)
movq (%r13,%rdx), %rdx
movl 0x8(%rdx), %edx
bswapl %edx
movl %edx, (%rbp,%rcx)
leal 0x10(%rax), %ecx
testb $0x3, %al
je 0x5795
movslq %ecx, %r14
leaq (%r14,%rbp), %rdi
movl %ebx, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
movl %r14d, %eax
incq %rax
orl $0x3, %ebx
addl $0x11, %ebx
movq %rax, %rcx
incq %rcx
testb $0x3, %al
movq %rcx, %rax
jne 0x5789
jmp 0x5797
movl %ecx, %ebx
incq %r12
movslq (%r15), %rax
cmpq %rax, %r12
jl 0x5717
movl %r12d, %eax
movq 0x18(%rsp), %r13
jmp 0x57b5
movq %rax, %r13
xorl %eax, %eax
leal 0xb(%rbx), %ecx
cmpl 0x4(%rsp), %ecx
jle 0x57d6
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %ebx, %r14
movl $0xc002000, (%rbp,%r14) # imm = 0xC002000
movw $0x0, 0x4(%rbp,%r14)
movb $0x0, 0x6(%rbp,%r14)
shlq $0x6, %rax
leaq 0xe695(%rip), %rcx      # 0x13e90
movq (%rcx,%rax), %rdi
callq 0x8180
andb $0xf, %al
movb %al, 0x7(%rbp,%r14)
movabsq $0x302f4450434e4853, %rax # imm = 0x302F4450434E4853
movq %rax, 0x8(%rbp,%r14)
leal 0x10(%rbx), %esi
testb $0x3, %bl
je 0x5857
movslq %esi, %r14
leaq (%r14,%rbp), %rdi
movl %ebx, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
movl %r14d, %eax
incq %rax
orl $0x3, %ebx
movl %ebx, %esi
addl $0x11, %esi
movq %rax, %rcx
incq %rcx
testb $0x3, %al
movq %rcx, %rax
jne 0x584d
leaq 0xda42(%rip), %rax      # 0x132a0
cmpl $0x0, (%rax)
movq %rbp, 0x10(%rsp)
jle 0x5a67
leaq 0x8(%rbp), %rax
movq %rax, 0x20(%rsp)
xorl %ecx, %ecx
leaq 0xda32(%rip), %rax      # 0x132b0
movq %rcx, 0x8(%rsp)
imulq $0x98, %rcx, %rbp
cmpl $0x0, 0x68(%rax,%rbp)
jle 0x5a45
addq %rax, %rbp
xorl %ebx, %ebx
movq 0x60(%rbp), %rax
imulq $0x70, %rbx, %rcx
leaq (%rax,%rcx), %r15
cmpl $0x0, 0x38(%rax,%rcx)
je 0x5986
movzbl 0x2c(%rax,%rcx), %r12d
testb %r12b, %r12b
je 0x5f87
addl $0x7, %r12d
shrl $0x3, %r12d
leal (%rsi,%r12), %edx
addl $0xa, %edx
cmpl 0x4(%rsp), %edx
jg 0x59b1
movq %rsi, %r14
leaq (%rax,%rcx), %rsi
addq $0x1c, %rsi
movslq %r14d, %rax
movq 0x10(%rsp), %r13
leaq (%rax,%r13), %rdi
addq $0xa, %rdi
movw $0x2300, -0xa(%rdi)     # imm = 0x2300
movl %r12d, %eax
shll $0x8, %eax
addl $0x600, %eax            # imm = 0x600
movw %ax, -0x8(%rdi)
movl 0x8(%rbp), %eax
bswapl %eax
movl %eax, -0x6(%rdi)
movb 0x2e(%r15), %al
andb $0xf, %al
movb %al, -0x2(%rdi)
movb 0x2c(%r15), %al
movb %al, -0x1(%rdi)
movq %r12, %rdx
callq 0x2210
movq %r14, %rax
addl %r12d, %r14d
addl $0xa, %r14d
testb $0x3, %r14b
je 0x597e
movslq %r14d, %rdi
addq %r13, %rdi
addl %r12d, %eax
movl $0x1, %edx
subl %eax, %edx
andl $0x3, %edx
incl %edx
movq %rax, %r12
xorl %esi, %esi
callq 0x2160
movl %r14d, %eax
incq %rax
notb %r14b
movzbl %r14b, %ecx
andl $0x3, %ecx
leal (%rcx,%r12), %esi
addl $0xb, %esi
movq %rax, %rcx
incq %rcx
testb $0x3, %al
movq %rcx, %rax
jne 0x5972
jmp 0x5981
movl %r14d, %esi
movq 0x18(%rsp), %r13
cmpl $0x0, 0x60(%r15)
jne 0x59a6
cmpl $0x0, 0x64(%r15)
jne 0x59a6
cmpl $0x0, 0x68(%r15)
jne 0x59a6
cmpl $0x0, 0x6c(%r15)
je 0x5a40
leal 0x18(%rsi), %r14d
cmpl 0x4(%rsp), %r14d
jle 0x59b6
xorl %r15d, %r15d
jmp 0x5a25
addq $0x60, %r15
movslq %esi, %rax
movq 0x10(%rsp), %rdx
movl $0x14002400, (%rdx,%rax) # imm = 0x14002400
movl 0x8(%rbp), %ecx
bswapl %ecx
movl %ecx, 0x4(%rdx,%rax)
movups (%r15), %xmm0
movq 0x20(%rsp), %rcx
movups %xmm0, (%rcx,%rax)
movb $0x1, %r15b
testb $0x3, %sil
je 0x5a22
movslq %r14d, %rdi
addq %rdx, %rdi
movl %esi, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
movq %rsi, %r12
xorl %esi, %esi
callq 0x2160
movq %r12, %rsi
movl %r14d, %eax
incq %rax
orl $0x3, %esi
addl $0x19, %esi
movq %rax, %rcx
incq %rcx
testb $0x3, %al
movq %rcx, %rax
jne 0x5a16
jmp 0x5a25
movl %r14d, %esi
testb %r15b, %r15b
je 0x57be
incq %rbx
movslq 0x68(%rbp), %rax
cmpq %rax, %rbx
jl 0x589a
jmp 0x5a45
movb $0x1, %r15b
jmp 0x5a25
movq 0x8(%rsp), %rcx
incq %rcx
leaq 0xd84c(%rip), %rax      # 0x132a0
movslq (%rax), %rax
cmpq %rax, %rcx
leaq 0xd84f(%rip), %rax      # 0x132b0
jl 0x587e
movq %rsi, 0x28(%rsp)
cmpl $0x0, 0x68(%r13)
jle 0x5b67
xorl %ebp, %ebp
xorl %r12d, %r12d
movl $0x0, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x60(%r13), %rax
movq (%rax,%rbp,8), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x5ad2
movswq 0x8(%rcx), %rsi
testq %rsi, %rsi
jle 0x5ad2
movq (%rcx), %rcx
leaq (%rsi,%rsi,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rsi, %rdx
xorl %esi, %esi
movzbl 0x10(%rcx,%rsi), %edi
addl $0x7, %edi
shrl $0x3, %edi
addl %edi, %r12d
addl $0xd, %r12d
addq $0x1c, %rsi
cmpq %rsi, %rdx
jne 0x5ab7
cmpq $0x0, 0x8(%rax)
je 0x5b3c
movq 0x60(%r13), %rax
movq (%rax,%rbp,8), %rax
movq 0x8(%rax), %rax
cmpw $0x0, 0x8(%rax)
jle 0x5b3c
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x8(%rsp), %rbx
movl 0x20(%rsp), %r15d
movq (%rax), %rdi
addq %r14, %rdi
callq 0x9ef3
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, %eax
sete %cl
setne %dl
addl %edx, %ebx
addl %ecx, %r15d
incq %r13
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbp,8), %rax
movq 0x8(%rax), %rax
movswq 0x8(%rax), %rcx
addq $0x1c, %r14
cmpq %rcx, %r13
jl 0x5afc
jmp 0x5b46
movq 0x8(%rsp), %rbx
movl 0x20(%rsp), %r15d
movl %r15d, 0x20(%rsp)
movq %rbx, 0x8(%rsp)
incq %rbp
movq 0x18(%rsp), %r13
movslq 0x68(%r13), %rax
cmpq %rax, %rbp
jl 0x5a8d
jmp 0x5b7b
movq $0x0, 0x8(%rsp)
movl $0x0, 0x20(%rsp)
xorl %r12d, %r12d
cmpl $0x0, 0x68(%r13)
jle 0x5f7d
xorl %ebx, %ebx
movq 0x8(%rsp), %rdx
testl %edx, %edx
leal 0x6(,%rdx,4), %eax
cmovlel %ebx, %eax
movl 0x20(%rsp), %esi
movl %esi, %edi
shll $0x4, %edi
leal 0x8(%rdi), %ecx
testl %esi, %esi
cmovlel %ebx, %ecx
leal (,%rdx,4), %esi
movl %esi, 0x34(%rsp)
movl %r12d, %esi
negl %esi
andl $0x3, %esi
addl %r12d, %esi
addl %eax, %esi
negl %eax
andl $0x2, %eax
addl %ecx, %esi
addl %eax, %esi
rolw $0x8, %si
movl %esi, 0x3c(%rsp)
movl %edi, %eax
orl $0x4, %eax
rolw $0x8, %ax
movl %eax, 0x38(%rsp)
leal 0xc(%rdi), %eax
movq %rax, 0x50(%rsp)
rolw $0x8, %di
movq %rdi, 0x40(%rsp)
leal 0xa(,%rdx,4), %eax
movq %rax, 0x48(%rsp)
leal 0x2(,%rdx,4), %eax
rolw $0x8, %ax
movl %eax, 0x30(%rsp)
movq 0x28(%rsp), %rcx
leal 0x4(%rcx), %r12d
cmpl 0x4(%rsp), %r12d
jg 0x57be
movslq %ecx, %rax
movq 0x10(%rsp), %rcx
movw $0x2100, (%rcx,%rax)    # imm = 0x2100
movl 0x3c(%rsp), %edx
movw %dx, 0x2(%rcx,%rax)
movq 0x60(%r13), %rax
movq (%rax,%rbx,8), %rax
cmpq $0x0, (%rax)
je 0x5d8b
movq 0x60(%r13), %rax
movq (%rax,%rbx,8), %rax
movq (%rax), %rax
cmpw $0x0, 0x8(%rax)
jle 0x5d8b
xorl %r15d, %r15d
movq %rbx, 0x28(%rsp)
movq (%rax), %r13
leaq (%r15,%r15,8), %rax
leaq (%rax,%rax,2), %rax
addq %r15, %rax
movzbl 0x10(%r13,%rax), %ecx
addl $0x7, %ecx
shrl $0x3, %ecx
leal (%r12,%rcx), %ebp
addl $0x11, %ebp
cmpl 0x4(%rsp), %ebp
jle 0x5c98
movq 0x18(%rsp), %r13
jmp 0x5d65
addq %rax, %r13
movslq %r12d, %rax
movq 0x10(%rsp), %rcx
movq %rcx, %rbx
leaq (%rcx,%rax), %rdi
addq $0xd, %rdi
movw $0x2200, -0xd(%rdi)     # imm = 0x2200
movzbl 0x10(%r13), %eax
shll $0x5, %eax
addl $0xe0, %eax
andl $0x3f00, %eax           # imm = 0x3F00
addl $0x900, %eax            # imm = 0x900
movw %ax, -0xb(%rdi)
movabsq $0x8070000100e0000, %rax # imm = 0x8070000100E0000
movq %rax, -0x9(%rdi)
movb 0x10(%r13), %al
movb %al, -0x1(%rdi)
movzbl 0x10(%r13), %edx
addl $0x7, %edx
shrl $0x3, %edx
movq %r13, %rsi
callq 0x2210
movzbl 0x10(%r13), %r14d
addl $0x7, %r14d
shrl $0x3, %r14d
leal (%r12,%r14), %r13d
addl $0xd, %r13d
testb $0x3, %r13b
je 0x5d58
movslq %r13d, %rdi
addq %rbx, %rdi
movl %r12d, %edx
xorl $0x1, %edx
subl %r14d, %edx
incl %edx
andl $0x3, %edx
incl %edx
xorl %esi, %esi
callq 0x2160
movl %r13d, %eax
incq %rax
addl %r14d, %r12d
notb %r13b
movzbl %r13b, %ecx
andl $0x3, %ecx
addl %ecx, %r12d
addl $0xe, %r12d
movq %rax, %rcx
incq %rcx
testb $0x3, %al
movq %rcx, %rax
jne 0x5d4c
jmp 0x5d5b
movl %r13d, %r12d
movq 0x18(%rsp), %r13
movq 0x28(%rsp), %rbx
cmpl 0x4(%rsp), %ebp
jg 0x57be
incq %r15
movq 0x60(%r13), %rax
movq (%rax,%rbx,8), %rax
movq (%rax), %rax
movswq 0x8(%rax), %rcx
cmpq %rcx, %r15
jl 0x5c67
cmpl $0x0, 0x20(%rsp)
jle 0x5e7e
movq 0x50(%rsp), %rax
addl %r12d, %eax
cmpl 0x4(%rsp), %eax
jg 0x57be
movslq %r12d, %r12
movq 0x10(%rsp), %rax
movw $0x2500, (%rax,%r12)    # imm = 0x2500
movl 0x38(%rsp), %ecx
movw %cx, 0x2(%rax,%r12)
movw $0x1700, 0x4(%rax,%r12) # imm = 0x1700
movq 0x40(%rsp), %rcx
movw %cx, 0x6(%rax,%r12)
addl $0x8, %r12d
movq 0x60(%r13), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
cmpw $0x0, 0x8(%rax)
jle 0x5e3b
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rax), %r13
addq %r14, %r13
movq %r13, %rdi
callq 0x9ef3
testl %eax, %eax
jne 0x5e19
movslq %r12d, %r12
movups (%r13), %xmm0
movq 0x10(%rsp), %rax
movups %xmm0, (%rax,%r12)
addl $0x10, %r12d
incq %r15
movq 0x18(%rsp), %r13
movq 0x60(%r13), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
movswq 0x8(%rax), %rcx
addq $0x1c, %r14
cmpq %rcx, %r15
jl 0x5df1
testb $0x3, %r12b
je 0x5e7e
movslq %r12d, %rdi
addq 0x10(%rsp), %rdi
movl %r12d, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
movl %r12d, %eax
incq %rax
orl $0x3, %r12d
incl %r12d
movq %rax, %rcx
movq 0x8(%rsp), %rdx
incq %rcx
testb $0x3, %al
movq %rcx, %rax
jne 0x5e72
jmp 0x5e83
movq 0x8(%rsp), %rdx
testl %edx, %edx
jle 0x5f65
movq 0x48(%rsp), %rax
addl %r12d, %eax
cmpl 0x4(%rsp), %eax
jg 0x57be
movslq %r12d, %r12
movq 0x10(%rsp), %rax
movw $0x2600, (%rax,%r12)    # imm = 0x2600
movl 0x30(%rsp), %ecx
movw %cx, 0x2(%rax,%r12)
movb $0x6, 0x4(%rax,%r12)
movl 0x34(%rsp), %ecx
movb %cl, 0x5(%rax,%r12)
addl $0x6, %r12d
movq 0x60(%r13), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
cmpw $0x0, 0x8(%rax)
jle 0x5f29
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rax), %r13
leaq (%r14,%r13), %rdi
callq 0x9ef3
testl %eax, %eax
je 0x5f07
movslq %r12d, %r12
movl 0xc(%r13,%r14), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx,%r12)
addl $0x4, %r12d
incq %r15
movq 0x18(%rsp), %r13
movq 0x60(%r13), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
movswq 0x8(%rax), %rcx
addq $0x1c, %r14
cmpq %rcx, %r15
jl 0x5ee2
testb $0x3, %r12b
je 0x5f65
movslq %r12d, %rdi
addq 0x10(%rsp), %rdi
movl %r12d, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
movl %r12d, %eax
incq %rax
orl $0x3, %r12d
incl %r12d
movq %rax, %rcx
incq %rcx
testb $0x3, %al
movq %rcx, %rax
jne 0x5f5b
incq %rbx
movslq 0x68(%r13), %rax
movl %r12d, %ecx
cmpq %rax, %rbx
jl 0x5c11
jmp 0x57c4
movq 0x28(%rsp), %r12
jmp 0x57c4
leaq 0x7802(%rip), %rdi      # 0xd790
leaq 0x776a(%rip), %rsi      # 0xd6ff
leaq 0x780a(%rip), %rcx      # 0xd7a6
movl $0xdc, %edx
callq 0x2150
nop