// File: ATOMIC-LICHESS[P]ATOMKRAFT/evaluate.cpp
// Function: trace_evaluate[abi:cxx11](Position const&)
std::string trace_evaluate(const Position& pos) {

    Value margin;
    std::string totals;

    TraceStream.str("");
    TraceStream << std::showpoint << std::showpos << std::fixed << std::setprecision(2);
    memset(TracedScores, 0, 2 * 16 * sizeof(Score));

    NEW bool expl_threat;
    do_evaluate<false, true>(pos, margin, &expl_threat);

    totals = TraceStream.str();
    TraceStream.str("");

    TraceStream << std::setw(21) << "Eval term " << "|    White    |    Black    |     Total     \n"
                <<             "                     |   MG    EG  |   MG    EG  |   MG     EG   \n"
                <<             "---------------------+-------------+-------------+---------------\n";

    trace_row("Material, PST, Tempo", PST);
    trace_row("Material imbalance", IMBALANCE);
    trace_row("Pawns", PAWN);
    trace_row("Knights", KNIGHT);
    trace_row("Bishops", BISHOP);
    trace_row("Rooks", ROOK);
    trace_row("Queens", QUEEN);
    trace_row("Mobility", MOBILITY);
    trace_row("King safety", KING);
    trace_row("Threats", THREAT);
    trace_row("Passed pawns", PASSED);
    trace_row("Unstoppable pawns", UNSTOPPABLE);
    trace_row("Space", SPACE);

    TraceStream <<             "---------------------+-------------+-------------+---------------\n";
    trace_row("Total", TOTAL);
    TraceStream << totals;

    return TraceStream.str();
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x70(%rsp)
movq %rdi, %rax
movq %rax, 0x78(%rsp)
movq %rdi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x6730
leaq 0xef(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x6980
movq 0x80(%rsp), %rdx
leaq 0x3875f(%rip), %rsi     # 0x57234
leaq 0xf0(%rsp), %rdi
callq 0x12070
jmp 0x1eae4
leaq 0x3c3db5(%rip), %rdi    # 0x3e28a0
leaq 0xf0(%rsp), %rsi
callq 0x6590
jmp 0x1eafa
leaq 0xf0(%rsp), %rdi
callq 0x6a78
leaq 0xef(%rsp), %rdi
callq 0x6550
leaq 0x3c3d95(%rip), %rdi    # 0x3e28b0
leaq 0x95be(%rip), %rsi      # 0x280e0
callq 0x6170
movq %rax, 0x68(%rsp)
jmp 0x1eb2e
movq 0x68(%rsp), %rdi
leaq 0x95c6(%rip), %rsi      # 0x28100
callq 0x6170
movq %rax, 0x60(%rsp)
jmp 0x1eb46
movq 0x60(%rsp), %rdi
leaq 0x95ce(%rip), %rsi      # 0x28120
callq 0x6170
movq %rax, 0x58(%rsp)
jmp 0x1eb5e
movl $0x2, %edi
callq 0x28140
movl %eax, 0x54(%rsp)
jmp 0x1eb6e
movq 0x58(%rsp), %rdi
movl 0x54(%rsp), %eax
movl %eax, 0xd8(%rsp)
movl 0xd8(%rsp), %esi
callq 0x6830
jmp 0x1eb8c
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x3c3f25(%rip)   # 0x3e2ac0
movaps %xmm0, 0x3c3f0e(%rip)   # 0x3e2ab0
movaps %xmm0, 0x3c3ef7(%rip)   # 0x3e2aa0
movaps %xmm0, 0x3c3ee0(%rip)   # 0x3e2a90
movaps %xmm0, 0x3c3ec9(%rip)   # 0x3e2a80
movaps %xmm0, 0x3c3eb2(%rip)   # 0x3e2a70
movaps %xmm0, 0x3c3e9b(%rip)   # 0x3e2a60
movaps %xmm0, 0x3c3e84(%rip)   # 0x3e2a50
movq 0x138(%rsp), %rdi
leaq 0x134(%rsp), %rsi
leaq 0xd7(%rsp), %rdx
callq 0x1ef30
jmp 0x1ebeb
leaq 0x3c3cae(%rip), %rsi    # 0x3e28a0
leaq 0xb0(%rsp), %rdi
callq 0x64a0
jmp 0x1ec01
leaq 0x110(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
movq %rsi, 0x30(%rsp)
callq 0x6640
movq 0x30(%rsp), %rdi
callq 0x6a78
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x6980
movq 0x38(%rsp), %rdx
leaq 0x385f1(%rip), %rsi     # 0x57234
leaq 0x90(%rsp), %rdi
callq 0x12070
jmp 0x1ec52
leaq 0x3c3c47(%rip), %rdi    # 0x3e28a0
leaq 0x90(%rsp), %rsi
callq 0x6590
jmp 0x1ec68
leaq 0x90(%rsp), %rdi
callq 0x6a78
leaq 0x8f(%rsp), %rdi
callq 0x6550
movl $0x15, %edi
callq 0x28160
movl %eax, 0x2c(%rsp)
jmp 0x1ec92
movl 0x2c(%rsp), %eax
movl %eax, 0x88(%rsp)
movl 0x88(%rsp), %esi
leaq 0x3c3c05(%rip), %rdi    # 0x3e28b0
callq 0x65a0
movq %rax, 0x20(%rsp)
jmp 0x1ecb7
movq 0x20(%rsp), %rdi
leaq 0x3b150(%rip), %rsi     # 0x59e13
callq 0x64b0
movq %rax, 0x18(%rsp)
jmp 0x1eccf
movq 0x18(%rsp), %rdi
leaq 0x3b143(%rip), %rsi     # 0x59e1e
callq 0x64b0
movq %rax, 0x10(%rsp)
jmp 0x1ece7
movq 0x10(%rsp), %rdi
leaq 0x3b159(%rip), %rsi     # 0x59e4c
callq 0x64b0
movq %rax, 0x8(%rsp)
jmp 0x1ecff
movq 0x8(%rsp), %rdi
leaq 0x3b184(%rip), %rsi     # 0x59e8f
callq 0x64b0
jmp 0x1ed12
leaq 0x3b1b9(%rip), %rdi     # 0x59ed2
movl $0x8, %esi
callq 0x1fc20
jmp 0x1ed25
leaq 0x3b1bb(%rip), %rdi     # 0x59ee7
movl $0x9, %esi
callq 0x1fc20
jmp 0x1ed38
leaq 0x3b1bb(%rip), %rdi     # 0x59efa
movl $0x1, %esi
callq 0x1fc20
jmp 0x1ed4b
leaq 0x3b1ae(%rip), %rdi     # 0x59f00
movl $0x2, %esi
callq 0x1fc20
jmp 0x1ed5e
leaq 0x3b1a3(%rip), %rdi     # 0x59f08
movl $0x3, %esi
callq 0x1fc20
jmp 0x1ed71
leaq 0x3b198(%rip), %rdi     # 0x59f10
movl $0x4, %esi
callq 0x1fc20
jmp 0x1ed84
leaq 0x3b18b(%rip), %rdi     # 0x59f16
movl $0x5, %esi
callq 0x1fc20
jmp 0x1ed97
leaq 0x3b17f(%rip), %rdi     # 0x59f1d
movl $0xa, %esi
callq 0x1fc20
jmp 0x1edaa
leaq 0x3b175(%rip), %rdi     # 0x59f26
movl $0x6, %esi
callq 0x1fc20
jmp 0x1edbd
leaq 0x3b16e(%rip), %rdi     # 0x59f32
movl $0xb, %esi
callq 0x1fc20
jmp 0x1edd0
leaq 0x3b163(%rip), %rdi     # 0x59f3a
movl $0xc, %esi
callq 0x1fc20
jmp 0x1ede3
leaq 0x3b15d(%rip), %rdi     # 0x59f47
movl $0xd, %esi
callq 0x1fc20
jmp 0x1edf6
leaq 0x3afe7(%rip), %rdi     # 0x59de4
movl $0xe, %esi
callq 0x1fc20
jmp 0x1ee09
leaq 0x3c3aa0(%rip), %rdi    # 0x3e28b0
leaq 0x3b078(%rip), %rsi     # 0x59e8f
callq 0x64b0
jmp 0x1ee1e
leaq 0x3b134(%rip), %rdi     # 0x59f59
movl $0xf, %esi
callq 0x1fc20
jmp 0x1ee31
leaq 0x3c3a78(%rip), %rdi    # 0x3e28b0
leaq 0x110(%rsp), %rsi
callq 0x6420
jmp 0x1ee47
movq 0x70(%rsp), %rdi
leaq 0x3c3a4d(%rip), %rsi    # 0x3e28a0
callq 0x64a0
jmp 0x1ee5a
leaq 0x110(%rsp), %rdi
callq 0x6a78
movq 0x78(%rsp), %rax
addq $0x148, %rsp            # imm = 0x148
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0x1eeab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x6a78
leaq 0xef(%rsp), %rdi
callq 0x6550
jmp 0x1ef14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0x1ef14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
jmp 0x1ef07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x6a78
leaq 0x8f(%rsp), %rdi
callq 0x6550
leaq 0x110(%rsp), %rdi
callq 0x6a78
movq 0xe0(%rsp), %rdi
callq 0x6970
nop