// File: /workspace/github_c_makefile_star2_O3/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, %r14d
movq %rdi, 0x10(%rsp)
leaq 0xddaf(%rip), %rdi      # 0x13280
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x49a3
movq %rax, 0x18(%rsp)
leaq 0xddc2(%rip), %r15      # 0x132a8
cmpl $0x0, (%r15)
jle 0x558f
xorl %r12d, %r12d
leaq 0xe996(%rip), %r13      # 0x13e90
xorl %ebx, %ebx
movq 0x10(%rsp), %r8
movslq %ebx, %rax
leaq 0xc(%rax), %rcx
cmpl %r14d, %ecx
jg 0x559e
movl $0xc000800, (%r8,%rax)  # imm = 0xC000800
movq %r12, %rdx
shlq $0x6, %rdx
movl 0x8(%r13,%rdx), %esi
movl %esi, 0x4(%r8,%rax)
movl 0xc(%r13,%rdx), %esi
bswapl %esi
movl %esi, 0x8(%r8,%rax)
movq (%r13,%rdx), %rdx
movl 0x8(%rdx), %edx
bswapl %edx
movl %edx, (%r8,%rcx)
leal 0x10(%rax), %ebp
testb $0x3, %al
je 0x5579
movslq %ebp, %rdi
addq %r8, %rdi
movl %ebx, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
orl $0x3, %ebx
addl $0x11, %ebx
incl %ebp
testb $0x3, %bpl
jne 0x556a
movq 0x10(%rsp), %r8
jmp 0x557b
movl %ebp, %ebx
incq %r12
movslq (%r15), %rax
cmpq %rax, %r12
jl 0x5501
movl %r12d, %eax
jmp 0x5596
xorl %eax, %eax
movq 0x10(%rsp), %r8
leal 0xb(%rbx), %ecx
cmpl %r14d, %ecx
jle 0x55b6
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, 0xc(%rsp)
movslq %ebx, %r14
movl $0xc002000, (%r8,%r14)  # imm = 0xC002000
movw $0x0, 0x4(%r8,%r14)
movb $0x0, 0x6(%r8,%r14)
shlq $0x6, %rax
leaq 0xe8b1(%rip), %rcx      # 0x13e90
movq (%rcx,%rax), %rdi
callq 0x7d6c
movq 0x10(%rsp), %r10
andb $0xf, %al
movb %al, 0x7(%r10,%r14)
movabsq $0x302f4450434e4853, %rax # imm = 0x302F4450434E4853
movq %rax, 0x8(%r10,%r14)
leal 0x10(%rbx), %r12d
testb $0x3, %bl
je 0x5643
movslq %r12d, %rdi
addq %r10, %rdi
movl %ebx, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
orl $0x3, %ebx
addl $0x11, %ebx
incl %r12d
testb $0x3, %r12b
jne 0x562b
movl %ebx, %r12d
movl 0xc(%rsp), %r14d
movq 0x10(%rsp), %r10
jmp 0x5648
movl 0xc(%rsp), %r14d
leaq 0xdc51(%rip), %rax      # 0x132a0
movl (%rax), %eax
testl %eax, %eax
jle 0x5842
leaq 0x8(%r10), %rcx
movq %rcx, 0x20(%rsp)
xorl %edx, %edx
leaq 0xdc45(%rip), %rsi      # 0x132b0
imulq $0x98, %rdx, %rdi
cmpl $0x0, 0x68(%rsi,%rdi)
jle 0x5833
movq %rdx, 0x30(%rsp)
addq %rsi, %rdi
xorl %ebp, %ebp
movq %rdi, 0x28(%rsp)
movq 0x60(%rdi), %rax
imulq $0x70, %rbp, %rcx
leaq (%rax,%rcx), %r15
cmpl $0x0, 0x38(%rax,%rcx)
je 0x5780
movzbl 0x2c(%rax,%rcx), %r13d
testb %r13b, %r13b
je 0x5d35
addl $0x7, %r13d
shrl $0x3, %r13d
leal (%r12,%r13), %ebx
addl $0xa, %ebx
cmpl %r14d, %ebx
jg 0x559e
leaq (%rax,%rcx), %rsi
addq $0x1c, %rsi
leal 0xa(%r12), %eax
movslq %r12d, %rcx
movw $0x2300, (%r10,%rcx)    # imm = 0x2300
movl %r13d, %edx
shll $0x8, %edx
addl $0x600, %edx            # imm = 0x600
movw %dx, 0x2(%r10,%rcx)
movl 0x8(%rdi), %edx
bswapl %edx
movl %edx, 0x4(%r10,%rcx)
movb 0x2e(%r15), %dl
andb $0xf, %dl
movb %dl, 0x8(%r10,%rcx)
movb 0x2c(%r15), %dl
movb %dl, 0x9(%r10,%rcx)
movslq %eax, %rdi
addq %r10, %rdi
movq %r13, %rdx
movq %r10, %r14
callq 0x2210
testb $0x3, %bl
je 0x5770
movslq %ebx, %rdi
addq %r14, %rdi
leal (%r12,%r13), %r14d
movl $0x1, %edx
subl %r14d, %edx
andl $0x3, %edx
incl %edx
xorl %esi, %esi
callq 0x2160
leal (%r12,%r13), %eax
addl $0xb, %eax
negb %al
movzbl %al, %eax
andl $0x3, %eax
leal (%rax,%r14), %r12d
addl $0xb, %r12d
incl %ebx
testb $0x3, %bl
jne 0x575d
movl 0xc(%rsp), %r14d
movq 0x10(%rsp), %r10
jmp 0x577b
movl %ebx, %r12d
movq %r14, %r10
movl 0xc(%rsp), %r14d
movq 0x28(%rsp), %rdi
cmpl $0x0, 0x60(%r15)
jne 0x579c
cmpl $0x0, 0x64(%r15)
jne 0x579c
cmpl $0x0, 0x68(%r15)
jne 0x579c
cmpl $0x0, 0x6c(%r15)
je 0x580e
leal 0x18(%r12), %ebx
cmpl %r14d, %ebx
jg 0x559e
addq $0x60, %r15
movslq %r12d, %rax
movl $0x14002400, (%r10,%rax) # imm = 0x14002400
movl 0x8(%rdi), %ecx
bswapl %ecx
movl %ecx, 0x4(%r10,%rax)
movups (%r15), %xmm0
movq 0x20(%rsp), %rcx
movups %xmm0, (%rcx,%rax)
testb $0x3, %r12b
je 0x580b
movslq %ebx, %rdi
addq %r10, %rdi
movl %r12d, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
orl $0x3, %r12d
addl $0x19, %r12d
incl %ebx
testb $0x3, %bl
jne 0x57f8
movq 0x10(%rsp), %r10
movq 0x28(%rsp), %rdi
jmp 0x580e
movl %ebx, %r12d
incq %rbp
movslq 0x68(%rdi), %rax
cmpq %rax, %rbp
jl 0x568c
leaq 0xda7b(%rip), %rax      # 0x132a0
movl (%rax), %eax
movq 0x30(%rsp), %rdx
leaq 0xda7d(%rip), %rsi      # 0x132b0
incq %rdx
movslq %eax, %rcx
cmpq %rcx, %rdx
jl 0x566b
movq 0x18(%rsp), %rax
movl 0x68(%rax), %ecx
testl %ecx, %ecx
jle 0x55a4
movq 0x60(%rax), %rax
xorl %ebp, %ebp
xorl %r13d, %r13d
movl $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq %r12, 0x30(%rsp)
movq (%rax,%rbp,8), %rdx
movq (%rdx), %rsi
testq %rsi, %rsi
je 0x58b6
movswq 0x8(%rsi), %r8
testq %r8, %r8
jle 0x58b6
movq (%rsi), %rsi
leaq (%r8,%r8,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %r8, %rdi
xorl %r8d, %r8d
movzbl 0x10(%rsi,%r8), %r9d
addl $0x7, %r9d
shrl $0x3, %r9d
addl %r9d, %r13d
addl $0xd, %r13d
addq $0x1c, %r8
cmpq %r8, %rdi
jne 0x5898
cmpq $0x0, 0x8(%rdx)
je 0x5939
movq (%rax,%rbp,8), %rdx
movq 0x8(%rdx), %rdx
cmpw $0x0, 0x8(%rdx)
jle 0x5939
xorl %r14d, %r14d
xorl %r15d, %r15d
movl 0x28(%rsp), %ebx
movq 0x20(%rsp), %r12
movq (%rdx), %rdi
addq %r14, %rdi
callq 0x99f6
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, %eax
sete %cl
setne %dl
addl %edx, %r12d
addl %ecx, %ebx
incq %r15
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbp,8), %rcx
movq 0x8(%rcx), %rdx
movswq 0x8(%rdx), %rcx
addq $0x1c, %r14
cmpq %rcx, %r15
jl 0x58db
movq %r12, 0x20(%rsp)
movl %ebx, 0x28(%rsp)
movq 0x18(%rsp), %rcx
movl 0x68(%rcx), %ecx
movl 0xc(%rsp), %r14d
movq 0x10(%rsp), %r10
movq 0x30(%rsp), %r12
incq %rbp
movslq %ecx, %rdx
cmpq %rdx, %rbp
jl 0x5871
testl %ecx, %ecx
jle 0x55a4
xorl %ebx, %ebx
movq 0x20(%rsp), %rsi
testl %esi, %esi
leal 0x6(,%rsi,4), %eax
cmovlel %ebx, %eax
movl 0x28(%rsp), %edx
movl %edx, %ebp
shll $0x4, %ebp
leal 0x8(%rbp), %ecx
testl %edx, %edx
cmovlel %ebx, %ecx
leal (,%rsi,4), %edx
movl %edx, 0x3c(%rsp)
movl %r13d, %edx
negl %edx
andl $0x3, %edx
addl %r13d, %edx
addl %eax, %edx
negl %eax
andl $0x2, %eax
addl %ecx, %edx
addl %eax, %edx
rolw $0x8, %dx
movl %edx, 0x44(%rsp)
movl %ebp, %eax
orl $0x4, %eax
rolw $0x8, %ax
movl %eax, 0x40(%rsp)
leal 0xc(%rbp), %eax
movq %rax, 0x50(%rsp)
rolw $0x8, %bp
leal 0xa(,%rsi,4), %eax
movq %rax, 0x48(%rsp)
leal 0x2(,%rsi,4), %eax
rolw $0x8, %ax
movl %eax, 0x38(%rsp)
leal 0x4(%r12), %r13d
cmpl %r14d, %r13d
jg 0x559e
movslq %r12d, %rax
movw $0x2100, (%r10,%rax)    # imm = 0x2100
movl 0x44(%rsp), %ecx
movw %cx, 0x2(%r10,%rax)
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbx,8), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x5b27
cmpw $0x0, 0x8(%rax)
jle 0x5b27
xorl %r15d, %r15d
movq (%rax), %r12
leaq (%r15,%r15,8), %rax
leaq (%rax,%rax,2), %rax
addq %r15, %rax
movzbl 0x10(%r12,%rax), %ecx
addl $0x7, %ecx
shrl $0x3, %ecx
addl %r13d, %ecx
addl $0x11, %ecx
cmpl %r14d, %ecx
jg 0x559e
addq %rax, %r12
movslq %r13d, %rax
leaq (%r10,%rax), %rdi
addq $0xd, %rdi
movw $0x2200, -0xd(%rdi)     # imm = 0x2200
movzbl 0x10(%r12), %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)
movzbl 0x10(%r12), %edx
movb %dl, -0x1(%rdi)
addl $0x7, %edx
shrl $0x3, %edx
movq %r12, %rsi
callq 0x2210
movzbl 0x10(%r12), %r14d
addl $0x7, %r14d
shrl $0x3, %r14d
leal (%r14,%r13), %r12d
addl $0xd, %r12d
testb $0x3, %r12b
je 0x5af7
movslq %r12d, %rdi
addq 0x10(%rsp), %rdi
movl %r13d, %edx
xorl $0x1, %edx
subl %r14d, %edx
incl %edx
andl $0x3, %edx
incl %edx
xorl %esi, %esi
callq 0x2160
leal (%r14,%r13), %eax
leal (%r14,%r13), %ecx
addl $0xe, %ecx
negb %cl
movzbl %cl, %ecx
andl $0x3, %ecx
addl %ecx, %eax
addl $0xe, %eax
incl %r12d
testb $0x3, %r12b
jne 0x5aeb
movl %eax, %r12d
movl 0xc(%rsp), %r14d
movq 0x10(%rsp), %r10
incq %r15
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbx,8), %rax
movq (%rax), %rax
movswq 0x8(%rax), %rcx
movl %r12d, %r13d
cmpq %rcx, %r15
jl 0x5a1a
jmp 0x5b2a
movl %r13d, %r12d
cmpl $0x0, 0x28(%rsp)
jle 0x5c25
movq 0x50(%rsp), %rax
addl %r12d, %eax
cmpl %r14d, %eax
jg 0x559e
movslq %r12d, %r12
movw $0x2500, (%r10,%r12)    # imm = 0x2500
movl 0x40(%rsp), %eax
movw %ax, 0x2(%r10,%r12)
movw $0x1700, 0x4(%r10,%r12) # imm = 0x1700
movw %bp, 0x6(%r10,%r12)
addl $0x8, %r12d
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
cmpw $0x0, 0x8(%rax)
jle 0x5bdb
xorl %r15d, %r15d
xorl %r14d, %r14d
movq (%rax), %r13
addq %r15, %r13
movq %r13, %rdi
callq 0x99f6
testl %eax, %eax
je 0x5ba3
movq 0x10(%rsp), %r10
jmp 0x5bb9
movslq %r12d, %r12
movups (%r13), %xmm0
movq 0x10(%rsp), %r10
movups %xmm0, (%r10,%r12)
addl $0x10, %r12d
movq 0x18(%rsp), %rax
incq %r14
movq 0x60(%rax), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
movswq 0x8(%rax), %rcx
addq $0x1c, %r15
cmpq %rcx, %r14
jl 0x5b8a
testb $0x3, %r12b
je 0x5c20
movslq %r12d, %rdi
addq %r10, %rdi
movl %r12d, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
movl %r12d, %eax
orl $0x3, %eax
incl %eax
movl 0xc(%rsp), %r14d
movq 0x20(%rsp), %rcx
incl %r12d
testb $0x3, %r12b
jne 0x5c0d
movl %eax, %r12d
movq 0x10(%rsp), %r10
jmp 0x5c2a
movl 0xc(%rsp), %r14d
movq 0x20(%rsp), %rcx
testl %ecx, %ecx
jle 0x5d1b
movq 0x48(%rsp), %rax
addl %r12d, %eax
cmpl %r14d, %eax
jg 0x559e
movslq %r12d, %r12
movw $0x2600, (%r10,%r12)    # imm = 0x2600
movl 0x38(%rsp), %eax
movw %ax, 0x2(%r10,%r12)
movb $0x6, 0x4(%r10,%r12)
movl 0x3c(%rsp), %eax
movb %al, 0x5(%r10,%r12)
addl $0x6, %r12d
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
cmpw $0x0, 0x8(%rax)
jle 0x5cd6
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rax), %r13
leaq (%r14,%r13), %rdi
callq 0x99f6
testl %eax, %eax
je 0x5caf
movslq %r12d, %r12
movl 0xc(%r13,%r14), %eax
movq 0x10(%rsp), %r10
movl %eax, (%r10,%r12)
addl $0x4, %r12d
jmp 0x5cb4
movq 0x10(%rsp), %r10
incq %r15
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
movswq 0x8(%rax), %rcx
addq $0x1c, %r14
cmpq %rcx, %r15
jl 0x5c88
testb $0x3, %r12b
je 0x5d16
movslq %r12d, %rdi
addq %r10, %rdi
movl %r12d, %eax
andl $0x3, %eax
movl $0x4, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x2160
movl %r12d, %eax
orl $0x3, %eax
incl %eax
movl 0xc(%rsp), %r14d
incl %r12d
testb $0x3, %r12b
jne 0x5d03
movl %eax, %r12d
movq 0x10(%rsp), %r10
jmp 0x5d1b
movl 0xc(%rsp), %r14d
incq %rbx
movq 0x18(%rsp), %rax
movslq 0x68(%rax), %rax
cmpq %rax, %rbx
jl 0x59d1
jmp 0x55a4
leaq 0x7a54(%rip), %rdi      # 0xd790
leaq 0x79bc(%rip), %rsi      # 0xd6ff
leaq 0x7a5c(%rip), %rcx      # 0xd7a6
movl $0xdc, %edx
callq 0x2150