// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x7f0, %rsp            # imm = 0x7F0
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x11998(%rip), %rdi     # 0x16290
xorl %esi, %esi
callq 0x4c80
movq %rax, -0x7e8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x4a6c
movl $0x0, -0x7ec(%rbp)
movq -0x7e8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x4955
movq -0x7e8(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x2040
movq -0x7e8(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x7e8(%rbp), %rax
movl $0x0, 0x48(%rax)
movslq 0x1195c(%rip), %rdi     # 0x162b8
movl $0xc, %esi
callq 0x21d0
movq %rax, %rcx
movq -0x7e8(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x7e8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x498e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4ba6
movl $0x0, -0x7ec(%rbp)
movl -0x7ec(%rbp), %eax
cmpl 0x11914(%rip), %eax     # 0x162b8
jge 0x4a5c
movq -0x7e8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x7ec(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x7ec(%rbp), %rdx
leaq 0x124cf(%rip), %rcx     # 0x16ea0
shlq $0x6, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
movl %ecx, (%rax)
movslq -0x7ec(%rbp), %rcx
leaq 0x124b5(%rip), %rax     # 0x16ea0
shlq $0x6, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl 0x8(%rax), %ecx
movq -0x7e8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x7ec(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movslq -0x7ec(%rbp), %rcx
leaq 0x1247e(%rip), %rax     # 0x16ea0
shlq $0x6, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq -0x7e8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x7ec(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x7ec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7ec(%rbp)
jmp 0x4998
movl 0x11856(%rip), %ecx     # 0x162b8
movq -0x7e8(%rbp), %rax
movl %ecx, 0x48(%rax)
leaq -0x7e0(%rbp), %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x5d50
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jge 0x4aaa
movq 0x1156b(%rip), %rax     # 0x15ff8
movq (%rax), %rdi
leaq 0xdbaf(%rip), %rsi      # 0x12646
movb $0x0, %al
callq 0x21f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4ba6
movq -0x7e8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4ac8
movq -0x7e8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
movslq -0x10(%rbp), %rdi
callq 0x2260
movq %rax, %rcx
movq -0x7e8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x7e8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x4af9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4ba6
movl -0x10(%rbp), %ecx
movq -0x7e8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x7e8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x7e0(%rbp), %rsi
movslq -0x10(%rbp), %rdx
callq 0x2230
movq -0x7e8(%rbp), %rdi
addq $0x1c, %rdi
leaq -0x7e0(%rbp), %rsi
movl -0x10(%rbp), %edx
callq 0x53c0
movq -0x7e8(%rbp), %rax
movl 0x24(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x24(%rax)
movq -0x7e8(%rbp), %rax
leaq 0x11727(%rip), %rcx     # 0x16280
movq (%rcx), %rdx
movq %rdx, 0x28(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x30(%rax)
cmpl $0x0, -0xc(%rbp)
je 0x4b73
callq 0x4420
leaq 0x116ae(%rip), %rdi     # 0x16228
leaq 0x116ff(%rip), %rsi     # 0x16280
movl $0xdbba0, %edx          # imm = 0xDBBA0
callq 0xfac0
leaq 0x11696(%rip), %rsi     # 0x16228
movl $0xdbba0, %edx          # imm = 0xDBBA0
movq %rsi, %rdi
callq 0xfba0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x7f0, %rsp            # imm = 0x7F0
popq %rbp
retq
nopw %cs:(%rax,%rax)