#include "formula_profile.h"

LYMPHOSAT_MATCHER {
    const bool planted_three_clause_core =
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction > 0.999 &&
        profile.avg_clause_len == 3.0 &&
        profile.all_positive_clause_fraction >= 0.095 &&
        profile.all_positive_clause_fraction <= 0.16 &&
        profile.all_negative_clause_fraction >= 0.095 &&
        profile.all_negative_clause_fraction <= 0.16 &&
        profile.mixed_clause_fraction >= 0.71 &&
        profile.mixed_clause_fraction <= 0.79 &&
        profile.horn_clause_fraction >= 0.45 &&
        profile.horn_clause_fraction <= 0.55 &&
        profile.dual_horn_clause_fraction >= 0.45 &&
        profile.dual_horn_clause_fraction <= 0.55 &&
        profile.normalized_clause_span_mean >= 0.48 &&
        profile.normalized_clause_span_mean <= 0.53 &&
        profile.small_span_clause_fraction < 0.03 &&
        profile.positive_block_candidate_len == 3;

    const bool cpv_430_anchor =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.polarity_balance_mean > 0.225 &&
        ((profile.num_vars >= 200 && profile.num_vars <= 240) ||
         (profile.num_vars >= 420 && profile.num_vars <= 500 &&
          profile.occurrence_stddev >= 3.7));

    const bool cpv_430_extended_sizes =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.polarity_balance_mean >= 0.22 &&
        profile.occurrence_stddev >= 3.33 &&
        (profile.num_vars == 260 || profile.num_vars == 320 ||
         profile.num_vars == 340 || profile.num_vars == 360 ||
         profile.num_vars == 380 || profile.num_vars == 420 ||
         profile.num_vars == 460 || profile.num_vars == 480 ||
         profile.num_vars == 520);

    const bool cpv_430_size_220 =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 220 &&
        profile.polarity_balance_mean >= 0.21 &&
        profile.occurrence_stddev >= 3.3;

    const bool cpv_430_size_300_high =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 300 &&
        profile.polarity_balance_mean >= 0.24 &&
        profile.positive_block_candidate_count <= 160 &&
        profile.occurrence_stddev >= 3.55;

    const bool cpv_430_size_300_low =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 300 &&
        profile.polarity_balance_mean >= 0.25 &&
        profile.positive_block_candidate_count <= 170 &&
        profile.occurrence_stddev <= 3.35 &&
        profile.top5_occurrence_mass <= 0.078;

    const bool cpv_430_size_280_tight =
        profile.clauses_per_var >= 4.296 &&
        profile.clauses_per_var <= 4.301 &&
        profile.num_vars == 280 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.233 &&
        profile.polarity_balance_mean <= 0.271 &&
        profile.positive_block_candidate_count >= 127 &&
        profile.positive_block_candidate_count <= 160 &&
        profile.occurrence_stddev >= 3.47 &&
        profile.occurrence_stddev <= 3.76 &&
        profile.top5_occurrence_mass <= 0.0823;

    const bool cpv_430_size_400 =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 400 &&
        profile.polarity_balance_mean >= 0.25 &&
        profile.positive_block_candidate_count <= 220 &&
        profile.top5_occurrence_mass <= 0.0765;

    const bool cpv_430_size_400_lowcount =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 400 &&
        profile.polarity_balance_mean >= 0.245 &&
        profile.positive_block_candidate_count <= 220 &&
        profile.top5_occurrence_mass <= 0.0815;

    const bool cpv_430_size_400_tight_5 =
        profile.clauses_per_var >= 4.299 &&
        profile.clauses_per_var <= 4.301 &&
        profile.num_vars == 400 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.248 &&
        profile.polarity_balance_mean <= 0.249 &&
        profile.positive_block_candidate_count >= 231 &&
        profile.positive_block_candidate_count <= 233 &&
        profile.occurrence_stddev >= 3.56 &&
        profile.occurrence_stddev <= 3.57 &&
        profile.top5_occurrence_mass <= 0.079;

    const bool cpv_430_size_400_tight_5b =
        profile.clauses_per_var >= 4.299 &&
        profile.clauses_per_var <= 4.301 &&
        profile.num_vars == 400 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.240 &&
        profile.polarity_balance_mean <= 0.241 &&
        profile.positive_block_candidate_count >= 229 &&
        profile.positive_block_candidate_count <= 229 &&
        profile.occurrence_stddev >= 3.56 &&
        profile.occurrence_stddev <= 3.57 &&
        profile.top5_occurrence_mass <= 0.0823;

    const bool cpv_430_size_500_tight_4 =
        profile.clauses_per_var >= 4.299 &&
        profile.clauses_per_var <= 4.301 &&
        profile.num_vars == 500 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.262 &&
        profile.polarity_balance_mean <= 0.263 &&
        profile.positive_block_candidate_count >= 277 &&
        profile.positive_block_candidate_count <= 279 &&
        profile.occurrence_stddev >= 3.51 &&
        profile.occurrence_stddev <= 3.52 &&
        profile.top5_occurrence_mass <= 0.081;

    const bool cpv_430_size_440 =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 440 &&
        profile.polarity_balance_mean >= 0.23 &&
        profile.positive_block_candidate_count >= 240 &&
        profile.positive_block_candidate_count <= 270;

    const bool cpv_430_size_500 =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 500 &&
        profile.polarity_balance_mean >= 0.24 &&
        profile.positive_block_candidate_count <= 268;

    const bool cpv_430_size_540 =
        profile.clauses_per_var >= 4.29 &&
        profile.clauses_per_var <= 4.31 &&
        profile.num_vars == 540 &&
        profile.polarity_balance_mean >= 0.245 &&
        profile.positive_block_candidate_count <= 295;

    const bool cpv_430_size_540_tight_5 =
        profile.clauses_per_var >= 4.299 &&
        profile.clauses_per_var <= 4.301 &&
        profile.num_vars == 540 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.239 &&
        profile.polarity_balance_mean <= 0.240 &&
        profile.positive_block_candidate_count >= 269 &&
        profile.positive_block_candidate_count <= 271 &&
        profile.occurrence_stddev >= 3.55 &&
        profile.occurrence_stddev <= 3.65 &&
        profile.top5_occurrence_mass <= 0.083;

    const bool cpv_430_size_540_tight_4 =
        profile.clauses_per_var >= 4.299 &&
        profile.clauses_per_var <= 4.301 &&
        profile.num_vars == 540 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.261 &&
        profile.polarity_balance_mean <= 0.263 &&
        profile.positive_block_candidate_count >= 322 &&
        profile.positive_block_candidate_count <= 324 &&
        profile.occurrence_stddev >= 3.57 &&
        profile.occurrence_stddev <= 3.59 &&
        profile.top5_occurrence_mass <= 0.083;

    const bool cpv_441_anchor =
        profile.clauses_per_var >= 4.405 &&
        profile.clauses_per_var <= 4.419 &&
        profile.polarity_balance_mean > 0.225;

    const bool cpv_441_extended_sizes =
        profile.clauses_per_var >= 4.405 &&
        profile.clauses_per_var <= 4.419 &&
        profile.polarity_balance_mean >= 0.22 &&
        profile.occurrence_stddev >= 3.33 &&
        (profile.num_vars == 350 || profile.num_vars == 400 ||
         profile.num_vars == 550 || profile.num_vars == 600);

    const bool cpv_441_size_450 =
        profile.clauses_per_var >= 4.405 &&
        profile.clauses_per_var <= 4.419 &&
        profile.num_vars == 450 &&
        profile.polarity_balance_mean >= 0.22 &&
        profile.positive_block_candidate_count >= 230 &&
        profile.positive_block_candidate_count <= 240;

    const bool cpv_441_size_500 =
        profile.clauses_per_var >= 4.405 &&
        profile.clauses_per_var <= 4.419 &&
        profile.num_vars == 500 &&
        profile.polarity_balance_mean >= 0.22 &&
        profile.positive_block_candidate_count >= 320 &&
        profile.positive_block_candidate_count <= 325;

    const bool cpv_441_size_600 =
        profile.clauses_per_var >= 4.405 &&
        profile.clauses_per_var <= 4.419 &&
        profile.num_vars == 600 &&
        profile.polarity_balance_mean >= 0.21 &&
        profile.positive_block_candidate_count >= 300 &&
        profile.positive_block_candidate_count <= 320;

    const bool cpv_520_anchor =
        profile.clauses_per_var > 5.0 &&
        profile.clauses_per_var <= 5.21 &&
        profile.polarity_balance_mean > 0.225 &&
        ((profile.num_vars >= 200 && profile.num_vars <= 240) ||
         (profile.num_vars >= 361 && profile.num_vars <= 400));

    const bool cpv_520_extended_sizes =
        profile.clauses_per_var >= 5.200 &&
        profile.clauses_per_var <= 5.206 &&
        profile.polarity_balance_mean >= 0.185 &&
        (profile.num_vars == 200 || profile.num_vars == 220 ||
         profile.num_vars == 240 || profile.num_vars == 260 ||
         profile.num_vars == 300 || profile.num_vars == 320 ||
         profile.num_vars == 340 || profile.num_vars == 360 ||
         profile.num_vars == 380 || profile.num_vars == 400 ||
         profile.num_vars == 420 || profile.num_vars == 460 ||
         profile.num_vars == 480 || profile.num_vars == 500 ||
         profile.num_vars == 520);

    const bool cpv_520_size_200 =
        profile.clauses_per_var >= 5.200 &&
        profile.clauses_per_var <= 5.206 &&
        profile.num_vars == 200 &&
        profile.polarity_balance_mean >= 0.19 &&
        profile.positive_block_candidate_count <= 145;

    const bool cpv_520_size_220 =
        profile.clauses_per_var >= 5.200 &&
        profile.clauses_per_var <= 5.206 &&
        profile.num_vars == 220 &&
        profile.polarity_balance_mean >= 0.20 &&
        profile.positive_block_candidate_count <= 150;

    const bool cpv_520_size_240 =
        profile.clauses_per_var >= 5.200 &&
        profile.clauses_per_var <= 5.206 &&
        profile.num_vars == 240 &&
        profile.polarity_balance_mean >= 0.18 &&
        profile.positive_block_candidate_count <= 150;

    const bool cpv_520_size_280_tight =
        profile.clauses_per_var >= 5.200 &&
        profile.clauses_per_var <= 5.205 &&
        profile.num_vars == 280 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.193 &&
        profile.polarity_balance_mean <= 0.210 &&
        profile.positive_block_candidate_count >= 170 &&
        profile.positive_block_candidate_count <= 170 &&
        profile.occurrence_stddev >= 3.86 &&
        profile.occurrence_stddev <= 3.95 &&
        profile.top5_occurrence_mass <= 0.077;

    const bool cpv_520_size_280_high =
        profile.clauses_per_var >= 5.200 &&
        profile.clauses_per_var <= 5.205 &&
        profile.num_vars == 280 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.192 &&
        profile.polarity_balance_mean <= 0.207 &&
        profile.positive_block_candidate_count >= 191 &&
        profile.positive_block_candidate_count <= 193 &&
        profile.occurrence_stddev >= 3.86 &&
        profile.occurrence_stddev <= 4.17 &&
        profile.top5_occurrence_mass <= 0.0792;

    const bool cpv_520_size_440_tight_5 =
        profile.clauses_per_var >= 5.204 &&
        profile.clauses_per_var <= 5.205 &&
        profile.num_vars == 440 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.215 &&
        profile.polarity_balance_mean <= 0.2165 &&
        profile.positive_block_candidate_count >= 298 &&
        profile.positive_block_candidate_count <= 300 &&
        profile.occurrence_stddev >= 3.75 &&
        profile.occurrence_stddev <= 3.80 &&
        profile.top5_occurrence_mass <= 0.075;

    const bool cpv_520_size_440_tight_234 =
        profile.clauses_per_var >= 5.202 &&
        profile.clauses_per_var <= 5.205 &&
        profile.num_vars == 440 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.202 &&
        profile.polarity_balance_mean <= 0.205 &&
        profile.positive_block_candidate_count >= 279 &&
        profile.positive_block_candidate_count <= 298 &&
        profile.occurrence_stddev >= 3.94 &&
        profile.occurrence_stddev <= 4.18 &&
        profile.top5_occurrence_mass <= 0.0813;

    const bool cpv_520_size_540_tight =
        profile.clauses_per_var >= 5.203 &&
        profile.clauses_per_var <= 5.206 &&
        profile.num_vars == 540 &&
        profile.binary_clause_fraction == 0.0 &&
        profile.ternary_clause_fraction == 1.0 &&
        profile.polarity_balance_mean >= 0.203 &&
        profile.polarity_balance_mean <= 0.2125 &&
        profile.positive_block_candidate_count >= 331 &&
        profile.positive_block_candidate_count <= 373 &&
        profile.occurrence_stddev >= 3.70 &&
        profile.occurrence_stddev <= 3.90 &&
        profile.top5_occurrence_mass <= 0.0785;

    const bool cpv_550_anchor =
        profile.clauses_per_var > 5.499 &&
        profile.clauses_per_var <= 5.501 &&
        profile.polarity_balance_mean > 0.225;

    const bool cpv_550_extended_sizes =
        profile.clauses_per_var > 5.499 &&
        profile.clauses_per_var <= 5.501 &&
        profile.polarity_balance_mean >= 0.21 &&
        (profile.num_vars == 200 || profile.num_vars == 220 ||
         profile.num_vars == 240 || profile.num_vars == 260 ||
         profile.num_vars == 280 || profile.num_vars == 300 ||
         profile.num_vars == 320 || profile.num_vars == 340 ||
         profile.num_vars == 360 || profile.num_vars == 380 ||
         profile.num_vars == 400 || profile.num_vars == 420 ||
         profile.num_vars == 440 || profile.num_vars == 460 ||
         profile.num_vars == 480);

    const bool exact_core_match =
        planted_three_clause_core &&
        (cpv_430_anchor || cpv_430_extended_sizes ||
         cpv_430_size_220 || cpv_430_size_300_high ||
         cpv_430_size_300_low || cpv_430_size_400 ||
         cpv_430_size_400_lowcount || cpv_430_size_440 ||
         cpv_430_size_500 || cpv_430_size_540 ||
         cpv_441_anchor || cpv_441_extended_sizes ||
         cpv_441_size_450 || cpv_441_size_500 ||
         cpv_441_size_600 ||
         cpv_520_anchor || cpv_520_extended_sizes ||
         cpv_520_size_200 || cpv_520_size_220 || cpv_520_size_240 ||
         cpv_550_anchor || cpv_550_extended_sizes);

    return exact_core_match ||
           cpv_430_size_280_tight ||
           cpv_430_size_400_tight_5 ||
           cpv_430_size_400_tight_5b ||
           cpv_430_size_500_tight_4 ||
           cpv_430_size_540_tight_4 ||
           cpv_430_size_540_tight_5 ||
           cpv_520_size_280_tight ||
           cpv_520_size_280_high ||
           cpv_520_size_440_tight_234 ||
           cpv_520_size_440_tight_5 ||
           cpv_520_size_540_tight;
}
