Index: genus2reduction-0.3/genus2reduction.c
===================================================================
--- genus2reduction-0.3.orig/genus2reduction.c	2011-08-13 23:10:02.622871337 +0000
+++ genus2reduction-0.3/genus2reduction.c	2011-08-13 23:13:56.302871205 +0000
@@ -86,7 +86,7 @@
   long tt,d,d1,d2,d3,f1,f2,g,h,v1,v2,j2m,r1,r2,r3,r4,dismin,alpha,lambda;
   long indice,vc6,mm,nb,dism,maxc,condp,R,alpha1,comp,beta,vy,dd,pr,ip,j,temp;
   
-  init(10000000,500000);
+  pari_init(10000000,500000);
   jpol2=lisseq("a0;a1;a2;a3;a4;a5;a6;2^-2*(-120*a0*a6+20*a1*a5-8*a2*a4+3*a3^2)");
   jpol4=lisseq("a0;a1;a2;a3;a4;a5;a6;2^-7*(240*(a0*a3*a4*a5+a1*a2*a3*a6)-400*(a0*a2*a5^2+a1^2*a4*a6)-64*(a0*a4^3+a2^3*a6)+16*(a1*a3*a4^2+a2^2*a3*a5)-672*a0*a3^2*a6+240*a1^2*a5^2-112*a1*a2*a4*a5-8*a1*a3^2*a5+16*a2^2*a4^2-16*a2*a3^2*a4+3*a3^4+2640*a0^2*a6^2-880*a0*a1*a5*a6+1312*a0*a2*a4*a6)");
   jpol6=lisseq("a0;a1;a2;a3;a4;a5;a6;2^-10*(1600*(a0^2*a4^2*a5^2+a1^2*a2^2*a6^2)+1600*(a0*a1*a2*a5^3+a1^3*a4*a5*a6)+640*(a0*a1*a3*a4*a5^2+a1^2*a2*a3*a5*a6)-4000*(a0^2*a3*a5^3+a1^3*a3*a6^2)-384*(a0*a1*a4^3*a5+a1*a2^3*a5*a6)-640*(a0*a2^2*a4*a5^2+a1^2*a2*a4^2*a6)+80*(a0*a2*a3^2*a5^2+a1^2*a3^2*a4*a6)+192*(a0*a2*a3*a4^2*a5+a1*a2^2*a3*a4*a6)-48*(a0*a3^3*a4*a5+a1*a2*a3^3*a6)-224*(a1^2*a3*a4^2*a5+a1*a2^2*a3*a5^2)+64*(a1^2*a4^4+a2^4*a5^2)-64*(a1*a2*a3*a4^3+a2^3*a3*a4*a5)+16*(a1*a3^3*a4^2+a2^2*a3^3*a5)-4096*(a0^2*a4^3*a6+a0*a2^3*a6^2)+6400*(a0^2*a2*a5^2*a6+a0*a1^2*a4*a6^2)+10560*(a0^2*a3*a4*a5*a6+a0*a1*a2*a3*a6^2)+2624*(a0*a1*a3*a4^2*a6+a0*a2^2*a3*a5*a6)-4432*a0*a1*a3^2*a5*a6-8*a2*a3^4*a4+a3^6-320*a1^3*a5^3+64*a1^2*a2*a4*a5^2+176*a1^2*a3^2*a5^2+128*a1*a2^2*a4^2*a5+112*a1*a2*a3^2*a4*a5-28*a1*a3^4*a5+16*a2^2*a3^2*a4^2+5120*a0^3*a6^3-2544*a0^2*a3^2*a6^2+312*a0*a3^4*a6-14336*a0^2*a2*a4*a6^2+1024*a0*a2^2*a4^2*a6-2560*a0^2*a1*a5*a6^2-2240*a0*a1^2*a5^2*a6-6528*a0*a1*a2*a4*a5*a6-1568*a0*a2*a3^2*a4*a6)");
@@ -115,7 +115,7 @@
   pr=1; if(!cmpis((GEN)factp[1],2)) pr=2;
   matmin=cgetg(6,19);
   for(j=1;j<=5;j++)
-    matmin[j]=lgetg(lg(factp)-pr+1,18);
+    matmin[j]=(long)cgetg(lg(factp)-pr+1,18);
   for(i=pr;i<lg(factp);i++)
     { 
       p=(GEN)factp[i];
@@ -400,7 +400,7 @@
 		    {
 		      if(myval(c3,p)>1) 
 			{printf("bug c3");fflush(stdout);exit(1);}
-		      mm=min(min(3*myval(c4,p)-4,3*myval(c5,p)-5),3*vc6-6);
+		      mm=minss(minss(3*myval(c4,p)-4,3*myval(c5,p)-5),3*vc6-6);
 		      if(alpha) 
 			{
 			  condp=dismin-mm-16;
@@ -473,7 +473,7 @@
 	      else
 		{
 		  list=factorpadicnonun(polh,p,dismin-5);
-		  nb=lg(list);prod=polun[varn(polh)];
+		  nb=lg(list);prod=pol_1(varn(polh));
 		  for(i=1;i<nb;i++)
 		    {
 		      facti=(GEN)list[i];
@@ -524,7 +524,7 @@
 	  }
 	if(cmpis(p,3)&&!cmpis(denom(theta),3)) goto modere;
 	list=factorpadicnonun(polh,p,dismin-10*alpha);
-	nb=lg(list);prod=polun[varn(polh)];
+	nb=lg(list);prod=pol_1(varn(polh));
 	for(i=1;i<nb;i++)
 	  {
 	    facti=(GEN)list[i];
@@ -597,7 +597,7 @@
   polh1=gcopy(polh);
   theta1=gcopy(theta);
   alpha1=alpha;
-  polh=gmul(gsubst(polh,0,ginv(polx[0])),gpuigs(polx[0],6));
+  polh=gmul(gsubst(polh,0,ginv(pol_x(0))),gpuigs(pol_x(0),6));
   polf=polymini(gmul(polh,gpuigs(p,alpha)),p);
   polh=(GEN)polf[1];
   lambda=itos((GEN)polf[2]);  
@@ -655,7 +655,7 @@
 	  d=val[6]-val[7]+(val[eps2]/eps);
 	  if(r1&&alpha1==0) 
 	    {
-	      polh1=gdiv(gsubst(polh1,0,gmul(p,polx[0])),gpuigs(p,3));
+	      polh1=gdiv(gsubst(polh1,0,gmul(p,pol_x(0))),gpuigs(p,3));
 	    }
 	  polhp=gmul(unmodp,polh1);	  
 	  if(!gcmp0(discsr(polhp))) 
@@ -671,10 +671,10 @@
 	{
           if(gcmp1(theta1)) 
 	    {
-	      polh1=gdiv(gsubst(polh1,0,gmul(p,polx[0])),gpuigs(p,3));
+	      polh1=gdiv(gsubst(polh1,0,gmul(p,pol_x(0))),gpuigs(p,3));
 	    }
 	  d=val[6]-3*val[3]+(val[eps2]/eps);
-	  d1=min(val[7]-3*val[3],d/2);
+	  d1=minss(val[7]-3*val[3],d/2);
 	  if(d==2*d1) indice=d1;
 	  else
 	    {
@@ -720,7 +720,7 @@
       { 
 	if(r1&&alpha1==0) 
 	  {
-	    polh1=gdiv(gsubst(polh1,0,gmul(p,polx[0])),gpuigs(p, 3));
+	    polh1=gdiv(gsubst(polh1,0,gmul(p,pol_x(0))),gpuigs(p, 3));
 	  }
 	polhp=gmul(unmodp,polh1);	  	
 	if(!gcmp0(discsr(polhp))) d=0;
@@ -749,7 +749,7 @@
       {
 	if(r2&&alpha==0)
 	  {
-	    polh=gdiv(gsubst(polh,0,gmul(p,polx[0])),gpuigs(p,3));
+	    polh=gdiv(gsubst(polh,0,gmul(p,pol_x(0))),gpuigs(p,3));
 	  }
 	polhp=gmul(unmodp,polh);	  
 	if(!gcmp0(discsr(polhp))) indice=0;
@@ -1647,7 +1647,7 @@
   else
   {
     v=myval((GEN)pol[2],p);
-    for(i=3;i<lx;i++) v=min(myval((GEN)pol[i],p),v);
+    for(i=3;i<lx;i++) v=minss(myval((GEN)pol[i],p),v);
   }
   return v;
 }
@@ -1673,8 +1673,8 @@
       if(contpol) {printf("contenu non trivial, erreur\n");fflush(stdout);exit(1);}
       pol=gdiv(pol,gpuigs(p,contpol));
       r=(lx-4)*ggval(td,p)+r;
-      upol=gsubst(gmul(pol,gpuigs(td,lx-4)),vx,gdiv(polx[vx],td));
-      fact=gsubst(factorpadic4(upol,p,r),vx,gmul(polx[vx],td));
+      upol=gsubst(gmul(pol,gpuigs(td,lx-4)),vx,gdiv(pol_x(vx),td));
+      fact=gsubst(factorpadic4(upol,p,r),vx,gmul(pol_x(vx),td));
       list=(GEN)fact[1];ep=(GEN)fact[2];nb=lg(list)-1;
       for(i=1;i<=nb;i++)
 	if(!gcmp1((GEN)ep[i])) 
@@ -1698,7 +1698,7 @@
  rec1:
   alpha=polval(pol,p);polh=gdiv(pol,gpuigs(p,alpha));
   if(gdivise(truecoeff(polh,6),p)&&gdivise(truecoeff(polh,5),p)&&gdivise(truecoeff(polh,4),p)&&gdivise(truecoeff(polh,3),p))
-    {polh=gmul(gpuigs(polx[0],6),gsubst(polh,0,ginv(polx[0])));}
+    {polh=gmul(gpuigs(pol_x(0),6),gsubst(polh,0,ginv(pol_x(0))));}
   alpha=alpha&1;      
   beta=0;  
   lambda=0; 
@@ -1709,11 +1709,11 @@
    
  labelm6:
   theta=caltheta(polh,p,lambda);
-  polf[5]=zero;          /* 1 si racine d'ordre 3 non dans F_p, 0 sinon */
+  polf[5]=(long)gen_0;          /* 1 si racine d'ordre 3 non dans F_p, 0 sinon */
   if(gcmp(theta,gun)>=0)
     { 
       ent=gfloor(theta);pent=gpui(p,ent,0);
-      polh=gdiv(gsubst(polh,0,gmul(pent,polx[0])),gpuigs(pent,6-lambda));
+      polh=gdiv(gsubst(polh,0,gmul(pent,pol_x(0))),gpuigs(pent,6-lambda));
       alpha=(alpha+lambda*itos(ent))&1;
       beta=beta+itos(ent);
       theta=gsub(theta,ent);
@@ -1728,11 +1728,11 @@
 	  rac=(GEN)fac[2];
 	  if(lgef(rac)==5) 
 	    {
-	      polf[5]=un;
+	      polf[5]=(long)gen_1;
 	      goto sortie;
 	    } 
 	  rac=lift(gdiv(gneg(truecoeff(rac,0)),truecoeff(rac,1)));
-	  polh=gsubst(polh,0,gadd(polx[0],rac));
+	  polh=gsubst(polh,0,gadd(pol_x(0),rac));
 	  lambda=6-maxord; goto labelm6;
 	}
       if(maxord<=2&&lgef(polhp)>=7) goto sortie;
@@ -1741,7 +1741,7 @@
     { 
       if((myval(truecoeff(polh,2),p)>1-alpha)&&(myval(truecoeff(polh,1),p)>2-alpha)&&(myval(truecoeff(polh,0),p)>3-alpha))
 	{
-	  pol=gsubst(polh,0,gmul(p,polx[0]));
+	  pol=gsubst(polh,0,gmul(p,pol_x(0)));
 	  if(alpha) pol=gmul(p,pol); 
 	  goto rec1;
 	}
@@ -1753,7 +1753,7 @@
 	{
 	  if(myval(truecoeff(polh,6),p)>=3&&myval(truecoeff(polh,5),p)>=2)
 	    {
-	      polh=gmul(gsubst(polh,0,gdiv(polx[0],p)),gpuigs(p,3));
+	      polh=gmul(gsubst(polh,0,gdiv(pol_x(0),p)),gpuigs(p,3));
 	      theta=gadd(theta,gun);
 	      alpha=0;
 	      beta=beta-1; 
@@ -1762,13 +1762,13 @@
 	}
       if(lgef(polhp)==9&&!gcmp0(theta))
 	{
-	  pro=gdiv(polhp,gpuigs(polx[0],3));
+	  pro=gdiv(polhp,gpuigs(pol_x(0),3));
 	  fac=factmz(pro,p);
 	  if(!cmpis((GEN)fac[1],3))
 	    {
 	      rac=(GEN)fac[2];
 	      rac=lift(gdiv(gneg(truecoeff(rac,0)),truecoeff(rac,1)));
-	      pro=gsubst(polh,0,gadd(rac,gmul(p,polx[0])));
+	      pro=gsubst(polh,0,gadd(rac,gmul(p,pol_x(0))));
 	      if(polval(pro,p)>=3)
 		{
 		  polh=gdiv(pro,gpuigs(p,3));
@@ -1815,7 +1815,7 @@
   if(lgef(polhp)!=6) 
     {printf("bug, on ne doit pas arriver dans discpart");fflush(stdout);exit(1);}
   list=factorpadicnonun(polh,p,ord);
-  prod=polun[varn(polh)];
+  prod=pol_1(varn(polh));
   for(i=1;i<lg(list);i++)
     {
       facti=(GEN)list[i];
@@ -1837,7 +1837,7 @@
 long
 myvalzi(GEN b) /* valuation par rapport a 3 dans Z[i] */ 
 {
-  return min(myval(greal(b),stoi(3)),myval(gimag(b),stoi(3)));
+  return minss(myval(greal(b),stoi(3)),myval(gimag(b),stoi(3)));
 }
 
 GEN 
@@ -1853,15 +1853,15 @@
   polh=pol;
   if(alpha) polh=gdiv(pol,p);
   beta=0;  
-  rac=gadd(lift(gdiv(gmul(unmodp,truecoeff(polh,3)),gmul(unmodp,truecoeff(polh,6)))),gi);
+  rac=gadd(lift(gdiv(gmul(unmodp,truecoeff(polh,3)),gmul(unmodp,truecoeff(polh,6)))),gen_I());
   
  labelm6:
-  polh=gsubst(polh,0,gadd(polx[0],rac));  
+  polh=gsubst(polh,0,gadd(pol_x(0),rac));  
   theta=calthetazi(polh);
   if(gcmp(theta,gun)>=0)
     { 
       ent=gfloor(theta);pent=gpui(p,ent,0);
-      polh=gdiv(gsubst(polh,0,gmul(pent,polx[0])),gpuigs(pent,3));
+      polh=gdiv(gsubst(polh,0,gmul(pent,pol_x(0))),gpuigs(pent,3));
       alpha=(alpha+itos(ent))&1;
       beta=beta+itos(ent);
       theta=gsub(theta,ent);
@@ -1879,7 +1879,7 @@
     {
       if(myvalzi(truecoeff(polh,6))>=3&&myvalzi(truecoeff(polh,5))>=2&&myvalzi(truecoeff(polh,4))>=1)
 	{
-	  polh=gmul(gsubst(polh,0,gdiv(polx[0],p)),gpuigs(p,3));
+	  polh=gmul(gsubst(polh,0,gdiv(pol_x(0),p)),gpuigs(p,3));
 	  theta=gadd(theta,gun);
 	  beta=beta-1;
 	  alpha=0;	
@@ -1907,7 +1907,7 @@
 /* on calcule la valuation de b dans Z[i, Y]/(Y^2-3) */
  {
   b=lift(b);
-  return min(2*myvalzi(truecoeff(b,0)),2*myvalzi(truecoeff(b,1))+1);
+  return minss(2*myvalzi(truecoeff(b,0)),2*myvalzi(truecoeff(b,1))+1);
 }
 
 GEN
@@ -1936,10 +1936,10 @@
     {printf("bug, le polynome n'est pas minimal\n");fflush(stdout);exit(1);}
   polh=pol;alpha=0;
   beta=0;  
-  polh=gdivgs(gsubst(polh,0,gmul(polx[0],y)),27);
+  polh=gdivgs(gsubst(polh,0,gmul(pol_x(0),y)),27);
   if(myvalzi2(truecoeff(polh,4))>0&&myvalzi2(truecoeff(polh,2))>0)  
     {
-      if(myvalzi2(gsub(truecoeff(polh,6),truecoeff(polh,0)))>0) rac=gi;
+      if(myvalzi2(gsub(truecoeff(polh,6),truecoeff(polh,0)))>0) rac=gen_I();
       else rac=gun;
     }
   else 
@@ -1949,12 +1949,12 @@
     }
 
  labelm6:
-  polh=gsubst(polh,0,gadd(polx[0],rac));  
+  polh=gsubst(polh,0,gadd(pol_x(0),rac));  
   theta=calthetazi2(polh);
   if(gcmp(theta,gun)>=0)
     { 
       ent=gfloor(theta);pent=gpui(y,ent,0);
-      polh=gdiv(gsubst(polh,0,gmul(pent,polx[0])),gpuigs(pent,3));
+      polh=gdiv(gsubst(polh,0,gmul(pent,pol_x(0))),gpuigs(pent,3));
       alpha=(alpha+itos(ent))&1;
       beta=beta+itos(ent);
       theta=gsub(theta,ent);
@@ -1998,7 +1998,7 @@
   u=truecoeff(lift(u),0);
   a=gmul(unmodp,greal(u));
   b=gmul(unmodp,gimag(u));
-  u=gadd(a,gmul(b,gi));
+  u=gadd(a,gmul(b,gen_I()));
   return u;
 }
 
@@ -2020,7 +2020,7 @@
 	{
 	  fac=(GEN)factmod(polhp,p);
 	  for(i=1;i<lg((GEN)fac[2]);i++) 
-	    m=max(m,itos(gcoeff(fac,i,2)));
+	    m=maxss(m,itos(gcoeff(fac,i,2)));
 	  for(i=1;i<lg((GEN)fac[1]);i++) 
 	    if(!cmpis(gcoeff(fac,i,2),m)) l=i;
 	  z=gcoeff(fac,l,1);
