static void read_hints __P((FILE *, struct ohash *, int, const char *));
static unsigned int read_hints __P((FILE *, struct ohash *, int, const char *, unsigned int));
static struct node *new_node __P((const char *, const char *));static void read_pairs __P((FILE *, struct ohash *, int, const char *));static void split_nodes __P((struct ohash *, struct array *, struct array *));static void insert_arc __P((struct node *, struct node *));#ifdef DEBUGstatic void dump_node __P((struct node *));static void dump_array __P((struct array *));static void dump_hash __P((struct ohash *));#endifstatic void read_hints __P((FILE *, struct ohash *, int, const char *));static struct node *find_smallest_node __P((struct array *));static struct node *find_good_cycle_break __P((struct array *));static void print_cycle __P((struct array *));static int find_cycle_with __P((struct node *, struct array *));static struct node *find_predecessor __P((struct array *, struct node *));static unsigned int traverse_node __P((struct node *, unsigned int, struct array *));static struct node *find_longest_cycle __P((struct array *, struct array *));static void heap_down __P((struct array *, unsigned int));static void heapify __P((struct array *, int));static struct node *dequeue __P((struct array *));static void enqueue __P((struct array *, struct node *));#define erealloc(n, s)	emem(realloc(n, s))static void *hash_alloc __P((size_t, void *));static void hash_free __P((void *, size_t, void *));static void* entry_alloc __P((size_t, void *));static void *emalloc __P((size_t));static void *emem __P((void *));#define DEBUG_TRAVERSE 0static struct ohash_info node_info = { 	offsetof(struct node, k), NULL, hash_alloc, hash_free, entry_alloc };int main __P((int, char *[]));/*** *** Memory handling.  ***/static void *emem(p)	void 		*p;{	if (p)		return p;	else		errx(EX_SOFTWARE, "Memory exhausted");}static void *hash_alloc(s, u)	size_t s;	void *u		UNUSED;{	return emem(calloc(s, 1));}static voidhash_free(p, s, u)	void *p;	size_t s	UNUSED;	void *u		UNUSED;{	free(p);}static void *entry_alloc(s, u)	size_t s;	void *u		UNUSED;{	return emalloc(s);}static void *emalloc(s)	size_t s;{	return emem(malloc(s));}/***  *** Hash table. ***//* Inserting and finding nodes in the hash structure. * We handle interval strings for efficiency wrt fgetln.  */static struct node *new_node(start, end)	const char 	*start;	const char 	*end;{	struct node 	*n;	n = ohash_create_entry(&node_info, start, &end);	n->from = NULL;	n->arcs = NULL;	n->refs = 0;	n->mark = 0;	n->order = 0;	n->traverse = NULL;	return n;}