// File: /workspace/github_cpp_makefile_star2_O2/antoniogarro[P]Hara/priors.cpp
// Function: Goban::init_priors(Prior*) const
void Goban::init_priors(Prior priors[]) const
{
  const double EQUIV = size;// /2;
  priors[PASS].prior = 0.1*EQUIV, priors[PASS].equiv = EQUIV;

  for(int i = 0; i < empty_points.length(); ++i){    
    int p = empty_points[i];
       priors[p].prior = 0.5*EQUIV, priors[p].equiv = EQUIV;
    }
    for(int i = 0; i < empty_points.length(); ++i){    
    int p = empty_points[i];
    if(is_self_atari(p, side)){
      priors[p].prior = 0.2*EQUIV, priors[p].equiv = 2*EQUIV;
      continue;
    }  
    if(is_surrounded(p, side)){
      priors[p].prior = 0.3*EQUIV, priors[p].equiv = EQUIV;
      continue;
    }
    priors[p].prior = 0.5*EQUIV, priors[p].equiv = EQUIV;
    if(size > 11){
      if(distance_to_edge[p] == 0 && !stones_around(p, 4)){
        priors[p].prior = 0.1*EQUIV, priors[p].equiv = EQUIV;
      }
      else if(distance_to_edge[p] == 3 && !stones_around(p, 4)){
        priors[p].prior = 0.9*EQUIV, priors[p].equiv = EQUIV;
      }
    }
    
    GroupSet<4> neigh;
    int nneigh = neighbour_groups(p, neigh);
    for(int j = 0; j < nneigh; j++){
      if(neigh[j]->has_one_liberty()){
        if(neigh[j]->get_color() != side){
          priors[p].prior = 1.4*EQUIV, priors[p].equiv = 2*EQUIV;
          goto endloop;
        }
        else{
          priors[p].prior = 0.6*EQUIV, priors[p].equiv = EQUIV;
          goto endloop;
        }
      }
    }
    if(match_mogo_pattern(p, side)){
      priors[p].prior = 0.9*EQUIV, priors[p].equiv = EQUIV;
      continue;
    }
  endloop:;
  }
  
  if(last_point == 0) return;
  
  PointSet<MAXSIZE2> list;
  capture_heuristic(last_point, list);
  for(int i = 0; i < list.length(); i++){
    priors[list[i]].prior += 3*EQUIV, priors[list[i]].equiv += 3*EQUIV;
  }
  list.clear();

  save_heuristic(last_point, list);
  for(int i = 0; i < list.length(); i++){
    priors[list[i]].prior += 2*EQUIV, priors[list[i]].equiv += 2*EQUIV;
  }
  list.clear();

  pattern_heuristic(last_point, list);
  for(int i = 0; i < list.length(); i++){
    priors[list[i]].prior += 2*EQUIV, priors[list[i]].equiv += 2*EQUIV;
  }
  list.clear();

  
  for(int i = 0; last_point && i < 4; i++){
    for(int j = 0; j < 4*(i+1); j++){
      int v =  within_manhattan[last_point][i][j];
      if(v) {
        priors[v].prior += (1.0-0.1*i)*EQUIV, priors[v].equiv += EQUIV;
      }
    }
  }
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x618, %rsp            # imm = 0x618
movq %rsi, %rbx
movq %rdi, %r14
cvtsi2sdl 0x8(%rdi), %xmm0
movsd 0x16bc(%rip), %xmm1     # 0xa020
mulsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd %xmm1, (%rsi)
movsd %xmm0, 0x8(%rsi)
movl 0xfc6d0(%rdi), %eax
movsd 0x1e0b(%rip), %xmm1     # 0xa790
mulsd %xmm0, %xmm1
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
cmpq %rcx, %rdx
je 0x89b6
movslq 0xfc128(%r14,%rcx,4), %rsi
shlq $0x4, %rsi
movsd %xmm1, (%rbx,%rsi)
movsd %xmm0, 0x8(%rbx,%rsi)
incq %rcx
jmp 0x8995
movsd %xmm1, 0x38(%rsp)
movsd 0x1644(%rip), %xmm1     # 0xa008
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x1dc2(%rip), %xmm1     # 0xa798
mulsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
movapd %xmm0, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd 0x1dc0(%rip), %xmm2     # 0xa7b0
movapd %xmm1, 0x10(%rsp)
mulpd %xmm1, %xmm2
movapd %xmm2, 0x50(%rsp)
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
movapd %xmm2, 0x40(%rsp)
xorl %ebp, %ebp
movapd %xmm0, (%rsp)
cltq
cmpq %rax, %rbp
jge 0x8ba5
movl 0xfc128(%r14,%rbp,4), %r12d
movslq %r12d, %r13
movzbl (%r14), %edx
movq %r14, %rdi
movl %r13d, %esi
callq 0x7734
testb %al, %al
je 0x8a4f
shlq $0x4, %r13
movapd 0x50(%rsp), %xmm0
movupd %xmm0, (%rbx,%r13)
jmp 0x8b96
movzbl (%r14), %edx
movq %r14, %rdi
movl %r13d, %esi
xorl %ecx, %ecx
callq 0x51b2
movq %r13, %r15
shlq $0x4, %r15
addq %rbx, %r15
testb %al, %al
je 0x8a83
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%r15)
movapd (%rsp), %xmm0
jmp 0x8b90
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%r15)
movapd (%rsp), %xmm0
movsd %xmm0, 0x8(%r15)
cmpl $0xc, 0x8(%r14)
jl 0x8afe
movl 0xdf6f8(%r14,%r13,4), %eax
testl %eax, %eax
jne 0x8ad1
movq %r14, %rdi
movl %r12d, %esi
pushq $0x4
popq %rdx
callq 0x82dc
movapd (%rsp), %xmm1
movsd 0x28(%rsp), %xmm0
testb %al, %al
je 0x8af3
movl 0xdf6f8(%r14,%r13,4), %eax
cmpl $0x3, %eax
jne 0x8afe
movq %r14, %rdi
movl %r13d, %esi
pushq $0x4
popq %rdx
callq 0x82dc
movapd (%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
testb %al, %al
jne 0x8afe
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
andl $0x0, 0x98(%rsp)
andq $0x0, 0x68(%rsp)
movq %r14, %rdi
movl %r13d, %esi
leaq 0x68(%rsp), %rdx
callq 0x4fc8
movapd (%rsp), %xmm2
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x8b6d
movq 0x68(%rsp,%rcx,8), %rdx
incq %rcx
cmpl $0x1, 0x96c(%rdx)
jne 0x8b2d
movb (%r14), %cl
xorl %eax, %eax
movapd %xmm2, %xmm0
cmpb (%rdx), %cl
sete %cl
je 0x8b59
movapd 0x40(%rsp), %xmm0
movb %cl, %al
leaq 0x1c6e(%rip), %rcx      # 0xa7d0
movsd (%rcx,%rax,8), %xmm1
mulsd %xmm2, %xmm1
jmp 0x8b8b
movzbl (%r14), %edx
movq %r14, %rdi
movl %r12d, %esi
callq 0x7e0e
movsd 0x20(%rsp), %xmm1
movapd (%rsp), %xmm0
testb %al, %al
je 0x8b96
movsd %xmm1, (%r15)
movsd %xmm0, 0x8(%r15)
incq %rbp
movl 0xfc6d0(%r14), %eax
jmp 0x8a11
movl 0xd63e0(%r14), %esi
testl %esi, %esi
je 0x8d67
leaq 0x68(%rsp), %r15
andl $0x0, 0x5ac(%r15)
andl $0x0, 0x8(%r15)
leaq 0x612b(%rip), %rax      # 0xecf8
movq %rax, (%r15)
movq %r14, %rdi
movq %r15, %rdx
callq 0x7bc6
movl 0x5ac(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movapd 0x1bcf(%rip), %xmm0     # 0xa7c0
mulpd 0x10(%rsp), %xmm0
cmpq %rcx, %rax
je 0x8c18
movslq 0x70(%rsp,%rcx,4), %rdx
shlq $0x4, %rdx
movupd (%rbx,%rdx), %xmm1
addpd %xmm0, %xmm1
movupd %xmm1, (%rbx,%rdx)
incq %rcx
jmp 0x8bf7
leaq 0x68(%rsp), %r15
andl $0x0, 0x5ac(%r15)
andl $0x0, 0x8(%r15)
movl 0xd63e0(%r14), %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x7aa4
movl 0x5ac(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movapd 0x10(%rsp), %xmm0
addpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
cmpq %rcx, %rax
je 0x8c7d
movslq 0x70(%rsp,%rcx,4), %rdx
shlq $0x4, %rdx
movupd (%rbx,%rdx), %xmm0
addpd 0x10(%rsp), %xmm0
movupd %xmm0, (%rbx,%rdx)
incq %rcx
jmp 0x8c5a
leaq 0x68(%rsp), %r15
andl $0x0, 0x5ac(%r15)
andl $0x0, 0x8(%r15)
movl 0xd63e0(%r14), %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x7b5e
movl 0x5ac(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movapd (%rsp), %xmm4
cmpq %rcx, %rax
je 0x8cd7
movslq 0x70(%rsp,%rcx,4), %rdx
shlq $0x4, %rdx
movupd (%rbx,%rdx), %xmm0
addpd 0x10(%rsp), %xmm0
movupd %xmm0, (%rbx,%rdx)
incq %rcx
jmp 0x8cb4
movl 0xd63e0(%r14), %eax
testl %eax, %eax
je 0x8d67
cltq
imulq $0x140, %rax, %rax      # imm = 0x140
addq %r14, %rax
addq $0xdfca0, %rax          # imm = 0xDFCA0
pushq $0x4
popq %rcx
xorl %edx, %edx
movsd 0x1a9b(%rip), %xmm0     # 0xa7a0
movsd 0x130b(%rip), %xmm1     # 0xa018
cmpq $0x4, %rdx
je 0x8d67
cvtsi2sd %edx, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
mulsd %xmm4, %xmm2
xorl %esi, %esi
cmpq %rsi, %rcx
je 0x8d5a
movslq (%rax,%rsi,4), %rdi
testq %rdi, %rdi
je 0x8d55
shlq $0x4, %rdi
movsd (%rbx,%rdi), %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, (%rbx,%rdi)
movsd 0x8(%rbx,%rdi), %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, 0x8(%rbx,%rdi)
incq %rsi
jmp 0x8d25
incq %rdx
addq $0x4, %rcx
addq $0x50, %rax
jmp 0x8d0d
addq $0x618, %rsp            # imm = 0x618
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)