#include "simint/boys/boys.h"
#include "simint/ostei/gen/ostei_generated.h"
#include "simint/vectorization/vectorization.h"
#include <math.h>
#include <string.h>


int ostei_h_g_i_i(struct simint_multi_shellpair const P,
                  struct simint_multi_shellpair const Q,
                  double screen_tol,
                  double * const restrict work,
                  double * const restrict INT__h_g_i_i)
{

    SIMINT_ASSUME_ALIGN_DBL(work);
    SIMINT_ASSUME_ALIGN_DBL(INT__h_g_i_i);
    int ab, cd, abcd;
    int istart, jstart;
    int iprimcd, nprim_icd, icd;
    const int check_screen = (screen_tol > 0.0);
    int i, j;
    int n;
    int not_screened;
    int real_abcd;
    int iket;
    int ibra;

    // partition workspace
    double * const INT__h_s_i_s = work + (SIMINT_NSHELL_SIMD * 0);
    double * const INT__h_s_k_s = work + (SIMINT_NSHELL_SIMD * 588);
    double * const INT__h_s_l_s = work + (SIMINT_NSHELL_SIMD * 1344);
    double * const INT__h_s_m_s = work + (SIMINT_NSHELL_SIMD * 2289);
    double * const INT__h_s_n_s = work + (SIMINT_NSHELL_SIMD * 3444);
    double * const INT__h_s_o_s = work + (SIMINT_NSHELL_SIMD * 4830);
    double * const INT__h_s_q_s = work + (SIMINT_NSHELL_SIMD * 6468);
    double * const INT__i_s_i_s = work + (SIMINT_NSHELL_SIMD * 8379);
    double * const INT__i_s_k_s = work + (SIMINT_NSHELL_SIMD * 9163);
    double * const INT__i_s_l_s = work + (SIMINT_NSHELL_SIMD * 10171);
    double * const INT__i_s_m_s = work + (SIMINT_NSHELL_SIMD * 11431);
    double * const INT__i_s_n_s = work + (SIMINT_NSHELL_SIMD * 12971);
    double * const INT__i_s_o_s = work + (SIMINT_NSHELL_SIMD * 14819);
    double * const INT__i_s_q_s = work + (SIMINT_NSHELL_SIMD * 17003);
    double * const INT__k_s_i_s = work + (SIMINT_NSHELL_SIMD * 19551);
    double * const INT__k_s_k_s = work + (SIMINT_NSHELL_SIMD * 20559);
    double * const INT__k_s_l_s = work + (SIMINT_NSHELL_SIMD * 21855);
    double * const INT__k_s_m_s = work + (SIMINT_NSHELL_SIMD * 23475);
    double * const INT__k_s_n_s = work + (SIMINT_NSHELL_SIMD * 25455);
    double * const INT__k_s_o_s = work + (SIMINT_NSHELL_SIMD * 27831);
    double * const INT__k_s_q_s = work + (SIMINT_NSHELL_SIMD * 30639);
    double * const INT__l_s_i_s = work + (SIMINT_NSHELL_SIMD * 33915);
    double * const INT__l_s_k_s = work + (SIMINT_NSHELL_SIMD * 35175);
    double * const INT__l_s_l_s = work + (SIMINT_NSHELL_SIMD * 36795);
    double * const INT__l_s_m_s = work + (SIMINT_NSHELL_SIMD * 38820);
    double * const INT__l_s_n_s = work + (SIMINT_NSHELL_SIMD * 41295);
    double * const INT__l_s_o_s = work + (SIMINT_NSHELL_SIMD * 44265);
    double * const INT__l_s_q_s = work + (SIMINT_NSHELL_SIMD * 47775);
    double * const INT__m_s_i_s = work + (SIMINT_NSHELL_SIMD * 51870);
    double * const INT__m_s_k_s = work + (SIMINT_NSHELL_SIMD * 53410);
    double * const INT__m_s_l_s = work + (SIMINT_NSHELL_SIMD * 55390);
    double * const INT__m_s_m_s = work + (SIMINT_NSHELL_SIMD * 57865);
    double * const INT__m_s_n_s = work + (SIMINT_NSHELL_SIMD * 60890);
    double * const INT__m_s_o_s = work + (SIMINT_NSHELL_SIMD * 64520);
    double * const INT__m_s_q_s = work + (SIMINT_NSHELL_SIMD * 68810);
    SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*73815);
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 22;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 85;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 205;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 395;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 665;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 1022;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 1470;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 2010;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 2640;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_n_s = primwork + 3355;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_o_s = primwork + 4147;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_q_s = primwork + 5005;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 5915;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 5942;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 6023;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 6185;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 6455;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 6860;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 7427;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 8183;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 9155;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 10370;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_n_s = primwork + 11855;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_o_s = primwork + 13637;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_q_s = primwork + 15743;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 18200;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 18248;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 18392;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 18680;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 19160;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 19880;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 20888;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 22232;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 23960;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 26120;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_n_s = primwork + 28760;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_o_s = primwork + 31928;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_q_s = primwork + 35672;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 40040;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 40110;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 40320;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 40740;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 41440;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 42490;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 43960;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 45920;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 48440;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 51590;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_n_s = primwork + 55440;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_o_s = primwork + 60060;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_q_s = primwork + 65520;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 71890;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 72160;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 72700;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 73600;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 74950;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 76840;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 79360;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 82600;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_m_s = primwork + 86650;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_n_s = primwork + 91600;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_o_s = primwork + 97540;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_q_s = primwork + 104560;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 112750;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 113380;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 114430;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 116005;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 118210;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 121150;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_l_s = primwork + 124930;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_m_s = primwork + 129655;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_n_s = primwork + 135430;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_o_s = primwork + 142360;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_q_s = primwork + 150550;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 160105;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_g_s = primwork + 161225;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_h_s = primwork + 162905;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_i_s = primwork + 165257;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_k_s = primwork + 168393;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_l_s = primwork + 172425;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_m_s = primwork + 177465;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_n_s = primwork + 183625;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_o_s = primwork + 191017;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_q_s = primwork + 199753;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_g_s = primwork + 209945;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_h_s = primwork + 211565;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_i_s = primwork + 213833;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_k_s = primwork + 216857;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_l_s = primwork + 220745;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_m_s = primwork + 225605;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_n_s = primwork + 231545;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_o_s = primwork + 238673;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_q_s = primwork + 247097;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_h_s = primwork + 256925;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_i_s = primwork + 258815;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_k_s = primwork + 261335;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_l_s = primwork + 264575;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_m_s = primwork + 268625;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_n_s = primwork + 273575;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_o_s = primwork + 279515;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_q_s = primwork + 286535;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_i_s = primwork + 294725;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_k_s = primwork + 296265;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_l_s = primwork + 298245;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_m_s = primwork + 300720;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_n_s = primwork + 303745;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_o_s = primwork + 307375;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_q_s = primwork + 311665;
    double * const hrrwork = (double *)(primwork + 316670);
    double * const HRR_INT__h_p_i_s = hrrwork + 0;
    double * const HRR_INT__h_p_k_s = hrrwork + 1764;
    double * const HRR_INT__h_p_l_s = hrrwork + 4032;
    double * const HRR_INT__h_p_m_s = hrrwork + 6867;
    double * const HRR_INT__h_p_n_s = hrrwork + 10332;
    double * const HRR_INT__h_p_o_s = hrrwork + 14490;
    double * const HRR_INT__h_p_q_s = hrrwork + 19404;
    double * const HRR_INT__h_d_i_s = hrrwork + 25137;
    double * const HRR_INT__h_d_k_s = hrrwork + 28665;
    double * const HRR_INT__h_d_l_s = hrrwork + 33201;
    double * const HRR_INT__h_d_m_s = hrrwork + 38871;
    double * const HRR_INT__h_d_n_s = hrrwork + 45801;
    double * const HRR_INT__h_d_o_s = hrrwork + 54117;
    double * const HRR_INT__h_d_q_s = hrrwork + 63945;
    double * const HRR_INT__h_f_i_s = hrrwork + 75411;
    double * const HRR_INT__h_f_k_s = hrrwork + 81291;
    double * const HRR_INT__h_f_l_s = hrrwork + 88851;
    double * const HRR_INT__h_f_m_s = hrrwork + 98301;
    double * const HRR_INT__h_f_n_s = hrrwork + 109851;
    double * const HRR_INT__h_f_o_s = hrrwork + 123711;
    double * const HRR_INT__h_f_q_s = hrrwork + 140091;
    double * const HRR_INT__h_g_i_s = hrrwork + 159201;
    double * const HRR_INT__h_g_i_p = hrrwork + 168021;
    double * const HRR_INT__h_g_i_d = hrrwork + 194481;
    double * const HRR_INT__h_g_i_f = hrrwork + 247401;
    double * const HRR_INT__h_g_i_g = hrrwork + 335601;
    double * const HRR_INT__h_g_i_h = hrrwork + 467901;
    double * const HRR_INT__h_g_k_s = hrrwork + 653121;
    double * const HRR_INT__h_g_k_p = hrrwork + 664461;
    double * const HRR_INT__h_g_k_d = hrrwork + 698481;
    double * const HRR_INT__h_g_k_f = hrrwork + 766521;
    double * const HRR_INT__h_g_k_g = hrrwork + 879921;
    double * const HRR_INT__h_g_k_h = hrrwork + 1050021;
    double * const HRR_INT__h_g_l_s = hrrwork + 1288161;
    double * const HRR_INT__h_g_l_p = hrrwork + 1302336;
    double * const HRR_INT__h_g_l_d = hrrwork + 1344861;
    double * const HRR_INT__h_g_l_f = hrrwork + 1429911;
    double * const HRR_INT__h_g_l_g = hrrwork + 1571661;
    double * const HRR_INT__h_g_m_s = hrrwork + 1784286;
    double * const HRR_INT__h_g_m_p = hrrwork + 1801611;
    double * const HRR_INT__h_g_m_d = hrrwork + 1853586;
    double * const HRR_INT__h_g_m_f = hrrwork + 1957536;
    double * const HRR_INT__h_g_n_s = hrrwork + 2130786;
    double * const HRR_INT__h_g_n_p = hrrwork + 2151576;
    double * const HRR_INT__h_g_n_d = hrrwork + 2213946;
    double * const HRR_INT__h_g_o_s = hrrwork + 2338686;
    double * const HRR_INT__h_g_o_p = hrrwork + 2363256;
    double * const HRR_INT__h_g_q_s = hrrwork + 2436966;
    double * const HRR_INT__i_p_i_s = hrrwork + 2465631;
    double * const HRR_INT__i_p_k_s = hrrwork + 2467983;
    double * const HRR_INT__i_p_l_s = hrrwork + 2471007;
    double * const HRR_INT__i_p_m_s = hrrwork + 2474787;
    double * const HRR_INT__i_p_n_s = hrrwork + 2479407;
    double * const HRR_INT__i_p_o_s = hrrwork + 2484951;
    double * const HRR_INT__i_p_q_s = hrrwork + 2491503;
    double * const HRR_INT__i_d_i_s = hrrwork + 2499147;
    double * const HRR_INT__i_d_k_s = hrrwork + 2503851;
    double * const HRR_INT__i_d_l_s = hrrwork + 2509899;
    double * const HRR_INT__i_d_m_s = hrrwork + 2517459;
    double * const HRR_INT__i_d_n_s = hrrwork + 2526699;
    double * const HRR_INT__i_d_o_s = hrrwork + 2537787;
    double * const HRR_INT__i_d_q_s = hrrwork + 2550891;
    double * const HRR_INT__i_f_i_s = hrrwork + 2566179;
    double * const HRR_INT__i_f_k_s = hrrwork + 2574019;
    double * const HRR_INT__i_f_l_s = hrrwork + 2584099;
    double * const HRR_INT__i_f_m_s = hrrwork + 2596699;
    double * const HRR_INT__i_f_n_s = hrrwork + 2612099;
    double * const HRR_INT__i_f_o_s = hrrwork + 2630579;
    double * const HRR_INT__i_f_q_s = hrrwork + 2652419;
    double * const HRR_INT__k_p_i_s = hrrwork + 2677899;
    double * const HRR_INT__k_p_k_s = hrrwork + 2680923;
    double * const HRR_INT__k_p_l_s = hrrwork + 2684811;
    double * const HRR_INT__k_p_m_s = hrrwork + 2689671;
    double * const HRR_INT__k_p_n_s = hrrwork + 2695611;
    double * const HRR_INT__k_p_o_s = hrrwork + 2702739;
    double * const HRR_INT__k_p_q_s = hrrwork + 2711163;
    double * const HRR_INT__k_d_i_s = hrrwork + 2720991;
    double * const HRR_INT__k_d_k_s = hrrwork + 2727039;
    double * const HRR_INT__k_d_l_s = hrrwork + 2734815;
    double * const HRR_INT__k_d_m_s = hrrwork + 2744535;
    double * const HRR_INT__k_d_n_s = hrrwork + 2756415;
    double * const HRR_INT__k_d_o_s = hrrwork + 2770671;
    double * const HRR_INT__k_d_q_s = hrrwork + 2787519;
    double * const HRR_INT__l_p_i_s = hrrwork + 2807175;
    double * const HRR_INT__l_p_k_s = hrrwork + 2810955;
    double * const HRR_INT__l_p_l_s = hrrwork + 2815815;
    double * const HRR_INT__l_p_m_s = hrrwork + 2821890;
    double * const HRR_INT__l_p_n_s = hrrwork + 2829315;
    double * const HRR_INT__l_p_o_s = hrrwork + 2838225;
    double * const HRR_INT__l_p_q_s = hrrwork + 2848755;


    // Create constants
    const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
    const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
    const SIMINT_DBLTYPE const_11 = SIMINT_DBLSET1(11);
    const SIMINT_DBLTYPE const_12 = SIMINT_DBLSET1(12);
    const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
    const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
    const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
    const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
    const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
    const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
    const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
    const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
    const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);


    ////////////////////////////////////////
    // Loop over shells and primitives
    ////////////////////////////////////////

    real_abcd = 0;
    istart = 0;
    for(ab = 0; ab < P.nshell12_clip; ++ab)
    {
        const int iend = istart + P.nprim12[ab];

        cd = 0;
        jstart = 0;

        for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
        {
            const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
            int jend = jstart;
            for(i = 0; i < nshellbatch; i++)
                jend += Q.nprim12[cd+i];

            // Clear the beginning of the workspace (where we are accumulating integrals)
            memset(work, 0, SIMINT_NSHELL_SIMD * 73815 * sizeof(double));
            abcd = 0;


            for(i = istart; i < iend; ++i)
            {
                SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen

                if(check_screen)
                {
                    // Skip this whole thing if always insignificant
                    if((P.screen[i] * Q.screen_max) < screen_tol)
                        continue;
                    bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
                }

                icd = 0;
                iprimcd = 0;
                nprim_icd = Q.nprim12[cd];
                double * restrict PRIM_PTR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
                double * restrict PRIM_PTR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
                double * restrict PRIM_PTR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
                double * restrict PRIM_PTR_INT__h_s_m_s = INT__h_s_m_s + abcd * 1155;
                double * restrict PRIM_PTR_INT__h_s_n_s = INT__h_s_n_s + abcd * 1386;
                double * restrict PRIM_PTR_INT__h_s_o_s = INT__h_s_o_s + abcd * 1638;
                double * restrict PRIM_PTR_INT__h_s_q_s = INT__h_s_q_s + abcd * 1911;
                double * restrict PRIM_PTR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
                double * restrict PRIM_PTR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
                double * restrict PRIM_PTR_INT__i_s_l_s = INT__i_s_l_s + abcd * 1260;
                double * restrict PRIM_PTR_INT__i_s_m_s = INT__i_s_m_s + abcd * 1540;
                double * restrict PRIM_PTR_INT__i_s_n_s = INT__i_s_n_s + abcd * 1848;
                double * restrict PRIM_PTR_INT__i_s_o_s = INT__i_s_o_s + abcd * 2184;
                double * restrict PRIM_PTR_INT__i_s_q_s = INT__i_s_q_s + abcd * 2548;
                double * restrict PRIM_PTR_INT__k_s_i_s = INT__k_s_i_s + abcd * 1008;
                double * restrict PRIM_PTR_INT__k_s_k_s = INT__k_s_k_s + abcd * 1296;
                double * restrict PRIM_PTR_INT__k_s_l_s = INT__k_s_l_s + abcd * 1620;
                double * restrict PRIM_PTR_INT__k_s_m_s = INT__k_s_m_s + abcd * 1980;
                double * restrict PRIM_PTR_INT__k_s_n_s = INT__k_s_n_s + abcd * 2376;
                double * restrict PRIM_PTR_INT__k_s_o_s = INT__k_s_o_s + abcd * 2808;
                double * restrict PRIM_PTR_INT__k_s_q_s = INT__k_s_q_s + abcd * 3276;
                double * restrict PRIM_PTR_INT__l_s_i_s = INT__l_s_i_s + abcd * 1260;
                double * restrict PRIM_PTR_INT__l_s_k_s = INT__l_s_k_s + abcd * 1620;
                double * restrict PRIM_PTR_INT__l_s_l_s = INT__l_s_l_s + abcd * 2025;
                double * restrict PRIM_PTR_INT__l_s_m_s = INT__l_s_m_s + abcd * 2475;
                double * restrict PRIM_PTR_INT__l_s_n_s = INT__l_s_n_s + abcd * 2970;
                double * restrict PRIM_PTR_INT__l_s_o_s = INT__l_s_o_s + abcd * 3510;
                double * restrict PRIM_PTR_INT__l_s_q_s = INT__l_s_q_s + abcd * 4095;
                double * restrict PRIM_PTR_INT__m_s_i_s = INT__m_s_i_s + abcd * 1540;
                double * restrict PRIM_PTR_INT__m_s_k_s = INT__m_s_k_s + abcd * 1980;
                double * restrict PRIM_PTR_INT__m_s_l_s = INT__m_s_l_s + abcd * 2475;
                double * restrict PRIM_PTR_INT__m_s_m_s = INT__m_s_m_s + abcd * 3025;
                double * restrict PRIM_PTR_INT__m_s_n_s = INT__m_s_n_s + abcd * 3630;
                double * restrict PRIM_PTR_INT__m_s_o_s = INT__m_s_o_s + abcd * 4290;
                double * restrict PRIM_PTR_INT__m_s_q_s = INT__m_s_q_s + abcd * 5005;



                // Load these one per loop over i
                const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
                const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
                const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };

                const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };

                for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
                {
                    // calculate the shell offsets
                    // these are the offset from the shell pointed to by cd
                    // for each element
                    int shelloffsets[SIMINT_SIMD_LEN] = {0};
                    int lastoffset = 0;
                    const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));

                    if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
                    {
                        // Handle if the first element of the vector is a new shell
                        if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
                        {
                            nprim_icd += Q.nprim12[cd + (++icd)];
                            PRIM_PTR_INT__h_s_i_s += 588;
                            PRIM_PTR_INT__h_s_k_s += 756;
                            PRIM_PTR_INT__h_s_l_s += 945;
                            PRIM_PTR_INT__h_s_m_s += 1155;
                            PRIM_PTR_INT__h_s_n_s += 1386;
                            PRIM_PTR_INT__h_s_o_s += 1638;
                            PRIM_PTR_INT__h_s_q_s += 1911;
                            PRIM_PTR_INT__i_s_i_s += 784;
                            PRIM_PTR_INT__i_s_k_s += 1008;
                            PRIM_PTR_INT__i_s_l_s += 1260;
                            PRIM_PTR_INT__i_s_m_s += 1540;
                            PRIM_PTR_INT__i_s_n_s += 1848;
                            PRIM_PTR_INT__i_s_o_s += 2184;
                            PRIM_PTR_INT__i_s_q_s += 2548;
                            PRIM_PTR_INT__k_s_i_s += 1008;
                            PRIM_PTR_INT__k_s_k_s += 1296;
                            PRIM_PTR_INT__k_s_l_s += 1620;
                            PRIM_PTR_INT__k_s_m_s += 1980;
                            PRIM_PTR_INT__k_s_n_s += 2376;
                            PRIM_PTR_INT__k_s_o_s += 2808;
                            PRIM_PTR_INT__k_s_q_s += 3276;
                            PRIM_PTR_INT__l_s_i_s += 1260;
                            PRIM_PTR_INT__l_s_k_s += 1620;
                            PRIM_PTR_INT__l_s_l_s += 2025;
                            PRIM_PTR_INT__l_s_m_s += 2475;
                            PRIM_PTR_INT__l_s_n_s += 2970;
                            PRIM_PTR_INT__l_s_o_s += 3510;
                            PRIM_PTR_INT__l_s_q_s += 4095;
                            PRIM_PTR_INT__m_s_i_s += 1540;
                            PRIM_PTR_INT__m_s_k_s += 1980;
                            PRIM_PTR_INT__m_s_l_s += 2475;
                            PRIM_PTR_INT__m_s_m_s += 3025;
                            PRIM_PTR_INT__m_s_n_s += 3630;
                            PRIM_PTR_INT__m_s_o_s += 4290;
                            PRIM_PTR_INT__m_s_q_s += 5005;
                        }
                        iprimcd++;
                        for(n = 1; n < SIMINT_SIMD_LEN; ++n)
                        {
                            if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
                            {
                                shelloffsets[n] = shelloffsets[n-1] + 1;
                                lastoffset++;
                                nprim_icd += Q.nprim12[cd + (++icd)];
                            }
                            else
                                shelloffsets[n] = shelloffsets[n-1];
                            iprimcd++;
                        }
                    }
                    else
                        iprimcd += SIMINT_SIMD_LEN;

                    // Do we have to compute this vector (or has it been screened out)?
                    // (not_screened != 0 means we have to do this vector)
                    if(check_screen)
                    {
                        const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
                        if(vmax < screen_tol)
                        {
                            PRIM_PTR_INT__h_s_i_s += lastoffset*588;
                            PRIM_PTR_INT__h_s_k_s += lastoffset*756;
                            PRIM_PTR_INT__h_s_l_s += lastoffset*945;
                            PRIM_PTR_INT__h_s_m_s += lastoffset*1155;
                            PRIM_PTR_INT__h_s_n_s += lastoffset*1386;
                            PRIM_PTR_INT__h_s_o_s += lastoffset*1638;
                            PRIM_PTR_INT__h_s_q_s += lastoffset*1911;
                            PRIM_PTR_INT__i_s_i_s += lastoffset*784;
                            PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
                            PRIM_PTR_INT__i_s_l_s += lastoffset*1260;
                            PRIM_PTR_INT__i_s_m_s += lastoffset*1540;
                            PRIM_PTR_INT__i_s_n_s += lastoffset*1848;
                            PRIM_PTR_INT__i_s_o_s += lastoffset*2184;
                            PRIM_PTR_INT__i_s_q_s += lastoffset*2548;
                            PRIM_PTR_INT__k_s_i_s += lastoffset*1008;
                            PRIM_PTR_INT__k_s_k_s += lastoffset*1296;
                            PRIM_PTR_INT__k_s_l_s += lastoffset*1620;
                            PRIM_PTR_INT__k_s_m_s += lastoffset*1980;
                            PRIM_PTR_INT__k_s_n_s += lastoffset*2376;
                            PRIM_PTR_INT__k_s_o_s += lastoffset*2808;
                            PRIM_PTR_INT__k_s_q_s += lastoffset*3276;
                            PRIM_PTR_INT__l_s_i_s += lastoffset*1260;
                            PRIM_PTR_INT__l_s_k_s += lastoffset*1620;
                            PRIM_PTR_INT__l_s_l_s += lastoffset*2025;
                            PRIM_PTR_INT__l_s_m_s += lastoffset*2475;
                            PRIM_PTR_INT__l_s_n_s += lastoffset*2970;
                            PRIM_PTR_INT__l_s_o_s += lastoffset*3510;
                            PRIM_PTR_INT__l_s_q_s += lastoffset*4095;
                            PRIM_PTR_INT__m_s_i_s += lastoffset*1540;
                            PRIM_PTR_INT__m_s_k_s += lastoffset*1980;
                            PRIM_PTR_INT__m_s_l_s += lastoffset*2475;
                            PRIM_PTR_INT__m_s_m_s += lastoffset*3025;
                            PRIM_PTR_INT__m_s_n_s += lastoffset*3630;
                            PRIM_PTR_INT__m_s_o_s += lastoffset*4290;
                            PRIM_PTR_INT__m_s_q_s += lastoffset*5005;
                            continue;
                        }
                    }

                    const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
                    const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
                    const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
                    const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);


                    /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
                    SIMINT_DBLTYPE PQ[3];
                    PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
                    PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
                    PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
                    SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
                    R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
                    R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);

                    const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
                    const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
                    const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
                    const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
                    const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
                    const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
                    const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };

                    // NOTE: Minus sign!
                    const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
                    SIMINT_DBLTYPE aop_PQ[3];
                    aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
                    aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
                    aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);

                    SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
                    SIMINT_DBLTYPE aoq_PQ[3];
                    aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
                    aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
                    aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
                    // Put a minus sign here so we don't have to in RR routines
                    a_over_q = SIMINT_NEG(a_over_q);


                    //////////////////////////////////////////////
                    // Fjt function section
                    // Maximum v value: 21
                    //////////////////////////////////////////////
                    // The parameter to the Fjt function
                    const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);


                    const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);


                    boys_F_split(PRIM_INT__s_s_s_s, F_x, 21);
                    SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
                    prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
                    for(n = 0; n <= 21; n++)
                        PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);

                    //////////////////////////////////////////////
                    // Primitive integrals: Vertical recurrance
                    //////////////////////////////////////////////

                    const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
                    const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_6_over_2p = SIMINT_MUL(const_6, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_7_over_2p = SIMINT_MUL(const_7, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_8_over_2p = SIMINT_MUL(const_8, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
                    const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_9_over_2q = SIMINT_MUL(const_9, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_10_over_2q = SIMINT_MUL(const_10, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_11_over_2q = SIMINT_MUL(const_11, one_over_2q);
                    const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
                    const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_11_over_2pq = SIMINT_MUL(const_11, one_over_2pq);
                    const SIMINT_DBLTYPE vrr_const_12_over_2pq = SIMINT_MUL(const_12, one_over_2pq);



                    // Forming PRIM_INT__s_s_p_s[21 * 3];
                    for(n = 0; n < 21; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
                        PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]);

                        PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
                        PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 1]);

                        PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
                        PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_p_s[n * 3 + 2]);

                    }



                    // Forming PRIM_INT__s_s_d_s[20 * 6];
                    for(n = 0; n < 20; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
                        PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]);
                        PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 0]);

                        PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
                        PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 1]);

                        PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
                        PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 2]);

                        PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
                        PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 3]);
                        PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 3]);

                        PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
                        PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 4]);

                        PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
                        PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_d_s[n * 6 + 5]);
                        PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__s_s_d_s[n * 6 + 5]);

                    }



                    // Forming PRIM_INT__s_s_f_s[19 * 10];
                    for(n = 0; n < 19; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
                        PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 0]);
                        PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__s_s_f_s[n * 10 + 0]);

                        PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
                        PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 1]);

                        PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
                        PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 2]);

                        PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
                        PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 3]);

                        PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
                        PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_f_s[n * 10 + 4]);

                        PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
                        PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 5]);

                        PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
                        PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 6]);
                        PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__s_s_f_s[n * 10 + 6]);

                        PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
                        PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 7]);

                        PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
                        PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 8]);

                        PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
                        PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 9]);
                        PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__s_s_f_s[n * 10 + 9]);

                    }



                    // Forming PRIM_INT__s_s_g_s[18 * 15];
                    for(n = 0; n < 18; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__s_s_g_s[n * 15 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_f_s[n * 10 + 0]);
                        PRIM_INT__s_s_g_s[n * 15 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 0], PRIM_INT__s_s_g_s[n * 15 + 0]);
                        PRIM_INT__s_s_g_s[n * 15 + 0] = SIMINT_FMADD( vrr_const_3_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]), PRIM_INT__s_s_g_s[n * 15 + 0]);

                        PRIM_INT__s_s_g_s[n * 15 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_f_s[n * 10 + 0]);
                        PRIM_INT__s_s_g_s[n * 15 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 0], PRIM_INT__s_s_g_s[n * 15 + 1]);

                        PRIM_INT__s_s_g_s[n * 15 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_f_s[n * 10 + 0]);
                        PRIM_INT__s_s_g_s[n * 15 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 0], PRIM_INT__s_s_g_s[n * 15 + 2]);

                        PRIM_INT__s_s_g_s[n * 15 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_f_s[n * 10 + 1]);
                        PRIM_INT__s_s_g_s[n * 15 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 1], PRIM_INT__s_s_g_s[n * 15 + 3]);
                        PRIM_INT__s_s_g_s[n * 15 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]), PRIM_INT__s_s_g_s[n * 15 + 3]);

                        PRIM_INT__s_s_g_s[n * 15 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_f_s[n * 10 + 1]);
                        PRIM_INT__s_s_g_s[n * 15 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 1], PRIM_INT__s_s_g_s[n * 15 + 4]);

                        PRIM_INT__s_s_g_s[n * 15 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_f_s[n * 10 + 2]);
                        PRIM_INT__s_s_g_s[n * 15 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 2], PRIM_INT__s_s_g_s[n * 15 + 5]);
                        PRIM_INT__s_s_g_s[n * 15 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]), PRIM_INT__s_s_g_s[n * 15 + 5]);

                        PRIM_INT__s_s_g_s[n * 15 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_f_s[n * 10 + 6]);
                        PRIM_INT__s_s_g_s[n * 15 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 6], PRIM_INT__s_s_g_s[n * 15 + 6]);

                        PRIM_INT__s_s_g_s[n * 15 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_f_s[n * 10 + 3]);
                        PRIM_INT__s_s_g_s[n * 15 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 3], PRIM_INT__s_s_g_s[n * 15 + 7]);

                        PRIM_INT__s_s_g_s[n * 15 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_f_s[n * 10 + 5]);
                        PRIM_INT__s_s_g_s[n * 15 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 5], PRIM_INT__s_s_g_s[n * 15 + 8]);

                        PRIM_INT__s_s_g_s[n * 15 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_f_s[n * 10 + 9]);
                        PRIM_INT__s_s_g_s[n * 15 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 9], PRIM_INT__s_s_g_s[n * 15 + 9]);

                        PRIM_INT__s_s_g_s[n * 15 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_f_s[n * 10 + 6]);
                        PRIM_INT__s_s_g_s[n * 15 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 6], PRIM_INT__s_s_g_s[n * 15 + 10]);
                        PRIM_INT__s_s_g_s[n * 15 + 10] = SIMINT_FMADD( vrr_const_3_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_d_s[n * 6 + 3]), PRIM_INT__s_s_g_s[n * 15 + 10]);

                        PRIM_INT__s_s_g_s[n * 15 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_f_s[n * 10 + 6]);
                        PRIM_INT__s_s_g_s[n * 15 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 6], PRIM_INT__s_s_g_s[n * 15 + 11]);

                        PRIM_INT__s_s_g_s[n * 15 + 12] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_f_s[n * 10 + 7]);
                        PRIM_INT__s_s_g_s[n * 15 + 12] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 7], PRIM_INT__s_s_g_s[n * 15 + 12]);
                        PRIM_INT__s_s_g_s[n * 15 + 12] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_d_s[n * 6 + 3]), PRIM_INT__s_s_g_s[n * 15 + 12]);

                        PRIM_INT__s_s_g_s[n * 15 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_f_s[n * 10 + 9]);
                        PRIM_INT__s_s_g_s[n * 15 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 9], PRIM_INT__s_s_g_s[n * 15 + 13]);

                        PRIM_INT__s_s_g_s[n * 15 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_f_s[n * 10 + 9]);
                        PRIM_INT__s_s_g_s[n * 15 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 9], PRIM_INT__s_s_g_s[n * 15 + 14]);
                        PRIM_INT__s_s_g_s[n * 15 + 14] = SIMINT_FMADD( vrr_const_3_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_d_s[n * 6 + 5]), PRIM_INT__s_s_g_s[n * 15 + 14]);

                    }


                    VRR_K_s_s_h_s(
                            PRIM_INT__s_s_h_s,
                            PRIM_INT__s_s_g_s,
                            PRIM_INT__s_s_f_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2q,
                            17);


                    VRR_K_s_s_i_s(
                            PRIM_INT__s_s_i_s,
                            PRIM_INT__s_s_h_s,
                            PRIM_INT__s_s_g_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2q,
                            16);


                    VRR_I_p_s_i_s(
                            PRIM_INT__p_s_i_s,
                            PRIM_INT__s_s_i_s,
                            PRIM_INT__s_s_h_s,
                            P_PA,
                            aop_PQ,
                            one_over_2pq,
                            9);


                    VRR_I_p_s_h_s(
                            PRIM_INT__p_s_h_s,
                            PRIM_INT__s_s_h_s,
                            PRIM_INT__s_s_g_s,
                            P_PA,
                            aop_PQ,
                            one_over_2pq,
                            9);


                    ostei_general_vrr_I(2, 0, 6, 0, 8,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__p_s_i_s, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);


                    VRR_I_p_s_g_s(
                            PRIM_INT__p_s_g_s,
                            PRIM_INT__s_s_g_s,
                            PRIM_INT__s_s_f_s,
                            P_PA,
                            aop_PQ,
                            one_over_2pq,
                            9);


                    VRR_I_d_s_h_s(
                            PRIM_INT__d_s_h_s,
                            PRIM_INT__p_s_h_s,
                            PRIM_INT__s_s_h_s,
                            PRIM_INT__p_s_g_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            8);


                    ostei_general_vrr_I(3, 0, 6, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);



                    // Forming PRIM_INT__p_s_f_s[9 * 30];
                    for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__p_s_f_s[n * 30 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 0]);
                        PRIM_INT__p_s_f_s[n * 30 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 0], PRIM_INT__p_s_f_s[n * 30 + 0]);
                        PRIM_INT__p_s_f_s[n * 30 + 0] = SIMINT_FMADD( vrr_const_3_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_f_s[n * 30 + 0]);

                        PRIM_INT__p_s_f_s[n * 30 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 1]);
                        PRIM_INT__p_s_f_s[n * 30 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 1], PRIM_INT__p_s_f_s[n * 30 + 1]);
                        PRIM_INT__p_s_f_s[n * 30 + 1] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_f_s[n * 30 + 1]);

                        PRIM_INT__p_s_f_s[n * 30 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 2]);
                        PRIM_INT__p_s_f_s[n * 30 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 2], PRIM_INT__p_s_f_s[n * 30 + 2]);
                        PRIM_INT__p_s_f_s[n * 30 + 2] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_f_s[n * 30 + 2]);

                        PRIM_INT__p_s_f_s[n * 30 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 3]);
                        PRIM_INT__p_s_f_s[n * 30 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 3], PRIM_INT__p_s_f_s[n * 30 + 3]);
                        PRIM_INT__p_s_f_s[n * 30 + 3] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_f_s[n * 30 + 3]);

                        PRIM_INT__p_s_f_s[n * 30 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 4]);
                        PRIM_INT__p_s_f_s[n * 30 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 4], PRIM_INT__p_s_f_s[n * 30 + 4]);
                        PRIM_INT__p_s_f_s[n * 30 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_f_s[n * 30 + 4]);

                        PRIM_INT__p_s_f_s[n * 30 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 5]);
                        PRIM_INT__p_s_f_s[n * 30 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 5], PRIM_INT__p_s_f_s[n * 30 + 5]);
                        PRIM_INT__p_s_f_s[n * 30 + 5] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_f_s[n * 30 + 5]);

                        PRIM_INT__p_s_f_s[n * 30 + 6] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 6]);
                        PRIM_INT__p_s_f_s[n * 30 + 6] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 6], PRIM_INT__p_s_f_s[n * 30 + 6]);

                        PRIM_INT__p_s_f_s[n * 30 + 7] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 7]);
                        PRIM_INT__p_s_f_s[n * 30 + 7] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 7], PRIM_INT__p_s_f_s[n * 30 + 7]);

                        PRIM_INT__p_s_f_s[n * 30 + 8] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 8]);
                        PRIM_INT__p_s_f_s[n * 30 + 8] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 8], PRIM_INT__p_s_f_s[n * 30 + 8]);

                        PRIM_INT__p_s_f_s[n * 30 + 9] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_f_s[n * 10 + 9]);
                        PRIM_INT__p_s_f_s[n * 30 + 9] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_f_s[(n+1) * 10 + 9], PRIM_INT__p_s_f_s[n * 30 + 9]);

                        PRIM_INT__p_s_f_s[n * 30 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 0]);
                        PRIM_INT__p_s_f_s[n * 30 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 0], PRIM_INT__p_s_f_s[n * 30 + 10]);

                        PRIM_INT__p_s_f_s[n * 30 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 1]);
                        PRIM_INT__p_s_f_s[n * 30 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 1], PRIM_INT__p_s_f_s[n * 30 + 11]);
                        PRIM_INT__p_s_f_s[n * 30 + 11] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_f_s[n * 30 + 11]);

                        PRIM_INT__p_s_f_s[n * 30 + 12] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 2]);
                        PRIM_INT__p_s_f_s[n * 30 + 12] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 2], PRIM_INT__p_s_f_s[n * 30 + 12]);

                        PRIM_INT__p_s_f_s[n * 30 + 13] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 3]);
                        PRIM_INT__p_s_f_s[n * 30 + 13] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 3], PRIM_INT__p_s_f_s[n * 30 + 13]);
                        PRIM_INT__p_s_f_s[n * 30 + 13] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_f_s[n * 30 + 13]);

                        PRIM_INT__p_s_f_s[n * 30 + 14] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 4]);
                        PRIM_INT__p_s_f_s[n * 30 + 14] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 4], PRIM_INT__p_s_f_s[n * 30 + 14]);
                        PRIM_INT__p_s_f_s[n * 30 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_f_s[n * 30 + 14]);

                        PRIM_INT__p_s_f_s[n * 30 + 15] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 5]);
                        PRIM_INT__p_s_f_s[n * 30 + 15] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 5], PRIM_INT__p_s_f_s[n * 30 + 15]);

                        PRIM_INT__p_s_f_s[n * 30 + 16] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 6]);
                        PRIM_INT__p_s_f_s[n * 30 + 16] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 6], PRIM_INT__p_s_f_s[n * 30 + 16]);
                        PRIM_INT__p_s_f_s[n * 30 + 16] = SIMINT_FMADD( vrr_const_3_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_f_s[n * 30 + 16]);

                        PRIM_INT__p_s_f_s[n * 30 + 17] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 7]);
                        PRIM_INT__p_s_f_s[n * 30 + 17] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 7], PRIM_INT__p_s_f_s[n * 30 + 17]);
                        PRIM_INT__p_s_f_s[n * 30 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_f_s[n * 30 + 17]);

                        PRIM_INT__p_s_f_s[n * 30 + 18] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 8]);
                        PRIM_INT__p_s_f_s[n * 30 + 18] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 8], PRIM_INT__p_s_f_s[n * 30 + 18]);
                        PRIM_INT__p_s_f_s[n * 30 + 18] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_f_s[n * 30 + 18]);

                        PRIM_INT__p_s_f_s[n * 30 + 19] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_f_s[n * 10 + 9]);
                        PRIM_INT__p_s_f_s[n * 30 + 19] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_f_s[(n+1) * 10 + 9], PRIM_INT__p_s_f_s[n * 30 + 19]);

                        PRIM_INT__p_s_f_s[n * 30 + 20] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 0]);
                        PRIM_INT__p_s_f_s[n * 30 + 20] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 0], PRIM_INT__p_s_f_s[n * 30 + 20]);

                        PRIM_INT__p_s_f_s[n * 30 + 21] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 1]);
                        PRIM_INT__p_s_f_s[n * 30 + 21] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 1], PRIM_INT__p_s_f_s[n * 30 + 21]);

                        PRIM_INT__p_s_f_s[n * 30 + 22] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 2]);
                        PRIM_INT__p_s_f_s[n * 30 + 22] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 2], PRIM_INT__p_s_f_s[n * 30 + 22]);
                        PRIM_INT__p_s_f_s[n * 30 + 22] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_f_s[n * 30 + 22]);

                        PRIM_INT__p_s_f_s[n * 30 + 23] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 3]);
                        PRIM_INT__p_s_f_s[n * 30 + 23] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 3], PRIM_INT__p_s_f_s[n * 30 + 23]);

                        PRIM_INT__p_s_f_s[n * 30 + 24] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 4]);
                        PRIM_INT__p_s_f_s[n * 30 + 24] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 4], PRIM_INT__p_s_f_s[n * 30 + 24]);
                        PRIM_INT__p_s_f_s[n * 30 + 24] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_f_s[n * 30 + 24]);

                        PRIM_INT__p_s_f_s[n * 30 + 25] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 5]);
                        PRIM_INT__p_s_f_s[n * 30 + 25] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 5], PRIM_INT__p_s_f_s[n * 30 + 25]);
                        PRIM_INT__p_s_f_s[n * 30 + 25] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_f_s[n * 30 + 25]);

                        PRIM_INT__p_s_f_s[n * 30 + 26] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 6]);
                        PRIM_INT__p_s_f_s[n * 30 + 26] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 6], PRIM_INT__p_s_f_s[n * 30 + 26]);

                        PRIM_INT__p_s_f_s[n * 30 + 27] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 7]);
                        PRIM_INT__p_s_f_s[n * 30 + 27] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 7], PRIM_INT__p_s_f_s[n * 30 + 27]);
                        PRIM_INT__p_s_f_s[n * 30 + 27] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_f_s[n * 30 + 27]);

                        PRIM_INT__p_s_f_s[n * 30 + 28] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 8]);
                        PRIM_INT__p_s_f_s[n * 30 + 28] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 8], PRIM_INT__p_s_f_s[n * 30 + 28]);
                        PRIM_INT__p_s_f_s[n * 30 + 28] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_f_s[n * 30 + 28]);

                        PRIM_INT__p_s_f_s[n * 30 + 29] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_f_s[n * 10 + 9]);
                        PRIM_INT__p_s_f_s[n * 30 + 29] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_f_s[(n+1) * 10 + 9], PRIM_INT__p_s_f_s[n * 30 + 29]);
                        PRIM_INT__p_s_f_s[n * 30 + 29] = SIMINT_FMADD( vrr_const_3_over_2pq, PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_f_s[n * 30 + 29]);

                    }


                    VRR_I_d_s_g_s(
                            PRIM_INT__d_s_g_s,
                            PRIM_INT__p_s_g_s,
                            PRIM_INT__s_s_g_s,
                            PRIM_INT__p_s_f_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            8);


                    ostei_general_vrr_I(3, 0, 5, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_h_s, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);


                    ostei_general_vrr_I(4, 0, 6, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_i_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);



                    // Forming PRIM_INT__p_s_d_s[9 * 18];
                    for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
                        PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
                        PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);

                        PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
                        PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
                        PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);

                        PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
                        PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
                        PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);

                        PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
                        PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 3]);

                        PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
                        PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 4]);

                        PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
                        PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 5]);

                        PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
                        PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 6]);

                        PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
                        PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 7]);
                        PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 7]);

                        PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
                        PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 8]);

                        PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
                        PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 9]);
                        PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 9]);

                        PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
                        PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 10]);
                        PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 10]);

                        PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
                        PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 11]);

                        PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
                        PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 12]);

                        PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
                        PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 13]);

                        PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
                        PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 14]);
                        PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 14]);

                        PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
                        PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 15]);

                        PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
                        PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 16]);
                        PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 16]);

                        PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
                        PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 17]);
                        PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 17]);

                    }


                    VRR_I_d_s_f_s(
                            PRIM_INT__d_s_f_s,
                            PRIM_INT__p_s_f_s,
                            PRIM_INT__s_s_f_s,
                            PRIM_INT__p_s_d_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            8);


                    VRR_I_f_s_g_s(
                            PRIM_INT__f_s_g_s,
                            PRIM_INT__d_s_g_s,
                            PRIM_INT__p_s_g_s,
                            PRIM_INT__d_s_f_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            7);


                    ostei_general_vrr_I(4, 0, 5, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_h_s, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);


                    ostei_general_vrr_I(5, 0, 6, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_i_s, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);


                    VRR_K_s_s_k_s(
                            PRIM_INT__s_s_k_s,
                            PRIM_INT__s_s_i_s,
                            PRIM_INT__s_s_h_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2q,
                            15);


                    ostei_general_vrr_I(1, 0, 7, 0, 9,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);


                    ostei_general_vrr_I(2, 0, 7, 0, 8,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);


                    ostei_general_vrr_I(3, 0, 7, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);


                    ostei_general_vrr_I(4, 0, 7, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_k_s, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);


                    ostei_general_vrr_I(5, 0, 7, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_k_s, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);



                    // Forming PRIM_INT__p_s_p_s[9 * 9];
                    for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
                        PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);
                        PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);

                        PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
                        PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 1]);

                        PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
                        PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 2]);

                        PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
                        PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 3]);

                        PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
                        PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 4]);
                        PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_p_s[n * 9 + 4]);

                        PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
                        PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 5]);

                        PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
                        PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 6]);

                        PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
                        PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 7]);

                        PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
                        PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 8]);
                        PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_p_s[n * 9 + 8]);

                    }



                    // Forming PRIM_INT__d_s_d_s[8 * 36];
                    for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__d_s_d_s[n * 36 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_d_s[n * 18 + 0]);
                        PRIM_INT__d_s_d_s[n * 36 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 0], PRIM_INT__d_s_d_s[n * 36 + 0]);
                        PRIM_INT__d_s_d_s[n * 36 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]), PRIM_INT__d_s_d_s[n * 36 + 0]);
                        PRIM_INT__d_s_d_s[n * 36 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__d_s_d_s[n * 36 + 0]);

                        PRIM_INT__d_s_d_s[n * 36 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_d_s[n * 18 + 1]);
                        PRIM_INT__d_s_d_s[n * 36 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 1], PRIM_INT__d_s_d_s[n * 36 + 1]);
                        PRIM_INT__d_s_d_s[n * 36 + 1] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_d_s[n * 6 + 1]), PRIM_INT__d_s_d_s[n * 36 + 1]);
                        PRIM_INT__d_s_d_s[n * 36 + 1] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__d_s_d_s[n * 36 + 1]);

                        PRIM_INT__d_s_d_s[n * 36 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_d_s[n * 18 + 2]);
                        PRIM_INT__d_s_d_s[n * 36 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 2], PRIM_INT__d_s_d_s[n * 36 + 2]);
                        PRIM_INT__d_s_d_s[n * 36 + 2] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__s_s_d_s[n * 6 + 2]), PRIM_INT__d_s_d_s[n * 36 + 2]);
                        PRIM_INT__d_s_d_s[n * 36 + 2] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__d_s_d_s[n * 36 + 2]);

                        PRIM_INT__d_s_d_s[n * 36 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_d_s[n * 18 + 3]);
                        PRIM_INT__d_s_d_s[n * 36 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 3], PRIM_INT__d_s_d_s[n * 36 + 3]);
                        PRIM_INT__d_s_d_s[n * 36 + 3] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_d_s[n * 6 + 3]), PRIM_INT__d_s_d_s[n * 36 + 3]);

                        PRIM_INT__d_s_d_s[n * 36 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_d_s[n * 18 + 4]);
                        PRIM_INT__d_s_d_s[n * 36 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 4], PRIM_INT__d_s_d_s[n * 36 + 4]);
                        PRIM_INT__d_s_d_s[n * 36 + 4] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__s_s_d_s[n * 6 + 4]), PRIM_INT__d_s_d_s[n * 36 + 4]);

                        PRIM_INT__d_s_d_s[n * 36 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_d_s[n * 18 + 5]);
                        PRIM_INT__d_s_d_s[n * 36 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 5], PRIM_INT__d_s_d_s[n * 36 + 5]);
                        PRIM_INT__d_s_d_s[n * 36 + 5] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_d_s[n * 6 + 5]), PRIM_INT__d_s_d_s[n * 36 + 5]);

                        PRIM_INT__d_s_d_s[n * 36 + 18] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_d_s[n * 18 + 6]);
                        PRIM_INT__d_s_d_s[n * 36 + 18] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 6], PRIM_INT__d_s_d_s[n * 36 + 18]);
                        PRIM_INT__d_s_d_s[n * 36 + 18] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]), PRIM_INT__d_s_d_s[n * 36 + 18]);

                        PRIM_INT__d_s_d_s[n * 36 + 19] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_d_s[n * 18 + 7]);
                        PRIM_INT__d_s_d_s[n * 36 + 19] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 7], PRIM_INT__d_s_d_s[n * 36 + 19]);
                        PRIM_INT__d_s_d_s[n * 36 + 19] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_d_s[n * 6 + 1]), PRIM_INT__d_s_d_s[n * 36 + 19]);
                        PRIM_INT__d_s_d_s[n * 36 + 19] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__d_s_d_s[n * 36 + 19]);

                        PRIM_INT__d_s_d_s[n * 36 + 20] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_d_s[n * 18 + 8]);
                        PRIM_INT__d_s_d_s[n * 36 + 20] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 8], PRIM_INT__d_s_d_s[n * 36 + 20]);
                        PRIM_INT__d_s_d_s[n * 36 + 20] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__s_s_d_s[n * 6 + 2]), PRIM_INT__d_s_d_s[n * 36 + 20]);

                        PRIM_INT__d_s_d_s[n * 36 + 21] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_d_s[n * 18 + 9]);
                        PRIM_INT__d_s_d_s[n * 36 + 21] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 9], PRIM_INT__d_s_d_s[n * 36 + 21]);
                        PRIM_INT__d_s_d_s[n * 36 + 21] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_d_s[n * 6 + 3]), PRIM_INT__d_s_d_s[n * 36 + 21]);
                        PRIM_INT__d_s_d_s[n * 36 + 21] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__d_s_d_s[n * 36 + 21]);

                        PRIM_INT__d_s_d_s[n * 36 + 22] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_d_s[n * 18 + 10]);
                        PRIM_INT__d_s_d_s[n * 36 + 22] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 10], PRIM_INT__d_s_d_s[n * 36 + 22]);
                        PRIM_INT__d_s_d_s[n * 36 + 22] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__s_s_d_s[n * 6 + 4]), PRIM_INT__d_s_d_s[n * 36 + 22]);
                        PRIM_INT__d_s_d_s[n * 36 + 22] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__d_s_d_s[n * 36 + 22]);

                        PRIM_INT__d_s_d_s[n * 36 + 23] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_d_s[n * 18 + 11]);
                        PRIM_INT__d_s_d_s[n * 36 + 23] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 11], PRIM_INT__d_s_d_s[n * 36 + 23]);
                        PRIM_INT__d_s_d_s[n * 36 + 23] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_d_s[n * 6 + 5]), PRIM_INT__d_s_d_s[n * 36 + 23]);

                        PRIM_INT__d_s_d_s[n * 36 + 30] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_d_s[n * 18 + 12]);
                        PRIM_INT__d_s_d_s[n * 36 + 30] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 12], PRIM_INT__d_s_d_s[n * 36 + 30]);
                        PRIM_INT__d_s_d_s[n * 36 + 30] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_d_s[n * 6 + 0]), PRIM_INT__d_s_d_s[n * 36 + 30]);

                        PRIM_INT__d_s_d_s[n * 36 + 31] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_d_s[n * 18 + 13]);
                        PRIM_INT__d_s_d_s[n * 36 + 31] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 13], PRIM_INT__d_s_d_s[n * 36 + 31]);
                        PRIM_INT__d_s_d_s[n * 36 + 31] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_d_s[n * 6 + 1]), PRIM_INT__d_s_d_s[n * 36 + 31]);

                        PRIM_INT__d_s_d_s[n * 36 + 32] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_d_s[n * 18 + 14]);
                        PRIM_INT__d_s_d_s[n * 36 + 32] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 14], PRIM_INT__d_s_d_s[n * 36 + 32]);
                        PRIM_INT__d_s_d_s[n * 36 + 32] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__s_s_d_s[n * 6 + 2]), PRIM_INT__d_s_d_s[n * 36 + 32]);
                        PRIM_INT__d_s_d_s[n * 36 + 32] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__d_s_d_s[n * 36 + 32]);

                        PRIM_INT__d_s_d_s[n * 36 + 33] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_d_s[n * 18 + 15]);
                        PRIM_INT__d_s_d_s[n * 36 + 33] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 15], PRIM_INT__d_s_d_s[n * 36 + 33]);
                        PRIM_INT__d_s_d_s[n * 36 + 33] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_d_s[n * 6 + 3]), PRIM_INT__d_s_d_s[n * 36 + 33]);

                        PRIM_INT__d_s_d_s[n * 36 + 34] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_d_s[n * 18 + 16]);
                        PRIM_INT__d_s_d_s[n * 36 + 34] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 16], PRIM_INT__d_s_d_s[n * 36 + 34]);
                        PRIM_INT__d_s_d_s[n * 36 + 34] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__s_s_d_s[n * 6 + 4]), PRIM_INT__d_s_d_s[n * 36 + 34]);
                        PRIM_INT__d_s_d_s[n * 36 + 34] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__d_s_d_s[n * 36 + 34]);

                        PRIM_INT__d_s_d_s[n * 36 + 35] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_d_s[n * 18 + 17]);
                        PRIM_INT__d_s_d_s[n * 36 + 35] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 17], PRIM_INT__d_s_d_s[n * 36 + 35]);
                        PRIM_INT__d_s_d_s[n * 36 + 35] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_d_s[n * 6 + 5]), PRIM_INT__d_s_d_s[n * 36 + 35]);
                        PRIM_INT__d_s_d_s[n * 36 + 35] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__d_s_d_s[n * 36 + 35]);

                    }


                    VRR_I_f_s_f_s(
                            PRIM_INT__f_s_f_s,
                            PRIM_INT__d_s_f_s,
                            PRIM_INT__p_s_f_s,
                            PRIM_INT__d_s_d_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            7);


                    ostei_general_vrr_I(4, 0, 4, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_g_s, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);


                    ostei_general_vrr_I(5, 0, 5, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_h_s, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_h_s);


                    ostei_general_vrr_I(6, 0, 6, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_i_s, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_i_s);


                    ostei_general_vrr1_K(8, 14,
                            one_over_2q, a_over_q, aoq_PQ, Q_PA,
                            PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);


                    ostei_general_vrr_I(1, 0, 8, 0, 9,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);


                    ostei_general_vrr_I(2, 0, 8, 0, 8,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__p_s_l_s, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_l_s);


                    ostei_general_vrr_I(3, 0, 8, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_l_s, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_l_s);


                    ostei_general_vrr_I(4, 0, 8, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_l_s, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_l_s);


                    ostei_general_vrr_I(5, 0, 8, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_l_s, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_l_s);


                    ostei_general_vrr_I(6, 0, 7, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_k_s, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_k_s);



                    // Forming PRIM_INT__p_s_s_s[9 * 3];
                    for(n = 0; n < 9; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
                        PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]);

                        PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
                        PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 1]);

                        PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
                        PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__p_s_s_s[n * 3 + 2]);

                    }



                    // Forming PRIM_INT__d_s_p_s[8 * 18];
                    for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 0]);
                        PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
                        PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 0]);
                        PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);

                        PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 1]);
                        PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__d_s_p_s[n * 18 + 1]);
                        PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 1]);

                        PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 2]);
                        PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__d_s_p_s[n * 18 + 2]);
                        PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 2]);

                        PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 3]);
                        PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);
                        PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 9]);

                        PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 4]);
                        PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__d_s_p_s[n * 18 + 10]);
                        PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 10]);
                        PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 10]);

                        PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 5]);
                        PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__d_s_p_s[n * 18 + 11]);
                        PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 11]);

                        PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 6]);
                        PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__d_s_p_s[n * 18 + 15]);
                        PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 15]);

                        PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 7]);
                        PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__d_s_p_s[n * 18 + 16]);
                        PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 16]);

                        PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 8]);
                        PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__d_s_p_s[n * 18 + 17]);
                        PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 17]);
                        PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 17]);

                    }


                    VRR_I_f_s_d_s(
                            PRIM_INT__f_s_d_s,
                            PRIM_INT__d_s_d_s,
                            PRIM_INT__p_s_d_s,
                            PRIM_INT__d_s_p_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            7);


                    VRR_I_g_s_f_s(
                            PRIM_INT__g_s_f_s,
                            PRIM_INT__f_s_f_s,
                            PRIM_INT__d_s_f_s,
                            PRIM_INT__f_s_d_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            6);


                    ostei_general_vrr_I(5, 0, 4, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_g_s, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_g_s);


                    ostei_general_vrr_I(6, 0, 5, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_h_s, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_g_s, NULL, PRIM_INT__i_s_h_s);


                    ostei_general_vrr_I(7, 0, 6, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_i_s, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_h_s, NULL, PRIM_INT__k_s_i_s);


                    ostei_general_vrr1_K(9, 13,
                            one_over_2q, a_over_q, aoq_PQ, Q_PA,
                            PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);


                    ostei_general_vrr_I(1, 0, 9, 0, 9,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);


                    ostei_general_vrr_I(2, 0, 9, 0, 8,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__p_s_m_s, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_m_s);


                    ostei_general_vrr_I(3, 0, 9, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_m_s, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_m_s);


                    ostei_general_vrr_I(4, 0, 9, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_m_s, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_m_s);


                    ostei_general_vrr_I(5, 0, 9, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_m_s, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_m_s);


                    ostei_general_vrr_I(6, 0, 8, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_l_s, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_k_s, NULL, PRIM_INT__i_s_l_s);


                    ostei_general_vrr_I(7, 0, 7, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_k_s, PRIM_INT__h_s_k_s, NULL, PRIM_INT__i_s_i_s, NULL, PRIM_INT__k_s_k_s);



                    // Forming PRIM_INT__d_s_s_s[8 * 6];
                    for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
                        PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 0]);
                        PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 0]);

                        PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
                        PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_s[n * 6 + 3]);
                        PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 3]);

                        PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
                        PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_s_s[n * 6 + 5]);
                        PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_s_s[(n+1) * 1 + 0], PRIM_INT__s_s_s_s[n * 1 + 0]), PRIM_INT__d_s_s_s[n * 6 + 5]);

                    }



                    // Forming PRIM_INT__f_s_p_s[7 * 30];
                    for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__f_s_p_s[n * 30 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_p_s[n * 18 + 0]);
                        PRIM_INT__f_s_p_s[n * 30 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 0], PRIM_INT__f_s_p_s[n * 30 + 0]);
                        PRIM_INT__f_s_p_s[n * 30 + 0] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]), PRIM_INT__f_s_p_s[n * 30 + 0]);
                        PRIM_INT__f_s_p_s[n * 30 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_p_s[n * 30 + 0]);

                        PRIM_INT__f_s_p_s[n * 30 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_p_s[n * 18 + 1]);
                        PRIM_INT__f_s_p_s[n * 30 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 1], PRIM_INT__f_s_p_s[n * 30 + 1]);
                        PRIM_INT__f_s_p_s[n * 30 + 1] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__p_s_p_s[n * 9 + 1]), PRIM_INT__f_s_p_s[n * 30 + 1]);

                        PRIM_INT__f_s_p_s[n * 30 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_p_s[n * 18 + 2]);
                        PRIM_INT__f_s_p_s[n * 30 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 2], PRIM_INT__f_s_p_s[n * 30 + 2]);
                        PRIM_INT__f_s_p_s[n * 30 + 2] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__p_s_p_s[n * 9 + 2]), PRIM_INT__f_s_p_s[n * 30 + 2]);

                        PRIM_INT__f_s_p_s[n * 30 + 18] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_p_s[n * 18 + 9]);
                        PRIM_INT__f_s_p_s[n * 30 + 18] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 9], PRIM_INT__f_s_p_s[n * 30 + 18]);
                        PRIM_INT__f_s_p_s[n * 30 + 18] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__p_s_p_s[n * 9 + 3]), PRIM_INT__f_s_p_s[n * 30 + 18]);

                        PRIM_INT__f_s_p_s[n * 30 + 19] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_p_s[n * 18 + 10]);
                        PRIM_INT__f_s_p_s[n * 30 + 19] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 10], PRIM_INT__f_s_p_s[n * 30 + 19]);
                        PRIM_INT__f_s_p_s[n * 30 + 19] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__p_s_p_s[n * 9 + 4]), PRIM_INT__f_s_p_s[n * 30 + 19]);
                        PRIM_INT__f_s_p_s[n * 30 + 19] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_p_s[n * 30 + 19]);

                        PRIM_INT__f_s_p_s[n * 30 + 20] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_p_s[n * 18 + 11]);
                        PRIM_INT__f_s_p_s[n * 30 + 20] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 11], PRIM_INT__f_s_p_s[n * 30 + 20]);
                        PRIM_INT__f_s_p_s[n * 30 + 20] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__p_s_p_s[n * 9 + 5]), PRIM_INT__f_s_p_s[n * 30 + 20]);

                        PRIM_INT__f_s_p_s[n * 30 + 27] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_p_s[n * 18 + 15]);
                        PRIM_INT__f_s_p_s[n * 30 + 27] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_p_s[(n+1) * 18 + 15], PRIM_INT__f_s_p_s[n * 30 + 27]);
                        PRIM_INT__f_s_p_s[n * 30 + 27] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__p_s_p_s[n * 9 + 6]), PRIM_INT__f_s_p_s[n * 30 + 27]);

                        PRIM_INT__f_s_p_s[n * 30 + 28] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_p_s[n * 18 + 16]);
                        PRIM_INT__f_s_p_s[n * 30 + 28] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_p_s[(n+1) * 18 + 16], PRIM_INT__f_s_p_s[n * 30 + 28]);
                        PRIM_INT__f_s_p_s[n * 30 + 28] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__p_s_p_s[n * 9 + 7]), PRIM_INT__f_s_p_s[n * 30 + 28]);

                        PRIM_INT__f_s_p_s[n * 30 + 29] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_p_s[n * 18 + 17]);
                        PRIM_INT__f_s_p_s[n * 30 + 29] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_p_s[(n+1) * 18 + 17], PRIM_INT__f_s_p_s[n * 30 + 29]);
                        PRIM_INT__f_s_p_s[n * 30 + 29] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__p_s_p_s[n * 9 + 8]), PRIM_INT__f_s_p_s[n * 30 + 29]);
                        PRIM_INT__f_s_p_s[n * 30 + 29] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_p_s[n * 30 + 29]);

                    }


                    VRR_I_g_s_d_s(
                            PRIM_INT__g_s_d_s,
                            PRIM_INT__f_s_d_s,
                            PRIM_INT__d_s_d_s,
                            PRIM_INT__f_s_p_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            6);


                    ostei_general_vrr_I(5, 0, 3, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_f_s, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_d_s, NULL, PRIM_INT__h_s_f_s);


                    ostei_general_vrr_I(6, 0, 4, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_g_s, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_f_s, NULL, PRIM_INT__i_s_g_s);


                    ostei_general_vrr_I(7, 0, 5, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_h_s, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_g_s, NULL, PRIM_INT__k_s_h_s);


                    ostei_general_vrr_I(8, 0, 6, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_i_s, PRIM_INT__i_s_i_s, NULL, PRIM_INT__k_s_h_s, NULL, PRIM_INT__l_s_i_s);


                    ostei_general_vrr1_K(10, 12,
                            one_over_2q, a_over_q, aoq_PQ, Q_PA,
                            PRIM_INT__s_s_m_s, PRIM_INT__s_s_l_s, PRIM_INT__s_s_n_s);


                    ostei_general_vrr_I(1, 0, 10, 0, 9,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__s_s_n_s, NULL, NULL, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_n_s);


                    ostei_general_vrr_I(2, 0, 10, 0, 8,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__p_s_n_s, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_n_s);


                    ostei_general_vrr_I(3, 0, 10, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_n_s, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_n_s);


                    ostei_general_vrr_I(4, 0, 10, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_n_s, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_n_s);


                    ostei_general_vrr_I(5, 0, 10, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_n_s, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_n_s);


                    ostei_general_vrr_I(6, 0, 9, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_m_s, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_l_s, NULL, PRIM_INT__i_s_m_s);


                    ostei_general_vrr_I(7, 0, 8, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_l_s, PRIM_INT__h_s_l_s, NULL, PRIM_INT__i_s_k_s, NULL, PRIM_INT__k_s_l_s);


                    ostei_general_vrr_I(8, 0, 7, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_k_s, PRIM_INT__i_s_k_s, NULL, PRIM_INT__k_s_i_s, NULL, PRIM_INT__l_s_k_s);



                    // Forming PRIM_INT__f_s_s_s[7 * 10];
                    for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
                        PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 0]);
                        PRIM_INT__f_s_s_s[n * 10 + 0] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__f_s_s_s[n * 10 + 0]);

                        PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
                        PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 6]);
                        PRIM_INT__f_s_s_s[n * 10 + 6] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__f_s_s_s[n * 10 + 6]);

                        PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
                        PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 9]);
                        PRIM_INT__f_s_s_s[n * 10 + 9] = SIMINT_FMADD( vrr_const_2_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__f_s_s_s[n * 10 + 9]);

                    }


                    VRR_I_g_s_p_s(
                            PRIM_INT__g_s_p_s,
                            PRIM_INT__f_s_p_s,
                            PRIM_INT__d_s_p_s,
                            PRIM_INT__f_s_s_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            6);


                    VRR_I_h_s_d_s(
                            PRIM_INT__h_s_d_s,
                            PRIM_INT__g_s_d_s,
                            PRIM_INT__f_s_d_s,
                            PRIM_INT__g_s_p_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            one_over_2pq,
                            5);


                    ostei_general_vrr_I(6, 0, 3, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_f_s, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_d_s, NULL, PRIM_INT__i_s_f_s);


                    ostei_general_vrr_I(7, 0, 4, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_g_s, PRIM_INT__h_s_g_s, NULL, PRIM_INT__i_s_f_s, NULL, PRIM_INT__k_s_g_s);


                    ostei_general_vrr_I(8, 0, 5, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_h_s, PRIM_INT__i_s_h_s, NULL, PRIM_INT__k_s_g_s, NULL, PRIM_INT__l_s_h_s);


                    ostei_general_vrr_I(9, 0, 6, 0, 1,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__l_s_i_s, PRIM_INT__k_s_i_s, NULL, PRIM_INT__l_s_h_s, NULL, PRIM_INT__m_s_i_s);


                    ostei_general_vrr1_K(11, 11,
                            one_over_2q, a_over_q, aoq_PQ, Q_PA,
                            PRIM_INT__s_s_n_s, PRIM_INT__s_s_m_s, PRIM_INT__s_s_o_s);


                    ostei_general_vrr_I(1, 0, 11, 0, 9,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__s_s_o_s, NULL, NULL, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_o_s);


                    ostei_general_vrr_I(2, 0, 11, 0, 8,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__p_s_o_s, PRIM_INT__s_s_o_s, NULL, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_o_s);


                    ostei_general_vrr_I(3, 0, 11, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_o_s, PRIM_INT__p_s_o_s, NULL, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_o_s);


                    ostei_general_vrr_I(4, 0, 11, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_o_s, PRIM_INT__d_s_o_s, NULL, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_o_s);


                    ostei_general_vrr_I(5, 0, 11, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_o_s, PRIM_INT__f_s_o_s, NULL, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_o_s);


                    ostei_general_vrr_I(6, 0, 10, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_n_s, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_m_s, NULL, PRIM_INT__i_s_n_s);


                    ostei_general_vrr_I(7, 0, 9, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_m_s, PRIM_INT__h_s_m_s, NULL, PRIM_INT__i_s_l_s, NULL, PRIM_INT__k_s_m_s);


                    ostei_general_vrr_I(8, 0, 8, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_l_s, PRIM_INT__i_s_l_s, NULL, PRIM_INT__k_s_k_s, NULL, PRIM_INT__l_s_l_s);


                    ostei_general_vrr_I(9, 0, 7, 0, 1,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__l_s_k_s, PRIM_INT__k_s_k_s, NULL, PRIM_INT__l_s_i_s, NULL, PRIM_INT__m_s_k_s);


                    ostei_general_vrr1_K(12, 10,
                            one_over_2q, a_over_q, aoq_PQ, Q_PA,
                            PRIM_INT__s_s_o_s, PRIM_INT__s_s_n_s, PRIM_INT__s_s_q_s);


                    ostei_general_vrr_I(1, 0, 12, 0, 9,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__s_s_q_s, NULL, NULL, PRIM_INT__s_s_o_s, NULL, PRIM_INT__p_s_q_s);


                    ostei_general_vrr_I(2, 0, 12, 0, 8,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__p_s_q_s, PRIM_INT__s_s_q_s, NULL, PRIM_INT__p_s_o_s, NULL, PRIM_INT__d_s_q_s);


                    ostei_general_vrr_I(3, 0, 12, 0, 7,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__d_s_q_s, PRIM_INT__p_s_q_s, NULL, PRIM_INT__d_s_o_s, NULL, PRIM_INT__f_s_q_s);


                    ostei_general_vrr_I(4, 0, 12, 0, 6,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__f_s_q_s, PRIM_INT__d_s_q_s, NULL, PRIM_INT__f_s_o_s, NULL, PRIM_INT__g_s_q_s);


                    ostei_general_vrr_I(5, 0, 12, 0, 5,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__g_s_q_s, PRIM_INT__f_s_q_s, NULL, PRIM_INT__g_s_o_s, NULL, PRIM_INT__h_s_q_s);


                    ostei_general_vrr_I(6, 0, 11, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_o_s, PRIM_INT__g_s_o_s, NULL, PRIM_INT__h_s_n_s, NULL, PRIM_INT__i_s_o_s);


                    ostei_general_vrr_I(7, 0, 10, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_n_s, PRIM_INT__h_s_n_s, NULL, PRIM_INT__i_s_m_s, NULL, PRIM_INT__k_s_n_s);


                    ostei_general_vrr_I(8, 0, 9, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_m_s, PRIM_INT__i_s_m_s, NULL, PRIM_INT__k_s_l_s, NULL, PRIM_INT__l_s_m_s);


                    ostei_general_vrr_I(9, 0, 8, 0, 1,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__l_s_l_s, PRIM_INT__k_s_l_s, NULL, PRIM_INT__l_s_k_s, NULL, PRIM_INT__m_s_l_s);


                    ostei_general_vrr_I(6, 0, 12, 0, 4,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__h_s_q_s, PRIM_INT__g_s_q_s, NULL, PRIM_INT__h_s_o_s, NULL, PRIM_INT__i_s_q_s);


                    ostei_general_vrr_I(7, 0, 11, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_o_s, PRIM_INT__h_s_o_s, NULL, PRIM_INT__i_s_n_s, NULL, PRIM_INT__k_s_o_s);


                    ostei_general_vrr_I(8, 0, 10, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_n_s, PRIM_INT__i_s_n_s, NULL, PRIM_INT__k_s_m_s, NULL, PRIM_INT__l_s_n_s);


                    ostei_general_vrr_I(9, 0, 9, 0, 1,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__l_s_m_s, PRIM_INT__k_s_m_s, NULL, PRIM_INT__l_s_l_s, NULL, PRIM_INT__m_s_m_s);


                    ostei_general_vrr_I(7, 0, 12, 0, 3,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__i_s_q_s, PRIM_INT__h_s_q_s, NULL, PRIM_INT__i_s_o_s, NULL, PRIM_INT__k_s_q_s);


                    ostei_general_vrr_I(8, 0, 11, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_o_s, PRIM_INT__i_s_o_s, NULL, PRIM_INT__k_s_n_s, NULL, PRIM_INT__l_s_o_s);


                    ostei_general_vrr_I(9, 0, 10, 0, 1,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__l_s_n_s, PRIM_INT__k_s_n_s, NULL, PRIM_INT__l_s_m_s, NULL, PRIM_INT__m_s_n_s);


                    ostei_general_vrr_I(8, 0, 12, 0, 2,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__k_s_q_s, PRIM_INT__i_s_q_s, NULL, PRIM_INT__k_s_o_s, NULL, PRIM_INT__l_s_q_s);


                    ostei_general_vrr_I(9, 0, 11, 0, 1,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__l_s_o_s, PRIM_INT__k_s_o_s, NULL, PRIM_INT__l_s_n_s, NULL, PRIM_INT__m_s_o_s);


                    ostei_general_vrr_I(9, 0, 12, 0, 1,
                            one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
                            PRIM_INT__l_s_q_s, PRIM_INT__k_s_q_s, NULL, PRIM_INT__l_s_o_s, NULL, PRIM_INT__m_s_q_s);




                    ////////////////////////////////////
                    // Accumulate contracted integrals
                    ////////////////////////////////////
                    if(lastoffset == 0)
                    {
                        contract_all(588, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
                        contract_all(756, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
                        contract_all(945, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
                        contract_all(1155, PRIM_INT__h_s_m_s, PRIM_PTR_INT__h_s_m_s);
                        contract_all(1386, PRIM_INT__h_s_n_s, PRIM_PTR_INT__h_s_n_s);
                        contract_all(1638, PRIM_INT__h_s_o_s, PRIM_PTR_INT__h_s_o_s);
                        contract_all(1911, PRIM_INT__h_s_q_s, PRIM_PTR_INT__h_s_q_s);
                        contract_all(784, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
                        contract_all(1008, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
                        contract_all(1260, PRIM_INT__i_s_l_s, PRIM_PTR_INT__i_s_l_s);
                        contract_all(1540, PRIM_INT__i_s_m_s, PRIM_PTR_INT__i_s_m_s);
                        contract_all(1848, PRIM_INT__i_s_n_s, PRIM_PTR_INT__i_s_n_s);
                        contract_all(2184, PRIM_INT__i_s_o_s, PRIM_PTR_INT__i_s_o_s);
                        contract_all(2548, PRIM_INT__i_s_q_s, PRIM_PTR_INT__i_s_q_s);
                        contract_all(1008, PRIM_INT__k_s_i_s, PRIM_PTR_INT__k_s_i_s);
                        contract_all(1296, PRIM_INT__k_s_k_s, PRIM_PTR_INT__k_s_k_s);
                        contract_all(1620, PRIM_INT__k_s_l_s, PRIM_PTR_INT__k_s_l_s);
                        contract_all(1980, PRIM_INT__k_s_m_s, PRIM_PTR_INT__k_s_m_s);
                        contract_all(2376, PRIM_INT__k_s_n_s, PRIM_PTR_INT__k_s_n_s);
                        contract_all(2808, PRIM_INT__k_s_o_s, PRIM_PTR_INT__k_s_o_s);
                        contract_all(3276, PRIM_INT__k_s_q_s, PRIM_PTR_INT__k_s_q_s);
                        contract_all(1260, PRIM_INT__l_s_i_s, PRIM_PTR_INT__l_s_i_s);
                        contract_all(1620, PRIM_INT__l_s_k_s, PRIM_PTR_INT__l_s_k_s);
                        contract_all(2025, PRIM_INT__l_s_l_s, PRIM_PTR_INT__l_s_l_s);
                        contract_all(2475, PRIM_INT__l_s_m_s, PRIM_PTR_INT__l_s_m_s);
                        contract_all(2970, PRIM_INT__l_s_n_s, PRIM_PTR_INT__l_s_n_s);
                        contract_all(3510, PRIM_INT__l_s_o_s, PRIM_PTR_INT__l_s_o_s);
                        contract_all(4095, PRIM_INT__l_s_q_s, PRIM_PTR_INT__l_s_q_s);
                        contract_all(1540, PRIM_INT__m_s_i_s, PRIM_PTR_INT__m_s_i_s);
                        contract_all(1980, PRIM_INT__m_s_k_s, PRIM_PTR_INT__m_s_k_s);
                        contract_all(2475, PRIM_INT__m_s_l_s, PRIM_PTR_INT__m_s_l_s);
                        contract_all(3025, PRIM_INT__m_s_m_s, PRIM_PTR_INT__m_s_m_s);
                        contract_all(3630, PRIM_INT__m_s_n_s, PRIM_PTR_INT__m_s_n_s);
                        contract_all(4290, PRIM_INT__m_s_o_s, PRIM_PTR_INT__m_s_o_s);
                        contract_all(5005, PRIM_INT__m_s_q_s, PRIM_PTR_INT__m_s_q_s);
                    }
                    else
                    {
                        contract(588, shelloffsets, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
                        contract(756, shelloffsets, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
                        contract(945, shelloffsets, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
                        contract(1155, shelloffsets, PRIM_INT__h_s_m_s, PRIM_PTR_INT__h_s_m_s);
                        contract(1386, shelloffsets, PRIM_INT__h_s_n_s, PRIM_PTR_INT__h_s_n_s);
                        contract(1638, shelloffsets, PRIM_INT__h_s_o_s, PRIM_PTR_INT__h_s_o_s);
                        contract(1911, shelloffsets, PRIM_INT__h_s_q_s, PRIM_PTR_INT__h_s_q_s);
                        contract(784, shelloffsets, PRIM_INT__i_s_i_s, PRIM_PTR_INT__i_s_i_s);
                        contract(1008, shelloffsets, PRIM_INT__i_s_k_s, PRIM_PTR_INT__i_s_k_s);
                        contract(1260, shelloffsets, PRIM_INT__i_s_l_s, PRIM_PTR_INT__i_s_l_s);
                        contract(1540, shelloffsets, PRIM_INT__i_s_m_s, PRIM_PTR_INT__i_s_m_s);
                        contract(1848, shelloffsets, PRIM_INT__i_s_n_s, PRIM_PTR_INT__i_s_n_s);
                        contract(2184, shelloffsets, PRIM_INT__i_s_o_s, PRIM_PTR_INT__i_s_o_s);
                        contract(2548, shelloffsets, PRIM_INT__i_s_q_s, PRIM_PTR_INT__i_s_q_s);
                        contract(1008, shelloffsets, PRIM_INT__k_s_i_s, PRIM_PTR_INT__k_s_i_s);
                        contract(1296, shelloffsets, PRIM_INT__k_s_k_s, PRIM_PTR_INT__k_s_k_s);
                        contract(1620, shelloffsets, PRIM_INT__k_s_l_s, PRIM_PTR_INT__k_s_l_s);
                        contract(1980, shelloffsets, PRIM_INT__k_s_m_s, PRIM_PTR_INT__k_s_m_s);
                        contract(2376, shelloffsets, PRIM_INT__k_s_n_s, PRIM_PTR_INT__k_s_n_s);
                        contract(2808, shelloffsets, PRIM_INT__k_s_o_s, PRIM_PTR_INT__k_s_o_s);
                        contract(3276, shelloffsets, PRIM_INT__k_s_q_s, PRIM_PTR_INT__k_s_q_s);
                        contract(1260, shelloffsets, PRIM_INT__l_s_i_s, PRIM_PTR_INT__l_s_i_s);
                        contract(1620, shelloffsets, PRIM_INT__l_s_k_s, PRIM_PTR_INT__l_s_k_s);
                        contract(2025, shelloffsets, PRIM_INT__l_s_l_s, PRIM_PTR_INT__l_s_l_s);
                        contract(2475, shelloffsets, PRIM_INT__l_s_m_s, PRIM_PTR_INT__l_s_m_s);
                        contract(2970, shelloffsets, PRIM_INT__l_s_n_s, PRIM_PTR_INT__l_s_n_s);
                        contract(3510, shelloffsets, PRIM_INT__l_s_o_s, PRIM_PTR_INT__l_s_o_s);
                        contract(4095, shelloffsets, PRIM_INT__l_s_q_s, PRIM_PTR_INT__l_s_q_s);
                        contract(1540, shelloffsets, PRIM_INT__m_s_i_s, PRIM_PTR_INT__m_s_i_s);
                        contract(1980, shelloffsets, PRIM_INT__m_s_k_s, PRIM_PTR_INT__m_s_k_s);
                        contract(2475, shelloffsets, PRIM_INT__m_s_l_s, PRIM_PTR_INT__m_s_l_s);
                        contract(3025, shelloffsets, PRIM_INT__m_s_m_s, PRIM_PTR_INT__m_s_m_s);
                        contract(3630, shelloffsets, PRIM_INT__m_s_n_s, PRIM_PTR_INT__m_s_n_s);
                        contract(4290, shelloffsets, PRIM_INT__m_s_o_s, PRIM_PTR_INT__m_s_o_s);
                        contract(5005, shelloffsets, PRIM_INT__m_s_q_s, PRIM_PTR_INT__m_s_q_s);
                        PRIM_PTR_INT__h_s_i_s += lastoffset*588;
                        PRIM_PTR_INT__h_s_k_s += lastoffset*756;
                        PRIM_PTR_INT__h_s_l_s += lastoffset*945;
                        PRIM_PTR_INT__h_s_m_s += lastoffset*1155;
                        PRIM_PTR_INT__h_s_n_s += lastoffset*1386;
                        PRIM_PTR_INT__h_s_o_s += lastoffset*1638;
                        PRIM_PTR_INT__h_s_q_s += lastoffset*1911;
                        PRIM_PTR_INT__i_s_i_s += lastoffset*784;
                        PRIM_PTR_INT__i_s_k_s += lastoffset*1008;
                        PRIM_PTR_INT__i_s_l_s += lastoffset*1260;
                        PRIM_PTR_INT__i_s_m_s += lastoffset*1540;
                        PRIM_PTR_INT__i_s_n_s += lastoffset*1848;
                        PRIM_PTR_INT__i_s_o_s += lastoffset*2184;
                        PRIM_PTR_INT__i_s_q_s += lastoffset*2548;
                        PRIM_PTR_INT__k_s_i_s += lastoffset*1008;
                        PRIM_PTR_INT__k_s_k_s += lastoffset*1296;
                        PRIM_PTR_INT__k_s_l_s += lastoffset*1620;
                        PRIM_PTR_INT__k_s_m_s += lastoffset*1980;
                        PRIM_PTR_INT__k_s_n_s += lastoffset*2376;
                        PRIM_PTR_INT__k_s_o_s += lastoffset*2808;
                        PRIM_PTR_INT__k_s_q_s += lastoffset*3276;
                        PRIM_PTR_INT__l_s_i_s += lastoffset*1260;
                        PRIM_PTR_INT__l_s_k_s += lastoffset*1620;
                        PRIM_PTR_INT__l_s_l_s += lastoffset*2025;
                        PRIM_PTR_INT__l_s_m_s += lastoffset*2475;
                        PRIM_PTR_INT__l_s_n_s += lastoffset*2970;
                        PRIM_PTR_INT__l_s_o_s += lastoffset*3510;
                        PRIM_PTR_INT__l_s_q_s += lastoffset*4095;
                        PRIM_PTR_INT__m_s_i_s += lastoffset*1540;
                        PRIM_PTR_INT__m_s_k_s += lastoffset*1980;
                        PRIM_PTR_INT__m_s_l_s += lastoffset*2475;
                        PRIM_PTR_INT__m_s_m_s += lastoffset*3025;
                        PRIM_PTR_INT__m_s_n_s += lastoffset*3630;
                        PRIM_PTR_INT__m_s_o_s += lastoffset*4290;
                        PRIM_PTR_INT__m_s_q_s += lastoffset*5005;
                    }

                }  // close loop over j
            }  // close loop over i
            
            //Advance to the next batch
            jstart = SIMINT_SIMD_ROUND(jend);
            
            //////////////////////////////////////////////
            // Contracted integrals: Horizontal recurrance
            //////////////////////////////////////////////


            const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };


            for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
            {
                const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };

                // set up HRR pointers
                double const * restrict HRR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
                double const * restrict HRR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
                double const * restrict HRR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
                double const * restrict HRR_INT__h_s_m_s = INT__h_s_m_s + abcd * 1155;
                double const * restrict HRR_INT__h_s_n_s = INT__h_s_n_s + abcd * 1386;
                double const * restrict HRR_INT__h_s_o_s = INT__h_s_o_s + abcd * 1638;
                double const * restrict HRR_INT__h_s_q_s = INT__h_s_q_s + abcd * 1911;
                double const * restrict HRR_INT__i_s_i_s = INT__i_s_i_s + abcd * 784;
                double const * restrict HRR_INT__i_s_k_s = INT__i_s_k_s + abcd * 1008;
                double const * restrict HRR_INT__i_s_l_s = INT__i_s_l_s + abcd * 1260;
                double const * restrict HRR_INT__i_s_m_s = INT__i_s_m_s + abcd * 1540;
                double const * restrict HRR_INT__i_s_n_s = INT__i_s_n_s + abcd * 1848;
                double const * restrict HRR_INT__i_s_o_s = INT__i_s_o_s + abcd * 2184;
                double const * restrict HRR_INT__i_s_q_s = INT__i_s_q_s + abcd * 2548;
                double const * restrict HRR_INT__k_s_i_s = INT__k_s_i_s + abcd * 1008;
                double const * restrict HRR_INT__k_s_k_s = INT__k_s_k_s + abcd * 1296;
                double const * restrict HRR_INT__k_s_l_s = INT__k_s_l_s + abcd * 1620;
                double const * restrict HRR_INT__k_s_m_s = INT__k_s_m_s + abcd * 1980;
                double const * restrict HRR_INT__k_s_n_s = INT__k_s_n_s + abcd * 2376;
                double const * restrict HRR_INT__k_s_o_s = INT__k_s_o_s + abcd * 2808;
                double const * restrict HRR_INT__k_s_q_s = INT__k_s_q_s + abcd * 3276;
                double const * restrict HRR_INT__l_s_i_s = INT__l_s_i_s + abcd * 1260;
                double const * restrict HRR_INT__l_s_k_s = INT__l_s_k_s + abcd * 1620;
                double const * restrict HRR_INT__l_s_l_s = INT__l_s_l_s + abcd * 2025;
                double const * restrict HRR_INT__l_s_m_s = INT__l_s_m_s + abcd * 2475;
                double const * restrict HRR_INT__l_s_n_s = INT__l_s_n_s + abcd * 2970;
                double const * restrict HRR_INT__l_s_o_s = INT__l_s_o_s + abcd * 3510;
                double const * restrict HRR_INT__l_s_q_s = INT__l_s_q_s + abcd * 4095;
                double const * restrict HRR_INT__m_s_i_s = INT__m_s_i_s + abcd * 1540;
                double const * restrict HRR_INT__m_s_k_s = INT__m_s_k_s + abcd * 1980;
                double const * restrict HRR_INT__m_s_l_s = INT__m_s_l_s + abcd * 2475;
                double const * restrict HRR_INT__m_s_m_s = INT__m_s_m_s + abcd * 3025;
                double const * restrict HRR_INT__m_s_n_s = INT__m_s_n_s + abcd * 3630;
                double const * restrict HRR_INT__m_s_o_s = INT__m_s_o_s + abcd * 4290;
                double const * restrict HRR_INT__m_s_q_s = INT__m_s_q_s + abcd * 5005;
                double * restrict HRR_INT__h_g_i_i = INT__h_g_i_i + real_abcd * 246960;

                // form INT__h_p_i_s
                HRR_J_h_p(
                    HRR_INT__h_p_i_s,
                    HRR_INT__h_s_i_s,
                    HRR_INT__i_s_i_s,
                    hAB, 28);

                // form INT__h_p_k_s
                HRR_J_h_p(
                    HRR_INT__h_p_k_s,
                    HRR_INT__h_s_k_s,
                    HRR_INT__i_s_k_s,
                    hAB, 36);

                // form INT__h_p_l_s
                HRR_J_h_p(
                    HRR_INT__h_p_l_s,
                    HRR_INT__h_s_l_s,
                    HRR_INT__i_s_l_s,
                    hAB, 45);

                // form INT__h_p_m_s
                HRR_J_h_p(
                    HRR_INT__h_p_m_s,
                    HRR_INT__h_s_m_s,
                    HRR_INT__i_s_m_s,
                    hAB, 55);

                // form INT__h_p_n_s
                HRR_J_h_p(
                    HRR_INT__h_p_n_s,
                    HRR_INT__h_s_n_s,
                    HRR_INT__i_s_n_s,
                    hAB, 66);

                // form INT__h_p_o_s
                HRR_J_h_p(
                    HRR_INT__h_p_o_s,
                    HRR_INT__h_s_o_s,
                    HRR_INT__i_s_o_s,
                    hAB, 78);

                // form INT__h_p_q_s
                HRR_J_h_p(
                    HRR_INT__h_p_q_s,
                    HRR_INT__h_s_q_s,
                    HRR_INT__i_s_q_s,
                    hAB, 91);

                // form INT__i_p_i_s
                HRR_J_i_p(
                    HRR_INT__i_p_i_s,
                    HRR_INT__i_s_i_s,
                    HRR_INT__k_s_i_s,
                    hAB, 28);

                // form INT__i_p_k_s
                HRR_J_i_p(
                    HRR_INT__i_p_k_s,
                    HRR_INT__i_s_k_s,
                    HRR_INT__k_s_k_s,
                    hAB, 36);

                // form INT__i_p_l_s
                HRR_J_i_p(
                    HRR_INT__i_p_l_s,
                    HRR_INT__i_s_l_s,
                    HRR_INT__k_s_l_s,
                    hAB, 45);

                // form INT__i_p_m_s
                HRR_J_i_p(
                    HRR_INT__i_p_m_s,
                    HRR_INT__i_s_m_s,
                    HRR_INT__k_s_m_s,
                    hAB, 55);

                // form INT__i_p_n_s
                HRR_J_i_p(
                    HRR_INT__i_p_n_s,
                    HRR_INT__i_s_n_s,
                    HRR_INT__k_s_n_s,
                    hAB, 66);

                // form INT__i_p_o_s
                HRR_J_i_p(
                    HRR_INT__i_p_o_s,
                    HRR_INT__i_s_o_s,
                    HRR_INT__k_s_o_s,
                    hAB, 78);

                // form INT__i_p_q_s
                HRR_J_i_p(
                    HRR_INT__i_p_q_s,
                    HRR_INT__i_s_q_s,
                    HRR_INT__k_s_q_s,
                    hAB, 91);

                // form INT__k_p_i_s
                HRR_J_k_p(
                    HRR_INT__k_p_i_s,
                    HRR_INT__k_s_i_s,
                    HRR_INT__l_s_i_s,
                    hAB, 28);

                // form INT__k_p_k_s
                HRR_J_k_p(
                    HRR_INT__k_p_k_s,
                    HRR_INT__k_s_k_s,
                    HRR_INT__l_s_k_s,
                    hAB, 36);

                // form INT__k_p_l_s
                HRR_J_k_p(
                    HRR_INT__k_p_l_s,
                    HRR_INT__k_s_l_s,
                    HRR_INT__l_s_l_s,
                    hAB, 45);

                // form INT__k_p_m_s
                HRR_J_k_p(
                    HRR_INT__k_p_m_s,
                    HRR_INT__k_s_m_s,
                    HRR_INT__l_s_m_s,
                    hAB, 55);

                // form INT__k_p_n_s
                HRR_J_k_p(
                    HRR_INT__k_p_n_s,
                    HRR_INT__k_s_n_s,
                    HRR_INT__l_s_n_s,
                    hAB, 66);

                // form INT__k_p_o_s
                HRR_J_k_p(
                    HRR_INT__k_p_o_s,
                    HRR_INT__k_s_o_s,
                    HRR_INT__l_s_o_s,
                    hAB, 78);

                // form INT__k_p_q_s
                HRR_J_k_p(
                    HRR_INT__k_p_q_s,
                    HRR_INT__k_s_q_s,
                    HRR_INT__l_s_q_s,
                    hAB, 91);

                // form INT__l_p_i_s
                HRR_J_l_p(
                    HRR_INT__l_p_i_s,
                    HRR_INT__l_s_i_s,
                    HRR_INT__m_s_i_s,
                    hAB, 28);

                // form INT__l_p_k_s
                HRR_J_l_p(
                    HRR_INT__l_p_k_s,
                    HRR_INT__l_s_k_s,
                    HRR_INT__m_s_k_s,
                    hAB, 36);

                // form INT__l_p_l_s
                HRR_J_l_p(
                    HRR_INT__l_p_l_s,
                    HRR_INT__l_s_l_s,
                    HRR_INT__m_s_l_s,
                    hAB, 45);

                // form INT__l_p_m_s
                HRR_J_l_p(
                    HRR_INT__l_p_m_s,
                    HRR_INT__l_s_m_s,
                    HRR_INT__m_s_m_s,
                    hAB, 55);

                // form INT__l_p_n_s
                HRR_J_l_p(
                    HRR_INT__l_p_n_s,
                    HRR_INT__l_s_n_s,
                    HRR_INT__m_s_n_s,
                    hAB, 66);

                // form INT__l_p_o_s
                HRR_J_l_p(
                    HRR_INT__l_p_o_s,
                    HRR_INT__l_s_o_s,
                    HRR_INT__m_s_o_s,
                    hAB, 78);

                // form INT__l_p_q_s
                HRR_J_l_p(
                    HRR_INT__l_p_q_s,
                    HRR_INT__l_s_q_s,
                    HRR_INT__m_s_q_s,
                    hAB, 91);

                // form INT__h_d_i_s
                HRR_J_h_d(
                    HRR_INT__h_d_i_s,
                    HRR_INT__h_p_i_s,
                    HRR_INT__i_p_i_s,
                    hAB, 28);

                // form INT__h_d_k_s
                HRR_J_h_d(
                    HRR_INT__h_d_k_s,
                    HRR_INT__h_p_k_s,
                    HRR_INT__i_p_k_s,
                    hAB, 36);

                // form INT__h_d_l_s
                HRR_J_h_d(
                    HRR_INT__h_d_l_s,
                    HRR_INT__h_p_l_s,
                    HRR_INT__i_p_l_s,
                    hAB, 45);

                // form INT__h_d_m_s
                HRR_J_h_d(
                    HRR_INT__h_d_m_s,
                    HRR_INT__h_p_m_s,
                    HRR_INT__i_p_m_s,
                    hAB, 55);

                // form INT__h_d_n_s
                HRR_J_h_d(
                    HRR_INT__h_d_n_s,
                    HRR_INT__h_p_n_s,
                    HRR_INT__i_p_n_s,
                    hAB, 66);

                // form INT__h_d_o_s
                HRR_J_h_d(
                    HRR_INT__h_d_o_s,
                    HRR_INT__h_p_o_s,
                    HRR_INT__i_p_o_s,
                    hAB, 78);

                // form INT__h_d_q_s
                HRR_J_h_d(
                    HRR_INT__h_d_q_s,
                    HRR_INT__h_p_q_s,
                    HRR_INT__i_p_q_s,
                    hAB, 91);

                // form INT__i_d_i_s
                HRR_J_i_d(
                    HRR_INT__i_d_i_s,
                    HRR_INT__i_p_i_s,
                    HRR_INT__k_p_i_s,
                    hAB, 28);

                // form INT__i_d_k_s
                HRR_J_i_d(
                    HRR_INT__i_d_k_s,
                    HRR_INT__i_p_k_s,
                    HRR_INT__k_p_k_s,
                    hAB, 36);

                // form INT__i_d_l_s
                HRR_J_i_d(
                    HRR_INT__i_d_l_s,
                    HRR_INT__i_p_l_s,
                    HRR_INT__k_p_l_s,
                    hAB, 45);

                // form INT__i_d_m_s
                HRR_J_i_d(
                    HRR_INT__i_d_m_s,
                    HRR_INT__i_p_m_s,
                    HRR_INT__k_p_m_s,
                    hAB, 55);

                // form INT__i_d_n_s
                HRR_J_i_d(
                    HRR_INT__i_d_n_s,
                    HRR_INT__i_p_n_s,
                    HRR_INT__k_p_n_s,
                    hAB, 66);

                // form INT__i_d_o_s
                HRR_J_i_d(
                    HRR_INT__i_d_o_s,
                    HRR_INT__i_p_o_s,
                    HRR_INT__k_p_o_s,
                    hAB, 78);

                // form INT__i_d_q_s
                HRR_J_i_d(
                    HRR_INT__i_d_q_s,
                    HRR_INT__i_p_q_s,
                    HRR_INT__k_p_q_s,
                    hAB, 91);

                // form INT__k_d_i_s
                HRR_J_k_d(
                    HRR_INT__k_d_i_s,
                    HRR_INT__k_p_i_s,
                    HRR_INT__l_p_i_s,
                    hAB, 28);

                // form INT__k_d_k_s
                HRR_J_k_d(
                    HRR_INT__k_d_k_s,
                    HRR_INT__k_p_k_s,
                    HRR_INT__l_p_k_s,
                    hAB, 36);

                // form INT__k_d_l_s
                HRR_J_k_d(
                    HRR_INT__k_d_l_s,
                    HRR_INT__k_p_l_s,
                    HRR_INT__l_p_l_s,
                    hAB, 45);

                // form INT__k_d_m_s
                HRR_J_k_d(
                    HRR_INT__k_d_m_s,
                    HRR_INT__k_p_m_s,
                    HRR_INT__l_p_m_s,
                    hAB, 55);

                // form INT__k_d_n_s
                HRR_J_k_d(
                    HRR_INT__k_d_n_s,
                    HRR_INT__k_p_n_s,
                    HRR_INT__l_p_n_s,
                    hAB, 66);

                // form INT__k_d_o_s
                HRR_J_k_d(
                    HRR_INT__k_d_o_s,
                    HRR_INT__k_p_o_s,
                    HRR_INT__l_p_o_s,
                    hAB, 78);

                // form INT__k_d_q_s
                HRR_J_k_d(
                    HRR_INT__k_d_q_s,
                    HRR_INT__k_p_q_s,
                    HRR_INT__l_p_q_s,
                    hAB, 91);

                // form INT__h_f_i_s
                HRR_J_h_f(
                    HRR_INT__h_f_i_s,
                    HRR_INT__h_d_i_s,
                    HRR_INT__i_d_i_s,
                    hAB, 28);

                // form INT__h_f_k_s
                HRR_J_h_f(
                    HRR_INT__h_f_k_s,
                    HRR_INT__h_d_k_s,
                    HRR_INT__i_d_k_s,
                    hAB, 36);

                // form INT__h_f_l_s
                HRR_J_h_f(
                    HRR_INT__h_f_l_s,
                    HRR_INT__h_d_l_s,
                    HRR_INT__i_d_l_s,
                    hAB, 45);

                // form INT__h_f_m_s
                HRR_J_h_f(
                    HRR_INT__h_f_m_s,
                    HRR_INT__h_d_m_s,
                    HRR_INT__i_d_m_s,
                    hAB, 55);

                // form INT__h_f_n_s
                HRR_J_h_f(
                    HRR_INT__h_f_n_s,
                    HRR_INT__h_d_n_s,
                    HRR_INT__i_d_n_s,
                    hAB, 66);

                // form INT__h_f_o_s
                HRR_J_h_f(
                    HRR_INT__h_f_o_s,
                    HRR_INT__h_d_o_s,
                    HRR_INT__i_d_o_s,
                    hAB, 78);

                // form INT__h_f_q_s
                HRR_J_h_f(
                    HRR_INT__h_f_q_s,
                    HRR_INT__h_d_q_s,
                    HRR_INT__i_d_q_s,
                    hAB, 91);

                // form INT__i_f_i_s
                HRR_J_i_f(
                    HRR_INT__i_f_i_s,
                    HRR_INT__i_d_i_s,
                    HRR_INT__k_d_i_s,
                    hAB, 28);

                // form INT__i_f_k_s
                HRR_J_i_f(
                    HRR_INT__i_f_k_s,
                    HRR_INT__i_d_k_s,
                    HRR_INT__k_d_k_s,
                    hAB, 36);

                // form INT__i_f_l_s
                HRR_J_i_f(
                    HRR_INT__i_f_l_s,
                    HRR_INT__i_d_l_s,
                    HRR_INT__k_d_l_s,
                    hAB, 45);

                // form INT__i_f_m_s
                HRR_J_i_f(
                    HRR_INT__i_f_m_s,
                    HRR_INT__i_d_m_s,
                    HRR_INT__k_d_m_s,
                    hAB, 55);

                // form INT__i_f_n_s
                HRR_J_i_f(
                    HRR_INT__i_f_n_s,
                    HRR_INT__i_d_n_s,
                    HRR_INT__k_d_n_s,
                    hAB, 66);

                // form INT__i_f_o_s
                HRR_J_i_f(
                    HRR_INT__i_f_o_s,
                    HRR_INT__i_d_o_s,
                    HRR_INT__k_d_o_s,
                    hAB, 78);

                // form INT__i_f_q_s
                HRR_J_i_f(
                    HRR_INT__i_f_q_s,
                    HRR_INT__i_d_q_s,
                    HRR_INT__k_d_q_s,
                    hAB, 91);

                // form INT__h_g_i_s
                HRR_J_h_g(
                    HRR_INT__h_g_i_s,
                    HRR_INT__h_f_i_s,
                    HRR_INT__i_f_i_s,
                    hAB, 28);

                // form INT__h_g_k_s
                HRR_J_h_g(
                    HRR_INT__h_g_k_s,
                    HRR_INT__h_f_k_s,
                    HRR_INT__i_f_k_s,
                    hAB, 36);

                // form INT__h_g_l_s
                HRR_J_h_g(
                    HRR_INT__h_g_l_s,
                    HRR_INT__h_f_l_s,
                    HRR_INT__i_f_l_s,
                    hAB, 45);

                // form INT__h_g_m_s
                HRR_J_h_g(
                    HRR_INT__h_g_m_s,
                    HRR_INT__h_f_m_s,
                    HRR_INT__i_f_m_s,
                    hAB, 55);

                // form INT__h_g_n_s
                HRR_J_h_g(
                    HRR_INT__h_g_n_s,
                    HRR_INT__h_f_n_s,
                    HRR_INT__i_f_n_s,
                    hAB, 66);

                // form INT__h_g_o_s
                HRR_J_h_g(
                    HRR_INT__h_g_o_s,
                    HRR_INT__h_f_o_s,
                    HRR_INT__i_f_o_s,
                    hAB, 78);

                // form INT__h_g_q_s
                HRR_J_h_g(
                    HRR_INT__h_g_q_s,
                    HRR_INT__h_f_q_s,
                    HRR_INT__i_f_q_s,
                    hAB, 91);

                // form INT__h_g_i_p
                HRR_L_i_p(
                    HRR_INT__h_g_i_p,
                    HRR_INT__h_g_i_s,
                    HRR_INT__h_g_k_s,
                    hCD, 315);

                // form INT__h_g_k_p
                HRR_L_k_p(
                    HRR_INT__h_g_k_p,
                    HRR_INT__h_g_k_s,
                    HRR_INT__h_g_l_s,
                    hCD, 315);

                // form INT__h_g_l_p
                HRR_L_l_p(
                    HRR_INT__h_g_l_p,
                    HRR_INT__h_g_l_s,
                    HRR_INT__h_g_m_s,
                    hCD, 315);

                // form INT__h_g_m_p
                ostei_general_hrr_L(5, 4, 9, 1, hCD, HRR_INT__h_g_n_s, HRR_INT__h_g_m_s, HRR_INT__h_g_m_p);

                // form INT__h_g_n_p
                ostei_general_hrr_L(5, 4, 10, 1, hCD, HRR_INT__h_g_o_s, HRR_INT__h_g_n_s, HRR_INT__h_g_n_p);

                // form INT__h_g_o_p
                ostei_general_hrr_L(5, 4, 11, 1, hCD, HRR_INT__h_g_q_s, HRR_INT__h_g_o_s, HRR_INT__h_g_o_p);

                // form INT__h_g_i_d
                HRR_L_i_d(
                    HRR_INT__h_g_i_d,
                    HRR_INT__h_g_i_p,
                    HRR_INT__h_g_k_p,
                    hCD, 315);

                // form INT__h_g_k_d
                HRR_L_k_d(
                    HRR_INT__h_g_k_d,
                    HRR_INT__h_g_k_p,
                    HRR_INT__h_g_l_p,
                    hCD, 315);

                // form INT__h_g_l_d
                ostei_general_hrr_L(5, 4, 8, 2, hCD, HRR_INT__h_g_m_p, HRR_INT__h_g_l_p, HRR_INT__h_g_l_d);

                // form INT__h_g_m_d
                ostei_general_hrr_L(5, 4, 9, 2, hCD, HRR_INT__h_g_n_p, HRR_INT__h_g_m_p, HRR_INT__h_g_m_d);

                // form INT__h_g_n_d
                ostei_general_hrr_L(5, 4, 10, 2, hCD, HRR_INT__h_g_o_p, HRR_INT__h_g_n_p, HRR_INT__h_g_n_d);

                // form INT__h_g_i_f
                HRR_L_i_f(
                    HRR_INT__h_g_i_f,
                    HRR_INT__h_g_i_d,
                    HRR_INT__h_g_k_d,
                    hCD, 315);

                // form INT__h_g_k_f
                ostei_general_hrr_L(5, 4, 7, 3, hCD, HRR_INT__h_g_l_d, HRR_INT__h_g_k_d, HRR_INT__h_g_k_f);

                // form INT__h_g_l_f
                ostei_general_hrr_L(5, 4, 8, 3, hCD, HRR_INT__h_g_m_d, HRR_INT__h_g_l_d, HRR_INT__h_g_l_f);

                // form INT__h_g_m_f
                ostei_general_hrr_L(5, 4, 9, 3, hCD, HRR_INT__h_g_n_d, HRR_INT__h_g_m_d, HRR_INT__h_g_m_f);

                // form INT__h_g_i_g
                ostei_general_hrr_L(5, 4, 6, 4, hCD, HRR_INT__h_g_k_f, HRR_INT__h_g_i_f, HRR_INT__h_g_i_g);

                // form INT__h_g_k_g
                ostei_general_hrr_L(5, 4, 7, 4, hCD, HRR_INT__h_g_l_f, HRR_INT__h_g_k_f, HRR_INT__h_g_k_g);

                // form INT__h_g_l_g
                ostei_general_hrr_L(5, 4, 8, 4, hCD, HRR_INT__h_g_m_f, HRR_INT__h_g_l_f, HRR_INT__h_g_l_g);

                // form INT__h_g_i_h
                ostei_general_hrr_L(5, 4, 6, 5, hCD, HRR_INT__h_g_k_g, HRR_INT__h_g_i_g, HRR_INT__h_g_i_h);

                // form INT__h_g_k_h
                ostei_general_hrr_L(5, 4, 7, 5, hCD, HRR_INT__h_g_l_g, HRR_INT__h_g_k_g, HRR_INT__h_g_k_h);

                // form INT__h_g_i_i
                ostei_general_hrr_L(5, 4, 6, 6, hCD, HRR_INT__h_g_k_h, HRR_INT__h_g_i_h, HRR_INT__h_g_i_i);


            }  // close HRR loop


        }   // close loop cdbatch

        istart = iend;
    }  // close loop over ab

    return P.nshell12_clip * Q.nshell12_clip;
}

int ostei_g_h_i_i(struct simint_multi_shellpair const P,
                  struct simint_multi_shellpair const Q,
                  double screen_tol,
                  double * const restrict work,
                  double * const restrict INT__g_h_i_i)
{
    double P_AB[3*P.nshell12];
    struct simint_multi_shellpair P_tmp = P;
    P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
    P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
    P_tmp.AB_x = P_AB;
    P_tmp.AB_y = P_AB + P.nshell12;
    P_tmp.AB_z = P_AB + 2*P.nshell12;

    for(int i = 0; i < P.nshell12; i++)
    {
        P_tmp.AB_x[i] = -P.AB_x[i];
        P_tmp.AB_y[i] = -P.AB_y[i];
        P_tmp.AB_z[i] = -P.AB_z[i];
    }

    int ret = ostei_h_g_i_i(P_tmp, Q, screen_tol, work, INT__g_h_i_i);
    double buffer[246960] SIMINT_ALIGN_ARRAY_DBL;

    for(int q = 0; q < ret; q++)
    {
        int idx = 0;
        for(int a = 0; a < 15; ++a)
        for(int b = 0; b < 21; ++b)
        for(int c = 0; c < 28; ++c)
        for(int d = 0; d < 28; ++d)
            buffer[idx++] = INT__g_h_i_i[q*246960+b*11760+a*784+c*28+d];

        memcpy(INT__g_h_i_i+q*246960, buffer, 246960*sizeof(double));
    }

    return ret;
}

