register int			startisdst;
outzone(zpfirst, zonecount)const struct zone * const	zpfirst;const int			zonecount;{	register const struct zone *	zp;	register struct rule *		rp;	register int			i, j;	register int			usestart, useuntil;	register time_t			starttime, untiltime;	register long			gmtoff;	register long			stdoff;	register int			year;	register long			startoff;	register int			startisdst;	register int			startttisstd;	register int			startttisgmt;	register int			type;	char				startbuf[BUFSIZ];	INITIALIZE(untiltime);	INITIALIZE(starttime);	INITIALIZE(startoff);	/*	** Now. . .finally. . .generate some useful data!	*/	timecnt = 0;	typecnt = 0;	charcnt = 0;	/*	** A guess that may well be corrected later.	*/	stdoff = 0;	/*	** Thanks to Earl Chew (earl@dnd.icp.nec.com.au)	** for noting the need to unconditionally initialize startttisstd.	*/	startttisstd = FALSE;	startttisgmt = FALSE;	for (i = 0; i < zonecount; ++i) {		zp = &zpfirst[i];		usestart = i > 0 && (zp - 1)->z_untiltime > min_time;		useuntil = i < (zonecount - 1);		if (useuntil && zp->z_untiltime <= min_time)			continue;		gmtoff = zp->z_gmtoff;		eat(zp->z_filename, zp->z_linenum);		startisdst = -1;		if (zp->z_nrules == 0) {			stdoff = zp->z_stdoff;			doabbr(startbuf, zp->z_format,				(char *) NULL, stdoff != 0);			type = addtype(oadd(zp->z_gmtoff, stdoff),				startbuf, stdoff != 0, startttisstd,				startttisgmt);			if (usestart)				addtt(starttime, type);			else if (stdoff != 0)				addtt(min_time, type);		} else for (year = min_year; year <= max_year; ++year) {			if (useuntil && year > zp->z_untilrule.r_hiyear)				break;			/*			** Mark which rules to do in the current year.			** For those to do, calculate rpytime(rp, year);			*/			for (j = 0; j < zp->z_nrules; ++j) {				rp = &zp->z_rules[j];				eats(zp->z_filename, zp->z_linenum,					rp->r_filename, rp->r_linenum);				rp->r_todo = year >= rp->r_loyear &&						year <= rp->r_hiyear &&						yearistype(year, rp->r_yrtype);				if (rp->r_todo)					rp->r_temp = rpytime(rp, year);			}			for ( ; ; ) {				register int	k;				register time_t	jtime, ktime;				register long	offset;				char		buf[BUFSIZ];				INITIALIZE(ktime);				if (useuntil) {					/*					** Turn untiltime into GMT					** assuming the current gmtoff and					** stdoff values.					*/					untiltime = zp->z_untiltime;					if (!zp->z_untilrule.r_todisgmt)						untiltime = tadd(untiltime,							-gmtoff);					if (!zp->z_untilrule.r_todisstd)						untiltime = tadd(untiltime,							-stdoff);				}				/*				** Find the rule (of those to do, if any)				** that takes effect earliest in the year.				*/				k = -1;				for (j = 0; j < zp->z_nrules; ++j) {					rp = &zp->z_rules[j];					if (!rp->r_todo)						continue;					eats(zp->z_filename, zp->z_linenum,						rp->r_filename, rp->r_linenum);					offset = rp->r_todisgmt ? 0 : gmtoff;					if (!rp->r_todisstd)						offset = oadd(offset, stdoff);					jtime = rp->r_temp;					if (jtime == min_time ||						jtime == max_time)							continue;					jtime = tadd(jtime, -offset);					if (k < 0 || jtime < ktime) {						k = j;						ktime = jtime;					}				}				if (k < 0)					break;	/* go on to next year */				rp = &zp->z_rules[k];				rp->r_todo = FALSE;				if (useuntil && ktime >= untiltime)					break;				if (usestart) {				    if (ktime < starttime) {					stdoff = rp->r_stdoff;					startoff = oadd(zp->z_gmtoff,						rp->r_stdoff);					doabbr(startbuf, zp->z_format,						rp->r_abbrvar,						rp->r_stdoff != 0);					startisdst = rp->r_stdoff != 0;					continue;				    }				    usestart = FALSE;				    if (ktime != starttime) {					if (startisdst < 0 &&					    zp->z_gmtoff !=					    (zp - 1)->z_gmtoff) {						type = (timecnt == 0) ? 0 :							types[timecnt - 1];						startoff = oadd(gmtoffs[type],							-(zp - 1)->z_gmtoff);						startisdst = startoff != 0;						startoff = oadd(startoff,							zp->z_gmtoff);						(void) strcpy(startbuf,						    &chars[abbrinds[type]]);					}					if (startisdst >= 0)addtt(starttime, addtype(startoff, startbuf, startisdst, startttisstd,	startttisgmt));				    }				}				eats(zp->z_filename, zp->z_linenum,					rp->r_filename, rp->r_linenum);				doabbr(buf, zp->z_format, rp->r_abbrvar,					rp->r_stdoff != 0);				offset = oadd(zp->z_gmtoff, rp->r_stdoff);				type = addtype(offset, buf, rp->r_stdoff != 0,					rp->r_todisstd, rp->r_todisgmt);				addtt(ktime, type);				stdoff = rp->r_stdoff;			}		}		/*		** Now we may get to set starttime for the next zone line.		*/		if (useuntil) {			starttime = tadd(zp->z_untiltime, -gmtoff);			startttisstd = zp->z_untilrule.r_todisstd;			startttisgmt = zp->z_untilrule.r_todisgmt;			if (!startttisstd)				starttime = tadd(starttime, -stdoff);		}	}	writezone(zpfirst->z_name);}