// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/src/think.cpp
// Function: print_search_summary(int, search_stats*)
void print_search_summary(int last_depth,search_stats *stats) {
    uint64 total_nodes = stats->nodes + stats->qnodes;

    float interior_pct = stats->nodes / (total_nodes/100.0);
    float qnode_pct = stats->qnodes / (total_nodes/100.0);

    print("\n");
    print("# depth: %d\n",last_depth);
    print("# nodes: %lluk, interior: %lluk (%.2f%%), quiescence: %lluk (%.2f%%)\n",
            total_nodes/1000,stats->nodes/1000,interior_pct,stats->qnodes/1000,qnode_pct);

    int32 search_time_ms = milli_timer() - get_start_time() + 1; // add 1 ms just to avoid div by 0
    float search_time = search_time_ms / 1000.0;
    uint64 nps = (stats->nodes+stats->qnodes) / search_time_ms;
    print("# search time: %.2f seconds, rate: %llu kn/s\n",search_time,nps);

    uint64 hash_hits = htbl.hits;
    uint64 hash_probes = htbl.probes;
    uint64 hash_collisions = htbl.collisions;
    float hash_hit_pct = hash_hits / ((hash_probes+1)/100.0);
    float hash_collision_pct = hash_collisions / ((hash_probes+1)/100.0);
    print("# hash probes: %lluk, hits: %lluk (%.2f%%), collisions: %lluk (%.2f%%)\n",
            hash_probes/1000,
            hash_hits/1000,hash_hit_pct,
            hash_collisions/1000,hash_collision_pct);

    uint64 pawn_hash_hits = phtbl.hits;
    uint64 pawn_hash_probes = phtbl.probes;
    uint64 pawn_hash_collisions = phtbl.collisions;
    float pawn_hash_hit_pct = pawn_hash_hits / ((pawn_hash_probes+1)/100.0);
    float pawn_hash_collision_pct = pawn_hash_collisions / ((pawn_hash_probes+1)/100.0);
    print("# pawn hash probes: %lluk, hits: %lluk (%.2f%%), collisions: %lluk (%.2f%%)\n",
            pawn_hash_probes/1000,
            pawn_hash_hits/1000,pawn_hash_hit_pct,
            pawn_hash_collisions/1000,pawn_hash_collision_pct);

    float fail_high_pct = stats->fail_highs / ((hash_probes+1)/100.0);
    float fail_low_pct = stats->fail_lows / ((hash_probes+1)/100.0);
    float exact_score_pct = stats->hash_exact_scores / ((hash_probes+1)/100.0);

    print("# fail highs: %lluk (%.2f%%), fail lows: %lluk (%.2f%%), exact scores: %lluk (%.2f%%)\n",
            stats->fail_highs,fail_high_pct,
            stats->fail_lows,fail_low_pct,
            stats->hash_exact_scores,exact_score_pct);

    print("# prunes: %llu\n", stats->prunes);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movq 0x18(%rsi), %rax
movq 0x20(%rsi), %rcx
leaq (%rcx,%rax), %r14
movq %rax, %xmm0
movq 0x1d6db(%rip), %xmm2    # 0x2a7c0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1d6df(%rip), %xmm3    # 0x2a7d0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq %r14, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movdqa %xmm2, %xmm4
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
divsd 0x1d6ba(%rip), %xmm2    # 0x2a7e0
divsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x10(%rsp)
movq %rcx, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
leaq 0x1b72e(%rip), %rdi     # 0x28890
xorl %eax, %eax
callq 0x5fdd
leaq 0x1d963(%rip), %rdi     # 0x2aad3
movl %ebp, %esi
xorl %eax, %eax
callq 0x5fdd
movl $0x3e8, %r15d           # imm = 0x3E8
movq %r14, %rax
xorl %edx, %edx
divq %r15
movq %rax, %rsi
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
xorl %edx, %edx
divq %r15
movq %rax, %r8
cvtss2sd 0x10(%rsp), %xmm0
movq %rcx, %rax
xorl %edx, %edx
divq %r15
cvtss2sd 0xc(%rsp), %xmm1
leaq 0x1d92b(%rip), %rdi     # 0x2aae0
movq %r8, %rdx
movq %rax, %rcx
movb $0x2, %al
callq 0x5fdd
callq 0xd470
movl %eax, %ebp
callq 0xa956
subl %eax, %ebp
incl %ebp
cvtsi2sd %ebp, %xmm0
divsd 0x1d60a(%rip), %xmm0    # 0x2a7e8
cvtsd2ss %xmm0, %xmm0
movq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
movslq %ebp, %rcx
xorl %edx, %edx
divq %rcx
cvtss2sd %xmm0, %xmm0
leaq 0x1d929(%rip), %rdi     # 0x2ab26
movq %rax, %rsi
movb $0x1, %al
callq 0x5fdd
leaq 0xedce2(%rip), %rdx     # 0xfaef0
movq 0x18(%rdx), %rax
movq 0x20(%rdx), %rcx
movq %rcx, %xmm0
movq 0x1d59d(%rip), %xmm2    # 0x2a7c0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1d5a1(%rip), %xmm3    # 0x2a7d0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
leaq 0x1(%rax), %rsi
movq %rsi, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movdqa %xmm2, %xmm4
subpd %xmm3, %xmm0
movapd %xmm3, %xmm5
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
divsd 0x1d574(%rip), %xmm2    # 0x2a7e0
divsd %xmm2, %xmm1
movapd %xmm2, %xmm3
movapd %xmm2, 0x10(%rsp)
cvtsd2ss %xmm1, %xmm0
movq 0x28(%rdx), %rsi
movq %rsi, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm5, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm3, %xmm2
cvtsd2ss %xmm2, %xmm1
xorl %edx, %edx
divq %r15
movq %rax, %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r15
movq %rax, %rcx
cvtss2sd %xmm0, %xmm0
movq %rsi, %rax
xorl %edx, %edx
divq %r15
cvtss2sd %xmm1, %xmm1
leaq 0x1d887(%rip), %rdi     # 0x2ab54
movq %r8, %rsi
movq %rcx, %rdx
movq %rax, %rcx
movb $0x2, %al
callq 0x5fdd
leaq 0xedc3c(%rip), %rdx     # 0xfaf20
movq 0x18(%rdx), %rax
movq 0x20(%rdx), %rcx
movq %rcx, %xmm0
movq 0x1d4c7(%rip), %xmm2    # 0x2a7c0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1d4cb(%rip), %xmm3    # 0x2a7d0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
leaq 0x1(%rax), %rsi
movq %rsi, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movdqa %xmm2, %xmm4
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
divsd 0x1d4a2(%rip), %xmm2    # 0x2a7e0
divsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm0
movq 0x28(%rdx), %rsi
movq %rsi, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
addsd %xmm1, %xmm3
divsd %xmm2, %xmm3
cvtsd2ss %xmm3, %xmm1
xorl %edx, %edx
divq %r15
movq %rax, %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r15
movq %rax, %rcx
cvtss2sd %xmm0, %xmm0
movq %rsi, %rax
xorl %edx, %edx
divq %r15
cvtss2sd %xmm1, %xmm1
leaq 0x1d807(%rip), %rdi     # 0x2ab9c
movq %r8, %rsi
movq %rcx, %rdx
movq %rax, %rcx
movb $0x2, %al
callq 0x5fdd
movq (%rbx), %rsi
movq %rsi, %xmm0
movq 0x1d40b(%rip), %xmm2    # 0x2a7c0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1d40f(%rip), %xmm4    # 0x2a7d0
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd 0x10(%rsp), %xmm3
divsd %xmm3, %xmm1
cvtsd2ss %xmm1, %xmm0
movq 0x8(%rbx), %rdx
movq %rdx, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movdqa %xmm2, %xmm5
subpd %xmm4, %xmm1
movapd %xmm4, %xmm6
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm3, %xmm2
movapd %xmm3, %xmm4
cvtsd2ss %xmm2, %xmm1
movq 0x10(%rbx), %rcx
movq %rcx, %xmm2
punpckldq %xmm5, %xmm2    # xmm2 = xmm2[0],xmm5[0],xmm2[1],xmm5[1]
subpd %xmm6, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
divsd %xmm4, %xmm3
cvtsd2ss %xmm3, %xmm2
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
leaq 0x1d7a1(%rip), %rdi     # 0x2abe9
movb $0x3, %al
callq 0x5fdd
movq 0x678(%rbx), %rsi
leaq 0x1d7e3(%rip), %rdi     # 0x2ac40
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5fdd
nop