// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq 0x8(%rsi), %rdx
movq 0x38(%rdi), %rsi
leaq 0x30(%rsp), %rdi
movq %rdx, 0x28(%rsp)
callq 0x1a320
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %rax
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
cmpq %rax, %r14
je 0x37da5
movss %xmm0, 0xc(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x28(%rsp), %rdx
movq %r12, 0x68(%rsp)
movq (%r14), %rax
cmpq %r12, %rax
je 0x37d8a
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 0x37c6c
movq 0x28(%rsp), %rdx
jmp 0x37d8a
movq %rbx, %r13
movq 0x38(%rbx), %rsi
leaq 0x30(%rsp), %rdi
movq %rbp, %rdx
callq 0x1a320
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 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x37cc1
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x37cd8
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 0x37d28
movq (%r15), %rsi
cmpq %rdx, %rsi
je 0x37d17
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 0x37d1c
movl $0x2, %ecx
addl %ecx, %r12d
addq $0x8, %r15
cmpq %rbx, %r15
jne 0x37cf3
subq 0x20(%rsp), %rbx
sarq $0x3, %rbx
js 0x37d3d
xorps %xmm0, %xmm0
cvtsi2ss %rbx, %xmm0
jmp 0x37d55
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 0xc(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %r12
movq %r13, %rbx
addq $0x8, %r14
cmpq 0x70(%rsp), %r14
jne 0x37c2a
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdi
jmp 0x37daf
movss %xmm0, 0xc(%rsp)
xorl %edi, %edi
xorl %esi, %esi
testq %rdi, %rdi
movq 0x50(%rsp), %rbx
movq 0x60(%rsp), %r14
je 0x37dc6
subq %rdi, %rsi
callq 0x6380
testq %rbx, %rbx
je 0x37ddb
movq 0x48(%rsp), %rsi
subq %rbx, %rsi
movq %rbx, %rdi
callq 0x6380
subq %rbx, %r14
sarq $0x3, %r14
js 0x37dee
xorps %xmm1, %xmm1
cvtsi2ss %r14, %xmm1
jmp 0x37e07
movq %r14, %rax
shrq %rax
andl $0x1, %r14d
orq %rax, %r14
xorps %xmm1, %xmm1
cvtsi2ss %r14, %xmm1
addss %xmm1, %xmm1
movss 0xc(%rsp), %xmm0
divss %xmm1, %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq $0x0, 0x48(%rsp)
xorl %edi, %edi
movq $0x0, 0x10(%rsp)
movq $0x0, 0x50(%rsp)
jmp 0x37e60
jmp 0x37e44
movq %rax, %r15
movq 0x18(%rsp), %rdi
jmp 0x37e60
movq %rax, %r15
movq 0x20(%rsp), %rdi
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
testq %rdi, %rdi
je 0x37e72
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x37e89
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %r15, %rdi
callq 0x6620
nop