#ifndef REGEX_H_
#define REGEX_H_
#include <stdio.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define LABELS_SIZE 128
struct _NFA {
struct _NFA *edges[2];
bool noname[2]; /* 添字のラベルが付けられてないなら真 */
int labels[LABELS_SIZE]; /* 添字はラベル名として扱い、中の値はedgesの添字として扱う。*/
int id; /* ループ判定用。edgesの先のノードのidより大きいならループ。 */
};
typedef struct _NFA *NFA;
NFA regex_compile(const char *str);
char* regex_search(NFA node, const char *str);
#endif
I2lmbmRlZiBSRUdFWF9IXwojZGVmaW5lIFJFR0VYX0hfCgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGJvb2wuaD4KI2luY2x1ZGUgPHN0ZGFyZy5oPgojaW5jbHVkZSA8c3RkbGliLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPGN0eXBlLmg+CgojZGVmaW5lIExBQkVMU19TSVpFIDEyOAoKc3RydWN0IF9ORkEgewogIHN0cnVjdCBfTkZBICplZGdlc1syXTsKICBib29sIG5vbmFtZVsyXTsgICAgCS8qIOa3u+Wtl+OBruODqeODmeODq+OBjOS7mOOBkeOCieOCjOOBpuOBquOBhOOBquOCieecnyAqLwogIGludCBsYWJlbHNbTEFCRUxTX1NJWkVdOyAvKiDmt7vlrZfjga/jg6njg5njg6vlkI3jgajjgZfjgabmibHjgYTjgIHkuK3jga7lgKTjga9lZGdlc+OBrua3u+Wtl+OBqOOBl+OBpuaJseOBhuOAgiovCiAgaW50IGlkOwkJICAgLyog44Or44O844OX5Yik5a6a55So44CCZWRnZXPjga7lhYjjga7jg47jg7zjg4njga5pZOOCiOOCiuWkp+OBjeOBhOOBquOCieODq+ODvOODl+OAgiAqLwp9OwoKdHlwZWRlZiBzdHJ1Y3QgX05GQSAqTkZBOwoKTkZBIHJlZ2V4X2NvbXBpbGUoY29uc3QgY2hhciAqc3RyKTsKY2hhciogcmVnZXhfc2VhcmNoKE5GQSBub2RlLCBjb25zdCBjaGFyICpzdHIpOwoKI2VuZGlmCg==