// File: /workspace/github_cpp_makefile_star2_O1/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 0x1ec1f(%rip), %xmm2    # 0x2c790
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1ec23(%rip), %xmm3    # 0x2c7a0
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 0x1ebfe(%rip), %xmm2    # 0x2c7b0
divsd %xmm2, %xmm1
xorps %xmm0, %xmm0
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
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
leaq 0x1cc6c(%rip), %rdi     # 0x2a860
xorl %eax, %eax
callq 0x640d
leaq 0x1eea1(%rip), %rdi     # 0x2caa3
movl %ebp, %esi
xorl %eax, %eax
callq 0x640d
shrq $0x3, %r14
movabsq $0x20c49ba5e353f7cf, %r15 # imm = 0x20C49BA5E353F7CF
movq %r14, %rax
mulq %r15
movq %rdx, %rsi
shrq $0x4, %rsi
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
shrq $0x3, %rax
mulq %r15
movq %rdx, %r8
shrq $0x4, %r8
shrq $0x3, %rcx
movq %rcx, %rax
mulq %r15
movq %rdx, %rcx
xorps %xmm0, %xmm0
cvtss2sd 0x10(%rsp), %xmm0
shrq $0x4, %rcx
xorps %xmm1, %xmm1
cvtss2sd 0xc(%rsp), %xmm1
leaq 0x1ee4a(%rip), %rdi     # 0x2cab0
movq %r8, %rdx
movb $0x2, %al
callq 0x640d
callq 0xdf58
movl %eax, %ebp
callq 0xb2c6
subl %eax, %ebp
incl %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
divsd 0x1eb29(%rip), %xmm0    # 0x2c7b8
cvtsd2ss %xmm0, %xmm0
movq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
movslq %ebp, %rcx
xorl %edx, %edx
divq %rcx
cvtss2sd %xmm0, %xmm0
leaq 0x1ee48(%rip), %rdi     # 0x2caf6
movq %rax, %rsi
movb $0x1, %al
callq 0x640d
leaq 0xea231(%rip), %rcx     # 0xf7ef0
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rcx
movq %rsi, %xmm0
movq 0x1eab8(%rip), %xmm2    # 0x2c790
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1eabc(%rip), %xmm3    # 0x2c7a0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
leaq 0x1(%rax), %rdx
movq %rdx, %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 0x1ea8f(%rip), %xmm2    # 0x2c7b0
divsd %xmm2, %xmm1
movapd %xmm2, %xmm3
movapd %xmm2, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movq %rcx, %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
xorps %xmm1, %xmm1
cvtsd2ss %xmm2, %xmm1
shrq $0x3, %rax
mulq %r15
movq %rdx, %r8
shrq $0x4, %r8
shrq $0x3, %rsi
movq %rsi, %rax
mulq %r15
movq %rdx, %r9
shrq $0x4, %r9
shrq $0x3, %rcx
movq %rcx, %rax
mulq %r15
movq %rdx, %rcx
cvtss2sd %xmm0, %xmm0
shrq $0x4, %rcx
cvtss2sd %xmm1, %xmm1
leaq 0x1ed8b(%rip), %rdi     # 0x2cb24
movq %r8, %rsi
movq %r9, %rdx
movb $0x2, %al
callq 0x640d
leaq 0xea173(%rip), %rcx     # 0xf7f20
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rcx
movq %rsi, %xmm0
movq 0x1e9ca(%rip), %xmm2    # 0x2c790
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1e9ce(%rip), %xmm3    # 0x2c7a0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
leaq 0x1(%rax), %rdx
movq %rdx, %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 0x1e9a5(%rip), %xmm2    # 0x2c7b0
divsd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movq %rcx, %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
xorps %xmm1, %xmm1
cvtsd2ss %xmm3, %xmm1
shrq $0x3, %rax
mulq %r15
movq %rdx, %r8
shrq $0x4, %r8
shrq $0x3, %rsi
movq %rsi, %rax
mulq %r15
movq %rdx, %r9
shrq $0x4, %r9
shrq $0x3, %rcx
movq %rcx, %rax
mulq %r15
movq %rdx, %rcx
cvtss2sd %xmm0, %xmm0
shrq $0x4, %rcx
cvtss2sd %xmm1, %xmm1
leaq 0x1ecf3(%rip), %rdi     # 0x2cb6c
movq %r8, %rsi
movq %r9, %rdx
movb $0x2, %al
callq 0x640d
movq (%rbx), %rsi
movq %rsi, %xmm0
movq 0x1e8fa(%rip), %xmm2    # 0x2c790
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1e8fe(%rip), %xmm4    # 0x2c7a0
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd 0x10(%rsp), %xmm3
divsd %xmm3, %xmm1
xorps %xmm0, %xmm0
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
xorps %xmm1, %xmm1
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
xorps %xmm2, %xmm2
cvtsd2ss %xmm3, %xmm2
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
leaq 0x1ec87(%rip), %rdi     # 0x2cbb9
movb $0x3, %al
callq 0x640d
movq 0x678(%rbx), %rsi
leaq 0x1ecc9(%rip), %rdi     # 0x2cc10
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x640d