// File: kobanium[P]Ray/src/common/Message.cpp
// Function: PrintOwner(uct_node_t const*, statistic_t const*, int, int, double*)
void
PrintOwner( const uct_node_t *root, const statistic_t *statistic, const int color, const int count, double *own )
{
  int player = 0, opponent = 0;
  double owner, score;
  std::ostringstream oss;
  const double inv_count = (count > 0) ? 1.0 / count : 1.0;

  if (!debug_message) return;

  oss << "   ";
  for (int i = 1, y = board_start; y <= board_end; y++, i++) {
    oss << "   " << gogui_x[i];
  }
  oss << "\n";

  oss << "   +";
  for (int i = 0; i < pure_board_size * 4; i++) {
    oss << "-";
  }
  oss << "+" << "\n";
  for (int i = 1, y = board_start; y <= board_end; y++, i++) {
    oss << std::setw(2) << (pure_board_size + 1 - i) << ":|";
    for (int x = board_start; x <= board_end; x++) {
      const int pos = POS(x, y);
      owner = static_cast<double>(statistic[pos].colors[color]) * inv_count;
      if (owner > 0.5) {
        player++;
      } else {
        opponent++;
      }
      own[pos] = owner * 100.0;
      oss << std::setw(3) << static_cast<int>(owner * 100) << " ";
    }
    oss << "|" << "\n";
  }

  oss << "   +";
  for (int i = 0; i < pure_board_size * 4; i++) {
    oss << "-";
  }
  oss << "+" << "\n";

  if (color == S_BLACK) {
    if (player - opponent > komi[0]) {
      score = player - opponent - komi[0];
      oss << "BLACK+" << score << "\n";
    } else {
      score = -(player - opponent - komi[0]);
      oss << "WHITE+" << score << "\n";
    }
  } else {
    if (player - opponent > -komi[0]) {
      score = player - opponent + komi[0];
      oss << "WHITE+" << score << "\n";
    } else {
      score = -(player - opponent + komi[0]);
      oss << "BLACK+" << score << "\n";
    }
  }

  std::cerr << oss.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x7750
cmpl $0x0, -0x18(%rbp)
jle 0x21248
cvtsi2sdl -0x18(%rbp), %xmm1
movsd 0x8adce(%rip), %xmm0    # 0xac008
divsd %xmm1, %xmm0
movsd %xmm0, -0x220(%rbp)
jmp 0x2125a
movsd 0x8adb8(%rip), %xmm0    # 0xac008
movsd %xmm0, -0x220(%rbp)
jmp 0x2125a
movsd -0x220(%rbp), %xmm0
movsd %xmm0, -0x1b8(%rbp)
testb $0x1, 0xc630f(%rip)     # 0xe7580
jne 0x21282
movl $0x1, -0x1bc(%rbp)
jmp 0x21910
leaq 0x8b1bb(%rip), %rsi     # 0xac444
leaq -0x1b0(%rbp), %rdi
callq 0x7530
jmp 0x21297
movl $0x1, -0x1d0(%rbp)
leaq 0xc67a8(%rip), %rax     # 0xe7a50
movl (%rax), %eax
movl %eax, -0x1d4(%rbp)
movl -0x1d4(%rbp), %eax
leaq 0xc6797(%rip), %rcx     # 0xe7a54
cmpl (%rcx), %eax
jg 0x21336
leaq 0x8b17c(%rip), %rsi     # 0xac444
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x228(%rbp)
jmp 0x212dd
movq -0x228(%rbp), %rdi
movslq -0x1d0(%rbp), %rax
leaq 0x8b0ae(%rip), %rcx     # 0xac3a0
movsbl (%rax,%rcx), %esi
callq 0x7660
jmp 0x212fd
jmp 0x212ff
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
movl -0x1d0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d0(%rbp)
jmp 0x212b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x21943
leaq 0x8e3c8(%rip), %rsi     # 0xaf705
leaq -0x1b0(%rbp), %rdi
callq 0x7530
jmp 0x2134b
leaq 0x8ad26(%rip), %rsi     # 0xac078
leaq -0x1b0(%rbp), %rdi
callq 0x7530
jmp 0x21360
movl $0x0, -0x1d8(%rbp)
movl -0x1d8(%rbp), %eax
leaq 0xc66cd(%rip), %rcx     # 0xe7a44
movl (%rcx), %ecx
shll $0x2, %ecx
cmpl %ecx, %eax
jge 0x213a8
leaq 0x8ad74(%rip), %rsi     # 0xac0fb
leaq -0x1b0(%rbp), %rdi
callq 0x7530
jmp 0x21395
jmp 0x21397
movl -0x1d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d8(%rbp)
jmp 0x2136a
leaq 0x8accc(%rip), %rsi     # 0xac07b
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x230(%rbp)
jmp 0x213c4
movq -0x230(%rbp), %rdi
leaq 0x8e333(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x213d9
movl $0x1, -0x1dc(%rbp)
leaq 0xc6666(%rip), %rax     # 0xe7a50
movl (%rax), %eax
movl %eax, -0x1e0(%rbp)
movl -0x1e0(%rbp), %eax
leaq 0xc6655(%rip), %rcx     # 0xe7a54
cmpl (%rcx), %eax
jg 0x2161e
movl $0x2, %edi
callq 0x25760
movl %eax, -0x234(%rbp)
jmp 0x21419
movl -0x234(%rbp), %eax
movl %eax, -0x1e4(%rbp)
movl -0x1e4(%rbp), %esi
leaq -0x1b0(%rbp), %rdi
callq 0x7640
movq %rax, -0x240(%rbp)
jmp 0x21440
movq -0x240(%rbp), %rdi
leaq 0xc65f6(%rip), %rax     # 0xe7a44
movl (%rax), %esi
movl -0x1dc(%rbp), %eax
subl %eax, %esi
incl %esi
callq 0x7980
movq %rax, -0x248(%rbp)
jmp 0x21468
movq -0x248(%rbp), %rdi
leaq 0x8ac07(%rip), %rsi     # 0xac07d
callq 0x7530
jmp 0x2147d
leaq 0xc65cc(%rip), %rax     # 0xe7a50
movl (%rax), %eax
movl %eax, -0x1e8(%rbp)
movl -0x1e8(%rbp), %eax
leaq 0xc65bb(%rip), %rcx     # 0xe7a54
cmpl (%rcx), %eax
jg 0x215c8
movl -0x1e8(%rbp), %eax
movl -0x1e0(%rbp), %ecx
leaq 0xc6598(%rip), %rdx     # 0xe7a4c
imull (%rdx), %ecx
addl %ecx, %eax
movl %eax, -0x1ec(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x1ec(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movslq -0x14(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x25780
cvtsi2sd %eax, %xmm0
mulsd -0x1b8(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
movsd 0x8ab11(%rip), %xmm1    # 0xac010
ucomisd %xmm1, %xmm0
jbe 0x21510
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x21519
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movsd -0x30(%rbp), %xmm0
movsd 0x8aaf2(%rip), %xmm1    # 0xac018
mulsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movslq -0x1ec(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x3, %edi
callq 0x25760
movl %eax, -0x24c(%rbp)
jmp 0x2154c
movl -0x24c(%rbp), %eax
movl %eax, -0x1f0(%rbp)
movl -0x1f0(%rbp), %esi
leaq -0x1b0(%rbp), %rdi
callq 0x7640
movq %rax, -0x258(%rbp)
jmp 0x21573
movq -0x258(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
movsd 0x8aa91(%rip), %xmm1    # 0xac018
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %esi
callq 0x7980
movq %rax, -0x260(%rbp)
jmp 0x2159d
movq -0x260(%rbp), %rdi
leaq 0x8ae9b(%rip), %rsi     # 0xac446
callq 0x7530
jmp 0x215b2
jmp 0x215b4
movl -0x1e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1e8(%rbp)
jmp 0x2148c
leaq 0x8aab2(%rip), %rsi     # 0xac081
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x268(%rbp)
jmp 0x215e4
movq -0x268(%rbp), %rdi
leaq 0x8e113(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x215f9
jmp 0x215fb
movl -0x1e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1e0(%rbp)
movl -0x1dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1dc(%rbp)
jmp 0x213f2
leaq 0x8aa53(%rip), %rsi     # 0xac078
leaq -0x1b0(%rbp), %rdi
callq 0x7530
jmp 0x21633
movl $0x0, -0x1f4(%rbp)
movl -0x1f4(%rbp), %eax
leaq 0xc63fa(%rip), %rcx     # 0xe7a44
movl (%rcx), %ecx
shll $0x2, %ecx
cmpl %ecx, %eax
jge 0x2167b
leaq 0x8aaa1(%rip), %rsi     # 0xac0fb
leaq -0x1b0(%rbp), %rdi
callq 0x7530
jmp 0x21668
jmp 0x2166a
movl -0x1f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f4(%rbp)
jmp 0x2163d
leaq 0x8a9f9(%rip), %rsi     # 0xac07b
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x270(%rbp)
jmp 0x21697
movq -0x270(%rbp), %rdi
leaq 0x8e060(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x216ac
cmpl $0x1, -0x14(%rbp)
jne 0x217b7
movl -0x24(%rbp), %eax
subl -0x28(%rbp), %eax
cvtsi2sd %eax, %xmm0
leaq 0x1ab5c9c9(%rip), %rax  # 0x1ab7e090
ucomisd (%rax), %xmm0
jbe 0x2173a
movl -0x24(%rbp), %eax
movl -0x28(%rbp), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
leaq 0x1ab5c9b0(%rip), %rax  # 0x1ab7e090
movsd (%rax), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq 0x8aa0e(%rip), %rsi     # 0xac102
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x278(%rbp)
jmp 0x21709
movq -0x278(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x7a60
movq %rax, -0x280(%rbp)
jmp 0x21723
movq -0x280(%rbp), %rdi
leaq 0x8dfd4(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x21738
jmp 0x217b2
movl -0x24(%rbp), %eax
movl -0x28(%rbp), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
leaq 0x1ab5c943(%rip), %rax  # 0x1ab7e090
movsd (%rax), %xmm1
subsd %xmm1, %xmm0
movaps 0x8a8d4(%rip), %xmm1    # 0xac030
pxor %xmm1, %xmm0
movlpd %xmm0, -0x38(%rbp)
leaq 0x8a99d(%rip), %rsi     # 0xac109
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x288(%rbp)
jmp 0x21781
movq -0x288(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x7a60
movq %rax, -0x290(%rbp)
jmp 0x2179b
movq -0x290(%rbp), %rdi
leaq 0x8df5c(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x217b0
jmp 0x217b2
jmp 0x218d0
movl -0x24(%rbp), %eax
subl -0x28(%rbp), %eax
cvtsi2sd %eax, %xmm0
leaq 0x1ab5c8c8(%rip), %rax  # 0x1ab7e090
movsd (%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x21856
movl -0x24(%rbp), %eax
movl -0x28(%rbp), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
leaq 0x1ab5c894(%rip), %rax  # 0x1ab7e090
movsd (%rax), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq 0x8a8f9(%rip), %rsi     # 0xac109
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x298(%rbp)
jmp 0x21825
movq -0x298(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x7a60
movq %rax, -0x2a0(%rbp)
jmp 0x2183f
movq -0x2a0(%rbp), %rdi
leaq 0x8deb8(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x21854
jmp 0x218ce
movl -0x24(%rbp), %eax
movl -0x28(%rbp), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
leaq 0x1ab5c827(%rip), %rax  # 0x1ab7e090
movsd (%rax), %xmm1
addsd %xmm1, %xmm0
movaps 0x8a7b8(%rip), %xmm1    # 0xac030
pxor %xmm1, %xmm0
movlpd %xmm0, -0x38(%rbp)
leaq 0x8a87a(%rip), %rsi     # 0xac102
leaq -0x1b0(%rbp), %rdi
callq 0x7530
movq %rax, -0x2a8(%rbp)
jmp 0x2189d
movq -0x2a8(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x7a60
movq %rax, -0x2b0(%rbp)
jmp 0x218b7
movq -0x2b0(%rbp), %rdi
leaq 0x8de40(%rip), %rsi     # 0xaf705
callq 0x7530
jmp 0x218cc
jmp 0x218ce
jmp 0x218d0
leaq -0x218(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x7580
jmp 0x218e5
movq 0xc5704(%rip), %rdi     # 0xe6ff0
leaq -0x218(%rbp), %rsi
callq 0x7480
jmp 0x218fa
leaq -0x218(%rbp), %rdi
callq 0x7ae8
movl $0x0, -0x1bc(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x7110
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x7ae8
leaq -0x1b0(%rbp), %rdi
callq 0x7110
movq -0x1c8(%rbp), %rdi
callq 0x79b0
nopl (%rax,%rax)