// File: /workspace/github_c_makefile_star2_O2/jech[P]shncpd/state.c
// Function: republish
int
republish(int do_neighs, int reset)
{
    int rc;
    unsigned char buf[2000];
    struct node *node = find_node(myid, 0);

    if(do_neighs) {
        int i = 0;
        if(node->neighs) {
            free(node->neighs);
            node->neighs = NULL;
            node->numneighs = 0;
        }
        node->neighs = calloc(numneighs, sizeof(struct node_neighbour));
        if(node->neighs == NULL)
            return -1;
        for(i = 0; i < numneighs; i++) {
            memcpy(node->neighs[i].neigh, neighs[i].id, 4);
            node->neighs[i].lei = neighs[i].interface->ifindex;
            node->neighs[i].nei = neighs[i].eid;
        }
        node->numneighs = numneighs;
    }

    rc = format_my_state(buf, sizeof(buf));
    if(rc < 0) {
        fprintf(stderr, "Couldn't format my state.\n");
        return -1;
    }
    if(node->data)
        free(node->data);
    node->data = malloc(rc);
    if(node->data == NULL)
        return -1;
    node->datalen = rc;
    memcpy(node->data, buf, rc);
    node_hash(node->datahash, buf, rc);
    node->seqno++;
    node->orig_time = now;

    if(reset)
        trickle_reset_all();

    ts_add_msec(&republish_time, &now, 900000);
    ts_add_random(&republish_time, &republish_time, 900000);

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7d8, %rsp            # imm = 0x7D8
movl %esi, %ebx
movl %edi, %r15d
leaq 0xd746(%rip), %rdi      # 0x11280
xorl %esi, %esi
callq 0x3d24
movq %rax, %r14
pushq $-0x1
popq %rbp
testl %r15d, %r15d
je 0x3bc4
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x3b5f
callq 0x2040
andl $0x0, 0x48(%r14)
movl 0xd742(%rip), %r15d     # 0x112a8
movslq %r15d, %rdi
pushq $0xc
popq %rsi
callq 0x21c0
movq %rax, 0x40(%r14)
testq %rax, %rax
je 0x3c6a
leaq 0xe317(%rip), %rcx      # 0x11e9c
xorl %edx, %edx
xorl %esi, %esi
movslq %r15d, %rdi
cmpq %rdi, %rsi
jge 0x3bc0
movl -0x4(%rcx), %edi
movl %edi, (%rax,%rdx)
movq -0xc(%rcx), %rax
movl 0x8(%rax), %edi
movq 0x40(%r14), %rax
movl %edi, 0x8(%rax,%rdx)
movl (%rcx), %edi
movl %edi, 0x4(%rax,%rdx)
incq %rsi
movl 0xd6f2(%rip), %r15d     # 0x112a8
addq $0x40, %rcx
addq $0xc, %rdx
jmp 0x3b89
movl %r15d, 0x48(%r14)
movq %rsp, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x48b7
testl %eax, %eax
js 0x3c7e
movl %eax, %r15d
movq 0x10(%r14), %rdi
callq 0x2040
movl %r15d, %r12d
movq %r12, %rdi
callq 0x2250
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x3c6a
movl %r15d, 0x18(%r14)
movq %rsp, %r13
movq %rax, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x2220
movq %r14, %rdi
addq $0x1c, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x420c
incl 0x24(%r14)
leaq 0xd645(%rip), %rax      # 0x11270
movups (%rax), %xmm0
movups %xmm0, 0x28(%r14)
testl %ebx, %ebx
je 0x3c3c
callq 0x38bc
leaq 0xd5d5(%rip), %rbx      # 0x11218
leaq 0xd626(%rip), %rsi      # 0x11270
movq %rbx, %rdi
movl $0xdbba0, %edx          # imm = 0xDBBA0
callq 0xa7e7
movq %rbx, %rdi
movq %rbx, %rsi
movl $0xdbba0, %edx          # imm = 0xDBBA0
callq 0xa826
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x7d8, %rsp            # imm = 0x7D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd373(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x8917(%rip), %rdi      # 0xc5a6
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
callq 0x2340
jmp 0x3c6a