// File: 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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x51cb0
movq %rax, -0x20(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3e880
leaq -0x60(%rbp), %rdi
callq 0x3e880
movq -0xe8(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x20(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x3c8d0
jmp 0x89dee
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3f230
leaq -0x78(%rbp), %rdi
callq 0xd7d0
movq -0xe8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
callq 0x39b60
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
callq 0x399f0
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x51bd0
testb $0x1, %al
jne 0x89e58
jmp 0x8a0bb
leaq -0x98(%rbp), %rdi
callq 0x51c10
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x89ea6
jmp 0x8a0aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xd7d0
leaq -0x48(%rbp), %rdi
callq 0xd7d0
jmp 0x8a14b
movq -0xa8(%rbp), %rdi
callq 0x51cb0
movq %rax, -0xf0(%rbp)
jmp 0x89ebb
movq -0xe8(%rbp), %rax
movq -0xf0(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movq 0x38(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0xf4(%rbp)
jmp 0x89eea
movq -0xe8(%rbp), %rax
movl -0xf4(%rbp), %ecx
movl %ecx, -0x2c(%rbp)
movq 0x38(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0xf8(%rbp)
jmp 0x89f17
movl -0xf8(%rbp), %eax
cmpl $0x2, %eax
jle 0x89f27
jmp 0x8a0aa
movq -0xe8(%rbp), %rax
movl -0x2c(%rbp), %edx
movl $0x2, %ecx
subl %edx, %ecx
movl %ecx, -0x30(%rbp)
movq 0x38(%rax), %rsi
movq -0x28(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x3c8d0
jmp 0x89f51
leaq -0x60(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3f230
leaq -0xc0(%rbp), %rdi
callq 0xd7d0
leaq -0x60(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x3b730
movq %rax, -0xd0(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x3b760
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x3b790
testb $0x1, %al
jne 0x89fb7
jmp 0x8a035
leaq -0xd0(%rbp), %rdi
callq 0x3bb00
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x89fe5
movl -0x30(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x30(%rbp)
jmp 0x8a022
movq -0xe8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0xe0(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0xfc(%rbp)
jmp 0x8a00c
movl -0xfc(%rbp), %eax
cmpl $0x1, %eax
jne 0x8a020
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x8a022
jmp 0x8a024
leaq -0xd0(%rbp), %rdi
callq 0x3bad0
jmp 0x89f9e
cvtsi2ssl -0x30(%rbp), %xmm0
movss %xmm0, -0x108(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3b0e0
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x104(%rbp)
testq %rax, %rax
movss %xmm0, -0x100(%rbp)
js 0x8a08c
movss -0x104(%rbp), %xmm0
movss %xmm0, -0x100(%rbp)
movss -0x108(%rbp), %xmm0
movss -0x100(%rbp), %xmm1
divss %xmm1, %xmm0
addss -0x14(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x51c30
jmp 0x89e3c
leaq -0x48(%rbp), %rdi
callq 0x3b0e0
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x110(%rbp)
testq %rax, %rax
movss %xmm0, -0x10c(%rbp)
js 0x8a105
movss -0x110(%rbp), %xmm0
movss %xmm0, -0x10c(%rbp)
movss -0x10c(%rbp), %xmm1
movss -0x14(%rbp), %xmm0
divss %xmm1, %xmm0
movss %xmm0, -0x14(%rbp)
movss -0x14(%rbp), %xmm0
movss %xmm0, -0x114(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xd7d0
leaq -0x48(%rbp), %rdi
callq 0xd7d0
movss -0x114(%rbp), %xmm0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x8880
nopw %cs:(%rax,%rax)