// File: /workspace/github_c_makefile_star2_O2/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, %ebp
movq %rdi, %r14
leaq 0xc9af(%rip), %rdi      # 0x11280
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x3d24
movq %rax, 0x10(%rsp)
leaq 0x8(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0xc9b9(%rip), %rcx      # 0x112a8
pushq $-0x1
popq %r13
leaq 0xd596(%rip), %rax      # 0x11e90
xorl %r12d, %r12d
movslq (%rcx), %rdx
movslq %r12d, %r15
cmpq %rdx, %rbx
jge 0x4960
leaq 0xc(%r15), %rdx
cmpl %ebp, %edx
jg 0x4f42
movl $0xc000800, (%r14,%r15) # imm = 0xC000800
movq %rbx, %rsi
shlq $0x6, %rsi
movl 0x8(%rax,%rsi), %edi
movl %edi, 0x4(%r14,%r15)
movl 0xc(%rax,%rsi), %edi
bswapl %edi
movl %edi, 0x8(%r14,%r15)
movq (%rax,%rsi), %rsi
movl 0x8(%rsi), %esi
bswapl %esi
movl %esi, (%r14,%rdx)
addl $0x10, %r12d
movslq %r12d, %r12
testb $0x3, %r12b
je 0x495b
movb $0x0, (%r14,%r12)
incq %r12
jmp 0x494b
incq %rbx
jmp 0x48fd
leal 0xb(%r12), %ecx
cmpl %ebp, %ecx
jg 0x4f42
movl $0xc002000, (%r14,%r15) # imm = 0xC002000
andw $0x0, 0x4(%r14,%r15)
movb $0x0, 0x6(%r14,%r15)
movl %ebx, %ecx
shlq $0x6, %rcx
movq (%rax,%rcx), %rdi
callq 0x708d
andb $0xf, %al
movb %al, 0x7(%r14,%r15)
movabsq $0x302f4450434e4853, %rax # imm = 0x302F4450434E4853
movq %rax, 0x8(%r14,%r15)
addl $0x10, %r12d
movslq %r12d, %rax
addq %r14, %rax
testb $0x3, %r12b
je 0x49c2
movb $0x0, (%rax)
incq %rax
incl %r12d
jmp 0x49b1
xorl %ecx, %ecx
leaq 0xc8d5(%rip), %rax      # 0x112a0
leaq 0xc8de(%rip), %rdx      # 0x112b0
movl %ebp, 0xc(%rsp)
movslq (%rax), %rax
cmpq %rax, %rcx
jge 0x4b32
movq %rcx, 0x20(%rsp)
imulq $0x98, %rcx, %r13
addq %rdx, %r13
xorl %r15d, %r15d
movslq 0x68(%r13), %rax
cmpq %rax, %r15
jge 0x4b13
movq 0x60(%r13), %rax
imulq $0x70, %r15, %rcx
leaq (%rax,%rcx), %rbx
cmpl $0x0, 0x38(%rax,%rcx)
je 0x4aa9
movzbl 0x2c(%rax,%rcx), %edx
testb %dl, %dl
je 0x4f59
addl $0x7, %edx
shrl $0x3, %edx
leal (%r12,%rdx), %ebp
addl $0xa, %ebp
cmpl 0xc(%rsp), %ebp
jg 0x4f3e
leaq (%rax,%rcx), %rsi
addq $0x1c, %rsi
movslq %r12d, %rax
addl $0xa, %r12d
movw $0x2300, (%r14,%rax)    # imm = 0x2300
movl %edx, %ecx
shll $0x8, %ecx
addl $0x600, %ecx            # imm = 0x600
movw %cx, 0x2(%r14,%rax)
movl 0x8(%r13), %ecx
bswapl %ecx
movl %ecx, 0x4(%r14,%rax)
movb 0x2e(%rbx), %cl
andb $0xf, %cl
movb %cl, 0x8(%r14,%rax)
movb 0x2c(%rbx), %cl
movb %cl, 0x9(%r14,%rax)
movslq %r12d, %rdi
addq %r14, %rdi
callq 0x2220
movslq %ebp, %rax
addq %r14, %rax
testb $0x3, %bpl
je 0x4aa2
movb $0x0, (%rax)
incq %rax
incl %ebp
jmp 0x4a92
movl %ebp, %r12d
movl 0xc(%rsp), %ebp
cmpl $0x0, 0x60(%rbx)
jne 0x4ac1
cmpl $0x0, 0x64(%rbx)
jne 0x4ac1
cmpl $0x0, 0x68(%rbx)
jne 0x4ac1
cmpl $0x0, 0x6c(%rbx)
je 0x4b0b
leal 0x18(%r12), %eax
cmpl %ebp, %eax
jg 0x4f3e
addq $0x60, %rbx
movslq %r12d, %rcx
movl $0x14002400, (%r14,%rcx) # imm = 0x14002400
movl 0x8(%r13), %edx
bswapl %edx
movl %edx, 0x4(%r14,%rcx)
movups (%rbx), %xmm0
movq 0x18(%rsp), %rdx
movups %xmm0, (%rdx,%rcx)
movslq %eax, %rcx
addq %r14, %rcx
testb $0x3, %al
je 0x4b08
movb $0x0, (%rcx)
incq %rcx
incl %eax
jmp 0x4afa
movl %eax, %r12d
incq %r15
jmp 0x49f4
movq 0x20(%rsp), %rcx
incq %rcx
pushq $-0x1
popq %r13
leaq 0xc77a(%rip), %rax      # 0x112a0
leaq 0xc783(%rip), %rdx      # 0x112b0
jmp 0x49d6
xorl %ebx, %ebx
movq $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
xorl %r15d, %r15d
movq 0x10(%rsp), %rcx
movslq 0x68(%rcx), %rax
cmpq %rax, %rbx
jge 0x4c0a
movq 0x60(%rcx), %rax
movq (%rax,%rbx,8), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x4ba1
movl 0x8(%rcx), %edx
testw %dx, %dx
movl $0x0, %esi
cmovlel %esi, %edx
movzwl %dx, %edx
imulq $0x1c, %rdx, %rdx
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x4ba1
movq (%rcx), %rdi
movzbl 0x10(%rdi,%rsi), %edi
addl $0x7, %edi
shrl $0x3, %edi
addl %edi, %r15d
addl $0xd, %r15d
addq $0x1c, %rsi
jmp 0x4b81
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x4c02
xorl %ebp, %ebp
xorl %r13d, %r13d
movswq 0x8(%rax), %rcx
cmpq %rcx, %r13
jge 0x4bfa
movq (%rax), %rdi
addq %rbp, %rdi
callq 0x8d1b
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, %eax
sete %cl
setne %dl
movq 0x18(%rsp), %rax
addl %edx, %eax
movq %rax, 0x18(%rsp)
addl %ecx, 0x20(%rsp)
incq %r13
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rax
addq $0x1c, %rbp
jmp 0x4baf
pushq $-0x1
popq %r13
movl 0xc(%rsp), %ebp
incq %rbx
jmp 0x4b48
movl 0x20(%rsp), %edx
movl %edx, %edi
shll $0x4, %edi
leal 0x8(%rdi), %ecx
xorl %r8d, %r8d
testl %edx, %edx
cmovlel %r8d, %ecx
movq 0x18(%rsp), %rsi
testl %esi, %esi
leal 0x6(,%rsi,4), %edx
cmovlel %r8d, %edx
leal (,%rsi,4), %r9d
movl %r9d, 0x34(%rsp)
movl %r15d, %r9d
negl %r9d
andl $0x3, %r9d
addl %r15d, %r9d
addl %edx, %r9d
negl %edx
andl $0x2, %edx
addl %ecx, %r9d
addl %edx, %r9d
rolw $0x8, %r9w
movl %r9d, 0x3c(%rsp)
movl %edi, %ecx
orl $0x4, %ecx
rolw $0x8, %cx
movl %ecx, 0x38(%rsp)
leal 0xc(%rdi), %ecx
movq %rcx, 0x50(%rsp)
rolw $0x8, %di
movq %rdi, 0x40(%rsp)
leal 0xa(,%rsi,4), %ecx
movq %rcx, 0x48(%rsp)
leal 0x2(,%rsi,4), %ecx
rolw $0x8, %cx
movl %ecx, 0x30(%rsp)
cltq
cmpq %rax, %r8
jge 0x4f54
leal 0x4(%r12), %r15d
cmpl %ebp, %r15d
jg 0x4f42
movslq %r12d, %rax
movw $0x2100, (%r14,%rax)    # imm = 0x2100
movl 0x3c(%rsp), %ecx
movw %cx, 0x2(%r14,%rax)
movq 0x10(%rsp), %rdx
movq 0x60(%rdx), %rax
movq (%rax,%r8,8), %rax
movq (%rax), %rax
testq %rax, %rax
movq %r8, 0x28(%rsp)
je 0x4dbf
xorl %ebx, %ebx
movswq 0x8(%rax), %rcx
cmpq %rcx, %rbx
jge 0x4dbf
movq (%rax), %r12
imulq $0x1c, %rbx, %rax
movzbl 0x10(%r12,%rax), %ecx
addl $0x7, %ecx
shrl $0x3, %ecx
addl %r15d, %ecx
addl $0x11, %ecx
cmpl %ebp, %ecx
jg 0x4f42
addq %rax, %r12
movslq %r15d, %rax
movw $0x2200, (%r14,%rax)    # imm = 0x2200
movzbl 0x10(%r12), %ecx
shll $0x5, %ecx
addl $0xe0, %ecx
andl $0x3f00, %ecx           # imm = 0x3F00
addl $0x900, %ecx            # imm = 0x900
movw %cx, 0x2(%r14,%rax)
movabsq $0x8070000100e0000, %rcx # imm = 0x8070000100E0000
movq %rcx, 0x4(%r14,%rax)
movzbl 0x10(%r12), %edx
movb %dl, 0xc(%r14,%rax)
leal 0xd(%r15), %eax
movslq %eax, %rdi
addq %r14, %rdi
addl $0x7, %edx
shrl $0x3, %edx
movq %r12, %rsi
callq 0x2220
movq 0x28(%rsp), %r8
movzbl 0x10(%r12), %eax
addl $0x7, %eax
shrl $0x3, %eax
addl %eax, %r15d
addl $0xd, %r15d
movslq %r15d, %rax
addq %r14, %rax
movq 0x10(%rsp), %rdx
testb $0x3, %r15b
je 0x4dac
movb $0x0, (%rax)
incq %rax
incl %r15d
jmp 0x4d9b
incq %rbx
movq 0x60(%rdx), %rax
movq (%rax,%r8,8), %rax
movq (%rax), %rax
jmp 0x4ce9
cmpl $0x0, 0x20(%rsp)
jle 0x4e77
movq 0x50(%rsp), %rax
addl %r15d, %eax
cmpl %ebp, %eax
jg 0x4f3e
movslq %r15d, %r15
movw $0x2500, (%r14,%r15)    # imm = 0x2500
movl 0x38(%rsp), %eax
movw %ax, 0x2(%r14,%r15)
movw $0x1700, 0x4(%r14,%r15) # imm = 0x1700
movq 0x40(%rsp), %rax
movw %ax, 0x6(%r14,%r15)
addl $0x8, %r15d
xorl %ebx, %ebx
xorl %r13d, %r13d
movq 0x60(%rdx), %rax
movq (%rax,%r8,8), %rax
movq 0x8(%rax), %rax
movswq 0x8(%rax), %rcx
movslq %r15d, %rbp
cmpq %rcx, %r13
jge 0x4e58
movq (%rax), %r12
addq %rbx, %r12
movq %r12, %rdi
callq 0x8d1b
testl %eax, %eax
jne 0x4e45
movups (%r12), %xmm0
movups %xmm0, (%r14,%rbp)
addl $0x10, %ebp
movl %ebp, %r15d
incq %r13
addq $0x1c, %rbx
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %r8
jmp 0x4e0a
addq %r14, %rbp
pushq $-0x1
popq %r13
testb $0x3, %r15b
je 0x4e71
movb $0x0, (%rbp)
incq %rbp
incl %r15d
jmp 0x4e5f
movl 0xc(%rsp), %ebp
jmp 0x4e7b
pushq $-0x1
popq %r13
cmpl $0x0, 0x18(%rsp)
jle 0x4f30
movq 0x48(%rsp), %rax
addl %r15d, %eax
cmpl %ebp, %eax
jg 0x4f42
movslq %r15d, %r15
movw $0x2600, (%r14,%r15)    # imm = 0x2600
movl 0x30(%rsp), %eax
movw %ax, 0x2(%r14,%r15)
movb $0x6, 0x4(%r14,%r15)
movl 0x34(%rsp), %eax
movb %al, 0x5(%r14,%r15)
addl $0x6, %r15d
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%r8,8), %rax
movq 0x8(%rax), %rax
movswq 0x8(%rax), %rcx
movslq %r15d, %r13
cmpq %rcx, %r12
jge 0x4f11
movq (%rax), %rbp
leaq (%rbx,%rbp), %rdi
callq 0x8d1b
testl %eax, %eax
je 0x4eff
movl 0xc(%rbp,%rbx), %eax
movl %eax, (%r14,%r13)
addl $0x4, %r13d
movl %r13d, %r15d
incq %r12
addq $0x1c, %rbx
movl 0xc(%rsp), %ebp
movq 0x28(%rsp), %r8
jmp 0x4ec2
addq %r14, %r13
movq 0x10(%rsp), %rdx
testb $0x3, %r15b
je 0x4f2c
movb $0x0, (%r13)
incq %r13
incl %r15d
jmp 0x4f19
pushq $-0x1
popq %r13
incq %r8
movl 0x68(%rdx), %eax
movl %r15d, %r12d
jmp 0x4c9c
pushq $-0x1
popq %r13
movl %r13d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, %r13d
jmp 0x4f42
leaq 0x7830(%rip), %rdi      # 0xc790
leaq 0x7798(%rip), %rsi      # 0xc6ff
leaq 0x7838(%rip), %rcx      # 0xc7a6
movl $0xdc, %edx
callq 0x2150