#ifndef CBM_AC_H
#define CBM_AC_H
#include <stdint.h>
typedef struct CBMAutomaton CBMAutomaton;
typedef struct {
const char *data;
int compressed_len;
int original_len;
} CBMLz4Entry;
typedef struct {
int file_index;
uint64_t bitmask;
} CBMLz4Match;
typedef struct {
int name_index;
int pattern_id;
} CBMMatchResult;
CBMAutomaton *cbm_ac_build(const char **patterns, const int *lengths, int count,
const uint8_t *alpha_map, int alpha_size);
void cbm_ac_free(CBMAutomaton *ac);
uint64_t cbm_ac_scan_bitmask(const CBMAutomaton *ac, const char *text, int text_len);
uint64_t cbm_ac_scan_lz4_bitmask(const CBMAutomaton *ac, const char *compressed, int compressed_len,
int original_len);
int cbm_ac_scan_lz4_batch(const CBMAutomaton *ac, const CBMLz4Entry *entries, int num_entries,
CBMLz4Match *out_matches, int max_matches);
int cbm_ac_scan_batch(const CBMAutomaton *ac, const char *names_buf, const int *name_offsets,
const int *name_lengths, int num_names, CBMMatchResult *out_matches,
int max_matches);
int cbm_ac_num_states(const CBMAutomaton *ac);
int cbm_ac_num_patterns(const CBMAutomaton *ac);
int cbm_ac_table_bytes(const CBMAutomaton *ac);
#endif