pattern_history_analysis.cpp is working now!