#ifndef _preprocess_hpp_INCLUDED
#define _preprocess_hpp_INCLUDED

#include "utils/hashmap.hpp"
#include "utils/vec.hpp"
typedef long long ll;

struct preprocess {
public:   
    preprocess();
    int vars;
    int clauses;
    vec<vec<int>> clause, res_clause;
    void readfile(const char *file);
    void release();
    
    int maxlen, orivars, oriclauses, res_clauses, resolutions;
    int *f, nlit, *a, *val, *color, *varval, *q, *seen, *resseen, *clean, *mapto, *mapfrom, *mapval;
    HashMap* C;
    vec<int> *occurp, *occurn, clause_delete, nxtc, resolution;

    ll mapv(int a, int b);
    int find(int x);    
    bool res_is_empty(int var);
    void update_var_clause_label();
    void preprocess_init();
    bool preprocess_resolution();
    bool preprocess_binary();
    bool preprocess_easy_clause();
    void get_complete_model();
    int  do_preprocess(char* filename);
};


#endif