/* If addr_link is not NULL, then '*addr_link' is set to the address of the last followed link. If the found node is the root, or if the tree is empty, then '*addr_link' is set to ADDR_NULL.  */
static uint32_t find_node(br_ssl_session_cache_lru *cc, const unsigned char *id, uint32_t *addr_link)
/* If addr_link is not NULL, then '*addr_link' is set to the address of the last followed link. If the found node is the root, or if the tree is empty, then '*addr_link' is set to ADDR_NULL.  */
static uint32_t find_node(br_ssl_session_cache_lru *cc, const unsigned char *id, uint32_t *addr_link)
{
	uint32_t x, y;
	x = cc->root;
	y = ADDR_NULL;
	while (x != ADDR_NULL) {
		int r;
		r = memcmp(id, cc->store + x + SESSION_ID_OFF, SESSION_ID_LEN);
		if (r < 0) {
			y = x + TREE_LEFT_OFF;
			x = get_left(cc, x);
		} else if (r == 0) {
			if (addr_link != NULL) {
				*addr_link = y;
			}
			return x;
		} else {
			y = x + TREE_RIGHT_OFF;
			x = get_right(cc, x);
		}
	}
	if (addr_link != NULL) {
		*addr_link = y;
	}
	return ADDR_NULL;
}