// File: /workspace/github_c_makefile_star2_O3/jech[P]shncpd/state.c
// Function: silly_walk
int
silly_walk(struct node *root)
{
    int sp = 0;
    unsigned short stack[numnodes];
    unsigned char seen[numnodes];
    int i, flushed, num;

    memset(seen, 0, sizeof(seen));
    seen[root - nodes] = 1;
    stack[sp++] = root - nodes;

    while(sp > 0) {
        int n = stack[--sp];
        for(i = 0; i < nodes[n].numneighs; i++) {
            struct node_neighbour *neigh = &nodes[n].neighs[i];
            int m = node_index(neigh->neigh);
            if(m < 0) {
                /* Neighbour link to a node we don't know about. */
                continue;
            }
            if(!seen[m] && neigh_symmetric(&nodes[n], &nodes[m], neigh)) {
                assert(sp < numnodes - 1);
                seen[m] = 1;
                stack[sp++] = m;
            }
        }
    }
    /* Flushing a node only moves the nodes *after* the one being flushed.
       Yes, it's a hack. */
    num = numnodes; flushed = 0;
    for(i = numnodes - 1; i >= 0; i--) {
        if(!seen[i]) {
            flush_node(&nodes[i]);
            flushed++;
        }
    }
    debugf("Silly walk flushed %d/%d nodes.\n", flushed, num);
    return !!flushed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movl 0xe6d4(%rip), %edx      # 0x132a4
movq %rsp, %r15
leaq 0xf(,%rdx,2), %r13
andq $-0x10, %r13
movq %r15, %rax
subq %r13, %rax
movq %rax, -0x38(%rbp)
movq %rax, %rsp
negq %r13
movq %rsp, %rbx
leaq 0xf(%rdx), %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2160
leaq 0xfc7f(%rip), %r12      # 0x14890
subq %r12, %r14
sarq $0x4, %r14
movabsq $0x6db6db6db6db6db7, %rax # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %r14
movb $0x1, (%r14,%rbx)
movw %r14w, (%r15,%r13)
movl $0x1, %ecx
decl %ecx
movq -0x38(%rbp), %rax
movq %rcx, -0x30(%rbp)
movzwl (%rax,%rcx,2), %eax
imulq $0x70, %rax, %r15
cmpl $0x0, 0x48(%r15,%r12)
jle 0x4d42
addq %r12, %r15
xorl %r13d, %r13d
leaq (,%r13,2), %r14
addq %r13, %r14
shlq $0x2, %r14
addq 0x40(%r15), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x49a3
testq %rax, %rax
je 0x4d08
subq %r12, %rax
cmpq $-0x6f, %rax
jl 0x4dcf
movq %rax, %rcx
sarq $0x4, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
movl 0xe5fd(%rip), %edx      # 0x132a4
movslq %edx, %rsi
cmpq %rsi, %rcx
jge 0x4dcf
testq %rax, %rax
js 0x4d08
movl %ecx, %eax
cmpb $0x0, (%rbx,%rax)
jne 0x4d08
imulq $0x70, %rax, %rdi
movl (%r14), %esi
cmpl 0x8(%rdi,%r12), %esi
jne 0x4dee
addq %r12, %rdi
movslq 0x48(%rdi), %rsi
testq %rsi, %rsi
jle 0x4d08
movq 0x40(%rdi), %rdi
movl (%rdi), %r8d
cmpl 0x8(%r15), %r8d
jne 0x4cff
movl 0x4(%rdi), %r8d
cmpl 0x8(%r14), %r8d
jne 0x4cff
movl 0x8(%rdi), %r8d
cmpl 0x4(%r14), %r8d
je 0x4d1a
addq $0xc, %rdi
decq %rsi
jne 0x4ce2
incq %r13
movslq 0x48(%r15), %rax
cmpq %rax, %r13
jl 0x4c59
jmp 0x4d42
decl %edx
movq -0x30(%rbp), %rsi
cmpl %edx, %esi
jge 0x4e0d
movq %rsi, %rdx
movb $0x1, (%rbx,%rax)
movslq %edx, %rax
incl %edx
movq %rdx, -0x30(%rbp)
movq -0x38(%rbp), %rdx
movw %cx, (%rdx,%rax,2)
jmp 0x4d08
movq -0x30(%rbp), %rcx
testl %ecx, %ecx
jg 0x4c35
movslq 0xe54f(%rip), %r14      # 0x132a4
testq %r14, %r14
jle 0x4d8e
leaq 0x1(%r14), %r13
imulq $0x70, %r14, %rax
addq %rax, %r12
addq $-0x70, %r12
xorl %r15d, %r15d
cmpb $0x0, -0x2(%rbx,%r13)
jne 0x4d7f
movq %r12, %rdi
callq 0x4aa0
incl %r15d
decq %r13
addq $-0x70, %r12
cmpq $0x1, %r13
ja 0x4d6c
jmp 0x4d91
xorl %r15d, %r15d
leaq 0xe4c0(%rip), %rax      # 0x13258
cmpl $0x2, (%rax)
jge 0x4db4
xorl %eax, %eax
testl %r15d, %r15d
setne %al
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x87ca(%rip), %rsi      # 0xd585
movl $0x2, %edi
movl %r15d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x30a8
jmp 0x4d9d
leaq 0x87eb(%rip), %rdi      # 0xd5c1
leaq 0x8711(%rip), %rsi      # 0xd4ee
leaq 0x880a(%rip), %rcx      # 0xd5ee
movl $0xca, %edx
callq 0x2150
leaq 0x881f(%rip), %rdi      # 0xd614
leaq 0x86f2(%rip), %rsi      # 0xd4ee
leaq 0x882d(%rip), %rcx      # 0xd630
movl $0xd5, %edx
callq 0x2150
leaq 0x8741(%rip), %rdi      # 0xd555
leaq 0x86d3(%rip), %rsi      # 0xd4ee
leaq 0x8745(%rip), %rcx      # 0xd567
movl $0xf5, %edx
callq 0x2150