// File: /workspace/github_cpp_makefile_star2_O3/Kei18[P]pibt/./src/solver/pibt.cpp
// Function: PIBT::getDensity(Agent*)
float PIBT::getDensity(Agent* a) {
  float density = 0;
  Node *v, *u;
  int d, tmp;
  v = a->getNode();
  Nodes Ci, Cj;
  Ci = G->neighbor(v);

  for (auto b : A) {
    if (b == a) continue;
    u = b->getNode();
    d = G->dist(u, v);
    if (G->dist(u, v) > 2) continue;
    tmp = - d + 2;
    Cj = G->neighbor(u);
    for (auto w : Cj) {
      if (w == v) {
        tmp += 2;
      } else if (G->dist(w, u) == 1) {
        ++tmp;
      }
    }
    density += (float)tmp / (float)Cj.size();
  }

  density /= (float)Ci.size();
  return density;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r12
movq %rdi, %r14
movq 0x8(%rsi), %rdx
movq 0x38(%rdi), %rsi
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %rdx, 0x28(%rsp)
callq 0x1a38a
movq (%rbx), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x60(%rsp)
movq 0x10(%rbx), %rax
movq %r14, %rbx
movq %rax, 0x50(%rsp)
movq 0x20(%r14), %r14
movq 0x28(%rbx), %rax
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
cmpq %rax, %r14
je 0x37be8
movss %xmm0, 0x4(%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x28(%rsp), %rdx
movq %r12, 0x68(%rsp)
movq (%r14), %rax
cmpq %r12, %rax
je 0x37bc0
movq 0x8(%rax), %rbp
movq 0x38(%rbx), %rdi
movq (%rdi), %rax
movq %rbp, %rsi
movq %rdx, %r13
callq *0x10(%rax)
movl %eax, %r15d
movq 0x38(%rbx), %rdi
movq (%rdi), %rax
movq %rbp, %rsi
movq %r13, %rdx
callq *0x10(%rax)
cmpl $0x2, %eax
jle 0x37aa2
movq 0x28(%rsp), %rdx
jmp 0x37bc0
movq %rbx, %r13
movq 0x38(%rbx), %rsi
leaq 0x30(%rsp), %rdi
movq %rbp, %rdx
callq 0x1a38a
movq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rbx
movq 0x40(%rsp), %rax
movq %rax, 0x58(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x37b0e
movq 0x8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x37b0e
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movl $0x2, %r12d
subl %r15d, %r12d
movq 0x20(%rsp), %rax
movq %rax, %r15
cmpq %rbx, %rax
movq 0x28(%rsp), %rdx
je 0x37b5e
movq (%r15), %rsi
cmpq %rdx, %rsi
je 0x37b4d
movq 0x38(%r13), %rdi
movq (%rdi), %rax
movq %rbp, %rdx
callq *0x10(%rax)
xorl %ecx, %ecx
cmpl $0x1, %eax
sete %cl
movq 0x28(%rsp), %rdx
jmp 0x37b52
movl $0x2, %ecx
addl %ecx, %r12d
addq $0x8, %r15
cmpq %rbx, %r15
jne 0x37b29
subq 0x20(%rsp), %rbx
sarq $0x3, %rbx
js 0x37b73
xorps %xmm0, %xmm0
cvtsi2ss %rbx, %xmm0
jmp 0x37b8b
movq %rbx, %rax
shrq %rax
andl $0x1, %ebx
orq %rax, %rbx
xorps %xmm0, %xmm0
cvtsi2ss %rbx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %r12d, %xmm1
divss %xmm0, %xmm1
movss 0x4(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x4(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %r12
movq %r13, %rbx
addq $0x8, %r14
cmpq 0x70(%rsp), %r14
jne 0x37a60
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x37bee
movq 0x8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x37bee
movss %xmm0, 0x4(%rsp)
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0x37c08
movq 0x50(%rsp), %rsi
subq %rbx, %rsi
movq %rbx, %rdi
callq 0x6380
movq 0x60(%rsp), %rcx
subq %rbx, %rcx
sarq $0x3, %rcx
js 0x37c20
xorps %xmm1, %xmm1
cvtsi2ss %rcx, %xmm1
jmp 0x37c38
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm1, %xmm1
cvtsi2ss %rcx, %xmm1
addss %xmm1, %xmm1
movss 0x4(%rsp), %xmm0
divss %xmm1, %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x37c53
movq %rax, %r15
movq 0x10(%rsp), %rdi
jmp 0x37c6f
movq %rax, %r15
movq 0x20(%rsp), %rdi
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
testq %rdi, %rdi
je 0x37c81
movq 0x8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x37c98
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %r15, %rdi
callq 0x6620