      SUBROUTINE ML5_0_SLOOPMATRIXHEL(P,HEL,ANS)
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INTEGER    NEXTERNAL
      PARAMETER (NEXTERNAL=5)

      INCLUDE 'nsquaredSO.inc'

C     
C     ARGUMENTS 
C     
      REAL*8 P(0:3,NEXTERNAL)
      REAL*8 ANS(0:3,0:NSQUAREDSO)
      INTEGER HEL, USERHEL
      COMMON/ML5_0_USERCHOICE/USERHEL
C     ----------
C     BEGIN CODE
C     ----------
      USERHEL=HEL
      CALL ML5_0_SLOOPMATRIX(P,ANS)
      END

      LOGICAL FUNCTION ML5_0_IS_HEL_SELECTED(HELID)
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INTEGER    NEXTERNAL
      PARAMETER (NEXTERNAL=5)
      INTEGER    NCOMB
      PARAMETER (NCOMB=48)
C     
C     ARGUMENTS
C     
      INTEGER HELID
C     
C     LOCALS
C     
      INTEGER I,J
      LOGICAL FOUNDIT
C     
C     GLOBALS
C     
      INTEGER HELC(NEXTERNAL,NCOMB)
      COMMON/ML5_0_HELCONFIGS/HELC

      INTEGER POLARIZATIONS(0:NEXTERNAL,0:5)
      COMMON/ML5_0_BEAM_POL/POLARIZATIONS
C     ----------
C     BEGIN CODE
C     ----------

      ML5_0_IS_HEL_SELECTED = .TRUE.
      IF (POLARIZATIONS(0,0).EQ.-1) THEN
        RETURN
      ENDIF

      DO I=1,NEXTERNAL
        IF (POLARIZATIONS(I,0).EQ.-1) THEN
          CYCLE
        ENDIF
        FOUNDIT = .FALSE.
        DO J=1,POLARIZATIONS(I,0)
          IF (HELC(I,HELID).EQ.POLARIZATIONS(I,J)) THEN
            FOUNDIT = .TRUE.
            EXIT
          ENDIF
        ENDDO
        IF(.NOT.FOUNDIT) THEN
          ML5_0_IS_HEL_SELECTED = .FALSE.
          RETURN
        ENDIF
      ENDDO
      RETURN

      END

      LOGICAL FUNCTION ML5_0_ISZERO(TOTEST, REFERENCE_VALUE, AMPLN)
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INTEGER    NLOOPAMPS
      PARAMETER (NLOOPAMPS=396)
C     
C     ARGUMENTS 
C     
      REAL*8 TOTEST, REFERENCE_VALUE
      INTEGER AMPLN
C     
C     GLOBAL 
C     
      INCLUDE 'MadLoopParams.inc'

      COMPLEX*16 AMPL(3,NLOOPAMPS)
      LOGICAL S(NLOOPAMPS)
      COMMON/ML5_0_AMPL/AMPL,S
C     ----------
C     BEGIN CODE
C     ----------
      IF(ABS(REFERENCE_VALUE).EQ.0.0D0) THEN
        ML5_0_ISZERO=.FALSE.
        WRITE(*,*) '##E02 ERRROR Reference value for comparison is'
     $   //' zero.'
        STOP
      ELSE
        ML5_0_ISZERO=((ABS(TOTEST)/ABS(REFERENCE_VALUE)).LT.ZEROTHRES)
      ENDIF
      IF(AMPLN.NE.-1) THEN
        IF((.NOT.ML5_0_ISZERO).AND.(.NOT.S(AMPLN))) THEN
          WRITE(*,*) '##W01 WARNING Contribution ',AMPLN,' is detected'
     $     //' as contributing with CR=',(ABS(TOTEST)
     $     /ABS(REFERENCE_VALUE)),' but is unstable.'
        ENDIF
      ENDIF

      END

      SUBROUTINE ML5_0_SLOOPMATRIX(P_USER,ANSRETURNED)
C     
C     Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
C     By the MadGraph5_aMC@NLO Development Team
C     Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
C     
C     Returns amplitude squared summed/avg over colors
C     and helicities for the point in phase space P(0:3,NEXTERNAL)
C     and external lines W(0:6,NEXTERNAL)
C     
C     Process: g g > w- t b~ QCD<=2 QED<=1 [ virt = QCD ]
C     
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      CHARACTER*512 PARAMFNAME,HELCONFIGFNAME,LOOPFILTERFNAME
      CHARACTER*512 COLORNUMFNAME,COLORDENOMFNAME, HELFILTERFNAME
      CHARACTER*512 PROC_PREFIX
      PARAMETER ( PARAMFNAME='MadLoopParams.dat')
      PARAMETER ( HELCONFIGFNAME='HelConfigs.dat')
      PARAMETER ( LOOPFILTERFNAME='LoopFilter.dat')
      PARAMETER ( HELFILTERFNAME='HelFilter.dat')
      PARAMETER ( COLORNUMFNAME='ColorNumFactors.dat')
      PARAMETER ( COLORDENOMFNAME='ColorDenomFactors.dat')
      PARAMETER ( PROC_PREFIX='ML5_0_')

      INTEGER NBORNAMPS
      PARAMETER (NBORNAMPS=8)
      INTEGER    NLOOPAMPS, NCTAMPS
      PARAMETER (NLOOPAMPS=396, NCTAMPS=252)
      INTEGER    NEXTERNAL
      PARAMETER (NEXTERNAL=5)
      INTEGER NINITIAL
      PARAMETER (NINITIAL=2)
      INTEGER    NWAVEFUNCS
      PARAMETER (NWAVEFUNCS=28)
      INTEGER    NCOMB
      PARAMETER (NCOMB=48)
      REAL*8     ZERO
      PARAMETER (ZERO=0D0)
      REAL*16     MP__ZERO
      PARAMETER (MP__ZERO=0E0_16)
      COMPLEX*16 IMAG1
      PARAMETER (IMAG1=(0D0,1D0))
C     This parameter is designed for the check timing command of MG5
      LOGICAL SKIPLOOPEVAL
      PARAMETER (SKIPLOOPEVAL=.FALSE.)
      LOGICAL BOOTANDSTOP
      PARAMETER (BOOTANDSTOP=.FALSE.)
      INCLUDE 'nsquaredSO.inc'
      INTEGER NSQUAREDSOP1
      PARAMETER (NSQUAREDSOP1=NSQUAREDSO+1)
      INTEGER MAXSTABILITYLENGTH
      DATA MAXSTABILITYLENGTH/20/
      COMMON/ML5_0_STABILITY_TESTS/MAXSTABILITYLENGTH
C     
C     ARGUMENTS 
C     
      REAL*8 P_USER(0:3,NEXTERNAL)
      REAL*8 ANSRETURNED(0:3,0:NSQUAREDSO)
C     
C     LOCAL VARIABLES 
C     
      REAL*8 ANS(0:3)
      INTEGER I,J,K,H

      CHARACTER*512 PARAMFN,HELCONFIGFN,LOOPFILTERFN,COLORNUMFN
     $ ,COLORDENOMFN,HELFILTERFN
      CHARACTER*512 TMP
      SAVE PARAMFN
      SAVE HELCONFIGFN
      SAVE LOOPFILTERFN
      SAVE COLORNUMFN
      SAVE COLORDENOMFN
      SAVE HELFILTERFN

      INTEGER HELPICKED_BU, CTMODEINIT_BU
      REAL*8 MLSTABTHRES_BU
C     P is the actual PS POINT used for the computation, and can be
C      rotated for the stability test purposes.
      REAL*8 P(0:3,NEXTERNAL)
C     DP_RES STORES THE DOUBLE PRECISION RESULT OBTAINED FROM
C      DIFFERENT EVALUATION METHODS IN ORDER TO ASSESS STABILITY.
C     THE STAB_STAGE COUNTER I CORRESPONDANCE GOES AS FOLLOWS
C     I=1 -> ORIGINAL PS, CTMODE=1
C     I=2 -> ORIGINAL PS, CTMODE=2, (ONLY WITH CTMODERUN=-1)
C     I=3 -> PS WITH ROTATION 1, CTMODE=1, (ONLY WITH CTMODERUN=-2)
C     I=4 -> PS WITH ROTATION 2, CTMODE=1, (ONLY WITH CTMODERUN=-3)
C     I=5 -> POSSIBLY MORE EVALUATION METHODS IN THE FUTURE, MAX IS
C      MAXSTABILITYLENGTH
C     IF UNSTABLE IT GOES TO THE SAME PATTERN BUT STAB_INDEX IS THEN
C      I+20.
      LOGICAL EVAL_DONE(MAXSTABILITYLENGTH)
      LOGICAL DOING_QP_EVALS
      INTEGER STAB_INDEX,BASIC_CT_MODE
      INTEGER N_DP_EVAL, N_QP_EVAL
      DATA N_DP_EVAL/1/
      DATA N_QP_EVAL/1/
C     This is used for loop-induced where the reference scale for
C      comparisons is infered from
C     the previous points
      REAL*8 NEXTREF
      DATA NEXTREF/ZERO/
      INTEGER NPSPOINTS
      DATA NPSPOINTS/0/
      LOGICAL FOUND_VALID_REDUCTION_METHOD
      DATA FOUND_VALID_REDUCTION_METHOD/.FALSE./

      REAL*8 ACC
      REAL*8 DP_RES(3,MAXSTABILITYLENGTH)
C     QP_RES STORES THE QUADRUPLE PRECISION RESULT OBTAINED FROM
C      DIFFERENT EVALUATION METHODS IN ORDER TO ASSESS STABILITY.
      REAL*8 QP_RES(3,MAXSTABILITYLENGTH)
      INTEGER NHEL(NEXTERNAL), IC(NEXTERNAL)
      INTEGER NATTEMPTS
      DATA NATTEMPTS/0/
      DATA IC/NEXTERNAL*1/
      REAL*8 BUFFR(3),TEMP(3),TEMP1,TEMP2
      COMPLEX*16 CFTOT
      LOGICAL FOUNDHELFILTER,FOUNDLOOPFILTER
      DATA FOUNDHELFILTER/.TRUE./
      DATA FOUNDLOOPFILTER/.TRUE./
      INTEGER IDEN
      DATA IDEN/256/
      INTEGER HELAVGFACTOR
      DATA HELAVGFACTOR/4/
C     For a 1>N process, them BEAMTWO_HELAVGFACTOR would be set to 1.
      INTEGER BEAMS_HELAVGFACTOR(2)
      DATA (BEAMS_HELAVGFACTOR(I),I=1,2)/2,2/
      LOGICAL DONEHELDOUBLECHECK
      DATA DONEHELDOUBLECHECK/.FALSE./
      INTEGER NEPS
      DATA NEPS/0/
C     Below are variables to bypass the checkphase and insure
C      stability check to take place
      LOGICAL OLD_CHECKPHASE, OLD_HELDOUBLECHECKED
      LOGICAL OLD_GOODHEL(NCOMB)
      LOGICAL OLD_GOODAMP(NLOOPAMPS,NCOMB)

      LOGICAL BYPASS_CHECK, ALWAYS_TEST_STABILITY
      COMMON/ML5_0_BYPASS_CHECK/BYPASS_CHECK, ALWAYS_TEST_STABILITY
C     
C     FUNCTIONS
C     
      LOGICAL ML5_0_ISZERO
      LOGICAL ML5_0_IS_HEL_SELECTED
C     
C     GLOBAL VARIABLES
C     
      INCLUDE 'process_info.inc'
      INCLUDE 'coupl.inc'
      INCLUDE 'mp_coupl.inc'
      INCLUDE 'MadLoopParams.inc'

      INTEGER NTRY
      DATA NTRY/0/
      LOGICAL CHECKPHASE
      DATA CHECKPHASE/.TRUE./
      LOGICAL HELDOUBLECHECKED
      DATA HELDOUBLECHECKED/.FALSE./
      REAL*8 REF
      DATA REF/0.0D0/
      COMMON/ML5_0_INIT/NTRY,CHECKPHASE,HELDOUBLECHECKED,REF

C     THE LOGICAL BELOWS ARE JUST TO KEEP TRACK OF WHETHER THE MP_PS
C      HAS BEEN SET YET OR NOT AND WHETER THE MP EXTERNAL WFS HAVE
C      BEEN COMPUTED YET.
      LOGICAL MP_DONE
      DATA MP_DONE/.FALSE./
      COMMON/ML5_0_MP_DONE/MP_DONE
      LOGICAL MP_PS_SET
      DATA MP_PS_SET/.FALSE./
      COMMON/ML5_0_MP_PS_SET/MP_PS_SET

C     PS CAN POSSIBILY BE PASSED THROUGH IMPROVE_PS BUT IS NOT
C      MODIFIED FOR THE PURPOSE OF THE STABILITY TEST	  
C     EVEN THOUGH THEY ARE PUT IN COMMON BLOCK, FOR NOW THEY ARE NOT
C      USED ANYWHERE ELSE
      REAL*8 PS(0:3,NEXTERNAL)
      COMMON/ML5_0_PSPOINT/PS
C     AGAIN BELOW, MP_PS IS THE FIXED (POSSIBLY IMPROVED) MP PS POINT
C      AND MP_P IS THE ONE WHICH CAN BE MODIFIED (I.E. ROTATED ETC.)
C      FOR STABILITY PURPOSE
C     EVEN THOUGH THEY ARE PUT IN COMMON BLOCK, FOR NOW THEY ARE NOT
C      USED ANYWHERE ELSE THAN HERE AND SET_MP_PS()
      REAL*16 MP_PS(0:3,NEXTERNAL),MP_P(0:3,NEXTERNAL)
      COMMON/ML5_0_MP_PSPOINT/MP_PS,MP_P

      REAL*8 LSCALE
      INTEGER CTMODE
      COMMON/ML5_0_CT/LSCALE,CTMODE

      LOGICAL GOODHEL(NCOMB)
      LOGICAL GOODAMP(NLOOPAMPS,NCOMB)
      COMMON/ML5_0_FILTERS/GOODAMP,GOODHEL

      INTEGER HELPICKED
      DATA HELPICKED/-1/
      COMMON/ML5_0_HELCHOICE/HELPICKED
      INTEGER USERHEL
      DATA USERHEL/-1/
      COMMON/ML5_0_USERCHOICE/USERHEL

      COMPLEX*16 AMP(NBORNAMPS,NCOMB)
      COMMON/ML5_0_AMPS/AMP
      COMPLEX*16 W(20,NWAVEFUNCS,NCOMB)
      INTEGER VALIDH
      COMMON/ML5_0_WFCTS/W
      COMMON/ML5_0_VALIDH/VALIDH

      COMPLEX*16 AMPL(3,NLOOPAMPS)
      LOGICAL S(NLOOPAMPS)
      COMMON/ML5_0_AMPL/AMPL,S

      INTEGER CF_D(NLOOPAMPS,NBORNAMPS)
      INTEGER CF_N(NLOOPAMPS,NBORNAMPS)
      COMMON/ML5_0_CF/CF_D,CF_N

      INTEGER HELC(NEXTERNAL,NCOMB)
      COMMON/ML5_0_HELCONFIGS/HELC

      REAL*8 PREC,USER_STAB_PREC
      DATA USER_STAB_PREC/-1.0D0/
      COMMON/ML5_0_USER_STAB_PREC/USER_STAB_PREC

C     Return codes H,T,U correspond to the hundreds, tens and units
C     building returncode, i.e.
C     RETURNCODE=100*RET_CODE_H+10*RET_CODE_T+RET_CODE_U

      INTEGER RET_CODE_H,RET_CODE_T,RET_CODE_U
      REAL*8 ACCURACY(0:NSQUAREDSO)
      DATA (ACCURACY(I),I=0,NSQUAREDSO)/NSQUAREDSOP1*1.0D0/
      DATA RET_CODE_H,RET_CODE_T,RET_CODE_U/1,1,0/
      COMMON/ML5_0_ACC/ACCURACY,RET_CODE_H,RET_CODE_T,RET_CODE_U

C     Allows to forbid the zero helicity double check, no matter the
C      value in MadLoopParams.dat
C     This can be accessed with the SET_FORBID_HEL_DOUBLECHECK
C      subroutine of MadLoopCommons.dat
      LOGICAL FORBID_HEL_DOUBLECHECK
      COMMON/FORBID_HEL_DOUBLECHECK/FORBID_HEL_DOUBLECHECK

      LOGICAL MP_DONE_ONCE
      DATA MP_DONE_ONCE/.FALSE./
      COMMON/ML5_0_MP_DONE_ONCE/MP_DONE_ONCE

      CHARACTER(512) MLPATH
      COMMON/MLPATH/MLPATH

      LOGICAL ML_INIT
      COMMON/ML_INIT/ML_INIT

C     This variable controls the *local* initialization of this
C      particular SubProcess.
C     For example, the reading of the filters must be done
C      independently by each SubProcess.
      LOGICAL LOCAL_ML_INIT
      DATA LOCAL_ML_INIT/.TRUE./

C     Variables related to turning off the Lorentz rotation test when
C      spin-2 particles are external
      LOGICAL WARNED_LORENTZ_STAB_TEST_OFF
      DATA WARNED_LORENTZ_STAB_TEST_OFF/.FALSE./
      INTEGER NROTATIONS_DP_BU,NROTATIONS_QP_BU

C     This array specify potential special requirements on the
C      helicities to
C     consider. POLARIZATIONS(0,0) is -1 if there is not such
C      requirement.
      INTEGER POLARIZATIONS(0:NEXTERNAL,0:5)
      COMMON/ML5_0_BEAM_POL/POLARIZATIONS

C     ----------
C     BEGIN CODE
C     ----------

      IF(ML_INIT) THEN
        CALL PRINT_MADLOOP_BANNER()
        TMP = 'auto'
        CALL SETMADLOOPPATH(TMP)
        CALL JOINPATH(MLPATH,PARAMFNAME,PARAMFN)
        CALL MADLOOPPARAMREADER(PARAMFN,.TRUE.)
        IF (FORBID_HEL_DOUBLECHECK) THEN
          DOUBLECHECKHELICITYFILTER = .FALSE.
        ENDIF
        ML_INIT = .FALSE.
C       For now only CutTools is interfaced in the default mode.
C        Samurai could follow.
        DO I=1,SIZE(MLREDUCTIONLIB)
          IF (MLREDUCTIONLIB(I).EQ.1) THEN
            FOUND_VALID_REDUCTION_METHOD = .TRUE.
          ENDIF
        ENDDO
        IF (.NOT.FOUND_VALID_REDUCTION_METHOD) THEN
          WRITE(*,*) 'ERROR:: For now, only CutTools is interfaced to'
     $     //' MadLoop in the non-optimized output.'
          WRITE(*,*) 'ERROR:: Make sure to include 1 in the parameter'
     $     //' MLReductionLib of the card MadLoopParams.dat'
          STOP 1
        ENDIF
      ENDIF
      IF (LOCAL_ML_INIT) THEN
C       Setup the file paths
        CALL JOINPATH(MLPATH,PARAMFNAME,PARAMFN)
        CALL JOINPATH(MLPATH,PROC_PREFIX,TMP)
        CALL JOINPATH(TMP,HELCONFIGFNAME,HELCONFIGFN)
        CALL JOINPATH(TMP,LOOPFILTERFNAME,LOOPFILTERFN)
        CALL JOINPATH(TMP,COLORNUMFNAME,COLORNUMFN)
        CALL JOINPATH(TMP,COLORDENOMFNAME,COLORDENOMFN)
        CALL JOINPATH(TMP,HELFILTERFNAME,HELFILTERFN)

C       Make sure that the loop filter is disabled when there is
C        spin-2 particles for 2>1 or 1>2 processes
        IF(MAX_SPIN_EXTERNAL_PARTICLE.GT.3.AND.(NEXTERNAL.LE.3.AND.HELI
     $CITYFILTERLEVEL.NE.0)) THEN
          WRITE(*,*) '##INFO: Helicity filter deactivated for 2>1'
     $     //' processes involving spin 2 particles.'
          HELICITYFILTERLEVEL = 0
C         We write a dummy filter for structural reasons here
          OPEN(1, FILE=HELFILTERFN, ERR=6116, STATUS='NEW'
     $     ,ACTION='WRITE')
          DO I=1,NCOMB
            WRITE(1,*) 'T'
          ENDDO
 6116     CONTINUE
          CLOSE(1)
        ENDIF

        OPEN(1, FILE=COLORNUMFN, ERR=104, STATUS='OLD',          
     $    ACTION='READ')
        DO I=1,NLOOPAMPS
          READ(1,*,END=105) (CF_N(I,J),J=1,NBORNAMPS)
        ENDDO
        GOTO 105
 104    CONTINUE
        STOP 'Color factors could not be initialized from file'
     $   //' ML5_0_ColorNumFactors.dat. File not found'
 105    CONTINUE
        CLOSE(1)
        OPEN(1, FILE=COLORDENOMFN, ERR=106, STATUS='OLD',          
     $    ACTION='READ')
        DO I=1,NLOOPAMPS
          READ(1,*,END=107) (CF_D(I,J),J=1,NBORNAMPS)
        ENDDO
        GOTO 107
 106    CONTINUE
        STOP 'Color factors could not be initialized from file'
     $   //' ML5_0_ColorDenomFactors.dat. File not found'
 107    CONTINUE
        CLOSE(1)
        OPEN(1, FILE=HELCONFIGFN, ERR=108, STATUS='OLD',              
     $       ACTION='READ')
        DO H=1,NCOMB
          READ(1,*,END=109) (HELC(I,H),I=1,NEXTERNAL)
        ENDDO
        GOTO 109
 108    CONTINUE
        STOP 'Color helictiy configurations could not be initialized'
     $   //' from file ML5_0_HelConfigs.dat. File not found'
 109    CONTINUE
        CLOSE(1)
        IF(BOOTANDSTOP) THEN
          WRITE(*,*) '##Stopped by user request.'
          STOP
        ENDIF
        LOCAL_ML_INIT = .FALSE.
      ENDIF

C     Make sure that lorentz rotation tests are not used if there is
C      external loop wavefunction of spin 2 and that one specific
C      helicity is asked
      NROTATIONS_DP_BU = NROTATIONS_DP
      NROTATIONS_QP_BU = NROTATIONS_QP
      IF(MAX_SPIN_EXTERNAL_PARTICLE.GT.3.AND.USERHEL.NE.-1) THEN
        IF(.NOT.WARNED_LORENTZ_STAB_TEST_OFF) THEN
          WRITE(*,*) '##WARNING: Evaluation of a specific helicity was'
     $     //' asked for this PS point, and there is a spin-2 (or'
     $     //' higher) particle in the external states.'
          WRITE(*,*) '##WARNING: As a result, MadLoop disabled the'
     $     //' Lorentz rotation test for this phase-space point only.'
          WRITE(*,*) '##WARNING: Further warning of that type'
     $     //' suppressed.'
          WARNED_LORENTZ_STAB_TEST_OFF = .FALSE.
        ENDIF
        NROTATIONS_QP=0
        NROTATIONS_DP=0
      ENDIF

      IF(NTRY.EQ.0) THEN
        CALL ML5_0_SET_N_EVALS(N_DP_EVAL,N_QP_EVAL)
        HELDOUBLECHECKED=(.NOT.DOUBLECHECKHELICITYFILTER)
     $   .OR.(HELICITYFILTERLEVEL.EQ.0)
        DO J=1,NCOMB
          DO I=1,NCTAMPS
            GOODAMP(I,J)=.TRUE.
          ENDDO
        ENDDO
        OPEN(1, FILE=LOOPFILTERFN, ERR=100, STATUS='OLD',          
     $    ACTION='READ')
        DO J=1,NCOMB
          READ(1,*,END=101) (GOODAMP(I,J),I=NCTAMPS+1,NLOOPAMPS)
        ENDDO
        GOTO 101
 100    CONTINUE
        FOUNDLOOPFILTER=.FALSE.
        DO J=1,NCOMB
          DO I=NCTAMPS+1,NLOOPAMPS
            GOODAMP(I,J)=(.NOT.USELOOPFILTER)
          ENDDO
        ENDDO
 101    CONTINUE
        CLOSE(1)
        IF (HELICITYFILTERLEVEL.EQ.0) THEN
          FOUNDHELFILTER=.TRUE.
          DO J=1,NCOMB
            GOODHEL(J)=.TRUE.
          ENDDO
          GOTO 122
        ENDIF
        OPEN(1, FILE=HELFILTERFN, ERR=102, STATUS='OLD',          
     $    ACTION='READ')
        READ(1,*,END=103) (GOODHEL(I),I=1,NCOMB)
        GOTO 103
 102    CONTINUE
        FOUNDHELFILTER=.FALSE.
        DO J=1,NCOMB
          GOODHEL(J)=.TRUE.
        ENDDO
 103    CONTINUE
        CLOSE(1)
 122    CONTINUE
      ENDIF

      MP_DONE=.FALSE.
      MP_DONE_ONCE=.FALSE.
      MP_PS_SET=.FALSE.
      STAB_INDEX=0
      DOING_QP_EVALS=.FALSE.
      EVAL_DONE(1)=.TRUE.
      DO I=2,MAXSTABILITYLENGTH
        EVAL_DONE(I)=.FALSE.
      ENDDO

C     Compute the born, for a specific helicity if asked so.
      CALL ML5_0_SMATRIXHEL(P_USER,USERHEL,ANS(0))


      IF (USER_STAB_PREC.GT.0.0D0) THEN
        MLSTABTHRES_BU=MLSTABTHRES
        MLSTABTHRES=USER_STAB_PREC
C       In the initialization, I cannot perform stability test and
C        therefore guarantee any precision
        CTMODEINIT_BU=CTMODEINIT
C       So either one choses quad precision directly
C       CTMODEINIT=4
C       Or, because this is very slow, we keep the orignal value. The
C        accuracy returned is -1 and tells the MC that he should not
C        trust the evaluation for checks.
        CTMODEINIT=CTMODEINIT_BU
      ENDIF

      IF(.NOT.BYPASS_CHECK) THEN
        NTRY=NTRY+1
      ENDIF

      IF(DONEHELDOUBLECHECK.AND.(.NOT.HELDOUBLECHECKED)) THEN
        HELDOUBLECHECKED=.TRUE.
        DONEHELDOUBLECHECK=.FALSE.
      ENDIF

      CHECKPHASE=(NTRY.LE.CHECKCYCLE).AND.(((.NOT.FOUNDLOOPFILTER)
     $ .AND.USELOOPFILTER).OR.(.NOT.FOUNDHELFILTER))

      IF (WRITEOUTFILTERS) THEN
        IF ((.NOT. CHECKPHASE).AND.(.NOT.FOUNDHELFILTER)) THEN
          OPEN(1, FILE=HELFILTERFN, ERR=110, STATUS='NEW'
     $     ,ACTION='WRITE')
          WRITE(1,*) (GOODHEL(I),I=1,NCOMB)
 110      CONTINUE
          CLOSE(1)
          FOUNDHELFILTER=.TRUE.
        ENDIF

        IF ((.NOT. CHECKPHASE).AND.(.NOT.FOUNDLOOPFILTER)
     $   .AND.USELOOPFILTER) THEN
          OPEN(1, FILE=LOOPFILTERFN, ERR=111, STATUS='NEW'
     $     ,ACTION='WRITE')
          DO J=1,NCOMB
            WRITE(1,*) (GOODAMP(I,J),I=NCTAMPS+1,NLOOPAMPS)
          ENDDO
 111      CONTINUE
          CLOSE(1)
          FOUNDLOOPFILTER=.TRUE.
        ENDIF
      ENDIF

      IF (BYPASS_CHECK) THEN
        OLD_CHECKPHASE = CHECKPHASE
        OLD_HELDOUBLECHECKED = HELDOUBLECHECKED
        CHECKPHASE = .FALSE.
        HELDOUBLECHECKED = .TRUE.
        DO I=1,NCOMB
          OLD_GOODHEL(I)=GOODHEL(I)
          GOODHEL(I) = .TRUE.
        ENDDO
        DO I=1,NCOMB
          DO J=1,NLOOPAMPS
            OLD_GOODAMP(J,I)=GOODAMP(J,I)
            GOODAMP(J,I) = .TRUE.
          ENDDO
        ENDDO
      ENDIF

      IF(CHECKPHASE.OR.(.NOT.HELDOUBLECHECKED)) THEN
        HELPICKED=1
        CTMODE=CTMODEINIT
      ELSE
        IF (USERHEL.NE.-1) THEN
          IF(.NOT.GOODHEL(USERHEL)) THEN
            ANS(1)=0.0D0
            ANS(2)=0.0D0
            ANS(3)=0.0D0
            GOTO 9999
          ENDIF
        ENDIF
        HELPICKED=USERHEL
        IF (CTMODERUN.GT.-1) THEN
          CTMODE=CTMODERUN
        ELSE
          CTMODE=1
        ENDIF
      ENDIF

      DO I=1,NEXTERNAL
        DO J=0,3
          PS(J,I)=P_USER(J,I)
        ENDDO
      ENDDO

      IF (IMPROVEPSPOINT.GE.0) THEN
C       Make the input PS more precise (exact onshell and
C        energy-momentum conservation)
        CALL ML5_0_IMPROVE_PS_POINT_PRECISION(PS)
      ENDIF

      DO I=1,NEXTERNAL
        DO J=0,3
          P(J,I)=PS(J,I)
        ENDDO
      ENDDO

      DO K=1, 3
        BUFFR(K)=0.0D0
        DO I=1,NLOOPAMPS
          AMPL(K,I)=(0.0D0,0.0D0)
        ENDDO
      ENDDO

      LSCALE=DSQRT(ABS((P(0,1)+P(0,2))**2-(P(1,1)+P(1,2))**2-(P(2,1)
     $ +P(2,2))**2-(P(3,1)+P(3,2))**2))

C     We chose to use the born evaluation for the reference
      CALL ML5_0_SMATRIX(P,REF)

 200  CONTINUE

      IF (CTMODE.EQ.0.OR.CTMODE.GE.4) THEN
        CALL MP_UPDATE_AS_PARAM()
      ENDIF

      IF (.NOT.MP_PS_SET.AND.(CTMODE.EQ.0.OR.CTMODE.GE.4)) THEN
        CALL ML5_0_SET_MP_PS(P_USER)
        MP_PS_SET = .TRUE.
      ENDIF

      DO K=1,3
        ANS(K)=0.0D0
      ENDDO

      VALIDH=-1
      DO H=1,NCOMB
        IF ((HELPICKED.EQ.H).OR.((HELPICKED.EQ.-1).AND.(CHECKPHASE.OR.(
     $.NOT.HELDOUBLECHECKED).OR.GOODHEL(H)))) THEN

C         Handle the possible requirement of specific polarizations
          IF ((.NOT.CHECKPHASE).AND.HELDOUBLECHECKED.AND.POLARIZATIONS(
     $0,0).EQ.0.AND.(.NOT.ML5_0_IS_HEL_SELECTED(H))) THEN
            CYCLE
          ENDIF

          IF (VALIDH.EQ.-1) VALIDH=H
          DO I=1,NEXTERNAL
            NHEL(I)=HELC(I,H)
          ENDDO
C         Check if we are in multiple precision and compute wfs and
C          amps accordingly if needed   
          IF (CTMODE.GE.4) THEN
C           Force that only current helicity is used in the routine
C            below
C           This should always be done, even if MP_DONE is True
C           because the AMPL of the R2 MUST be recomputed for loop
C            induced.
C           (because they are not saved for each hel configuration)
C           (This is not optimal unlike what is done int the loop
C            optimized output)
            HELPICKED_BU = HELPICKED
            HELPICKED = H
            CALL ML5_0_MP_BORN_AMPS_AND_WFS(MP_P)
            HELPICKED = HELPICKED_BU
            GOTO 300
          ENDIF
          CALL VXXXXX(P(0,1),ZERO,NHEL(1),-1*IC(1),W(1,1,H))
          CALL VXXXXX(P(0,2),ZERO,NHEL(2),-1*IC(2),W(1,2,H))
          CALL VXXXXX(P(0,3),MDL_MW,NHEL(3),+1*IC(3),W(1,3,H))
          CALL OXXXXX(P(0,4),MDL_MT,NHEL(4),+1*IC(4),W(1,4,H))
          CALL IXXXXX(P(0,5),MDL_MB,NHEL(5),-1*IC(5),W(1,5,H))
          CALL VVV1P0_1(W(1,1,H),W(1,2,H),GC_4,ZERO,ZERO,W(1,6,H))
          CALL FFV2_1(W(1,4,H),W(1,3,H),GC_47,MDL_MB,ZERO,W(1,7,H))
C         Amplitude(s) for born diagram with ID 1
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),GC_5,AMP(1,H))
          CALL FFV2_2(W(1,5,H),W(1,3,H),GC_47,MDL_MT,MDL_WT,W(1,8,H))
C         Amplitude(s) for born diagram with ID 2
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),GC_5,AMP(2,H))
          CALL FFV1_1(W(1,4,H),W(1,1,H),GC_5,MDL_MT,MDL_WT,W(1,9,H))
          CALL FFV1_2(W(1,5,H),W(1,2,H),GC_5,MDL_MB,ZERO,W(1,10,H))
C         Amplitude(s) for born diagram with ID 3
          CALL FFV2_0(W(1,10,H),W(1,9,H),W(1,3,H),GC_47,AMP(3,H))
C         Amplitude(s) for born diagram with ID 4
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),GC_5,AMP(4,H))
          CALL FFV1_2(W(1,5,H),W(1,1,H),GC_5,MDL_MB,ZERO,W(1,11,H))
          CALL FFV1_1(W(1,4,H),W(1,2,H),GC_5,MDL_MT,MDL_WT,W(1,12,H))
C         Amplitude(s) for born diagram with ID 5
          CALL FFV2_0(W(1,11,H),W(1,12,H),W(1,3,H),GC_47,AMP(5,H))
C         Amplitude(s) for born diagram with ID 6
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),GC_5,AMP(6,H))
C         Amplitude(s) for born diagram with ID 7
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),GC_5,AMP(7,H))
C         Amplitude(s) for born diagram with ID 8
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),GC_5,AMP(8,H))
          CALL FFV1P0_3(W(1,5,H),W(1,7,H),GC_5,ZERO,ZERO,W(1,13,H))
C         Counter-term amplitude(s) for loop diagram number 9
          CALL R2_GG_1_0(W(1,6,H),W(1,13,H),R2_GGQ,AMPL(1,1))
          CALL R2_GG_1_0(W(1,6,H),W(1,13,H),R2_GGQ,AMPL(1,2))
          CALL R2_GG_1_0(W(1,6,H),W(1,13,H),R2_GGQ,AMPL(1,3))
          CALL R2_GG_1_0(W(1,6,H),W(1,13,H),R2_GGQ,AMPL(1,4))
          CALL FFV1P0_3(W(1,8,H),W(1,4,H),GC_5,ZERO,ZERO,W(1,14,H))
C         Counter-term amplitude(s) for loop diagram number 10
          CALL R2_GG_1_0(W(1,6,H),W(1,14,H),R2_GGQ,AMPL(1,5))
          CALL R2_GG_1_0(W(1,6,H),W(1,14,H),R2_GGQ,AMPL(1,6))
          CALL R2_GG_1_0(W(1,6,H),W(1,14,H),R2_GGQ,AMPL(1,7))
          CALL R2_GG_1_0(W(1,6,H),W(1,14,H),R2_GGQ,AMPL(1,8))
C         Counter-term amplitude(s) for loop diagram number 11
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GB_1EPS,AMPL(2,9)
     $     )
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GB_1EPS,AMPL(2
     $     ,10))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GB_1EPS,AMPL(2
     $     ,11))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GB_1EPS,AMPL(2
     $     ,12))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GB,AMPL(1,13))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GB_1EPS,AMPL(2
     $     ,14))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GT,AMPL(1,15))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GB_1EPS,AMPL(2
     $     ,16))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),UV_3GG_1EPS,AMPL(2
     $     ,17))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),R2_3GQ,AMPL(1,18))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),R2_3GQ,AMPL(1,19))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),R2_3GQ,AMPL(1,20))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),R2_3GQ,AMPL(1,21))
C         Counter-term amplitude(s) for loop diagram number 12
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GB_1EPS,AMPL(2
     $     ,22))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GB_1EPS,AMPL(2
     $     ,23))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GB_1EPS,AMPL(2
     $     ,24))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GB_1EPS,AMPL(2
     $     ,25))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GB,AMPL(1,26))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GB_1EPS,AMPL(2
     $     ,27))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GT,AMPL(1,28))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GB_1EPS,AMPL(2
     $     ,29))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),UV_3GG_1EPS,AMPL(2
     $     ,30))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),R2_3GQ,AMPL(1,31))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),R2_3GQ,AMPL(1,32))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),R2_3GQ,AMPL(1,33))
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),R2_3GQ,AMPL(1,34))
          CALL FFV1_2(W(1,5,H),W(1,6,H),GC_5,MDL_MB,ZERO,W(1,15,H))
C         Counter-term amplitude(s) for loop diagram number 15
          CALL R2_QQ_1_R2_QQ_2_0(W(1,15,H),W(1,7,H),R2_QQQ,R2_QQB
     $     ,AMPL(1,35))
          CALL R2_QQ_2_0(W(1,15,H),W(1,7,H),UV_BMASS,AMPL(1,36))
          CALL R2_QQ_2_0(W(1,15,H),W(1,7,H),UV_BMASS_1EPS,AMPL(2,37))
C         Counter-term amplitude(s) for loop diagram number 16
          CALL R2_GG_1_R2_GG_3_0(W(1,6,H),W(1,13,H),R2_GGQ,R2_GGB
     $     ,AMPL(1,38))
C         Counter-term amplitude(s) for loop diagram number 17
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,39))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,40))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,41))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,42))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQB,AMPL(1,43))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,44))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQT,AMPL(1,45))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,46))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),UV_GQQG_1EPS,AMPL(2
     $     ,47))
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),R2_GQQ,AMPL(1,48))
C         Counter-term amplitude(s) for loop diagram number 19
          CALL R2_GG_1_R2_GG_3_0(W(1,6,H),W(1,14,H),R2_GGQ,R2_GGB
     $     ,AMPL(1,49))
C         Counter-term amplitude(s) for loop diagram number 20
          CALL FFV2_0(W(1,15,H),W(1,4,H),W(1,3,H),R2_SXCW,AMPL(1,50))
          CALL FFV1_1(W(1,4,H),W(1,6,H),GC_5,MDL_MT,MDL_WT,W(1,16,H))
C         Counter-term amplitude(s) for loop diagram number 23
          CALL FFV2_0(W(1,5,H),W(1,16,H),W(1,3,H),R2_SXCW,AMPL(1,51))
          CALL FFV2_1(W(1,9,H),W(1,3,H),GC_47,MDL_MB,ZERO,W(1,17,H))
C         Counter-term amplitude(s) for loop diagram number 25
          CALL R2_QQ_1_R2_QQ_2_0(W(1,10,H),W(1,17,H),R2_QQQ,R2_QQB
     $     ,AMPL(1,52))
          CALL R2_QQ_2_0(W(1,10,H),W(1,17,H),UV_BMASS,AMPL(1,53))
          CALL R2_QQ_2_0(W(1,10,H),W(1,17,H),UV_BMASS_1EPS,AMPL(2,54))
C         Counter-term amplitude(s) for loop diagram number 26
          CALL FFV2_0(W(1,10,H),W(1,9,H),W(1,3,H),R2_SXCW,AMPL(1,55))
C         Counter-term amplitude(s) for loop diagram number 27
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,56))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,57))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,58))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,59))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQB,AMPL(1,60))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,61))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQT,AMPL(1,62))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,63))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),UV_GQQG_1EPS,AMPL(2
     $     ,64))
          CALL FFV1_0(W(1,5,H),W(1,17,H),W(1,2,H),R2_GQQ,AMPL(1,65))
          CALL FFV1_1(W(1,9,H),W(1,2,H),GC_5,MDL_MT,MDL_WT,W(1,18,H))
C         Counter-term amplitude(s) for loop diagram number 29
          CALL FFV2_0(W(1,5,H),W(1,18,H),W(1,3,H),R2_SXCW,AMPL(1,66))
          CALL FFV2_1(W(1,12,H),W(1,3,H),GC_47,MDL_MB,ZERO,W(1,19,H))
C         Counter-term amplitude(s) for loop diagram number 33
          CALL R2_QQ_1_R2_QQ_2_0(W(1,11,H),W(1,19,H),R2_QQQ,R2_QQB
     $     ,AMPL(1,67))
          CALL R2_QQ_2_0(W(1,11,H),W(1,19,H),UV_BMASS,AMPL(1,68))
          CALL R2_QQ_2_0(W(1,11,H),W(1,19,H),UV_BMASS_1EPS,AMPL(2,69))
C         Counter-term amplitude(s) for loop diagram number 34
          CALL FFV2_0(W(1,11,H),W(1,12,H),W(1,3,H),R2_SXCW,AMPL(1,70))
C         Counter-term amplitude(s) for loop diagram number 35
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,71))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,72))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,73))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,74))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQB,AMPL(1,75))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,76))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQT,AMPL(1,77))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,78))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),UV_GQQG_1EPS,AMPL(2
     $     ,79))
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),R2_GQQ,AMPL(1,80))
          CALL FFV1_2(W(1,11,H),W(1,2,H),GC_5,MDL_MB,ZERO,W(1,20,H))
C         Counter-term amplitude(s) for loop diagram number 37
          CALL R2_QQ_1_R2_QQ_2_0(W(1,20,H),W(1,7,H),R2_QQQ,R2_QQB
     $     ,AMPL(1,81))
          CALL R2_QQ_2_0(W(1,20,H),W(1,7,H),UV_BMASS,AMPL(1,82))
          CALL R2_QQ_2_0(W(1,20,H),W(1,7,H),UV_BMASS_1EPS,AMPL(2,83))
          CALL FFV1_1(W(1,7,H),W(1,2,H),GC_5,MDL_MB,ZERO,W(1,21,H))
C         Counter-term amplitude(s) for loop diagram number 38
          CALL R2_QQ_1_R2_QQ_2_0(W(1,11,H),W(1,21,H),R2_QQQ,R2_QQB
     $     ,AMPL(1,84))
          CALL R2_QQ_2_0(W(1,11,H),W(1,21,H),UV_BMASS,AMPL(1,85))
          CALL R2_QQ_2_0(W(1,11,H),W(1,21,H),UV_BMASS_1EPS,AMPL(2,86))
C         Counter-term amplitude(s) for loop diagram number 40
          CALL FFV2_0(W(1,20,H),W(1,4,H),W(1,3,H),R2_SXCW,AMPL(1,87))
C         Counter-term amplitude(s) for loop diagram number 43
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,88))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,89))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,90))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,91))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQB,AMPL(1,92))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,93))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQT,AMPL(1,94))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,95))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),UV_GQQG_1EPS,AMPL(2
     $     ,96))
          CALL FFV1_0(W(1,5,H),W(1,19,H),W(1,1,H),R2_GQQ,AMPL(1,97))
C         Counter-term amplitude(s) for loop diagram number 45
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,98))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,99))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,100))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,101))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQB,AMPL(1,102))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,103))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQT,AMPL(1,104))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,105))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),UV_GQQG_1EPS,AMPL(2
     $     ,106))
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),R2_GQQ,AMPL(1,107))
C         Counter-term amplitude(s) for loop diagram number 48
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),R2_3GQ,AMPL(1,108))
C         Counter-term amplitude(s) for loop diagram number 50
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),R2_3GQ,AMPL(1,109))
C         Counter-term amplitude(s) for loop diagram number 53
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,110))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,111))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,112))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,113))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQB,AMPL(1,114))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,115))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQT,AMPL(1,116))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,117))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),UV_GQQG_1EPS,AMPL(2
     $     ,118))
          CALL FFV1_0(W(1,5,H),W(1,21,H),W(1,1,H),R2_GQQ,AMPL(1,119))
          CALL FFV1_1(W(1,12,H),W(1,1,H),GC_5,MDL_MT,MDL_WT,W(1,22,H))
C         Counter-term amplitude(s) for loop diagram number 59
          CALL FFV2_0(W(1,5,H),W(1,22,H),W(1,3,H),R2_SXCW,AMPL(1,120))
          CALL FFV1_2(W(1,10,H),W(1,1,H),GC_5,MDL_MB,ZERO,W(1,23,H))
C         Counter-term amplitude(s) for loop diagram number 63
          CALL R2_QQ_1_R2_QQ_2_0(W(1,23,H),W(1,7,H),R2_QQQ,R2_QQB
     $     ,AMPL(1,121))
          CALL R2_QQ_2_0(W(1,23,H),W(1,7,H),UV_BMASS,AMPL(1,122))
          CALL R2_QQ_2_0(W(1,23,H),W(1,7,H),UV_BMASS_1EPS,AMPL(2,123))
          CALL FFV1_1(W(1,7,H),W(1,1,H),GC_5,MDL_MB,ZERO,W(1,24,H))
C         Counter-term amplitude(s) for loop diagram number 64
          CALL R2_QQ_1_R2_QQ_2_0(W(1,10,H),W(1,24,H),R2_QQQ,R2_QQB
     $     ,AMPL(1,124))
          CALL R2_QQ_2_0(W(1,10,H),W(1,24,H),UV_BMASS,AMPL(1,125))
          CALL R2_QQ_2_0(W(1,10,H),W(1,24,H),UV_BMASS_1EPS,AMPL(2,126))
C         Counter-term amplitude(s) for loop diagram number 66
          CALL FFV2_0(W(1,23,H),W(1,4,H),W(1,3,H),R2_SXCW,AMPL(1,127))
C         Counter-term amplitude(s) for loop diagram number 69
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,128))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,129))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,130))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,131))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQB,AMPL(1,132))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,133))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQT,AMPL(1,134))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,135))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),UV_GQQG_1EPS,AMPL(2
     $     ,136))
          CALL FFV1_0(W(1,5,H),W(1,24,H),W(1,2,H),R2_GQQ,AMPL(1,137))
C         Counter-term amplitude(s) for loop diagram number 85
          CALL R2_GG_1_R2_GG_3_0(W(1,6,H),W(1,13,H),R2_GGQ,R2_GGT
     $     ,AMPL(1,138))
C         Counter-term amplitude(s) for loop diagram number 86
          CALL R2_QQ_1_R2_QQ_2_0(W(1,8,H),W(1,16,H),R2_QQQ,R2_QQT
     $     ,AMPL(1,139))
          CALL R2_QQ_2_0(W(1,8,H),W(1,16,H),UV_TMASS,AMPL(1,140))
          CALL R2_QQ_2_0(W(1,8,H),W(1,16,H),UV_TMASS_1EPS,AMPL(2,141))
C         Counter-term amplitude(s) for loop diagram number 87
          CALL R2_GG_1_R2_GG_3_0(W(1,6,H),W(1,14,H),R2_GGQ,R2_GGT
     $     ,AMPL(1,142))
C         Counter-term amplitude(s) for loop diagram number 88
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,143))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,144))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,145))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,146))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQB,AMPL(1,147))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,148))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQT,AMPL(1,149))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQQ_1EPS,AMPL(2
     $     ,150))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),UV_GQQG_1EPS,AMPL(2
     $     ,151))
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),R2_GQQ,AMPL(1,152))
          CALL FFV2_2(W(1,10,H),W(1,3,H),GC_47,MDL_MT,MDL_WT,W(1,25,H))
C         Counter-term amplitude(s) for loop diagram number 90
          CALL R2_QQ_1_R2_QQ_2_0(W(1,25,H),W(1,9,H),R2_QQQ,R2_QQT
     $     ,AMPL(1,153))
          CALL R2_QQ_2_0(W(1,25,H),W(1,9,H),UV_TMASS,AMPL(1,154))
          CALL R2_QQ_2_0(W(1,25,H),W(1,9,H),UV_TMASS_1EPS,AMPL(2,155))
C         Counter-term amplitude(s) for loop diagram number 91
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,156))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,157))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,158))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,159))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQB,AMPL(1,160))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,161))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQT,AMPL(1,162))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,163))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),UV_GQQG_1EPS,AMPL(2
     $     ,164))
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),R2_GQQ,AMPL(1,165))
C         Counter-term amplitude(s) for loop diagram number 92
          CALL R2_QQ_1_R2_QQ_2_0(W(1,8,H),W(1,18,H),R2_QQQ,R2_QQT
     $     ,AMPL(1,166))
          CALL R2_QQ_2_0(W(1,8,H),W(1,18,H),UV_TMASS,AMPL(1,167))
          CALL R2_QQ_2_0(W(1,8,H),W(1,18,H),UV_TMASS_1EPS,AMPL(2,168))
          CALL FFV1_2(W(1,8,H),W(1,2,H),GC_5,MDL_MT,MDL_WT,W(1,26,H))
C         Counter-term amplitude(s) for loop diagram number 93
          CALL R2_QQ_1_R2_QQ_2_0(W(1,26,H),W(1,9,H),R2_QQQ,R2_QQT
     $     ,AMPL(1,169))
          CALL R2_QQ_2_0(W(1,26,H),W(1,9,H),UV_TMASS,AMPL(1,170))
          CALL R2_QQ_2_0(W(1,26,H),W(1,9,H),UV_TMASS_1EPS,AMPL(2,171))
          CALL FFV2_2(W(1,11,H),W(1,3,H),GC_47,MDL_MT,MDL_WT,W(1,27,H))
C         Counter-term amplitude(s) for loop diagram number 95
          CALL R2_QQ_1_R2_QQ_2_0(W(1,27,H),W(1,12,H),R2_QQQ,R2_QQT
     $     ,AMPL(1,172))
          CALL R2_QQ_2_0(W(1,27,H),W(1,12,H),UV_TMASS,AMPL(1,173))
          CALL R2_QQ_2_0(W(1,27,H),W(1,12,H),UV_TMASS_1EPS,AMPL(2,174))
C         Counter-term amplitude(s) for loop diagram number 96
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,175))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,176))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,177))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,178))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQB,AMPL(1,179))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,180))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQT,AMPL(1,181))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,182))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),UV_GQQG_1EPS,AMPL(2
     $     ,183))
          CALL FFV1_0(W(1,27,H),W(1,4,H),W(1,2,H),R2_GQQ,AMPL(1,184))
C         Counter-term amplitude(s) for loop diagram number 98
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,185))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,186))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,187))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,188))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQB,AMPL(1,189))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,190))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQT,AMPL(1,191))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,192))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),UV_GQQG_1EPS,AMPL(2
     $     ,193))
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),R2_GQQ,AMPL(1,194))
C         Counter-term amplitude(s) for loop diagram number 99
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,195))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,196))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,197))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,198))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQB,AMPL(1,199))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,200))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQT,AMPL(1,201))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,202))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),UV_GQQG_1EPS,AMPL(2
     $     ,203))
          CALL FFV1_0(W(1,25,H),W(1,4,H),W(1,1,H),R2_GQQ,AMPL(1,204))
C         Counter-term amplitude(s) for loop diagram number 100
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),R2_3GQ,AMPL(1,205))
C         Counter-term amplitude(s) for loop diagram number 101
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),R2_3GQ,AMPL(1,206))
C         Counter-term amplitude(s) for loop diagram number 107
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,207))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,208))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,209))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,210))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQB,AMPL(1,211))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,212))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQT,AMPL(1,213))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQQ_1EPS,AMPL(2
     $     ,214))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),UV_GQQG_1EPS,AMPL(2
     $     ,215))
          CALL FFV1_0(W(1,26,H),W(1,4,H),W(1,1,H),R2_GQQ,AMPL(1,216))
C         Counter-term amplitude(s) for loop diagram number 108
          CALL R2_QQ_1_R2_QQ_2_0(W(1,8,H),W(1,22,H),R2_QQQ,R2_QQT
     $     ,AMPL(1,217))
          CALL R2_QQ_2_0(W(1,8,H),W(1,22,H),UV_TMASS,AMPL(1,218))
          CALL R2_QQ_2_0(W(1,8,H),W(1,22,H),UV_TMASS_1EPS,AMPL(2,219))
          CALL FFV1_2(W(1,8,H),W(1,1,H),GC_5,MDL_MT,MDL_WT,W(1,28,H))
C         Counter-term amplitude(s) for loop diagram number 109
          CALL R2_QQ_1_R2_QQ_2_0(W(1,28,H),W(1,12,H),R2_QQQ,R2_QQT
     $     ,AMPL(1,220))
          CALL R2_QQ_2_0(W(1,28,H),W(1,12,H),UV_TMASS,AMPL(1,221))
          CALL R2_QQ_2_0(W(1,28,H),W(1,12,H),UV_TMASS_1EPS,AMPL(2,222))
C         Counter-term amplitude(s) for loop diagram number 112
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,223))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,224))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,225))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,226))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQB,AMPL(1,227))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,228))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQT,AMPL(1,229))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQQ_1EPS,AMPL(2
     $     ,230))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),UV_GQQG_1EPS,AMPL(2
     $     ,231))
          CALL FFV1_0(W(1,28,H),W(1,4,H),W(1,2,H),R2_GQQ,AMPL(1,232))
C         Counter-term amplitude(s) for loop diagram number 119
          CALL R2_GG_1_R2_GG_2_0(W(1,6,H),W(1,13,H),R2_GGG_1,R2_GGG_2
     $     ,AMPL(1,233))
C         Counter-term amplitude(s) for loop diagram number 120
          CALL R2_GG_1_R2_GG_2_0(W(1,6,H),W(1,14,H),R2_GGG_1,R2_GGG_2
     $     ,AMPL(1,234))
C         Counter-term amplitude(s) for loop diagram number 121
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,13,H),R2_3GG,AMPL(1,235))
C         Counter-term amplitude(s) for loop diagram number 122
          CALL VVV1_0(W(1,1,H),W(1,2,H),W(1,14,H),R2_3GG,AMPL(1,236))
C         Amplitude(s) for UVCT diagram with ID 135
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),GC_5,AMPL(1,237))
          AMPL(1,237)=AMPL(1,237)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 136
          CALL FFV1_0(W(1,5,H),W(1,7,H),W(1,6,H),GC_5,AMPL(2,238))
          AMPL(2,238)=AMPL(2,238)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
C         Amplitude(s) for UVCT diagram with ID 137
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),GC_5,AMPL(1,239))
          AMPL(1,239)=AMPL(1,239)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 138
          CALL FFV1_0(W(1,8,H),W(1,4,H),W(1,6,H),GC_5,AMPL(2,240))
          AMPL(2,240)=AMPL(2,240)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
C         Amplitude(s) for UVCT diagram with ID 139
          CALL FFV2_0(W(1,10,H),W(1,9,H),W(1,3,H),GC_47,AMPL(1,241))
          AMPL(1,241)=AMPL(1,241)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 140
          CALL FFV2_0(W(1,10,H),W(1,9,H),W(1,3,H),GC_47,AMPL(2,242))
          AMPL(2,242)=AMPL(2,242)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
C         Amplitude(s) for UVCT diagram with ID 141
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),GC_5,AMPL(1,243))
          AMPL(1,243)=AMPL(1,243)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 142
          CALL FFV1_0(W(1,8,H),W(1,9,H),W(1,2,H),GC_5,AMPL(2,244))
          AMPL(2,244)=AMPL(2,244)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
C         Amplitude(s) for UVCT diagram with ID 143
          CALL FFV2_0(W(1,11,H),W(1,12,H),W(1,3,H),GC_47,AMPL(1,245))
          AMPL(1,245)=AMPL(1,245)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 144
          CALL FFV2_0(W(1,11,H),W(1,12,H),W(1,3,H),GC_47,AMPL(2,246))
          AMPL(2,246)=AMPL(2,246)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
C         Amplitude(s) for UVCT diagram with ID 145
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),GC_5,AMPL(1,247))
          AMPL(1,247)=AMPL(1,247)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 146
          CALL FFV1_0(W(1,11,H),W(1,7,H),W(1,2,H),GC_5,AMPL(2,248))
          AMPL(2,248)=AMPL(2,248)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
C         Amplitude(s) for UVCT diagram with ID 147
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),GC_5,AMPL(1,249))
          AMPL(1,249)=AMPL(1,249)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 148
          CALL FFV1_0(W(1,8,H),W(1,12,H),W(1,1,H),GC_5,AMPL(2,250))
          AMPL(2,250)=AMPL(2,250)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
C         Amplitude(s) for UVCT diagram with ID 149
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),GC_5,AMPL(1,251))
          AMPL(1,251)=AMPL(1,251)*(2.0D0*UVWFCT_G_2+2.0D0*UVWFCT_G_1
     $     +1.0D0*UVWFCT_T_0+1.0D0*UVWFCT_B_0)
C         Amplitude(s) for UVCT diagram with ID 150
          CALL FFV1_0(W(1,10,H),W(1,7,H),W(1,1,H),GC_5,AMPL(2,252))
          AMPL(2,252)=AMPL(2,252)*(2.0D0*UVWFCT_B_0_1EPS+4.0D0
     $     *UVWFCT_G_2_1EPS)
 300      CONTINUE



          DO I=1,NCTAMPS
            DO J=1,NBORNAMPS
              CFTOT=DCMPLX(CF_N(I,J)/DBLE(ABS(CF_D(I,J))),0.0D0)
              IF(CF_D(I,J).LT.0) CFTOT=CFTOT*IMAG1
              DO K=1,3
                ANS(K)=ANS(K)+2.0D0*DBLE(CFTOT*AMPL(K,I)*DCONJG(AMP(J
     $           ,H)))
              ENDDO
            ENDDO
          ENDDO
        ENDIF
      ENDDO

C     WHEN CTMODE IS >=4, then the MP computation of wfs and amps is
C      automatically done.
      IF (CTMODE.GE.4) THEN
        MP_DONE = .TRUE.
      ENDIF

      IF(SKIPLOOPEVAL) THEN
        GOTO 1226
      ENDIF

C     Loop amplitude for loop diagram with ID 9
      CALL ML5_0_LOOP_2_2(1,6,13,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,4,253,AMPL(1,253),S(253))
C     Loop amplitude for loop diagram with ID 10
      CALL ML5_0_LOOP_2_2(1,6,14,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,4,254,AMPL(1,254),S(254))
C     Loop amplitude for loop diagram with ID 11
      CALL ML5_0_LOOP_3_3(2,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,4,255,AMPL(1,255),S(255))
C     Loop amplitude for loop diagram with ID 12
      CALL ML5_0_LOOP_3_3(2,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,4,256,AMPL(1,256),S(256))
C     Loop amplitude for loop diagram with ID 13
      CALL ML5_0_LOOP_3_3(3,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,4,257,AMPL(1,257),S(257))
C     Loop amplitude for loop diagram with ID 14
      CALL ML5_0_LOOP_3_3(3,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,4,258,AMPL(1,258),S(258))
C     Loop amplitude for loop diagram with ID 15
      CALL ML5_0_LOOP_2_2(4,7,15,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,259,AMPL(1,259),S(259))
C     Loop amplitude for loop diagram with ID 16
      CALL ML5_0_LOOP_2_2(1,6,13,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,2,1,1,260,AMPL(1,260),S(260))
C     Loop amplitude for loop diagram with ID 17
      CALL ML5_0_LOOP_3_3(5,5,6,7,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,261,AMPL(1,261),S(261))
C     Loop amplitude for loop diagram with ID 18
      CALL ML5_0_LOOP_3_3(6,5,6,7,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_4,MP__GC_4,GC_5
     $ ,MP__GC_5,2,1,1,262,AMPL(1,262),S(262))
C     Loop amplitude for loop diagram with ID 19
      CALL ML5_0_LOOP_2_2(1,6,14,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,2,1,1,263,AMPL(1,263),S(263))
C     Loop amplitude for loop diagram with ID 20
      CALL ML5_0_LOOP_3_3(7,3,4,15,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,264,AMPL(1,264),S(264))
C     Loop amplitude for loop diagram with ID 21
      CALL ML5_0_LOOP_4_4(8,3,4,5,6,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,265,AMPL(1,265),S(265))
C     Loop amplitude for loop diagram with ID 22
      CALL ML5_0_LOOP_4_4(9,3,5,4,6,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,266,AMPL(1,266),S(266))
C     Loop amplitude for loop diagram with ID 23
      CALL ML5_0_LOOP_3_3(10,3,5,16,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,267,AMPL(1,267),S(267))
C     Loop amplitude for loop diagram with ID 24
      CALL ML5_0_LOOP_4_4(11,3,4,6,5,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_4,MP__GC_4,GC_5
     $ ,MP__GC_5,3,1,1,268,AMPL(1,268),S(268))
C     Loop amplitude for loop diagram with ID 25
      CALL ML5_0_LOOP_2_2(12,10,17,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,269,AMPL(1,269),S(269))
C     Loop amplitude for loop diagram with ID 26
      CALL ML5_0_LOOP_3_3(7,3,9,10,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,270,AMPL(1,270),S(270))
C     Loop amplitude for loop diagram with ID 27
      CALL ML5_0_LOOP_3_3(13,2,5,17,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,271,AMPL(1,271),S(271))
C     Loop amplitude for loop diagram with ID 28
      CALL ML5_0_LOOP_4_4(14,2,3,9,5,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,272,AMPL(1,272),S(272))
C     Loop amplitude for loop diagram with ID 29
      CALL ML5_0_LOOP_3_3(10,3,5,18,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,273,AMPL(1,273),S(273))
C     Loop amplitude for loop diagram with ID 30
      CALL ML5_0_LOOP_4_4(15,2,5,3,9,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,GC_5,MP__GC_5,3,1,1,274,AMPL(1,274),S(274))
C     Loop amplitude for loop diagram with ID 31
      CALL ML5_0_LOOP_4_4(16,2,3,5,9,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,275,AMPL(1,275),S(275))
C     Loop amplitude for loop diagram with ID 32
      CALL ML5_0_LOOP_3_3(17,2,5,17,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,276,AMPL(1,276),S(276))
C     Loop amplitude for loop diagram with ID 33
      CALL ML5_0_LOOP_2_2(12,11,19,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,277,AMPL(1,277),S(277))
C     Loop amplitude for loop diagram with ID 34
      CALL ML5_0_LOOP_3_3(7,3,12,11,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,278,AMPL(1,278),S(278))
C     Loop amplitude for loop diagram with ID 35
      CALL ML5_0_LOOP_3_3(18,2,7,11,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,279,AMPL(1,279),S(279))
C     Loop amplitude for loop diagram with ID 36
      CALL ML5_0_LOOP_4_4(14,2,3,4,11,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,280,AMPL(1,280),S(280))
C     Loop amplitude for loop diagram with ID 37
      CALL ML5_0_LOOP_2_2(4,7,20,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,281,AMPL(1,281),S(281))
C     Loop amplitude for loop diagram with ID 38
      CALL ML5_0_LOOP_2_2(12,11,21,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,282,AMPL(1,282),S(282))
C     Loop amplitude for loop diagram with ID 39
      CALL ML5_0_LOOP_3_3(19,2,7,11,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,283,AMPL(1,283),S(283))
C     Loop amplitude for loop diagram with ID 40
      CALL ML5_0_LOOP_3_3(7,3,4,20,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,284,AMPL(1,284),S(284))
C     Loop amplitude for loop diagram with ID 41
      CALL ML5_0_LOOP_4_4(16,2,3,11,4,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,285,AMPL(1,285),S(285))
C     Loop amplitude for loop diagram with ID 42
      CALL ML5_0_LOOP_4_4(20,2,4,3,11,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,GC_5,MP__GC_5,3,1,1,286,AMPL(1,286),S(286))
C     Loop amplitude for loop diagram with ID 43
      CALL ML5_0_LOOP_3_3(13,1,5,19,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,287,AMPL(1,287),S(287))
C     Loop amplitude for loop diagram with ID 44
      CALL ML5_0_LOOP_4_4(14,1,3,12,5,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,288,AMPL(1,288),S(288))
C     Loop amplitude for loop diagram with ID 45
      CALL ML5_0_LOOP_3_3(18,1,7,10,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,289,AMPL(1,289),S(289))
C     Loop amplitude for loop diagram with ID 46
      CALL ML5_0_LOOP_4_4(14,1,3,4,10,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,290,AMPL(1,290),S(290))
C     Loop amplitude for loop diagram with ID 47
      CALL ML5_0_LOOP_5_5(21,1,2,3,4,5,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,4,1,1,291,AMPL(1,291),S(291))
C     Loop amplitude for loop diagram with ID 48
      CALL ML5_0_LOOP_3_3(2,1,2,13,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,292,AMPL(1,292),S(292))
C     Loop amplitude for loop diagram with ID 49
      CALL ML5_0_LOOP_4_4(22,1,2,7,5,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,293,AMPL(1,293),S(293))
C     Loop amplitude for loop diagram with ID 50
      CALL ML5_0_LOOP_3_3(2,1,2,14,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,294,AMPL(1,294),S(294))
C     Loop amplitude for loop diagram with ID 51
      CALL ML5_0_LOOP_3_3(3,1,2,13,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,295,AMPL(1,295),S(295))
C     Loop amplitude for loop diagram with ID 52
      CALL ML5_0_LOOP_4_4(23,1,2,5,7,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,296,AMPL(1,296),S(296))
C     Loop amplitude for loop diagram with ID 53
      CALL ML5_0_LOOP_3_3(13,1,5,21,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,297,AMPL(1,297),S(297))
C     Loop amplitude for loop diagram with ID 54
      CALL ML5_0_LOOP_4_4(24,1,5,2,7,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_4,MP__GC_4,GC_5
     $ ,MP__GC_5,3,1,1,298,AMPL(1,298),S(298))
C     Loop amplitude for loop diagram with ID 55
      CALL ML5_0_LOOP_3_3(3,1,2,14,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,299,AMPL(1,299),S(299))
C     Loop amplitude for loop diagram with ID 56
      CALL ML5_0_LOOP_5_5(25,1,2,5,4,3,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,4,1,1,300,AMPL(1,300),S(300))
C     Loop amplitude for loop diagram with ID 57
      CALL ML5_0_LOOP_5_5(26,1,3,2,4,5,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,4,1,1,301,AMPL(1,301),S(301))
C     Loop amplitude for loop diagram with ID 58
      CALL ML5_0_LOOP_5_5(27,1,3,4,2,5,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,GC_5,MP__GC_5,GC_4,MP__GC_4,GC_5,MP__GC_5,4,1,1,302
     $ ,AMPL(1,302),S(302))
C     Loop amplitude for loop diagram with ID 59
      CALL ML5_0_LOOP_3_3(10,3,5,22,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,303,AMPL(1,303),S(303))
C     Loop amplitude for loop diagram with ID 60
      CALL ML5_0_LOOP_4_4(16,1,3,5,12,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,304,AMPL(1,304),S(304))
C     Loop amplitude for loop diagram with ID 61
      CALL ML5_0_LOOP_4_4(15,1,5,3,12,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,GC_5,MP__GC_5,3,1,1,305,AMPL(1,305),S(305))
C     Loop amplitude for loop diagram with ID 62
      CALL ML5_0_LOOP_3_3(17,1,5,19,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,306,AMPL(1,306),S(306))
C     Loop amplitude for loop diagram with ID 63
      CALL ML5_0_LOOP_2_2(4,7,23,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,307,AMPL(1,307),S(307))
C     Loop amplitude for loop diagram with ID 64
      CALL ML5_0_LOOP_2_2(12,10,24,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,308,AMPL(1,308),S(308))
C     Loop amplitude for loop diagram with ID 65
      CALL ML5_0_LOOP_3_3(19,1,7,10,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,309,AMPL(1,309),S(309))
C     Loop amplitude for loop diagram with ID 66
      CALL ML5_0_LOOP_3_3(7,3,4,23,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,310,AMPL(1,310),S(310))
C     Loop amplitude for loop diagram with ID 67
      CALL ML5_0_LOOP_4_4(16,1,3,10,4,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,311,AMPL(1,311),S(311))
C     Loop amplitude for loop diagram with ID 68
      CALL ML5_0_LOOP_4_4(20,1,4,3,10,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,GC_5,MP__GC_5,3,1,1,312,AMPL(1,312),S(312))
C     Loop amplitude for loop diagram with ID 69
      CALL ML5_0_LOOP_3_3(13,2,5,24,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,313,AMPL(1,313),S(313))
C     Loop amplitude for loop diagram with ID 70
      CALL ML5_0_LOOP_4_4(28,1,5,2,7,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,314,AMPL(1,314),S(314))
C     Loop amplitude for loop diagram with ID 71
      CALL ML5_0_LOOP_5_5(29,1,3,2,5,4,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,4,1,1,315,AMPL(1,315),S(315))
C     Loop amplitude for loop diagram with ID 72
      CALL ML5_0_LOOP_5_5(30,1,4,3,2,5,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,4,1,1,316,AMPL(1,316),S(316))
C     Loop amplitude for loop diagram with ID 73
      CALL ML5_0_LOOP_3_3(17,2,5,24,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,317,AMPL(1,317),S(317))
C     Loop amplitude for loop diagram with ID 74
      CALL ML5_0_LOOP_3_3(17,1,5,21,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,318,AMPL(1,318),S(318))
C     Loop amplitude for loop diagram with ID 75
      CALL ML5_0_LOOP_4_4(31,1,2,7,5,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,GC_4,MP__GC_4,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5,MP__GC_5,3,1,1
     $ ,319,AMPL(1,319),S(319))
C     Loop amplitude for loop diagram with ID 76
      CALL ML5_0_LOOP_4_4(32,1,2,5,7,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,GC_4,MP__GC_4,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5,MP__GC_5,3,1,1
     $ ,320,AMPL(1,320),S(320))
C     Loop amplitude for loop diagram with ID 77
      CALL ML5_0_LOOP_3_4_3(33,1,2,1,5,1,2,7,DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,1,1,1,321,AMPL(1,321),S(321))
      CALL ML5_0_LOOP_3_4_3(34,1,2,1,5,1,2,7,DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,1,1,1,322,AMPL(1,322),S(322))
      CALL ML5_0_LOOP_3_4_3(35,1,2,1,5,1,2,7,DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,1,1,1,323,AMPL(1,323),S(323))
C     Loop amplitude for loop diagram with ID 78
      CALL ML5_0_LOOP_5_5(36,1,3,5,2,4,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,GC_5,MP__GC_5,GC_4,MP__GC_4,GC_5,MP__GC_5,4,1,1,324
     $ ,AMPL(1,324),S(324))
C     Loop amplitude for loop diagram with ID 79
      CALL ML5_0_LOOP_5_5(37,1,2,4,5,3,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_47
     $ ,MP__GC_47,4,1,1,325,AMPL(1,325),S(325))
C     Loop amplitude for loop diagram with ID 80
      CALL ML5_0_LOOP_5_5(38,1,4,2,3,5,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5
     $ ,MP__GC_5,4,1,1,326,AMPL(1,326),S(326))
C     Loop amplitude for loop diagram with ID 81
      CALL ML5_0_LOOP_5_5(39,1,2,4,3,5,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),DCMPLX(MDL_MB),CMPLX(MP__MDL_MB
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,4,1
     $ ,1,327,AMPL(1,327),S(327))
C     Loop amplitude for loop diagram with ID 82
      CALL ML5_0_LOOP_5_5(40,1,2,3,5,4,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MB),CMPLX(MP__MDL_MB,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,4,1,1,328,AMPL(1,328),S(328))
C     Loop amplitude for loop diagram with ID 83
      CALL ML5_0_LOOP_5_5(41,1,2,5,3,4,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_47,MP__GC_47,GC_5,MP__GC_5,4,1
     $ ,1,329,AMPL(1,329),S(329))
C     Loop amplitude for loop diagram with ID 84
      CALL ML5_0_LOOP_4_5_4(42,1,1,2,1,3,4,1,2,5,DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,2,1,1,330,AMPL(1,330),S(330))
      CALL ML5_0_LOOP_4_5_4(43,1,1,2,1,3,4,1,2,5,DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,2,1,1,331,AMPL(1,331),S(331))
      CALL ML5_0_LOOP_4_5_4(44,1,1,2,1,3,4,1,2,5,DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MB)
     $ ,CMPLX(MP__MDL_MB,KIND=16),GC_47,MP__GC_47,GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,2,1,1,332,AMPL(1,332),S(332))
C     Loop amplitude for loop diagram with ID 85
      CALL ML5_0_LOOP_2_2(1,6,13,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,2,1,1,333,AMPL(1,333),S(333))
C     Loop amplitude for loop diagram with ID 86
      CALL ML5_0_LOOP_2_2(12,8,16,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,334,AMPL(1,334),S(334))
C     Loop amplitude for loop diagram with ID 87
      CALL ML5_0_LOOP_2_2(1,6,14,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,2,1,1,335,AMPL(1,335),S(335))
C     Loop amplitude for loop diagram with ID 88
      CALL ML5_0_LOOP_3_3(45,4,6,8,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,336,AMPL(1,336),S(336))
C     Loop amplitude for loop diagram with ID 89
      CALL ML5_0_LOOP_3_3(46,4,6,8,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_4,MP__GC_4,GC_5
     $ ,MP__GC_5,2,1,1,337,AMPL(1,337),S(337))
C     Loop amplitude for loop diagram with ID 90
      CALL ML5_0_LOOP_2_2(4,9,25,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,338,AMPL(1,338),S(338))
C     Loop amplitude for loop diagram with ID 91
      CALL ML5_0_LOOP_3_3(18,2,9,8,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,339,AMPL(1,339),S(339))
C     Loop amplitude for loop diagram with ID 92
      CALL ML5_0_LOOP_2_2(12,8,18,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,340,AMPL(1,340),S(340))
C     Loop amplitude for loop diagram with ID 93
      CALL ML5_0_LOOP_2_2(4,9,26,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,341,AMPL(1,341),S(341))
C     Loop amplitude for loop diagram with ID 94
      CALL ML5_0_LOOP_3_3(19,2,9,8,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,342,AMPL(1,342),S(342))
C     Loop amplitude for loop diagram with ID 95
      CALL ML5_0_LOOP_2_2(4,12,27,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,343,AMPL(1,343),S(343))
C     Loop amplitude for loop diagram with ID 96
      CALL ML5_0_LOOP_3_3(18,2,4,27,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,344,AMPL(1,344),S(344))
C     Loop amplitude for loop diagram with ID 97
      CALL ML5_0_LOOP_3_3(19,2,4,27,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,345,AMPL(1,345),S(345))
C     Loop amplitude for loop diagram with ID 98
      CALL ML5_0_LOOP_3_3(18,1,12,8,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,346,AMPL(1,346),S(346))
C     Loop amplitude for loop diagram with ID 99
      CALL ML5_0_LOOP_3_3(18,1,4,25,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,347,AMPL(1,347),S(347))
C     Loop amplitude for loop diagram with ID 100
      CALL ML5_0_LOOP_3_3(2,1,2,13,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,348,AMPL(1,348),S(348))
C     Loop amplitude for loop diagram with ID 101
      CALL ML5_0_LOOP_3_3(2,1,2,14,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,349,AMPL(1,349),S(349))
C     Loop amplitude for loop diagram with ID 102
      CALL ML5_0_LOOP_4_4(22,1,2,4,8,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,350,AMPL(1,350),S(350))
C     Loop amplitude for loop diagram with ID 103
      CALL ML5_0_LOOP_3_3(3,1,2,13,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,351,AMPL(1,351),S(351))
C     Loop amplitude for loop diagram with ID 104
      CALL ML5_0_LOOP_3_3(3,1,2,14,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,352,AMPL(1,352),S(352))
C     Loop amplitude for loop diagram with ID 105
      CALL ML5_0_LOOP_4_4(23,1,2,8,4,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,3,1,1,353,AMPL(1,353),S(353))
C     Loop amplitude for loop diagram with ID 106
      CALL ML5_0_LOOP_4_4(47,1,4,2,8,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_4,MP__GC_4,GC_5
     $ ,MP__GC_5,3,1,1,354,AMPL(1,354),S(354))
C     Loop amplitude for loop diagram with ID 107
      CALL ML5_0_LOOP_3_3(18,1,4,26,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,355,AMPL(1,355),S(355))
C     Loop amplitude for loop diagram with ID 108
      CALL ML5_0_LOOP_2_2(12,8,22,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,356,AMPL(1,356),S(356))
C     Loop amplitude for loop diagram with ID 109
      CALL ML5_0_LOOP_2_2(4,12,28,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,1,1,1,357,AMPL(1,357),S(357))
C     Loop amplitude for loop diagram with ID 110
      CALL ML5_0_LOOP_3_3(19,1,12,8,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,358,AMPL(1,358),S(358))
C     Loop amplitude for loop diagram with ID 111
      CALL ML5_0_LOOP_3_3(19,1,4,25,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,359,AMPL(1,359),S(359))
C     Loop amplitude for loop diagram with ID 112
      CALL ML5_0_LOOP_3_3(18,2,4,28,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,360,AMPL(1,360),S(360))
C     Loop amplitude for loop diagram with ID 113
      CALL ML5_0_LOOP_4_4(48,1,4,2,8,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,GC_5,MP__GC_5,3,1,1,361,AMPL(1,361),S(361))
C     Loop amplitude for loop diagram with ID 114
      CALL ML5_0_LOOP_3_3(19,2,4,28,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,362,AMPL(1,362),S(362))
C     Loop amplitude for loop diagram with ID 115
      CALL ML5_0_LOOP_3_3(19,1,4,26,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5
     $ ,MP__GC_5,2,1,1,363,AMPL(1,363),S(363))
C     Loop amplitude for loop diagram with ID 116
      CALL ML5_0_LOOP_4_4(32,1,2,8,4,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,GC_4,MP__GC_4,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5,MP__GC_5,3,1,1
     $ ,364,AMPL(1,364),S(364))
C     Loop amplitude for loop diagram with ID 117
      CALL ML5_0_LOOP_4_4(31,1,2,4,8,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(MDL_MT)
     $ ,CMPLX(MP__MDL_MT,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,GC_4,MP__GC_4,GC_4,MP__GC_4,GC_5,MP__GC_5,GC_5,MP__GC_5,3,1,1
     $ ,365,AMPL(1,365),S(365))
C     Loop amplitude for loop diagram with ID 118
      CALL ML5_0_LOOP_3_4_3(49,1,2,1,4,1,2,8,DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,1,1,1,366,AMPL(1,366),S(366))
      CALL ML5_0_LOOP_3_4_3(50,1,2,1,4,1,2,8,DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,1,1,1,367,AMPL(1,367),S(367))
      CALL ML5_0_LOOP_3_4_3(51,1,2,1,4,1,2,8,DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(MDL_MT),CMPLX(MP__MDL_MT,KIND=16),GC_5,MP__GC_5,GC_6
     $ ,MP__GC_6,GC_5,MP__GC_5,1,1,1,368,AMPL(1,368),S(368))
C     Loop amplitude for loop diagram with ID 119
      CALL ML5_0_LOOP_2_2(52,6,13,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,2,2,1,369,AMPL(1,369),S(369))
C     Loop amplitude for loop diagram with ID 120
      CALL ML5_0_LOOP_2_2(52,6,14,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,2,2,1,370,AMPL(1,370),S(370))
C     Loop amplitude for loop diagram with ID 121
      CALL ML5_0_LOOP_3_3(53,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,3,1,1,371,AMPL(1,371),S(371))
C     Loop amplitude for loop diagram with ID 122
      CALL ML5_0_LOOP_3_3(53,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,3,1,1,372,AMPL(1,372),S(372))
C     Loop amplitude for loop diagram with ID 123
      CALL ML5_0_LOOP_2_3_2(54,1,2,1,13,2,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,373,AMPL(1,373),S(373))
      CALL ML5_0_LOOP_2_3_2(55,1,2,1,13,2,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,374,AMPL(1,374),S(374))
      CALL ML5_0_LOOP_2_3_2(56,1,2,1,13,2,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,375,AMPL(1,375),S(375))
C     Loop amplitude for loop diagram with ID 124
      CALL ML5_0_LOOP_2_3_2(54,1,2,1,14,2,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,376,AMPL(1,376),S(376))
      CALL ML5_0_LOOP_2_3_2(55,1,2,1,14,2,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,377,AMPL(1,377),S(377))
      CALL ML5_0_LOOP_2_3_2(56,1,2,1,14,2,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,378,AMPL(1,378),S(378))
C     Loop amplitude for loop diagram with ID 125
      CALL ML5_0_LOOP_2_3_2(54,1,2,2,13,1,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,379,AMPL(1,379),S(379))
      CALL ML5_0_LOOP_2_3_2(55,1,2,2,13,1,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,380,AMPL(1,380),S(380))
      CALL ML5_0_LOOP_2_3_2(56,1,2,2,13,1,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,381,AMPL(1,381),S(381))
C     Loop amplitude for loop diagram with ID 126
      CALL ML5_0_LOOP_2_3_2(54,1,2,2,14,1,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,382,AMPL(1,382),S(382))
      CALL ML5_0_LOOP_2_3_2(55,1,2,2,14,1,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,383,AMPL(1,383),S(383))
      CALL ML5_0_LOOP_2_3_2(56,1,2,2,14,1,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4
     $ ,GC_6,MP__GC_6,1,2,1,384,AMPL(1,384),S(384))
C     Loop amplitude for loop diagram with ID 127
      CALL ML5_0_LOOP_2_3_2(57,2,1,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_6,MP__GC_6
     $ ,GC_4,MP__GC_4,1,2,1,385,AMPL(1,385),S(385))
      CALL ML5_0_LOOP_2_3_2(58,2,1,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_6,MP__GC_6
     $ ,GC_4,MP__GC_4,1,2,1,386,AMPL(1,386),S(386))
      CALL ML5_0_LOOP_2_3_2(59,2,1,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_6,MP__GC_6
     $ ,GC_4,MP__GC_4,1,2,1,387,AMPL(1,387),S(387))
C     Loop amplitude for loop diagram with ID 128
      CALL ML5_0_LOOP_2_3_2(57,2,1,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_6,MP__GC_6
     $ ,GC_4,MP__GC_4,1,2,1,388,AMPL(1,388),S(388))
      CALL ML5_0_LOOP_2_3_2(58,2,1,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_6,MP__GC_6
     $ ,GC_4,MP__GC_4,1,2,1,389,AMPL(1,389),S(389))
      CALL ML5_0_LOOP_2_3_2(59,2,1,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_6,MP__GC_6
     $ ,GC_4,MP__GC_4,1,2,1,390,AMPL(1,390),S(390))
C     Loop amplitude for loop diagram with ID 129
      CALL ML5_0_LOOP_2_2(60,6,13,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,2,1,1,391,AMPL(1,391),S(391))
C     Loop amplitude for loop diagram with ID 130
      CALL ML5_0_LOOP_2_2(60,6,14,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16)
     $ ,DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,2,1,1,392,AMPL(1,392),S(392))
C     Loop amplitude for loop diagram with ID 131
      CALL ML5_0_LOOP_3_3(61,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,3,1,1,393,AMPL(1,393),S(393))
C     Loop amplitude for loop diagram with ID 132
      CALL ML5_0_LOOP_3_3(61,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,3,1,1,394,AMPL(1,394),S(394))
C     Loop amplitude for loop diagram with ID 133
      CALL ML5_0_LOOP_3_3(62,1,2,13,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,3,1,1,395,AMPL(1,395),S(395))
C     Loop amplitude for loop diagram with ID 134
      CALL ML5_0_LOOP_3_3(62,1,2,14,DCMPLX(ZERO),CMPLX(MP__ZERO
     $ ,KIND=16),DCMPLX(ZERO),CMPLX(MP__ZERO,KIND=16),DCMPLX(ZERO)
     $ ,CMPLX(MP__ZERO,KIND=16),GC_4,MP__GC_4,GC_4,MP__GC_4,GC_4
     $ ,MP__GC_4,3,1,1,396,AMPL(1,396),S(396))

      DO I=NCTAMPS+1,NLOOPAMPS
        ANS(1)=ANS(1)+AMPL(1,I)
        ANS(2)=ANS(2)+AMPL(2,I)
        ANS(3)=ANS(3)+AMPL(3,I)
        IF((CTMODERUN.NE.-1).AND..NOT.CHECKPHASE.AND.(.NOT.S(I))) THEN
          WRITE(*,*) '##W03 WARNING Contribution ',I,' is unstable.'
        ENDIF
      ENDDO

 1226 CONTINUE

      IF (CHECKPHASE.OR.(.NOT.HELDOUBLECHECKED)) THEN
C       Update of NEXTREF, will be used for loop induced only.
        NEXTREF = NEXTREF + ANS(1) + ANS(2) + ANS(3)
        IF((USERHEL.EQ.-1).OR.(USERHEL.EQ.HELPICKED)) THEN
          BUFFR(1)=BUFFR(1)+ANS(1)
          BUFFR(2)=BUFFR(2)+ANS(2)
          BUFFR(3)=BUFFR(3)+ANS(3)
        ENDIF

        IF (CHECKPHASE) THEN
C         SET THE HELICITY FILTER
          IF(.NOT.FOUNDHELFILTER) THEN
            IF(ML5_0_ISZERO(ABS(ANS(1))+ABS(ANS(2))+ABS(ANS(3)),REF
     $       /DBLE(NCOMB),-1)) THEN
              IF(NTRY.EQ.1) THEN
                GOODHEL(HELPICKED)=.FALSE.
              ELSEIF(GOODHEL(HELPICKED)) THEN
                WRITE(*,*) '##W02A WARNING Inconsistent helicity '
     $           ,HELPICKED
                IF(HELINITSTARTOVER) THEN
                  WRITE(*,*) '##I01 INFO Initialization starting over'
     $             //' because of inconsistency in the helicity filter'
     $             //' setup.'
                  NTRY=0
                ENDIF
              ENDIF
            ELSE
              IF(.NOT.GOODHEL(HELPICKED)) THEN
                WRITE(*,*) '##W02B WARNING Inconsistent helicity '
     $           ,HELPICKED
                IF(HELINITSTARTOVER) THEN
                  WRITE(*,*) '##I01 INFO Initialization starting over'
     $             //' because of inconsistency in the helicity filter'
     $             //' setup.'
                  NTRY=0
                ELSE
                  GOODHEL(HELPICKED)=.TRUE.
                ENDIF
              ENDIF
            ENDIF
          ENDIF

C         SET THE LOOP FILTER
          IF(.NOT.FOUNDLOOPFILTER.AND.USELOOPFILTER) THEN
            DO I=NCTAMPS+1,NLOOPAMPS
              IF(.NOT.ML5_0_ISZERO(ABS(AMPL(1,I))+ABS(AMPL(2,I))
     $         +ABS(AMPL(3,I)),(REF*1.0D-4),I)) THEN
                IF(NTRY.EQ.1) THEN
                  GOODAMP(I,HELPICKED)=.TRUE.
                ELSEIF(.NOT.GOODAMP(I,HELPICKED)) THEN
                  WRITE(*,*) '##W02 WARNING Inconsistent loop amp ',I
     $             ,' for helicity ',HELPICKED,'.'
                  IF(LOOPINITSTARTOVER) THEN
                    WRITE(*,*) '##I01 INFO Initialization starting'
     $               //' over because of inconsistency in the loop'
     $               //' filter setup.'
                    NTRY=0
                  ELSE
                    GOODAMP(I,HELPICKED)=.TRUE.
                  ENDIF
                ENDIF
              ENDIF
            ENDDO
          ENDIF
        ELSEIF (.NOT.HELDOUBLECHECKED)THEN
          IF ((.NOT.GOODHEL(HELPICKED)).AND.(.NOT.ML5_0_ISZERO(ABS(ANS(
     $1))+ABS(ANS(2))+ABS(ANS(3)),REF/DBLE(NCOMB),-1))) THEN
            WRITE(*,*) '##W15 Helicity filter could not be'
     $       //' successfully double checked.'
            WRITE(*,*) '##One reason for this is that you have changed'
     $       //' sensible parameters which affected what are the zero'
     $       //' helicity configurations.'
            WRITE(*,*) '##MadLoop will try to reset the Helicity'
     $       //' filter with the next PS points it receives.'
            NTRY=0
            OPEN(30,FILE=HELFILTERFN,ERR=349)
 349        CONTINUE
            CLOSE(30,STATUS='delete')
          ENDIF
C         SET HELDOUBLECHECKED TO .TRUE. WHEN DONE
C         even if it failed we do not want to redo the check
C          afterwards if HELINITSTARTOVER=.FALSE.
          IF (HELPICKED.EQ.NCOMB.AND.(NTRY.NE.0.OR..NOT.HELINITSTARTOVE
     $R)) THEN
            DONEHELDOUBLECHECK=.TRUE.
          ENDIF
        ENDIF

C       GOTO NEXT HELICITY OR FINISH
        IF(HELPICKED.NE.NCOMB) THEN
          HELPICKED=HELPICKED+1
          MP_DONE=.FALSE.
          GOTO 200
        ELSE
          ANS(1)=BUFFR(1)
          ANS(2)=BUFFR(2)
          ANS(3)=BUFFR(3)
C         We add one here to the number of PS points used for building
C          the reference scale for comparison (used only for
C          loop-induced processes).
          NPSPOINTS = NPSPOINTS+1
          IF(NTRY.EQ.0) THEN
            NATTEMPTS=NATTEMPTS+1
            IF(NATTEMPTS.EQ.MAXATTEMPTS) THEN
              WRITE(*,*) '##E01 ERROR Could not initialize the filters'
     $         //' in ',MAXATTEMPTS,' trials'
              STOP
            ENDIF
          ENDIF
        ENDIF

      ENDIF

      DO K=1,3
        ANS(K)=ANS(K)/DBLE(IDEN)
        IF (USERHEL.NE.-1) THEN
          ANS(K)=ANS(K)*HELAVGFACTOR
        ELSE
          DO J=1,NINITIAL
            IF (POLARIZATIONS(J,0).NE.-1) THEN
              ANS(K)=ANS(K)*BEAMS_HELAVGFACTOR(J)
              ANS(K)=ANS(K)/POLARIZATIONS(J,0)
            ENDIF
          ENDDO
        ENDIF
      ENDDO

      IF(.NOT.CHECKPHASE.AND.HELDOUBLECHECKED.AND.(CTMODERUN.LE.-1))
     $  THEN
        STAB_INDEX=STAB_INDEX+1
        IF(DOING_QP_EVALS) THEN
          QP_RES(1,STAB_INDEX)=ANS(1)
          QP_RES(2,STAB_INDEX)=ANS(2)
          QP_RES(3,STAB_INDEX)=ANS(3)
        ELSE
          DP_RES(1,STAB_INDEX)=ANS(1)
          DP_RES(2,STAB_INDEX)=ANS(2)
          DP_RES(3,STAB_INDEX)=ANS(3)
        ENDIF

        IF(DOING_QP_EVALS) THEN
          BASIC_CT_MODE=4
        ELSE
          BASIC_CT_MODE=1
        ENDIF

C       BEGINNING OF THE DEFINITIONS OF THE DIFFERENT EVALUATION
C        METHODS

        IF(.NOT.EVAL_DONE(2)) THEN
          EVAL_DONE(2)=.TRUE.
          CTMODE=BASIC_CT_MODE+1
          GOTO 200
        ENDIF

        CTMODE=BASIC_CT_MODE

        IF(.NOT.EVAL_DONE(3).AND. ((DOING_QP_EVALS.AND.NROTATIONS_QP.GE
     $.1).OR.((.NOT.DOING_QP_EVALS).AND.NROTATIONS_DP.GE.1)) ) THEN
          EVAL_DONE(3)=.TRUE.
          CALL ML5_0_ROTATE_PS(PS,P,1)
          IF (DOING_QP_EVALS) CALL ML5_0_MP_ROTATE_PS(MP_PS,MP_P,1)
          GOTO 200
        ENDIF

        IF(.NOT.EVAL_DONE(4).AND. ((DOING_QP_EVALS.AND.NROTATIONS_QP.GE
     $.2).OR.((.NOT.DOING_QP_EVALS).AND.NROTATIONS_DP.GE.2)) ) THEN
          EVAL_DONE(4)=.TRUE.
          CALL ML5_0_ROTATE_PS(PS,P,2)
          IF (DOING_QP_EVALS) CALL ML5_0_MP_ROTATE_PS(MP_PS,MP_P,2)
          GOTO 200
        ENDIF

        CALL ML5_0_ROTATE_PS(PS,P,0)
        IF (DOING_QP_EVALS) CALL ML5_0_MP_ROTATE_PS(MP_PS,MP_P,0)

C       END OF THE DEFINITIONS OF THE DIFFERENT EVALUATION METHODS

        IF(DOING_QP_EVALS) THEN
          CALL ML5_0_COMPUTE_ACCURACY(QP_RES,N_QP_EVAL,ACC,ANS(1))
          ACCURACY(0)=ACC
          RET_CODE_H=3
          IF(ACC.GE.MLSTABTHRES) THEN
            RET_CODE_H=4
            NEPS=NEPS+1
            CALL ML5_0_COMPUTE_ACCURACY(DP_RES,N_DP_EVAL,TEMP1,TEMP)
            WRITE(*,*) '##W03 WARNING An unstable PS point was',      
     $        ' detected.'
            WRITE(*,*) '##(DP,QP) accuracies : (',TEMP1,',',ACC,')'
            WRITE(*,*) '##Best estimate (fin,1eps,2eps) :',(ANS(I),I=1
     $       ,3)
            IF(NEPS.LE.10) THEN
              WRITE(*,*) '##Double precision evaluations :',(DP_RES(1
     $         ,I),I=1,N_DP_EVAL)
              WRITE(*,*) '##Quad   precision evaluations :',(QP_RES(1
     $         ,I),I=1,N_QP_EVAL)
              WRITE(*,*) '##PS point specification :'
              WRITE(*,*) '##Renormalization scale MU_R=',MU_R
              DO I=1,NEXTERNAL
                WRITE (*,'(i2,1x,4e27.17)') I, P(0,I),P(1,I),P(2,I)
     $           ,P(3,I)
              ENDDO
            ENDIF
            IF(NEPS.EQ.10) THEN
              WRITE(*,*) '##Further output of the details of these'
     $         //' unstable PS points will now be suppressed.'
            ENDIF
          ENDIF
        ELSE
          CALL ML5_0_COMPUTE_ACCURACY(DP_RES,N_DP_EVAL,ACC,ANS(1))
          IF(ACC.GE.MLSTABTHRES) THEN
            DOING_QP_EVALS=.TRUE.
            EVAL_DONE(1)=.TRUE.
            DO I=2,MAXSTABILITYLENGTH
              EVAL_DONE(I)=.FALSE.
            ENDDO
            STAB_INDEX=0
            CTMODE=4
            GOTO 200
          ELSE
            ACCURACY(0)=ACC
            RET_CODE_H=2
          ENDIF
        ENDIF
      ELSE
        RET_CODE_H=1
        ACCURACY=-1.0D0
      ENDIF

 9999 CONTINUE

C     Finalize the return code
      IF (MP_DONE_ONCE) THEN
        RET_CODE_T=2
      ELSE
        RET_CODE_T=1
      ENDIF
      IF(CHECKPHASE.OR..NOT.HELDOUBLECHECKED) THEN
        RET_CODE_H=1
        RET_CODE_T=RET_CODE_T+2
        ACCURACY=-1.0D0
      ENDIF
      IF (RET_CODE_H.EQ.4) THEN
        RET_CODE_U=0
      ELSE
        RET_CODE_U=1
      ENDIF

C     Reinitialize the default threshold if it was specified by the
C      user
      IF (USER_STAB_PREC.GT.0.0D0) THEN
        MLSTABTHRES=MLSTABTHRES_BU
        CTMODEINIT=CTMODEINIT_BU
      ENDIF

C     Reinitialize the Lorentz test if it had been disabled because
C      spin-2 particles are in the external states.
      NROTATIONS_DP = NROTATIONS_DP_BU
      NROTATIONS_QP = NROTATIONS_QP_BU

C     Conform to the returned synthax of split orders even though the
C      default output does not support it (this then done only for
C      compatibility purpose).
      ANSRETURNED(0,0)=ANS(0)
      ANSRETURNED(1,0)=ANS(1)
      ANSRETURNED(2,0)=ANS(2)
      ANSRETURNED(3,0)=ANS(3)

C     Reinitialize the check phase logicals and the filters if check
C      bypassed
      IF (BYPASS_CHECK) THEN
        CHECKPHASE = OLD_CHECKPHASE
        HELDOUBLECHECKED = OLD_HELDOUBLECHECKED
        DO I=1,NCOMB
          GOODHEL(I)=OLD_GOODHEL(I)
        ENDDO
        DO I=1,NCOMB
          DO J=1,NLOOPAMPS
            GOODAMP(J,I)=OLD_GOODAMP(J,I)
          ENDDO
        ENDDO
      ENDIF

      END

      SUBROUTINE ML5_0_COMPUTE_ACCURACY(FULLLIST, LENGTH, ACC,
     $  ESTIMATE)
      IMPLICIT NONE
C     
C     PARAMETERS 
C     
      INTEGER MAXSTABILITYLENGTH
      COMMON/ML5_0_STABILITY_TESTS/MAXSTABILITYLENGTH
C     
C     ARGUMENTS 
C     
      REAL*8 FULLLIST(3,MAXSTABILITYLENGTH)
      INTEGER LENGTH
      REAL*8 ACC, ESTIMATE(3)
C     
C     LOCAL VARIABLES 
C     
      LOGICAL MASK(MAXSTABILITYLENGTH)
      LOGICAL MASK3(3)
      DATA MASK3/.TRUE.,.TRUE.,.TRUE./
      INTEGER I,J
      REAL*8 AVG
      REAL*8 DIFF
      REAL*8 ACCURACIES(3)
      REAL*8 LIST(MAXSTABILITYLENGTH)

C     ----------
C     BEGIN CODE
C     ----------
      DO I=1,LENGTH
        MASK(I)=.TRUE.
      ENDDO
      DO I=LENGTH+1,MAXSTABILITYLENGTH
        MASK(I)=.FALSE.
      ENDDO

      DO I=1,3
        DO J=1,MAXSTABILITYLENGTH
          LIST(J)=FULLLIST(I,J)
        ENDDO
        DIFF=MAXVAL(LIST,1,MASK)-MINVAL(LIST,1,MASK)
        AVG=(MAXVAL(LIST,1,MASK)+MINVAL(LIST,1,MASK))/2.0D0
        ESTIMATE(I)=AVG
        IF (AVG.EQ.0.0D0) THEN
          ACCURACIES(I)=DIFF
        ELSE
          ACCURACIES(I)=DIFF/ABS(AVG)
        ENDIF
      ENDDO

C     The technique below is too sensitive, typically to
C     unstablities in very small poles
C     ACC=MAXVAL(ACCURACIES,1,MASK3)
C     The following is used instead
      ACC = 0.0D0
      AVG = 0.0D0
      DO I=1,3
        ACC = ACC + ACCURACIES(I)*ABS(ESTIMATE(I))
        AVG = AVG + ESTIMATE(I)
      ENDDO
      ACC  = ACC / ( ABS(AVG) / 3.0D0)

C     If NaN are present in the evaluation, automatically set the
C      accuracy to 1.0d99.
      DO I=1,3
        DO J=1,MAXSTABILITYLENGTH
          IF (ISNAN(FULLLIST(I,J))) THEN
            ACC = 1.0D99
          ENDIF
        ENDDO
      ENDDO

      END

      SUBROUTINE ML5_0_SET_N_EVALS(N_DP_EVALS,N_QP_EVALS)

      IMPLICIT NONE
      INTEGER N_DP_EVALS, N_QP_EVALS

      INCLUDE 'MadLoopParams.inc'

      IF(CTMODERUN.LE.-1) THEN
        N_DP_EVALS=2+NROTATIONS_DP
        N_QP_EVALS=2+NROTATIONS_QP
      ELSE
        N_DP_EVALS=1
        N_QP_EVALS=1
      ENDIF

      IF(N_DP_EVALS.GT.20.OR.N_QP_EVALS.GT.20) THEN
        WRITE(*,*) '##ERROR:: Increase hardcoded maxstabilitylength.'
        STOP
      ENDIF

      END


C     THIS SUBROUTINE SIMPLY SET THE GLOBAL PS CONFIGURATION GLOBAL
C      VARIABLES FROM A GIVEN VARIABLE IN DOUBLE PRECISION
      SUBROUTINE ML5_0_SET_MP_PS(P)

      INTEGER    NEXTERNAL
      PARAMETER (NEXTERNAL=5)
      REAL*16 MP_PS(0:3,NEXTERNAL),MP_P(0:3,NEXTERNAL)
      COMMON/ML5_0_MP_PSPOINT/MP_PS,MP_P
      REAL*8 P(0:3,NEXTERNAL)

      DO I=1,NEXTERNAL
        DO J=0,3
          MP_PS(J,I)=P(J,I)
        ENDDO
      ENDDO
      CALL ML5_0_MP_IMPROVE_PS_POINT_PRECISION(MP_PS)
      DO I=1,NEXTERNAL
        DO J=0,3
          MP_P(J,I)=MP_PS(J,I)
        ENDDO
      ENDDO

      END

      SUBROUTINE ML5_0_SET_COUPLINGORDERS_TARGET(SOTARGET)
      IMPLICIT NONE
C     
C     This routine can be accessed by an external user to set the
C      squared split order target.
C     This functionality is only available in the optimized mode, but
C      for compatibility 
C     purposes, a dummy version is also put in this default output.
C     
C     
C     ARGUMENTS
C     
      INTEGER SOTARGET
C     ----------
C     BEGIN CODE
C     ----------
      WRITE(*,*) '##WARNING:: Ignored, the possibility of selecting'
     $ //' specific squared order contributions is not available in'
     $ //' the default mode.'

      END

      SUBROUTINE ML5_0_FORCE_STABILITY_CHECK(ONOFF)
C     
C     This function can be called by the MadLoop user so as to always
C      have stability
C     checked, even during initialisation, when calling the *_thres
C      routines.
C     
      LOGICAL ONOFF

      LOGICAL BYPASS_CHECK, ALWAYS_TEST_STABILITY
      DATA BYPASS_CHECK, ALWAYS_TEST_STABILITY /.FALSE.,.FALSE./
      COMMON/ML5_0_BYPASS_CHECK/BYPASS_CHECK, ALWAYS_TEST_STABILITY

      ALWAYS_TEST_STABILITY = ONOFF

      END

      SUBROUTINE ML5_0_GET_ANSWER_DIMENSION(ANSDIM)
C     
C     Simple subroutine which returns the upper bound of the second
C      dimension of the
C     quantity ANS(0:3,0:ANSDIM) returned by MadLoop. As long as the
C      default output
C     cannot handle split orders, this ANSDIM will always be 0.
C     
      INCLUDE 'nsquaredSO.inc'

      INTEGER ANSDIM

      ANSDIM=NSQUAREDSO

      END

      SUBROUTINE ML5_0_GET_NSQSO_LOOP(NSQSO)
C     
C     Simple subroutine returning the number of squared split order
C     contributions returned in ANS when calling sloopmatrix 
C     
      INCLUDE 'nsquaredSO.inc'

      INTEGER NSQSO

      NSQSO=NSQUAREDSO

      END

      SUBROUTINE ML5_0_SET_LEG_POLARIZATION(LEG_ID, LEG_POLARIZATION)
      IMPLICIT NONE
C     
C     ARGUMENTS
C     
      INTEGER LEG_ID
      INTEGER LEG_POLARIZATION
C     
C     LOCALS
C     
      INTEGER I
      INTEGER LEG_POLARIZATIONS(0:5)
C     ----------
C     BEGIN CODE
C     ----------

      IF (LEG_POLARIZATION.EQ.-10000) THEN
        LEG_POLARIZATIONS(0)=-1
        DO I=1,5
          LEG_POLARIZATIONS(I)=-10000
        ENDDO
      ELSE
        LEG_POLARIZATIONS(0)=1
        LEG_POLARIZATIONS(1)=LEG_POLARIZATION
        DO I=2,5
          LEG_POLARIZATIONS(I)=-10000
        ENDDO
      ENDIF
      CALL ML5_0_SET_LEG_POLARIZATIONS(LEG_ID,LEG_POLARIZATIONS)

      END

      SUBROUTINE ML5_0_SET_LEG_POLARIZATIONS(LEG_ID, LEG_POLARIZATIONS)
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INTEGER    NEXTERNAL
      PARAMETER (NEXTERNAL=5)
      INTEGER NPOLENTRIES
      PARAMETER (NPOLENTRIES=(NEXTERNAL+1)*6)
      INTEGER    NCOMB
      PARAMETER (NCOMB=48)
C     
C     ARGUMENTS
C     
      INTEGER LEG_ID
      INTEGER LEG_POLARIZATIONS(0:5)
C     
C     LOCALS
C     
      INTEGER I,J
      LOGICAL ALL_SUMMED_OVER
C     
C     GLOBALS
C     
C     Entry 0 of the first dimension is all -1 if there is no
C      polarization requirement.
C     Then for each leg with ID legID, it is either summed over if
C     POLARIZATIONS(legID,0) is -1, or the list of helicity considered
C      for that
C     leg is POLARIZATIONS(legID,1: POLARIZATIONS(legID,0)   ).
      INTEGER POLARIZATIONS(0:NEXTERNAL,0:5)
      DATA ((POLARIZATIONS(I,J),I=0,NEXTERNAL),J=0,5)/NPOLENTRIES*-1/
      COMMON/ML5_0_BEAM_POL/POLARIZATIONS

      INTEGER BORN_POLARIZATIONS(0:NEXTERNAL,0:5)
      COMMON/ML5_0_BORN_BEAM_POL/BORN_POLARIZATIONS

C     ----------
C     BEGIN CODE
C     ----------

      IF (LEG_POLARIZATIONS(0).EQ.-1) THEN
        DO I=0,5
          POLARIZATIONS(LEG_ID,I)=-1
        ENDDO
      ELSE
        DO I=0,LEG_POLARIZATIONS(0)
          POLARIZATIONS(LEG_ID,I)=LEG_POLARIZATIONS(I)
        ENDDO
        DO I=LEG_POLARIZATIONS(0)+1,5
          POLARIZATIONS(LEG_ID,I)=-10000
        ENDDO
      ENDIF

      ALL_SUMMED_OVER = .TRUE.
      DO I=1,NEXTERNAL
        IF (POLARIZATIONS(I,0).NE.-1) THEN
          ALL_SUMMED_OVER = .FALSE.
          EXIT
        ENDIF
      ENDDO
      IF (ALL_SUMMED_OVER) THEN
        DO I=0,5
          POLARIZATIONS(0,I)=-1
        ENDDO
      ELSE
        DO I=0,5
          POLARIZATIONS(0,I)=0
        ENDDO
      ENDIF

      DO I=0,NEXTERNAL
        DO J=0,5
          BORN_POLARIZATIONS(I,J) = POLARIZATIONS(I,J)
        ENDDO
      ENDDO


      RETURN

      END

      SUBROUTINE ML5_0_SLOOPMATRIXHEL_THRES(P,HEL,ANS,PREC_ASKED
     $ ,PREC_FOUND,RET_CODE)
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INTEGER    NEXTERNAL
      PARAMETER (NEXTERNAL=5)
      INCLUDE 'nsquaredSO.inc'
C     
C     ARGUMENTS 
C     
      REAL*8 P(0:3,NEXTERNAL)
      REAL*8 ANS(0:3,0:NSQUAREDSO)
      INTEGER HEL,RET_CODE
      REAL*8 PREC_ASKED,PREC_FOUND(0:NSQUAREDSO)
C     
C     GLOBAL VARIABLES
C     
      REAL*8 USER_STAB_PREC
      COMMON/ML5_0_USER_STAB_PREC/USER_STAB_PREC

      INTEGER I

      INTEGER H,T,U
      REAL*8 ACCURACY(0:NSQUAREDSO)
      COMMON/ML5_0_ACC/ACCURACY,H,T,U

      LOGICAL BYPASS_CHECK, ALWAYS_TEST_STABILITY
      COMMON/ML5_0_BYPASS_CHECK/BYPASS_CHECK, ALWAYS_TEST_STABILITY

C     ----------
C     BEGIN CODE
C     ----------
      USER_STAB_PREC = PREC_ASKED
      CALL ML5_0_SLOOPMATRIXHEL(P,HEL,ANS)
      IF(ALWAYS_TEST_STABILITY.AND.(H.EQ.1.OR.ACCURACY(0).LT.0.0D0))
     $  THEN
        BYPASS_CHECK = .TRUE.
        CALL ML5_0_SLOOPMATRIXHEL(P,HEL,ANS)
        BYPASS_CHECK = .FALSE.
C       Make sure we correctly return an initialization-type T code
        IF (T.EQ.2) T=4
        IF (T.EQ.1) T=3
      ENDIF

C     Reset it to default value not to affect next runs
      USER_STAB_PREC = -1.0D0
      DO I=0,NSQUAREDSO
        PREC_FOUND(I)=ACCURACY(I)
      ENDDO
      RET_CODE=100*H+10*T+U

      END

      SUBROUTINE ML5_0_SLOOPMATRIX_THRES(P,ANS,PREC_ASKED,PREC_FOUND
     $ ,RET_CODE)
C     
C     Inputs are:
C     P(0:3, Nexternal)  double  :: Kinematic configuration
C      (E,px,py,pz)
C     PEC_ASKED          double  :: Target relative accuracy, -1 for
C      default
C     
C     Outputs are:
C     ANS(3)             double  :: Result (finite, single pole,
C      double pole) 
C     PREC_FOUND         double  :: Relative accuracy estimated for
C      the result
C     Returns -1 if no stab test could be performed.
C     RET_CODE			 integer :: Return code. See below for details
C     
C     Return code conventions: RET_CODE = H*100 + T*10 + U
C     
C     H == 1
C     Stability unknown.
C     H == 2
C     Stable PS (SPS) point.
C     No stability rescue was necessary.
C     H == 3
C     Unstable PS (UPS) point.
C     Stability rescue necessary, and successful.
C     H == 4
C     Exceptional PS (EPS) point.
C     Stability rescue attempted, but unsuccessful.
C     
C     T == 1
C     Default computation (double prec.) was performed.
C     T == 2
C     Quadruple precision was used for this PS point.
C     T == 3
C     MadLoop in initialization phase. Only double precision used.
C     T == 4
C     MadLoop in initialization phase. Quadruple precision used.
C     
C     U is a number left for future use (always set to 0 for now).
C     example: TIR vs OPP usage.
C     
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INTEGER    NEXTERNAL
      PARAMETER (NEXTERNAL=5)
      INCLUDE 'nsquaredSO.inc'
C     
C     ARGUMENTS 
C     
      REAL*8 P(0:3,NEXTERNAL)
      REAL*8 ANS(0:3,0:NSQUAREDSO)
      REAL*8 PREC_ASKED,PREC_FOUND(0:NSQUAREDSO)
      INTEGER RET_CODE
C     
C     GLOBAL VARIABLES
C     
      REAL*8 USER_STAB_PREC
      COMMON/ML5_0_USER_STAB_PREC/USER_STAB_PREC

      INTEGER I

      INTEGER H,T,U
      REAL*8 ACCURACY(0:NSQUAREDSO)
      COMMON/ML5_0_ACC/ACCURACY,H,T,U

      LOGICAL BYPASS_CHECK, ALWAYS_TEST_STABILITY
      COMMON/ML5_0_BYPASS_CHECK/BYPASS_CHECK, ALWAYS_TEST_STABILITY

C     ----------
C     BEGIN CODE
C     ----------
      USER_STAB_PREC = PREC_ASKED
      CALL ML5_0_SLOOPMATRIX(P,ANS)
      IF(ALWAYS_TEST_STABILITY.AND.(H.EQ.1.OR.ACCURACY(0).LT.0.0D0))
     $  THEN
        BYPASS_CHECK = .TRUE.
        CALL ML5_0_SLOOPMATRIX(P,ANS)
        BYPASS_CHECK = .FALSE.
C       Make sure we correctly return an initialization-type T code
        IF (T.EQ.2) T=4
        IF (T.EQ.1) T=3
      ENDIF

C     Reset it to default value not to affect next runs
      USER_STAB_PREC = -1.0D0
      DO I=0,NSQUAREDSO
        PREC_FOUND(I)=ACCURACY(I)
      ENDDO
      RET_CODE=100*H+10*T+U

      END

