#pragma TASS input 
double tol;
#pragma TASS output 
double phi;

void main() {
	double j=1.0; 
	double k=1.0; 
	double err=tol; 
	double p=0.0;
	
l:
#pragma TASS jointinvariant @main{err==spec.err && p==spec.p && j==spec.j && j>0 && k==spec.k && k>0} 
	while (err>=tol) {
		k=j+k; 
		j=k-j; 
		err=k/j-p;
		p=err+p;
		if (err < 0) err=-err;
	}
	phi=p;
}
