#include "isajet/pilot.h"
      REAL*8 FUNCTION ZJJ5(P1, P2, P3, P4, P5,NHEL,IM1,IM2)
C  
C Function generated by Madgraph
C Returns amplitude squared summed/avg over colors
C for the point in phase space p1,p2,p3,p4,...
C and helicity NHEL(1),NHEL(2),....
C  
C for process : q(im1) q(im2)  -> z q(im1) q(im2)
C with IM1 != IM2
C  
#if defined(CERNLIB_IMPNONE)
      IMPLICIT NONE
#endif
C  
C CONSTANTS
C  
      INTEGER    NGRAPHS,    NEIGEN,    NEXTERNAL       
      PARAMETER (NGRAPHS=  4,NEIGEN=  1,NEXTERNAL=5)    
      REAL*8     ZERO
      PARAMETER (ZERO=0D0)
C  
C ARGUMENTS 
C  
      REAL*8 P1(0:3),P2(0:3),P3(0:3),P4(0:3),P5(0:3)                             
      INTEGER NHEL(NEXTERNAL)                                                    
      INTEGER IM1,IM2
C  
C LOCAL VARIABLES 
C  
      INTEGER I,J
      REAL*8 EIGEN_VAL(NEIGEN), EIGEN_VEC(NGRAPHS,NEIGEN)
      COMPLEX*16 ZTEMP
      COMPLEX*16 AMP(NGRAPHS)
      COMPLEX*16 W1(6)  , W2(6)  , W3(6)  , W4(6)  , W5(6)        
      COMPLEX*16 W6(6)  , W7(6)  , W8(6)  , W9(6)  , W10(6)       
      COMPLEX*16 W11(6) , W12(6) 
      REAL*8 GZUD1(2),GZUD2(2)
C  
C GLOBAL VARIABLES
C  
#include "isajet/mgcoms.inc"
C  
C COLOR DATA
C  
      DATA EIGEN_VAL(1  )/       8.8888888888888884D-01 /                  
      DATA EIGEN_VEC(1  ,1  )/  -5.0000000000000000D-01 /                  
      DATA EIGEN_VEC(2  ,1  )/  -5.0000000000000000D-01 /                  
      DATA EIGEN_VEC(3  ,1  )/  -5.0000000000000000D-01 /                  
      DATA EIGEN_VEC(4  ,1  )/  -5.0000000000000000D-01 /                  
C ----------
C BEGIN CODE
C ----------
      IF(IM1.EQ.3.OR.IM1.EQ.7.OR.IM1.EQ.11) THEN
        GZUD1(1)=GZD(1)
        GZUD1(2)=GZD(2)
      ELSE
        GZUD1(1)=GZU(1)
        GZUD1(2)=GZU(2)
      ENDIF
      IF(IM2.EQ.3.OR.IM2.EQ.7.OR.IM2.EQ.11) THEN
        GZUD2(1)=GZD(1)
        GZUD2(2)=GZD(2)
      ELSE
        GZUD2(1)=GZU(1)
        GZUD2(2)=GZU(2)
      ENDIF
C
      CALL IXXXXX(P1  ,FMASS(IM1),NHEL(1  ), 1,W1  )                       
      CALL IXXXXX(P2  ,FMASS(IM2),NHEL(2  ), 1,W2  )                       
      CALL VXXXXX(P3  ,ZMASS,NHEL(3  ), 1,W3  )                            
      CALL OXXXXX(P4  ,FMASS(IM1),NHEL(4  ), 1,W4  )                       
      CALL OXXXXX(P5  ,FMASS(IM2),NHEL(5  ), 1,W5  )                       
      CALL JIOXXX(W1  ,W4  ,GG,ZERO,ZERO,W6  )                             
      CALL FVOXXX(W5  ,W3  ,GZUD2,FMASS(IM2),FWIDTH(IM2),W7  )               
      CALL IOVXXX(W2  ,W7  ,W6  ,GG,AMP(1  ))                              
      CALL FVIXXX(W2  ,W3  ,GZUD2,FMASS(IM2),FWIDTH(IM2),W8  )               
      CALL IOVXXX(W8  ,W5  ,W6  ,GG,AMP(2  ))                              
      CALL FVIXXX(W1  ,W3  ,GZUD1,FMASS(IM1),FWIDTH(IM1),W9  )               
      CALL JIOXXX(W9  ,W4  ,GG,ZERO,ZERO,W10 )                             
      CALL IOVXXX(W2  ,W5  ,W10 ,GG,AMP(3  ))                              
      CALL FVOXXX(W4  ,W3  ,GZUD1,FMASS(IM1),FWIDTH(IM1),W11 )               
      CALL JIOXXX(W2  ,W5  ,GG,ZERO,ZERO,W12 )                             
      CALL IOVXXX(W1  ,W11 ,W12 ,GG,AMP(4  ))                              
      ZJJ5 = 0.D0 
      DO I = 1, NEIGEN
          ZTEMP = (0.D0,0.D0)
          DO J = 1, NGRAPHS
              ZTEMP = ZTEMP + EIGEN_VEC(J,I)*AMP(J)
          ENDDO
          ZJJ5 =ZJJ5+ZTEMP*EIGEN_VAL(I)*CONJG(ZTEMP) 
      ENDDO
C      CALL GAUGECHECK(AMP,ZTEMP,EIGEN_VEC,EIGEN_VAL,NGRAPHS,NEIGEN)
      END
