#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_k_i_k_i(struct simint_multi_shellpair const P,
                  struct simint_multi_shellpair const Q,
                  double screen_tol,
                  double * const restrict work,
                  double * const restrict INT__k_i_k_i)
{

    SIMINT_ASSUME_ALIGN_DBL(work);
    SIMINT_ASSUME_ALIGN_DBL(INT__k_i_k_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__k_s_k_s = work + (SIMINT_NSHELL_SIMD * 0);
    double * const INT__k_s_l_s = work + (SIMINT_NSHELL_SIMD * 1296);
    double * const INT__k_s_m_s = work + (SIMINT_NSHELL_SIMD * 2916);
    double * const INT__k_s_n_s = work + (SIMINT_NSHELL_SIMD * 4896);
    double * const INT__k_s_o_s = work + (SIMINT_NSHELL_SIMD * 7272);
    double * const INT__k_s_q_s = work + (SIMINT_NSHELL_SIMD * 10080);
    double * const INT__k_s_r_s = work + (SIMINT_NSHELL_SIMD * 13356);
    double * const INT__l_s_k_s = work + (SIMINT_NSHELL_SIMD * 17136);
    double * const INT__l_s_l_s = work + (SIMINT_NSHELL_SIMD * 18756);
    double * const INT__l_s_m_s = work + (SIMINT_NSHELL_SIMD * 20781);
    double * const INT__l_s_n_s = work + (SIMINT_NSHELL_SIMD * 23256);
    double * const INT__l_s_o_s = work + (SIMINT_NSHELL_SIMD * 26226);
    double * const INT__l_s_q_s = work + (SIMINT_NSHELL_SIMD * 29736);
    double * const INT__l_s_r_s = work + (SIMINT_NSHELL_SIMD * 33831);
    double * const INT__m_s_k_s = work + (SIMINT_NSHELL_SIMD * 38556);
    double * const INT__m_s_l_s = work + (SIMINT_NSHELL_SIMD * 40536);
    double * const INT__m_s_m_s = work + (SIMINT_NSHELL_SIMD * 43011);
    double * const INT__m_s_n_s = work + (SIMINT_NSHELL_SIMD * 46036);
    double * const INT__m_s_o_s = work + (SIMINT_NSHELL_SIMD * 49666);
    double * const INT__m_s_q_s = work + (SIMINT_NSHELL_SIMD * 53956);
    double * const INT__m_s_r_s = work + (SIMINT_NSHELL_SIMD * 58961);
    double * const INT__n_s_k_s = work + (SIMINT_NSHELL_SIMD * 64736);
    double * const INT__n_s_l_s = work + (SIMINT_NSHELL_SIMD * 67112);
    double * const INT__n_s_m_s = work + (SIMINT_NSHELL_SIMD * 70082);
    double * const INT__n_s_n_s = work + (SIMINT_NSHELL_SIMD * 73712);
    double * const INT__n_s_o_s = work + (SIMINT_NSHELL_SIMD * 78068);
    double * const INT__n_s_q_s = work + (SIMINT_NSHELL_SIMD * 83216);
    double * const INT__n_s_r_s = work + (SIMINT_NSHELL_SIMD * 89222);
    double * const INT__o_s_k_s = work + (SIMINT_NSHELL_SIMD * 96152);
    double * const INT__o_s_l_s = work + (SIMINT_NSHELL_SIMD * 98960);
    double * const INT__o_s_m_s = work + (SIMINT_NSHELL_SIMD * 102470);
    double * const INT__o_s_n_s = work + (SIMINT_NSHELL_SIMD * 106760);
    double * const INT__o_s_o_s = work + (SIMINT_NSHELL_SIMD * 111908);
    double * const INT__o_s_q_s = work + (SIMINT_NSHELL_SIMD * 117992);
    double * const INT__o_s_r_s = work + (SIMINT_NSHELL_SIMD * 125090);
    double * const INT__q_s_k_s = work + (SIMINT_NSHELL_SIMD * 133280);
    double * const INT__q_s_l_s = work + (SIMINT_NSHELL_SIMD * 136556);
    double * const INT__q_s_m_s = work + (SIMINT_NSHELL_SIMD * 140651);
    double * const INT__q_s_n_s = work + (SIMINT_NSHELL_SIMD * 145656);
    double * const INT__q_s_o_s = work + (SIMINT_NSHELL_SIMD * 151662);
    double * const INT__q_s_q_s = work + (SIMINT_NSHELL_SIMD * 158760);
    double * const INT__q_s_r_s = work + (SIMINT_NSHELL_SIMD * 167041);
    double * const INT__r_s_k_s = work + (SIMINT_NSHELL_SIMD * 176596);
    double * const INT__r_s_l_s = work + (SIMINT_NSHELL_SIMD * 180376);
    double * const INT__r_s_m_s = work + (SIMINT_NSHELL_SIMD * 185101);
    double * const INT__r_s_n_s = work + (SIMINT_NSHELL_SIMD * 190876);
    double * const INT__r_s_o_s = work + (SIMINT_NSHELL_SIMD * 197806);
    double * const INT__r_s_q_s = work + (SIMINT_NSHELL_SIMD * 205996);
    double * const INT__r_s_r_s = work + (SIMINT_NSHELL_SIMD * 215551);
    SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*226576);
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 27;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 66;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 138;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 248;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 398;
    SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 587;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 811;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 889;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 1006;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 1222;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1552;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 2002;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 2569;
    SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 3241;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 3997;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 4147;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 4381;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 4813;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 5473;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 6373;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 7507;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 8851;
    SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 10363;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_s_s = primwork + 11983;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 12223;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 12613;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 13333;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 14433;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 15933;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 17823;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 20063;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 22583;
    SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 25283;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_s_s = primwork + 28033;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_p_s = primwork + 28378;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 28963;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 30043;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 31693;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 33943;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 36778;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 40138;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 43918;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_m_s = primwork + 47968;
    SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_n_s = primwork + 52093;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_s_s = primwork + 56053;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_p_s = primwork + 56515;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_d_s = primwork + 57334;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 58846;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 61156;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 64306;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 68275;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 72979;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_l_s = primwork + 78271;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_m_s = primwork + 83941;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_n_s = primwork + 89716;
    SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_o_s = primwork + 95260;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_s_s = primwork + 100174;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_p_s = primwork + 100762;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_d_s = primwork + 101854;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_f_s = primwork + 103870;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_g_s = primwork + 106950;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_h_s = primwork + 111150;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_i_s = primwork + 116442;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_k_s = primwork + 122714;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_l_s = primwork + 129770;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_m_s = primwork + 137330;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_n_s = primwork + 145030;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_o_s = primwork + 152422;
    SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_q_s = primwork + 158974;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_s_s = primwork + 164070;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_p_s = primwork + 164790;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_d_s = primwork + 166194;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_f_s = primwork + 168786;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_g_s = primwork + 172746;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_h_s = primwork + 178146;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_i_s = primwork + 184950;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_k_s = primwork + 193014;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_l_s = primwork + 202086;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_m_s = primwork + 211806;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_n_s = primwork + 221706;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_o_s = primwork + 231210;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_q_s = primwork + 239634;
    SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_r_s = primwork + 246186;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_s_s = primwork + 249966;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_p_s = primwork + 250821;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_d_s = primwork + 252576;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_f_s = primwork + 255816;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_g_s = primwork + 260766;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_h_s = primwork + 267516;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_i_s = primwork + 276021;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_k_s = primwork + 286101;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_l_s = primwork + 297441;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_m_s = primwork + 309591;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_n_s = primwork + 321966;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_o_s = primwork + 333846;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_q_s = primwork + 344376;
    SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_r_s = primwork + 352566;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_s_s = primwork + 357291;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_p_s = primwork + 358281;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_d_s = primwork + 360426;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_f_s = primwork + 364386;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_g_s = primwork + 370436;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_h_s = primwork + 378686;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_i_s = primwork + 389081;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_k_s = primwork + 401401;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_l_s = primwork + 415261;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_m_s = primwork + 430111;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_n_s = primwork + 445236;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_o_s = primwork + 459756;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_q_s = primwork + 472626;
    SIMINT_DBLTYPE * const restrict PRIM_INT__m_s_r_s = primwork + 482636;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_s_s = primwork + 488411;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_p_s = primwork + 489533;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_d_s = primwork + 492107;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_f_s = primwork + 496859;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_g_s = primwork + 504119;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_h_s = primwork + 514019;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_i_s = primwork + 526493;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_k_s = primwork + 541277;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_l_s = primwork + 557909;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_m_s = primwork + 575729;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_n_s = primwork + 593879;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_o_s = primwork + 611303;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_q_s = primwork + 626747;
    SIMINT_DBLTYPE * const restrict PRIM_INT__n_s_r_s = primwork + 638759;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_s_s = primwork + 645689;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_p_s = primwork + 646937;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_d_s = primwork + 649979;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_f_s = primwork + 655595;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_g_s = primwork + 664175;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_h_s = primwork + 675875;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_i_s = primwork + 690617;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_k_s = primwork + 708089;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_l_s = primwork + 727745;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_m_s = primwork + 748805;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_n_s = primwork + 770255;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_o_s = primwork + 790847;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_q_s = primwork + 809099;
    SIMINT_DBLTYPE * const restrict PRIM_INT__o_s_r_s = primwork + 823295;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_s_s = primwork + 831485;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_p_s = primwork + 832850;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_d_s = primwork + 836399;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_f_s = primwork + 842951;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_g_s = primwork + 852961;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_h_s = primwork + 866611;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_i_s = primwork + 883810;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_k_s = primwork + 904194;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_l_s = primwork + 927126;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_m_s = primwork + 951696;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_n_s = primwork + 976721;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_o_s = primwork + 1000745;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_q_s = primwork + 1022039;
    SIMINT_DBLTYPE * const restrict PRIM_INT__q_s_r_s = primwork + 1038601;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_s_s = primwork + 1048156;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_p_s = primwork + 1049626;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_d_s = primwork + 1053721;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_f_s = primwork + 1061281;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_g_s = primwork + 1072831;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_h_s = primwork + 1088581;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_i_s = primwork + 1108426;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_k_s = primwork + 1131946;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_l_s = primwork + 1158406;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_m_s = primwork + 1186756;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_n_s = primwork + 1215631;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_o_s = primwork + 1243351;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_q_s = primwork + 1267921;
    SIMINT_DBLTYPE * const restrict PRIM_INT__r_s_r_s = primwork + 1287031;
    double * const hrrwork = (double *)(primwork + 1298056);
    double * const HRR_INT__k_p_k_s = hrrwork + 0;
    double * const HRR_INT__k_p_l_s = hrrwork + 3888;
    double * const HRR_INT__k_p_m_s = hrrwork + 8748;
    double * const HRR_INT__k_p_n_s = hrrwork + 14688;
    double * const HRR_INT__k_p_o_s = hrrwork + 21816;
    double * const HRR_INT__k_p_q_s = hrrwork + 30240;
    double * const HRR_INT__k_p_r_s = hrrwork + 40068;
    double * const HRR_INT__k_d_k_s = hrrwork + 51408;
    double * const HRR_INT__k_d_l_s = hrrwork + 59184;
    double * const HRR_INT__k_d_m_s = hrrwork + 68904;
    double * const HRR_INT__k_d_n_s = hrrwork + 80784;
    double * const HRR_INT__k_d_o_s = hrrwork + 95040;
    double * const HRR_INT__k_d_q_s = hrrwork + 111888;
    double * const HRR_INT__k_d_r_s = hrrwork + 131544;
    double * const HRR_INT__k_f_k_s = hrrwork + 154224;
    double * const HRR_INT__k_f_l_s = hrrwork + 167184;
    double * const HRR_INT__k_f_m_s = hrrwork + 183384;
    double * const HRR_INT__k_f_n_s = hrrwork + 203184;
    double * const HRR_INT__k_f_o_s = hrrwork + 226944;
    double * const HRR_INT__k_f_q_s = hrrwork + 255024;
    double * const HRR_INT__k_f_r_s = hrrwork + 287784;
    double * const HRR_INT__k_g_k_s = hrrwork + 325584;
    double * const HRR_INT__k_g_l_s = hrrwork + 345024;
    double * const HRR_INT__k_g_m_s = hrrwork + 369324;
    double * const HRR_INT__k_g_n_s = hrrwork + 399024;
    double * const HRR_INT__k_g_o_s = hrrwork + 434664;
    double * const HRR_INT__k_g_q_s = hrrwork + 476784;
    double * const HRR_INT__k_g_r_s = hrrwork + 525924;
    double * const HRR_INT__k_h_k_s = hrrwork + 582624;
    double * const HRR_INT__k_h_l_s = hrrwork + 609840;
    double * const HRR_INT__k_h_m_s = hrrwork + 643860;
    double * const HRR_INT__k_h_n_s = hrrwork + 685440;
    double * const HRR_INT__k_h_o_s = hrrwork + 735336;
    double * const HRR_INT__k_h_q_s = hrrwork + 794304;
    double * const HRR_INT__k_h_r_s = hrrwork + 863100;
    double * const HRR_INT__k_i_k_s = hrrwork + 942480;
    double * const HRR_INT__k_i_k_p = hrrwork + 978768;
    double * const HRR_INT__k_i_k_d = hrrwork + 1087632;
    double * const HRR_INT__k_i_k_f = hrrwork + 1305360;
    double * const HRR_INT__k_i_k_g = hrrwork + 1668240;
    double * const HRR_INT__k_i_k_h = hrrwork + 2212560;
    double * const HRR_INT__k_i_l_s = hrrwork + 2974608;
    double * const HRR_INT__k_i_l_p = hrrwork + 3019968;
    double * const HRR_INT__k_i_l_d = hrrwork + 3156048;
    double * const HRR_INT__k_i_l_f = hrrwork + 3428208;
    double * const HRR_INT__k_i_l_g = hrrwork + 3881808;
    double * const HRR_INT__k_i_l_h = hrrwork + 4562208;
    double * const HRR_INT__k_i_m_s = hrrwork + 5514768;
    double * const HRR_INT__k_i_m_p = hrrwork + 5570208;
    double * const HRR_INT__k_i_m_d = hrrwork + 5736528;
    double * const HRR_INT__k_i_m_f = hrrwork + 6069168;
    double * const HRR_INT__k_i_m_g = hrrwork + 6623568;
    double * const HRR_INT__k_i_n_s = hrrwork + 7455168;
    double * const HRR_INT__k_i_n_p = hrrwork + 7521696;
    double * const HRR_INT__k_i_n_d = hrrwork + 7721280;
    double * const HRR_INT__k_i_n_f = hrrwork + 8120448;
    double * const HRR_INT__k_i_o_s = hrrwork + 8785728;
    double * const HRR_INT__k_i_o_p = hrrwork + 8864352;
    double * const HRR_INT__k_i_o_d = hrrwork + 9100224;
    double * const HRR_INT__k_i_q_s = hrrwork + 9571968;
    double * const HRR_INT__k_i_q_p = hrrwork + 9663696;
    double * const HRR_INT__k_i_r_s = hrrwork + 9938880;
    double * const HRR_INT__l_p_k_s = hrrwork + 10044720;
    double * const HRR_INT__l_p_l_s = hrrwork + 10049580;
    double * const HRR_INT__l_p_m_s = hrrwork + 10055655;
    double * const HRR_INT__l_p_n_s = hrrwork + 10063080;
    double * const HRR_INT__l_p_o_s = hrrwork + 10071990;
    double * const HRR_INT__l_p_q_s = hrrwork + 10082520;
    double * const HRR_INT__l_p_r_s = hrrwork + 10094805;
    double * const HRR_INT__l_d_k_s = hrrwork + 10108980;
    double * const HRR_INT__l_d_l_s = hrrwork + 10118700;
    double * const HRR_INT__l_d_m_s = hrrwork + 10130850;
    double * const HRR_INT__l_d_n_s = hrrwork + 10145700;
    double * const HRR_INT__l_d_o_s = hrrwork + 10163520;
    double * const HRR_INT__l_d_q_s = hrrwork + 10184580;
    double * const HRR_INT__l_d_r_s = hrrwork + 10209150;
    double * const HRR_INT__l_f_k_s = hrrwork + 10237500;
    double * const HRR_INT__l_f_l_s = hrrwork + 10253700;
    double * const HRR_INT__l_f_m_s = hrrwork + 10273950;
    double * const HRR_INT__l_f_n_s = hrrwork + 10298700;
    double * const HRR_INT__l_f_o_s = hrrwork + 10328400;
    double * const HRR_INT__l_f_q_s = hrrwork + 10363500;
    double * const HRR_INT__l_f_r_s = hrrwork + 10404450;
    double * const HRR_INT__l_g_k_s = hrrwork + 10451700;
    double * const HRR_INT__l_g_l_s = hrrwork + 10476000;
    double * const HRR_INT__l_g_m_s = hrrwork + 10506375;
    double * const HRR_INT__l_g_n_s = hrrwork + 10543500;
    double * const HRR_INT__l_g_o_s = hrrwork + 10588050;
    double * const HRR_INT__l_g_q_s = hrrwork + 10640700;
    double * const HRR_INT__l_g_r_s = hrrwork + 10702125;
    double * const HRR_INT__l_h_k_s = hrrwork + 10773000;
    double * const HRR_INT__l_h_l_s = hrrwork + 10807020;
    double * const HRR_INT__l_h_m_s = hrrwork + 10849545;
    double * const HRR_INT__l_h_n_s = hrrwork + 10901520;
    double * const HRR_INT__l_h_o_s = hrrwork + 10963890;
    double * const HRR_INT__l_h_q_s = hrrwork + 11037600;
    double * const HRR_INT__l_h_r_s = hrrwork + 11123595;
    double * const HRR_INT__m_p_k_s = hrrwork + 11222820;
    double * const HRR_INT__m_p_l_s = hrrwork + 11228760;
    double * const HRR_INT__m_p_m_s = hrrwork + 11236185;
    double * const HRR_INT__m_p_n_s = hrrwork + 11245260;
    double * const HRR_INT__m_p_o_s = hrrwork + 11256150;
    double * const HRR_INT__m_p_q_s = hrrwork + 11269020;
    double * const HRR_INT__m_p_r_s = hrrwork + 11284035;
    double * const HRR_INT__m_d_k_s = hrrwork + 11301360;
    double * const HRR_INT__m_d_l_s = hrrwork + 11313240;
    double * const HRR_INT__m_d_m_s = hrrwork + 11328090;
    double * const HRR_INT__m_d_n_s = hrrwork + 11346240;
    double * const HRR_INT__m_d_o_s = hrrwork + 11368020;
    double * const HRR_INT__m_d_q_s = hrrwork + 11393760;
    double * const HRR_INT__m_d_r_s = hrrwork + 11423790;
    double * const HRR_INT__m_f_k_s = hrrwork + 11458440;
    double * const HRR_INT__m_f_l_s = hrrwork + 11478240;
    double * const HRR_INT__m_f_m_s = hrrwork + 11502990;
    double * const HRR_INT__m_f_n_s = hrrwork + 11533240;
    double * const HRR_INT__m_f_o_s = hrrwork + 11569540;
    double * const HRR_INT__m_f_q_s = hrrwork + 11612440;
    double * const HRR_INT__m_f_r_s = hrrwork + 11662490;
    double * const HRR_INT__m_g_k_s = hrrwork + 11720240;
    double * const HRR_INT__m_g_l_s = hrrwork + 11749940;
    double * const HRR_INT__m_g_m_s = hrrwork + 11787065;
    double * const HRR_INT__m_g_n_s = hrrwork + 11832440;
    double * const HRR_INT__m_g_o_s = hrrwork + 11886890;
    double * const HRR_INT__m_g_q_s = hrrwork + 11951240;
    double * const HRR_INT__m_g_r_s = hrrwork + 12026315;
    double * const HRR_INT__n_p_k_s = hrrwork + 12112940;
    double * const HRR_INT__n_p_l_s = hrrwork + 12120068;
    double * const HRR_INT__n_p_m_s = hrrwork + 12128978;
    double * const HRR_INT__n_p_n_s = hrrwork + 12139868;
    double * const HRR_INT__n_p_o_s = hrrwork + 12152936;
    double * const HRR_INT__n_p_q_s = hrrwork + 12168380;
    double * const HRR_INT__n_p_r_s = hrrwork + 12186398;
    double * const HRR_INT__n_d_k_s = hrrwork + 12207188;
    double * const HRR_INT__n_d_l_s = hrrwork + 12221444;
    double * const HRR_INT__n_d_m_s = hrrwork + 12239264;
    double * const HRR_INT__n_d_n_s = hrrwork + 12261044;
    double * const HRR_INT__n_d_o_s = hrrwork + 12287180;
    double * const HRR_INT__n_d_q_s = hrrwork + 12318068;
    double * const HRR_INT__n_d_r_s = hrrwork + 12354104;
    double * const HRR_INT__n_f_k_s = hrrwork + 12395684;
    double * const HRR_INT__n_f_l_s = hrrwork + 12419444;
    double * const HRR_INT__n_f_m_s = hrrwork + 12449144;
    double * const HRR_INT__n_f_n_s = hrrwork + 12485444;
    double * const HRR_INT__n_f_o_s = hrrwork + 12529004;
    double * const HRR_INT__n_f_q_s = hrrwork + 12580484;
    double * const HRR_INT__n_f_r_s = hrrwork + 12640544;
    double * const HRR_INT__o_p_k_s = hrrwork + 12709844;
    double * const HRR_INT__o_p_l_s = hrrwork + 12718268;
    double * const HRR_INT__o_p_m_s = hrrwork + 12728798;
    double * const HRR_INT__o_p_n_s = hrrwork + 12741668;
    double * const HRR_INT__o_p_o_s = hrrwork + 12757112;
    double * const HRR_INT__o_p_q_s = hrrwork + 12775364;
    double * const HRR_INT__o_p_r_s = hrrwork + 12796658;
    double * const HRR_INT__o_d_k_s = hrrwork + 12821228;
    double * const HRR_INT__o_d_l_s = hrrwork + 12838076;
    double * const HRR_INT__o_d_m_s = hrrwork + 12859136;
    double * const HRR_INT__o_d_n_s = hrrwork + 12884876;
    double * const HRR_INT__o_d_o_s = hrrwork + 12915764;
    double * const HRR_INT__o_d_q_s = hrrwork + 12952268;
    double * const HRR_INT__o_d_r_s = hrrwork + 12994856;
    double * const HRR_INT__q_p_k_s = hrrwork + 13043996;
    double * const HRR_INT__q_p_l_s = hrrwork + 13053824;
    double * const HRR_INT__q_p_m_s = hrrwork + 13066109;
    double * const HRR_INT__q_p_n_s = hrrwork + 13081124;
    double * const HRR_INT__q_p_o_s = hrrwork + 13099142;
    double * const HRR_INT__q_p_q_s = hrrwork + 13120436;
    double * const HRR_INT__q_p_r_s = hrrwork + 13145279;


    // 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_13 = SIMINT_DBLSET1(13);
    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 * 226576 * 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__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__k_s_r_s = INT__k_s_r_s + abcd * 3780;
                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__l_s_r_s = INT__l_s_r_s + abcd * 4725;
                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;
                double * restrict PRIM_PTR_INT__m_s_r_s = INT__m_s_r_s + abcd * 5775;
                double * restrict PRIM_PTR_INT__n_s_k_s = INT__n_s_k_s + abcd * 2376;
                double * restrict PRIM_PTR_INT__n_s_l_s = INT__n_s_l_s + abcd * 2970;
                double * restrict PRIM_PTR_INT__n_s_m_s = INT__n_s_m_s + abcd * 3630;
                double * restrict PRIM_PTR_INT__n_s_n_s = INT__n_s_n_s + abcd * 4356;
                double * restrict PRIM_PTR_INT__n_s_o_s = INT__n_s_o_s + abcd * 5148;
                double * restrict PRIM_PTR_INT__n_s_q_s = INT__n_s_q_s + abcd * 6006;
                double * restrict PRIM_PTR_INT__n_s_r_s = INT__n_s_r_s + abcd * 6930;
                double * restrict PRIM_PTR_INT__o_s_k_s = INT__o_s_k_s + abcd * 2808;
                double * restrict PRIM_PTR_INT__o_s_l_s = INT__o_s_l_s + abcd * 3510;
                double * restrict PRIM_PTR_INT__o_s_m_s = INT__o_s_m_s + abcd * 4290;
                double * restrict PRIM_PTR_INT__o_s_n_s = INT__o_s_n_s + abcd * 5148;
                double * restrict PRIM_PTR_INT__o_s_o_s = INT__o_s_o_s + abcd * 6084;
                double * restrict PRIM_PTR_INT__o_s_q_s = INT__o_s_q_s + abcd * 7098;
                double * restrict PRIM_PTR_INT__o_s_r_s = INT__o_s_r_s + abcd * 8190;
                double * restrict PRIM_PTR_INT__q_s_k_s = INT__q_s_k_s + abcd * 3276;
                double * restrict PRIM_PTR_INT__q_s_l_s = INT__q_s_l_s + abcd * 4095;
                double * restrict PRIM_PTR_INT__q_s_m_s = INT__q_s_m_s + abcd * 5005;
                double * restrict PRIM_PTR_INT__q_s_n_s = INT__q_s_n_s + abcd * 6006;
                double * restrict PRIM_PTR_INT__q_s_o_s = INT__q_s_o_s + abcd * 7098;
                double * restrict PRIM_PTR_INT__q_s_q_s = INT__q_s_q_s + abcd * 8281;
                double * restrict PRIM_PTR_INT__q_s_r_s = INT__q_s_r_s + abcd * 9555;
                double * restrict PRIM_PTR_INT__r_s_k_s = INT__r_s_k_s + abcd * 3780;
                double * restrict PRIM_PTR_INT__r_s_l_s = INT__r_s_l_s + abcd * 4725;
                double * restrict PRIM_PTR_INT__r_s_m_s = INT__r_s_m_s + abcd * 5775;
                double * restrict PRIM_PTR_INT__r_s_n_s = INT__r_s_n_s + abcd * 6930;
                double * restrict PRIM_PTR_INT__r_s_o_s = INT__r_s_o_s + abcd * 8190;
                double * restrict PRIM_PTR_INT__r_s_q_s = INT__r_s_q_s + abcd * 9555;
                double * restrict PRIM_PTR_INT__r_s_r_s = INT__r_s_r_s + abcd * 11025;



                // 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__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__k_s_r_s += 3780;
                            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__l_s_r_s += 4725;
                            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;
                            PRIM_PTR_INT__m_s_r_s += 5775;
                            PRIM_PTR_INT__n_s_k_s += 2376;
                            PRIM_PTR_INT__n_s_l_s += 2970;
                            PRIM_PTR_INT__n_s_m_s += 3630;
                            PRIM_PTR_INT__n_s_n_s += 4356;
                            PRIM_PTR_INT__n_s_o_s += 5148;
                            PRIM_PTR_INT__n_s_q_s += 6006;
                            PRIM_PTR_INT__n_s_r_s += 6930;
                            PRIM_PTR_INT__o_s_k_s += 2808;
                            PRIM_PTR_INT__o_s_l_s += 3510;
                            PRIM_PTR_INT__o_s_m_s += 4290;
                            PRIM_PTR_INT__o_s_n_s += 5148;
                            PRIM_PTR_INT__o_s_o_s += 6084;
                            PRIM_PTR_INT__o_s_q_s += 7098;
                            PRIM_PTR_INT__o_s_r_s += 8190;
                            PRIM_PTR_INT__q_s_k_s += 3276;
                            PRIM_PTR_INT__q_s_l_s += 4095;
                            PRIM_PTR_INT__q_s_m_s += 5005;
                            PRIM_PTR_INT__q_s_n_s += 6006;
                            PRIM_PTR_INT__q_s_o_s += 7098;
                            PRIM_PTR_INT__q_s_q_s += 8281;
                            PRIM_PTR_INT__q_s_r_s += 9555;
                            PRIM_PTR_INT__r_s_k_s += 3780;
                            PRIM_PTR_INT__r_s_l_s += 4725;
                            PRIM_PTR_INT__r_s_m_s += 5775;
                            PRIM_PTR_INT__r_s_n_s += 6930;
                            PRIM_PTR_INT__r_s_o_s += 8190;
                            PRIM_PTR_INT__r_s_q_s += 9555;
                            PRIM_PTR_INT__r_s_r_s += 11025;
                        }
                        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__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__k_s_r_s += lastoffset*3780;
                            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__l_s_r_s += lastoffset*4725;
                            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;
                            PRIM_PTR_INT__m_s_r_s += lastoffset*5775;
                            PRIM_PTR_INT__n_s_k_s += lastoffset*2376;
                            PRIM_PTR_INT__n_s_l_s += lastoffset*2970;
                            PRIM_PTR_INT__n_s_m_s += lastoffset*3630;
                            PRIM_PTR_INT__n_s_n_s += lastoffset*4356;
                            PRIM_PTR_INT__n_s_o_s += lastoffset*5148;
                            PRIM_PTR_INT__n_s_q_s += lastoffset*6006;
                            PRIM_PTR_INT__n_s_r_s += lastoffset*6930;
                            PRIM_PTR_INT__o_s_k_s += lastoffset*2808;
                            PRIM_PTR_INT__o_s_l_s += lastoffset*3510;
                            PRIM_PTR_INT__o_s_m_s += lastoffset*4290;
                            PRIM_PTR_INT__o_s_n_s += lastoffset*5148;
                            PRIM_PTR_INT__o_s_o_s += lastoffset*6084;
                            PRIM_PTR_INT__o_s_q_s += lastoffset*7098;
                            PRIM_PTR_INT__o_s_r_s += lastoffset*8190;
                            PRIM_PTR_INT__q_s_k_s += lastoffset*3276;
                            PRIM_PTR_INT__q_s_l_s += lastoffset*4095;
                            PRIM_PTR_INT__q_s_m_s += lastoffset*5005;
                            PRIM_PTR_INT__q_s_n_s += lastoffset*6006;
                            PRIM_PTR_INT__q_s_o_s += lastoffset*7098;
                            PRIM_PTR_INT__q_s_q_s += lastoffset*8281;
                            PRIM_PTR_INT__q_s_r_s += lastoffset*9555;
                            PRIM_PTR_INT__r_s_k_s += lastoffset*3780;
                            PRIM_PTR_INT__r_s_l_s += lastoffset*4725;
                            PRIM_PTR_INT__r_s_m_s += lastoffset*5775;
                            PRIM_PTR_INT__r_s_n_s += lastoffset*6930;
                            PRIM_PTR_INT__r_s_o_s += lastoffset*8190;
                            PRIM_PTR_INT__r_s_q_s += lastoffset*9555;
                            PRIM_PTR_INT__r_s_r_s += lastoffset*11025;
                            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: 26
                    //////////////////////////////////////////////
                    // 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, 26);
                    SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
                    prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
                    for(n = 0; n <= 26; 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_9_over_2p = SIMINT_MUL(const_9, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_10_over_2p = SIMINT_MUL(const_10, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_11_over_2p = SIMINT_MUL(const_11, one_over_2p);
                    const SIMINT_DBLTYPE vrr_const_12_over_2p = SIMINT_MUL(const_12, 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_12_over_2q = SIMINT_MUL(const_12, 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);
                    const SIMINT_DBLTYPE vrr_const_13_over_2pq = SIMINT_MUL(const_13, one_over_2pq);



                    // Forming PRIM_INT__p_s_s_s[26 * 3];
                    for(n = 0; n < 26; ++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_s_s[25 * 6];
                    for(n = 0; n < 25; ++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 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
                        PRIM_INT__d_s_s_s[n * 6 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_s_s[n * 6 + 1]);

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

                        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 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
                        PRIM_INT__d_s_s_s[n * 6 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_s_s[n * 6 + 4]);

                        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_s_s[24 * 10];
                    for(n = 0; n < 24; ++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 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
                        PRIM_INT__f_s_s_s[n * 10 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__f_s_s_s[n * 10 + 1]);

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

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

                        PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
                        PRIM_INT__f_s_s_s[n * 10 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__f_s_s_s[n * 10 + 4]);

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

                        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 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
                        PRIM_INT__f_s_s_s[n * 10 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__f_s_s_s[n * 10 + 7]);

                        PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
                        PRIM_INT__f_s_s_s[n * 10 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_s_s[n * 10 + 8]);

                        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]);

                    }



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

                        PRIM_INT__g_s_s_s[n * 15 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__f_s_s_s[n * 10 + 0]);
                        PRIM_INT__g_s_s_s[n * 15 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 0], PRIM_INT__g_s_s_s[n * 15 + 0]);
                        PRIM_INT__g_s_s_s[n * 15 + 0] = SIMINT_FMADD( vrr_const_3_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_s[n * 6 + 0]), PRIM_INT__g_s_s_s[n * 15 + 0]);

                        PRIM_INT__g_s_s_s[n * 15 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__f_s_s_s[n * 10 + 0]);
                        PRIM_INT__g_s_s_s[n * 15 + 1] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 0], PRIM_INT__g_s_s_s[n * 15 + 1]);

                        PRIM_INT__g_s_s_s[n * 15 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__f_s_s_s[n * 10 + 0]);
                        PRIM_INT__g_s_s_s[n * 15 + 2] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 0], PRIM_INT__g_s_s_s[n * 15 + 2]);

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

                        PRIM_INT__g_s_s_s[n * 15 + 4] = SIMINT_MUL(P_PA[2], PRIM_INT__f_s_s_s[n * 10 + 1]);
                        PRIM_INT__g_s_s_s[n * 15 + 4] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 1], PRIM_INT__g_s_s_s[n * 15 + 4]);

                        PRIM_INT__g_s_s_s[n * 15 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__f_s_s_s[n * 10 + 2]);
                        PRIM_INT__g_s_s_s[n * 15 + 5] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 2], PRIM_INT__g_s_s_s[n * 15 + 5]);
                        PRIM_INT__g_s_s_s[n * 15 + 5] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_s[n * 6 + 0]), PRIM_INT__g_s_s_s[n * 15 + 5]);

                        PRIM_INT__g_s_s_s[n * 15 + 6] = SIMINT_MUL(P_PA[0], PRIM_INT__f_s_s_s[n * 10 + 6]);
                        PRIM_INT__g_s_s_s[n * 15 + 6] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 6], PRIM_INT__g_s_s_s[n * 15 + 6]);

                        PRIM_INT__g_s_s_s[n * 15 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__f_s_s_s[n * 10 + 3]);
                        PRIM_INT__g_s_s_s[n * 15 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 3], PRIM_INT__g_s_s_s[n * 15 + 7]);

                        PRIM_INT__g_s_s_s[n * 15 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__f_s_s_s[n * 10 + 5]);
                        PRIM_INT__g_s_s_s[n * 15 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 5], PRIM_INT__g_s_s_s[n * 15 + 8]);

                        PRIM_INT__g_s_s_s[n * 15 + 9] = SIMINT_MUL(P_PA[0], PRIM_INT__f_s_s_s[n * 10 + 9]);
                        PRIM_INT__g_s_s_s[n * 15 + 9] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 9], PRIM_INT__g_s_s_s[n * 15 + 9]);

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

                        PRIM_INT__g_s_s_s[n * 15 + 11] = SIMINT_MUL(P_PA[2], PRIM_INT__f_s_s_s[n * 10 + 6]);
                        PRIM_INT__g_s_s_s[n * 15 + 11] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 6], PRIM_INT__g_s_s_s[n * 15 + 11]);

                        PRIM_INT__g_s_s_s[n * 15 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__f_s_s_s[n * 10 + 7]);
                        PRIM_INT__g_s_s_s[n * 15 + 12] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 7], PRIM_INT__g_s_s_s[n * 15 + 12]);
                        PRIM_INT__g_s_s_s[n * 15 + 12] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_s_s[n * 6 + 3]), PRIM_INT__g_s_s_s[n * 15 + 12]);

                        PRIM_INT__g_s_s_s[n * 15 + 13] = SIMINT_MUL(P_PA[1], PRIM_INT__f_s_s_s[n * 10 + 9]);
                        PRIM_INT__g_s_s_s[n * 15 + 13] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 9], PRIM_INT__g_s_s_s[n * 15 + 13]);

                        PRIM_INT__g_s_s_s[n * 15 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__f_s_s_s[n * 10 + 9]);
                        PRIM_INT__g_s_s_s[n * 15 + 14] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 9], PRIM_INT__g_s_s_s[n * 15 + 14]);
                        PRIM_INT__g_s_s_s[n * 15 + 14] = SIMINT_FMADD( vrr_const_3_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_s_s[n * 6 + 5]), PRIM_INT__g_s_s_s[n * 15 + 14]);

                    }


                    VRR_I_h_s_s_s(
                            PRIM_INT__h_s_s_s,
                            PRIM_INT__g_s_s_s,
                            PRIM_INT__f_s_s_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            22);


                    VRR_I_i_s_s_s(
                            PRIM_INT__i_s_s_s,
                            PRIM_INT__h_s_s_s,
                            PRIM_INT__g_s_s_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            21);


                    VRR_I_k_s_s_s(
                            PRIM_INT__k_s_s_s,
                            PRIM_INT__i_s_s_s,
                            PRIM_INT__h_s_s_s,
                            P_PA,
                            a_over_p,
                            aop_PQ,
                            one_over_2p,
                            20);


                    ostei_general_vrr_K(7, 0, 1, 0, 13,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_s_s, NULL, NULL, PRIM_INT__i_s_s_s, NULL, PRIM_INT__k_s_p_s);


                    VRR_K_i_s_p_s(
                            PRIM_INT__i_s_p_s,
                            PRIM_INT__i_s_s_s,
                            PRIM_INT__h_s_s_s,
                            Q_PA,
                            aoq_PQ,
                            one_over_2pq,
                            13);


                    ostei_general_vrr_K(7, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_p_s, PRIM_INT__k_s_s_s, NULL, PRIM_INT__i_s_p_s, NULL, PRIM_INT__k_s_d_s);


                    VRR_K_h_s_p_s(
                            PRIM_INT__h_s_p_s,
                            PRIM_INT__h_s_s_s,
                            PRIM_INT__g_s_s_s,
                            Q_PA,
                            aoq_PQ,
                            one_over_2pq,
                            13);


                    ostei_general_vrr_K(6, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_p_s, PRIM_INT__i_s_s_s, NULL, PRIM_INT__h_s_p_s, NULL, PRIM_INT__i_s_d_s);


                    ostei_general_vrr_K(7, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_d_s, PRIM_INT__k_s_p_s, NULL, PRIM_INT__i_s_d_s, NULL, PRIM_INT__k_s_f_s);


                    VRR_K_g_s_p_s(
                            PRIM_INT__g_s_p_s,
                            PRIM_INT__g_s_s_s,
                            PRIM_INT__f_s_s_s,
                            Q_PA,
                            aoq_PQ,
                            one_over_2pq,
                            13);


                    VRR_K_h_s_d_s(
                            PRIM_INT__h_s_d_s,
                            PRIM_INT__h_s_p_s,
                            PRIM_INT__h_s_s_s,
                            PRIM_INT__g_s_p_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            12);


                    ostei_general_vrr_K(6, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_d_s, PRIM_INT__i_s_p_s, NULL, PRIM_INT__h_s_d_s, NULL, PRIM_INT__i_s_f_s);


                    ostei_general_vrr_K(7, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_f_s, PRIM_INT__k_s_d_s, NULL, PRIM_INT__i_s_f_s, NULL, PRIM_INT__k_s_g_s);



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

                        PRIM_INT__f_s_p_s[n * 30 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 0]);
                        PRIM_INT__f_s_p_s[n * 30 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 0], PRIM_INT__f_s_p_s[n * 30 + 0]);
                        PRIM_INT__f_s_p_s[n * 30 + 0] = SIMINT_FMADD( vrr_const_3_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(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 0]);
                        PRIM_INT__f_s_p_s[n * 30 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 0], PRIM_INT__f_s_p_s[n * 30 + 1]);

                        PRIM_INT__f_s_p_s[n * 30 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 0]);
                        PRIM_INT__f_s_p_s[n * 30 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 0], PRIM_INT__f_s_p_s[n * 30 + 2]);

                        PRIM_INT__f_s_p_s[n * 30 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 1]);
                        PRIM_INT__f_s_p_s[n * 30 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 1], PRIM_INT__f_s_p_s[n * 30 + 3]);
                        PRIM_INT__f_s_p_s[n * 30 + 3] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__f_s_p_s[n * 30 + 3]);

                        PRIM_INT__f_s_p_s[n * 30 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 1]);
                        PRIM_INT__f_s_p_s[n * 30 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 1], PRIM_INT__f_s_p_s[n * 30 + 4]);
                        PRIM_INT__f_s_p_s[n * 30 + 4] = 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 + 4]);

                        PRIM_INT__f_s_p_s[n * 30 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 1]);
                        PRIM_INT__f_s_p_s[n * 30 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 1], PRIM_INT__f_s_p_s[n * 30 + 5]);

                        PRIM_INT__f_s_p_s[n * 30 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 2]);
                        PRIM_INT__f_s_p_s[n * 30 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 2], PRIM_INT__f_s_p_s[n * 30 + 6]);
                        PRIM_INT__f_s_p_s[n * 30 + 6] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__f_s_p_s[n * 30 + 6]);

                        PRIM_INT__f_s_p_s[n * 30 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 2]);
                        PRIM_INT__f_s_p_s[n * 30 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 2], PRIM_INT__f_s_p_s[n * 30 + 7]);

                        PRIM_INT__f_s_p_s[n * 30 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 2]);
                        PRIM_INT__f_s_p_s[n * 30 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 2], PRIM_INT__f_s_p_s[n * 30 + 8]);
                        PRIM_INT__f_s_p_s[n * 30 + 8] = 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 + 8]);

                        PRIM_INT__f_s_p_s[n * 30 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 3]);
                        PRIM_INT__f_s_p_s[n * 30 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 3], PRIM_INT__f_s_p_s[n * 30 + 9]);
                        PRIM_INT__f_s_p_s[n * 30 + 9] = 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 + 9]);

                        PRIM_INT__f_s_p_s[n * 30 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 3]);
                        PRIM_INT__f_s_p_s[n * 30 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 3], PRIM_INT__f_s_p_s[n * 30 + 10]);
                        PRIM_INT__f_s_p_s[n * 30 + 10] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__f_s_p_s[n * 30 + 10]);

                        PRIM_INT__f_s_p_s[n * 30 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 3]);
                        PRIM_INT__f_s_p_s[n * 30 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 3], PRIM_INT__f_s_p_s[n * 30 + 11]);

                        PRIM_INT__f_s_p_s[n * 30 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 4]);
                        PRIM_INT__f_s_p_s[n * 30 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 4], PRIM_INT__f_s_p_s[n * 30 + 12]);
                        PRIM_INT__f_s_p_s[n * 30 + 12] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__f_s_p_s[n * 30 + 12]);

                        PRIM_INT__f_s_p_s[n * 30 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 4]);
                        PRIM_INT__f_s_p_s[n * 30 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 4], PRIM_INT__f_s_p_s[n * 30 + 13]);
                        PRIM_INT__f_s_p_s[n * 30 + 13] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__f_s_p_s[n * 30 + 13]);

                        PRIM_INT__f_s_p_s[n * 30 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 4]);
                        PRIM_INT__f_s_p_s[n * 30 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 4], PRIM_INT__f_s_p_s[n * 30 + 14]);
                        PRIM_INT__f_s_p_s[n * 30 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__f_s_p_s[n * 30 + 14]);

                        PRIM_INT__f_s_p_s[n * 30 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 5]);
                        PRIM_INT__f_s_p_s[n * 30 + 15] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 5], PRIM_INT__f_s_p_s[n * 30 + 15]);
                        PRIM_INT__f_s_p_s[n * 30 + 15] = 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 + 15]);

                        PRIM_INT__f_s_p_s[n * 30 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 5]);
                        PRIM_INT__f_s_p_s[n * 30 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 5], PRIM_INT__f_s_p_s[n * 30 + 16]);

                        PRIM_INT__f_s_p_s[n * 30 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 5]);
                        PRIM_INT__f_s_p_s[n * 30 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 5], PRIM_INT__f_s_p_s[n * 30 + 17]);
                        PRIM_INT__f_s_p_s[n * 30 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__f_s_p_s[n * 30 + 17]);

                        PRIM_INT__f_s_p_s[n * 30 + 18] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 6]);
                        PRIM_INT__f_s_p_s[n * 30 + 18] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 6], PRIM_INT__f_s_p_s[n * 30 + 18]);

                        PRIM_INT__f_s_p_s[n * 30 + 19] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 6]);
                        PRIM_INT__f_s_p_s[n * 30 + 19] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 6], PRIM_INT__f_s_p_s[n * 30 + 19]);
                        PRIM_INT__f_s_p_s[n * 30 + 19] = SIMINT_FMADD( vrr_const_3_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(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 6]);
                        PRIM_INT__f_s_p_s[n * 30 + 20] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 6], PRIM_INT__f_s_p_s[n * 30 + 20]);

                        PRIM_INT__f_s_p_s[n * 30 + 21] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 7]);
                        PRIM_INT__f_s_p_s[n * 30 + 21] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 7], PRIM_INT__f_s_p_s[n * 30 + 21]);

                        PRIM_INT__f_s_p_s[n * 30 + 22] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 7]);
                        PRIM_INT__f_s_p_s[n * 30 + 22] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 7], PRIM_INT__f_s_p_s[n * 30 + 22]);
                        PRIM_INT__f_s_p_s[n * 30 + 22] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__f_s_p_s[n * 30 + 22]);

                        PRIM_INT__f_s_p_s[n * 30 + 23] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 7]);
                        PRIM_INT__f_s_p_s[n * 30 + 23] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 7], PRIM_INT__f_s_p_s[n * 30 + 23]);
                        PRIM_INT__f_s_p_s[n * 30 + 23] = 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 + 23]);

                        PRIM_INT__f_s_p_s[n * 30 + 24] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 8]);
                        PRIM_INT__f_s_p_s[n * 30 + 24] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 8], PRIM_INT__f_s_p_s[n * 30 + 24]);

                        PRIM_INT__f_s_p_s[n * 30 + 25] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 8]);
                        PRIM_INT__f_s_p_s[n * 30 + 25] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 8], PRIM_INT__f_s_p_s[n * 30 + 25]);
                        PRIM_INT__f_s_p_s[n * 30 + 25] = 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 + 25]);

                        PRIM_INT__f_s_p_s[n * 30 + 26] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 8]);
                        PRIM_INT__f_s_p_s[n * 30 + 26] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 8], PRIM_INT__f_s_p_s[n * 30 + 26]);
                        PRIM_INT__f_s_p_s[n * 30 + 26] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__f_s_p_s[n * 30 + 26]);

                        PRIM_INT__f_s_p_s[n * 30 + 27] = SIMINT_MUL(Q_PA[0], PRIM_INT__f_s_s_s[n * 10 + 9]);
                        PRIM_INT__f_s_p_s[n * 30 + 27] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__f_s_s_s[(n+1) * 10 + 9], PRIM_INT__f_s_p_s[n * 30 + 27]);

                        PRIM_INT__f_s_p_s[n * 30 + 28] = SIMINT_MUL(Q_PA[1], PRIM_INT__f_s_s_s[n * 10 + 9]);
                        PRIM_INT__f_s_p_s[n * 30 + 28] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__f_s_s_s[(n+1) * 10 + 9], PRIM_INT__f_s_p_s[n * 30 + 28]);

                        PRIM_INT__f_s_p_s[n * 30 + 29] = SIMINT_MUL(Q_PA[2], PRIM_INT__f_s_s_s[n * 10 + 9]);
                        PRIM_INT__f_s_p_s[n * 30 + 29] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__f_s_s_s[(n+1) * 10 + 9], PRIM_INT__f_s_p_s[n * 30 + 29]);
                        PRIM_INT__f_s_p_s[n * 30 + 29] = SIMINT_FMADD( vrr_const_3_over_2pq, PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__f_s_p_s[n * 30 + 29]);

                    }


                    VRR_K_g_s_d_s(
                            PRIM_INT__g_s_d_s,
                            PRIM_INT__g_s_p_s,
                            PRIM_INT__g_s_s_s,
                            PRIM_INT__f_s_p_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            12);


                    ostei_general_vrr_K(5, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_d_s, PRIM_INT__h_s_p_s, NULL, PRIM_INT__g_s_d_s, NULL, PRIM_INT__h_s_f_s);


                    ostei_general_vrr_K(6, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_f_s, PRIM_INT__i_s_d_s, NULL, PRIM_INT__h_s_f_s, NULL, PRIM_INT__i_s_g_s);


                    ostei_general_vrr_K(7, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_g_s, PRIM_INT__k_s_f_s, NULL, PRIM_INT__i_s_g_s, NULL, PRIM_INT__k_s_h_s);



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

                        PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 0]);
                        PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
                        PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_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(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 0]);
                        PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 1]);

                        PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 0]);
                        PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_p_s[n * 18 + 2]);

                        PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 1]);
                        PRIM_INT__d_s_p_s[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 3]);
                        PRIM_INT__d_s_p_s[n * 18 + 3] = 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 + 3]);

                        PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 1]);
                        PRIM_INT__d_s_p_s[n * 18 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 4]);
                        PRIM_INT__d_s_p_s[n * 18 + 4] = 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 + 4]);

                        PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 1]);
                        PRIM_INT__d_s_p_s[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_p_s[n * 18 + 5]);

                        PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 2]);
                        PRIM_INT__d_s_p_s[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 6]);
                        PRIM_INT__d_s_p_s[n * 18 + 6] = 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 + 6]);

                        PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 2]);
                        PRIM_INT__d_s_p_s[n * 18 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 7]);

                        PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 2]);
                        PRIM_INT__d_s_p_s[n * 18 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_p_s[n * 18 + 8]);
                        PRIM_INT__d_s_p_s[n * 18 + 8] = 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 + 8]);

                        PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 3]);
                        PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);

                        PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 3]);
                        PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 10]);
                        PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_2_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(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 3]);
                        PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_p_s[n * 18 + 11]);

                        PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 4]);
                        PRIM_INT__d_s_p_s[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 12]);

                        PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 4]);
                        PRIM_INT__d_s_p_s[n * 18 + 13] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 13]);
                        PRIM_INT__d_s_p_s[n * 18 + 13] = 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 + 13]);

                        PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 4]);
                        PRIM_INT__d_s_p_s[n * 18 + 14] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_p_s[n * 18 + 14]);
                        PRIM_INT__d_s_p_s[n * 18 + 14] = 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 + 14]);

                        PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_s_s[n * 6 + 5]);
                        PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 15]);

                        PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_s_s[n * 6 + 5]);
                        PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 16]);

                        PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_s_s[n * 6 + 5]);
                        PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_p_s[n * 18 + 17]);
                        PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 17]);

                    }


                    VRR_K_f_s_d_s(
                            PRIM_INT__f_s_d_s,
                            PRIM_INT__f_s_p_s,
                            PRIM_INT__f_s_s_s,
                            PRIM_INT__d_s_p_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            12);


                    VRR_K_g_s_f_s(
                            PRIM_INT__g_s_f_s,
                            PRIM_INT__g_s_d_s,
                            PRIM_INT__g_s_p_s,
                            PRIM_INT__f_s_d_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            11);


                    ostei_general_vrr_K(5, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_f_s, PRIM_INT__h_s_d_s, NULL, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_g_s);


                    ostei_general_vrr_K(6, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_g_s, PRIM_INT__i_s_f_s, NULL, PRIM_INT__h_s_g_s, NULL, PRIM_INT__i_s_h_s);


                    ostei_general_vrr_K(7, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_h_s, PRIM_INT__k_s_g_s, NULL, PRIM_INT__i_s_h_s, NULL, PRIM_INT__k_s_i_s);



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

                        PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
                        PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_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(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 0]);
                        PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 1]);

                        PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 0]);
                        PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 2]);

                        PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 1]);
                        PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 3]);

                        PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
                        PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_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(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 1]);
                        PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 5]);

                        PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_s_s[n * 3 + 2]);
                        PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 6]);

                        PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_s_s[n * 3 + 2]);
                        PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 7]);

                        PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
                        PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_s_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[12 * 36];
                    for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__d_s_d_s[n * 36 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_p_s[n * 18 + 0]);
                        PRIM_INT__d_s_d_s[n * 36 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_p_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_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_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 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_p_s[n * 18 + 1]);
                        PRIM_INT__d_s_d_s[n * 36 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 1], PRIM_INT__d_s_d_s[n * 36 + 3]);
                        PRIM_INT__d_s_d_s[n * 36 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_s[n * 6 + 0]), PRIM_INT__d_s_d_s[n * 36 + 3]);

                        PRIM_INT__d_s_d_s[n * 36 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_p_s[n * 18 + 2]);
                        PRIM_INT__d_s_d_s[n * 36 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_p_s[(n+1) * 18 + 2], PRIM_INT__d_s_d_s[n * 36 + 5]);
                        PRIM_INT__d_s_d_s[n * 36 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 0], PRIM_INT__d_s_s_s[n * 6 + 0]), PRIM_INT__d_s_d_s[n * 36 + 5]);

                        PRIM_INT__d_s_d_s[n * 36 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_p_s[n * 18 + 3]);
                        PRIM_INT__d_s_d_s[n * 36 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 3], PRIM_INT__d_s_d_s[n * 36 + 6]);
                        PRIM_INT__d_s_d_s[n * 36 + 6] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_s_s[n * 6 + 1]), PRIM_INT__d_s_d_s[n * 36 + 6]);
                        PRIM_INT__d_s_d_s[n * 36 + 6] = 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 + 6]);

                        PRIM_INT__d_s_d_s[n * 36 + 9] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_p_s[n * 18 + 4]);
                        PRIM_INT__d_s_d_s[n * 36 + 9] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 4], PRIM_INT__d_s_d_s[n * 36 + 9]);
                        PRIM_INT__d_s_d_s[n * 36 + 9] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_s_s[n * 6 + 1]), PRIM_INT__d_s_d_s[n * 36 + 9]);
                        PRIM_INT__d_s_d_s[n * 36 + 9] = 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 + 9]);

                        PRIM_INT__d_s_d_s[n * 36 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_p_s[n * 18 + 5]);
                        PRIM_INT__d_s_d_s[n * 36 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_p_s[(n+1) * 18 + 5], PRIM_INT__d_s_d_s[n * 36 + 11]);
                        PRIM_INT__d_s_d_s[n * 36 + 11] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 1], PRIM_INT__d_s_s_s[n * 6 + 1]), PRIM_INT__d_s_d_s[n * 36 + 11]);

                        PRIM_INT__d_s_d_s[n * 36 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_p_s[n * 18 + 6]);
                        PRIM_INT__d_s_d_s[n * 36 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 6], PRIM_INT__d_s_d_s[n * 36 + 12]);
                        PRIM_INT__d_s_d_s[n * 36 + 12] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_s_s[n * 6 + 2]), PRIM_INT__d_s_d_s[n * 36 + 12]);
                        PRIM_INT__d_s_d_s[n * 36 + 12] = 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 + 12]);

                        PRIM_INT__d_s_d_s[n * 36 + 15] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_p_s[n * 18 + 7]);
                        PRIM_INT__d_s_d_s[n * 36 + 15] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 7], PRIM_INT__d_s_d_s[n * 36 + 15]);
                        PRIM_INT__d_s_d_s[n * 36 + 15] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_s_s[n * 6 + 2]), PRIM_INT__d_s_d_s[n * 36 + 15]);

                        PRIM_INT__d_s_d_s[n * 36 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_p_s[n * 18 + 8]);
                        PRIM_INT__d_s_d_s[n * 36 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_p_s[(n+1) * 18 + 8], PRIM_INT__d_s_d_s[n * 36 + 17]);
                        PRIM_INT__d_s_d_s[n * 36 + 17] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 2], PRIM_INT__d_s_s_s[n * 6 + 2]), PRIM_INT__d_s_d_s[n * 36 + 17]);
                        PRIM_INT__d_s_d_s[n * 36 + 17] = 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 + 17]);

                        PRIM_INT__d_s_d_s[n * 36 + 18] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_p_s[n * 18 + 9]);
                        PRIM_INT__d_s_d_s[n * 36 + 18] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 9], PRIM_INT__d_s_d_s[n * 36 + 18]);
                        PRIM_INT__d_s_d_s[n * 36 + 18] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_s_s[n * 6 + 3]), PRIM_INT__d_s_d_s[n * 36 + 18]);

                        PRIM_INT__d_s_d_s[n * 36 + 21] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_p_s[n * 18 + 10]);
                        PRIM_INT__d_s_d_s[n * 36 + 21] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 10], PRIM_INT__d_s_d_s[n * 36 + 21]);
                        PRIM_INT__d_s_d_s[n * 36 + 21] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_s_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 + 23] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_p_s[n * 18 + 11]);
                        PRIM_INT__d_s_d_s[n * 36 + 23] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_p_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_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 3], PRIM_INT__d_s_s_s[n * 6 + 3]), PRIM_INT__d_s_d_s[n * 36 + 23]);

                        PRIM_INT__d_s_d_s[n * 36 + 24] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_p_s[n * 18 + 12]);
                        PRIM_INT__d_s_d_s[n * 36 + 24] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 12], PRIM_INT__d_s_d_s[n * 36 + 24]);
                        PRIM_INT__d_s_d_s[n * 36 + 24] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_s_s[n * 6 + 4]), PRIM_INT__d_s_d_s[n * 36 + 24]);

                        PRIM_INT__d_s_d_s[n * 36 + 27] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_p_s[n * 18 + 13]);
                        PRIM_INT__d_s_d_s[n * 36 + 27] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 13], PRIM_INT__d_s_d_s[n * 36 + 27]);
                        PRIM_INT__d_s_d_s[n * 36 + 27] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_s_s[n * 6 + 4]), PRIM_INT__d_s_d_s[n * 36 + 27]);
                        PRIM_INT__d_s_d_s[n * 36 + 27] = 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 + 27]);

                        PRIM_INT__d_s_d_s[n * 36 + 29] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_p_s[n * 18 + 14]);
                        PRIM_INT__d_s_d_s[n * 36 + 29] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_p_s[(n+1) * 18 + 14], PRIM_INT__d_s_d_s[n * 36 + 29]);
                        PRIM_INT__d_s_d_s[n * 36 + 29] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 4], PRIM_INT__d_s_s_s[n * 6 + 4]), PRIM_INT__d_s_d_s[n * 36 + 29]);
                        PRIM_INT__d_s_d_s[n * 36 + 29] = 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 + 29]);

                        PRIM_INT__d_s_d_s[n * 36 + 30] = SIMINT_MUL(Q_PA[0], PRIM_INT__d_s_p_s[n * 18 + 15]);
                        PRIM_INT__d_s_d_s[n * 36 + 30] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__d_s_p_s[(n+1) * 18 + 15], PRIM_INT__d_s_d_s[n * 36 + 30]);
                        PRIM_INT__d_s_d_s[n * 36 + 30] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_s_s[n * 6 + 5]), PRIM_INT__d_s_d_s[n * 36 + 30]);

                        PRIM_INT__d_s_d_s[n * 36 + 33] = SIMINT_MUL(Q_PA[1], PRIM_INT__d_s_p_s[n * 18 + 16]);
                        PRIM_INT__d_s_d_s[n * 36 + 33] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__d_s_p_s[(n+1) * 18 + 16], PRIM_INT__d_s_d_s[n * 36 + 33]);
                        PRIM_INT__d_s_d_s[n * 36 + 33] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_s_s[n * 6 + 5]), PRIM_INT__d_s_d_s[n * 36 + 33]);

                        PRIM_INT__d_s_d_s[n * 36 + 35] = SIMINT_MUL(Q_PA[2], PRIM_INT__d_s_p_s[n * 18 + 17]);
                        PRIM_INT__d_s_d_s[n * 36 + 35] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__d_s_p_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_2q, SIMINT_FMADD(a_over_q, PRIM_INT__d_s_s_s[(n+1) * 6 + 5], PRIM_INT__d_s_s_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_K_f_s_f_s(
                            PRIM_INT__f_s_f_s,
                            PRIM_INT__f_s_d_s,
                            PRIM_INT__f_s_p_s,
                            PRIM_INT__d_s_d_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            11);


                    ostei_general_vrr_K(4, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__g_s_f_s, PRIM_INT__g_s_d_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);


                    ostei_general_vrr_K(5, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_g_s, PRIM_INT__h_s_f_s, NULL, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_h_s);


                    ostei_general_vrr_K(6, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_h_s, PRIM_INT__i_s_g_s, NULL, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_i_s);


                    ostei_general_vrr_K(7, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_i_s, PRIM_INT__k_s_h_s, NULL, PRIM_INT__i_s_i_s, NULL, PRIM_INT__k_s_k_s);



                    // Forming PRIM_INT__s_s_p_s[13 * 3];
                    for(n = 0; n < 13; ++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__p_s_d_s[12 * 18];
                    for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_p_s[n * 9 + 0]);
                        PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
                        PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__p_s_d_s[n * 18 + 0]);
                        PRIM_INT__p_s_d_s[n * 18 + 0] = 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 + 0]);

                        PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_p_s[n * 9 + 1]);
                        PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__p_s_d_s[n * 18 + 3]);
                        PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__p_s_d_s[n * 18 + 3]);

                        PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_p_s[n * 9 + 2]);
                        PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__p_s_d_s[n * 18 + 5]);
                        PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__p_s_s_s[n * 3 + 0]), PRIM_INT__p_s_d_s[n * 18 + 5]);

                        PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_p_s[n * 9 + 3]);
                        PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__p_s_d_s[n * 18 + 6]);
                        PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__p_s_d_s[n * 18 + 6]);

                        PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_p_s[n * 9 + 4]);
                        PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__p_s_d_s[n * 18 + 9]);
                        PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__p_s_d_s[n * 18 + 9]);
                        PRIM_INT__p_s_d_s[n * 18 + 9] = 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 + 9]);

                        PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_p_s[n * 9 + 5]);
                        PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__p_s_d_s[n * 18 + 11]);
                        PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__p_s_s_s[n * 3 + 1]), PRIM_INT__p_s_d_s[n * 18 + 11]);

                        PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_p_s[n * 9 + 6]);
                        PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__p_s_d_s[n * 18 + 12]);
                        PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__p_s_d_s[n * 18 + 12]);

                        PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_p_s[n * 9 + 7]);
                        PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__p_s_d_s[n * 18 + 15]);
                        PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__p_s_d_s[n * 18 + 15]);

                        PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_p_s[n * 9 + 8]);
                        PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__p_s_d_s[n * 18 + 17]);
                        PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__p_s_s_s[n * 3 + 2]), PRIM_INT__p_s_d_s[n * 18 + 17]);
                        PRIM_INT__p_s_d_s[n * 18 + 17] = 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 + 17]);

                    }


                    VRR_K_d_s_f_s(
                            PRIM_INT__d_s_f_s,
                            PRIM_INT__d_s_d_s,
                            PRIM_INT__d_s_p_s,
                            PRIM_INT__p_s_d_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            11);


                    VRR_K_f_s_g_s(
                            PRIM_INT__f_s_g_s,
                            PRIM_INT__f_s_f_s,
                            PRIM_INT__f_s_d_s,
                            PRIM_INT__d_s_f_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            10);


                    ostei_general_vrr_K(4, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__g_s_g_s, PRIM_INT__g_s_f_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);


                    ostei_general_vrr_K(5, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_h_s, PRIM_INT__h_s_g_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);


                    ostei_general_vrr_K(6, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_i_s, PRIM_INT__i_s_h_s, NULL, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_k_s);


                    ostei_general_vrr_K(7, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_k_s, PRIM_INT__k_s_i_s, NULL, PRIM_INT__i_s_k_s, NULL, PRIM_INT__k_s_l_s);


                    ostei_general_vrr1_I(8, 19,
                            one_over_2p, a_over_p, aop_PQ, P_PA,
                            PRIM_INT__k_s_s_s, PRIM_INT__i_s_s_s, PRIM_INT__l_s_s_s);


                    ostei_general_vrr_K(8, 0, 1, 0, 13,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_s_s, NULL, NULL, PRIM_INT__k_s_s_s, NULL, PRIM_INT__l_s_p_s);


                    ostei_general_vrr_K(8, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_p_s, PRIM_INT__l_s_s_s, NULL, PRIM_INT__k_s_p_s, NULL, PRIM_INT__l_s_d_s);


                    ostei_general_vrr_K(8, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_d_s, PRIM_INT__l_s_p_s, NULL, PRIM_INT__k_s_d_s, NULL, PRIM_INT__l_s_f_s);


                    ostei_general_vrr_K(8, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_f_s, PRIM_INT__l_s_d_s, NULL, PRIM_INT__k_s_f_s, NULL, PRIM_INT__l_s_g_s);


                    ostei_general_vrr_K(8, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_g_s, PRIM_INT__l_s_f_s, NULL, PRIM_INT__k_s_g_s, NULL, PRIM_INT__l_s_h_s);


                    ostei_general_vrr_K(8, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_h_s, PRIM_INT__l_s_g_s, NULL, PRIM_INT__k_s_h_s, NULL, PRIM_INT__l_s_i_s);


                    ostei_general_vrr_K(8, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_i_s, PRIM_INT__l_s_h_s, NULL, PRIM_INT__k_s_i_s, NULL, PRIM_INT__l_s_k_s);



                    // Forming PRIM_INT__s_s_d_s[12 * 6];
                    for(n = 0; n < 12; ++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 + 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 + 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__p_s_f_s[11 * 30];
                    for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
                    {

                        PRIM_INT__p_s_f_s[n * 30 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_d_s[n * 18 + 0]);
                        PRIM_INT__p_s_f_s[n * 30 + 0] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 0], PRIM_INT__p_s_f_s[n * 30 + 0]);
                        PRIM_INT__p_s_f_s[n * 30 + 0] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]), PRIM_INT__p_s_f_s[n * 30 + 0]);
                        PRIM_INT__p_s_f_s[n * 30 + 0] = 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 + 0]);

                        PRIM_INT__p_s_f_s[n * 30 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_d_s[n * 18 + 3]);
                        PRIM_INT__p_s_f_s[n * 30 + 6] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 3], PRIM_INT__p_s_f_s[n * 30 + 6]);
                        PRIM_INT__p_s_f_s[n * 30 + 6] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__p_s_p_s[n * 9 + 1]), PRIM_INT__p_s_f_s[n * 30 + 6]);

                        PRIM_INT__p_s_f_s[n * 30 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_d_s[n * 18 + 5]);
                        PRIM_INT__p_s_f_s[n * 30 + 9] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 5], PRIM_INT__p_s_f_s[n * 30 + 9]);
                        PRIM_INT__p_s_f_s[n * 30 + 9] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__p_s_p_s[n * 9 + 2]), PRIM_INT__p_s_f_s[n * 30 + 9]);

                        PRIM_INT__p_s_f_s[n * 30 + 10] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_d_s[n * 18 + 6]);
                        PRIM_INT__p_s_f_s[n * 30 + 10] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 6], PRIM_INT__p_s_f_s[n * 30 + 10]);
                        PRIM_INT__p_s_f_s[n * 30 + 10] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__p_s_p_s[n * 9 + 3]), PRIM_INT__p_s_f_s[n * 30 + 10]);

                        PRIM_INT__p_s_f_s[n * 30 + 16] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_d_s[n * 18 + 9]);
                        PRIM_INT__p_s_f_s[n * 30 + 16] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 9], PRIM_INT__p_s_f_s[n * 30 + 16]);
                        PRIM_INT__p_s_f_s[n * 30 + 16] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__p_s_p_s[n * 9 + 4]), PRIM_INT__p_s_f_s[n * 30 + 16]);
                        PRIM_INT__p_s_f_s[n * 30 + 16] = 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 + 16]);

                        PRIM_INT__p_s_f_s[n * 30 + 19] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_d_s[n * 18 + 11]);
                        PRIM_INT__p_s_f_s[n * 30 + 19] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 11], PRIM_INT__p_s_f_s[n * 30 + 19]);
                        PRIM_INT__p_s_f_s[n * 30 + 19] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__p_s_p_s[n * 9 + 5]), PRIM_INT__p_s_f_s[n * 30 + 19]);

                        PRIM_INT__p_s_f_s[n * 30 + 20] = SIMINT_MUL(Q_PA[0], PRIM_INT__p_s_d_s[n * 18 + 12]);
                        PRIM_INT__p_s_f_s[n * 30 + 20] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__p_s_d_s[(n+1) * 18 + 12], PRIM_INT__p_s_f_s[n * 30 + 20]);
                        PRIM_INT__p_s_f_s[n * 30 + 20] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__p_s_p_s[n * 9 + 6]), PRIM_INT__p_s_f_s[n * 30 + 20]);

                        PRIM_INT__p_s_f_s[n * 30 + 26] = SIMINT_MUL(Q_PA[1], PRIM_INT__p_s_d_s[n * 18 + 15]);
                        PRIM_INT__p_s_f_s[n * 30 + 26] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__p_s_d_s[(n+1) * 18 + 15], PRIM_INT__p_s_f_s[n * 30 + 26]);
                        PRIM_INT__p_s_f_s[n * 30 + 26] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__p_s_p_s[n * 9 + 7]), PRIM_INT__p_s_f_s[n * 30 + 26]);

                        PRIM_INT__p_s_f_s[n * 30 + 29] = SIMINT_MUL(Q_PA[2], PRIM_INT__p_s_d_s[n * 18 + 17]);
                        PRIM_INT__p_s_f_s[n * 30 + 29] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__p_s_d_s[(n+1) * 18 + 17], PRIM_INT__p_s_f_s[n * 30 + 29]);
                        PRIM_INT__p_s_f_s[n * 30 + 29] = SIMINT_FMADD( vrr_const_2_over_2q, SIMINT_FMADD(a_over_q, PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__p_s_p_s[n * 9 + 8]), PRIM_INT__p_s_f_s[n * 30 + 29]);
                        PRIM_INT__p_s_f_s[n * 30 + 29] = 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 + 29]);

                    }


                    VRR_K_d_s_g_s(
                            PRIM_INT__d_s_g_s,
                            PRIM_INT__d_s_f_s,
                            PRIM_INT__d_s_d_s,
                            PRIM_INT__p_s_f_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            10);


                    ostei_general_vrr_K(3, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__f_s_g_s, PRIM_INT__f_s_f_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);


                    ostei_general_vrr_K(4, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__g_s_h_s, PRIM_INT__g_s_g_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);


                    ostei_general_vrr_K(5, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_i_s, PRIM_INT__h_s_h_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);


                    ostei_general_vrr_K(6, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_k_s, PRIM_INT__i_s_i_s, NULL, PRIM_INT__h_s_k_s, NULL, PRIM_INT__i_s_l_s);


                    ostei_general_vrr_K(7, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_l_s, PRIM_INT__k_s_k_s, NULL, PRIM_INT__i_s_l_s, NULL, PRIM_INT__k_s_m_s);


                    ostei_general_vrr_K(8, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_k_s, PRIM_INT__l_s_i_s, NULL, PRIM_INT__k_s_k_s, NULL, PRIM_INT__l_s_l_s);


                    ostei_general_vrr1_I(9, 18,
                            one_over_2p, a_over_p, aop_PQ, P_PA,
                            PRIM_INT__l_s_s_s, PRIM_INT__k_s_s_s, PRIM_INT__m_s_s_s);


                    ostei_general_vrr_K(9, 0, 1, 0, 13,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_s_s, NULL, NULL, PRIM_INT__l_s_s_s, NULL, PRIM_INT__m_s_p_s);


                    ostei_general_vrr_K(9, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_p_s, PRIM_INT__m_s_s_s, NULL, PRIM_INT__l_s_p_s, NULL, PRIM_INT__m_s_d_s);


                    ostei_general_vrr_K(9, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_d_s, PRIM_INT__m_s_p_s, NULL, PRIM_INT__l_s_d_s, NULL, PRIM_INT__m_s_f_s);


                    ostei_general_vrr_K(9, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_f_s, PRIM_INT__m_s_d_s, NULL, PRIM_INT__l_s_f_s, NULL, PRIM_INT__m_s_g_s);


                    ostei_general_vrr_K(9, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_g_s, PRIM_INT__m_s_f_s, NULL, PRIM_INT__l_s_g_s, NULL, PRIM_INT__m_s_h_s);


                    ostei_general_vrr_K(9, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_h_s, PRIM_INT__m_s_g_s, NULL, PRIM_INT__l_s_h_s, NULL, PRIM_INT__m_s_i_s);


                    ostei_general_vrr_K(9, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_i_s, PRIM_INT__m_s_h_s, NULL, PRIM_INT__l_s_i_s, NULL, PRIM_INT__m_s_k_s);



                    // Forming PRIM_INT__s_s_f_s[11 * 10];
                    for(n = 0; n < 11; ++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 + 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 + 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]);

                    }


                    VRR_K_p_s_g_s(
                            PRIM_INT__p_s_g_s,
                            PRIM_INT__p_s_f_s,
                            PRIM_INT__p_s_d_s,
                            PRIM_INT__s_s_f_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            10);


                    VRR_K_d_s_h_s(
                            PRIM_INT__d_s_h_s,
                            PRIM_INT__d_s_g_s,
                            PRIM_INT__d_s_f_s,
                            PRIM_INT__p_s_g_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            9);


                    ostei_general_vrr_K(3, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__f_s_h_s, PRIM_INT__f_s_g_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);


                    ostei_general_vrr_K(4, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__g_s_i_s, PRIM_INT__g_s_h_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);


                    ostei_general_vrr_K(5, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_k_s, PRIM_INT__h_s_i_s, NULL, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_l_s);


                    ostei_general_vrr_K(6, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_l_s, PRIM_INT__i_s_k_s, NULL, PRIM_INT__h_s_l_s, NULL, PRIM_INT__i_s_m_s);


                    ostei_general_vrr_K(7, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_m_s, PRIM_INT__k_s_l_s, NULL, PRIM_INT__i_s_m_s, NULL, PRIM_INT__k_s_n_s);


                    ostei_general_vrr_K(8, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_l_s, PRIM_INT__l_s_k_s, NULL, PRIM_INT__k_s_l_s, NULL, PRIM_INT__l_s_m_s);


                    ostei_general_vrr_K(9, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_k_s, PRIM_INT__m_s_i_s, NULL, PRIM_INT__l_s_k_s, NULL, PRIM_INT__m_s_l_s);


                    ostei_general_vrr1_I(10, 17,
                            one_over_2p, a_over_p, aop_PQ, P_PA,
                            PRIM_INT__m_s_s_s, PRIM_INT__l_s_s_s, PRIM_INT__n_s_s_s);


                    ostei_general_vrr_K(10, 0, 1, 0, 13,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_s_s, NULL, NULL, PRIM_INT__m_s_s_s, NULL, PRIM_INT__n_s_p_s);


                    ostei_general_vrr_K(10, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_p_s, PRIM_INT__n_s_s_s, NULL, PRIM_INT__m_s_p_s, NULL, PRIM_INT__n_s_d_s);


                    ostei_general_vrr_K(10, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_d_s, PRIM_INT__n_s_p_s, NULL, PRIM_INT__m_s_d_s, NULL, PRIM_INT__n_s_f_s);


                    ostei_general_vrr_K(10, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_f_s, PRIM_INT__n_s_d_s, NULL, PRIM_INT__m_s_f_s, NULL, PRIM_INT__n_s_g_s);


                    ostei_general_vrr_K(10, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_g_s, PRIM_INT__n_s_f_s, NULL, PRIM_INT__m_s_g_s, NULL, PRIM_INT__n_s_h_s);


                    ostei_general_vrr_K(10, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_h_s, PRIM_INT__n_s_g_s, NULL, PRIM_INT__m_s_h_s, NULL, PRIM_INT__n_s_i_s);


                    ostei_general_vrr_K(10, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_i_s, PRIM_INT__n_s_h_s, NULL, PRIM_INT__m_s_i_s, NULL, PRIM_INT__n_s_k_s);



                    // Forming PRIM_INT__s_s_g_s[10 * 15];
                    for(n = 0; n < 10; ++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 + 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 + 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_p_s_h_s(
                            PRIM_INT__p_s_h_s,
                            PRIM_INT__p_s_g_s,
                            PRIM_INT__p_s_f_s,
                            PRIM_INT__s_s_g_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            9);


                    ostei_general_vrr_K(2, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__d_s_h_s, PRIM_INT__d_s_g_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);


                    ostei_general_vrr_K(3, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__f_s_i_s, PRIM_INT__f_s_h_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);


                    ostei_general_vrr_K(4, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__g_s_k_s, PRIM_INT__g_s_i_s, NULL, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_l_s);


                    ostei_general_vrr_K(5, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_l_s, PRIM_INT__h_s_k_s, NULL, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_m_s);


                    ostei_general_vrr_K(6, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_m_s, PRIM_INT__i_s_l_s, NULL, PRIM_INT__h_s_m_s, NULL, PRIM_INT__i_s_n_s);


                    ostei_general_vrr_K(7, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_n_s, PRIM_INT__k_s_m_s, NULL, PRIM_INT__i_s_n_s, NULL, PRIM_INT__k_s_o_s);


                    ostei_general_vrr_K(8, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_m_s, PRIM_INT__l_s_l_s, NULL, PRIM_INT__k_s_m_s, NULL, PRIM_INT__l_s_n_s);


                    ostei_general_vrr_K(9, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_l_s, PRIM_INT__m_s_k_s, NULL, PRIM_INT__l_s_l_s, NULL, PRIM_INT__m_s_m_s);


                    ostei_general_vrr_K(10, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_k_s, PRIM_INT__n_s_i_s, NULL, PRIM_INT__m_s_k_s, NULL, PRIM_INT__n_s_l_s);


                    ostei_general_vrr1_I(11, 16,
                            one_over_2p, a_over_p, aop_PQ, P_PA,
                            PRIM_INT__n_s_s_s, PRIM_INT__m_s_s_s, PRIM_INT__o_s_s_s);


                    ostei_general_vrr_K(11, 0, 1, 0, 13,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_s_s, NULL, NULL, PRIM_INT__n_s_s_s, NULL, PRIM_INT__o_s_p_s);


                    ostei_general_vrr_K(11, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_p_s, PRIM_INT__o_s_s_s, NULL, PRIM_INT__n_s_p_s, NULL, PRIM_INT__o_s_d_s);


                    ostei_general_vrr_K(11, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_d_s, PRIM_INT__o_s_p_s, NULL, PRIM_INT__n_s_d_s, NULL, PRIM_INT__o_s_f_s);


                    ostei_general_vrr_K(11, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_f_s, PRIM_INT__o_s_d_s, NULL, PRIM_INT__n_s_f_s, NULL, PRIM_INT__o_s_g_s);


                    ostei_general_vrr_K(11, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_g_s, PRIM_INT__o_s_f_s, NULL, PRIM_INT__n_s_g_s, NULL, PRIM_INT__o_s_h_s);


                    ostei_general_vrr_K(11, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_h_s, PRIM_INT__o_s_g_s, NULL, PRIM_INT__n_s_h_s, NULL, PRIM_INT__o_s_i_s);


                    ostei_general_vrr_K(11, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_i_s, PRIM_INT__o_s_h_s, NULL, PRIM_INT__n_s_i_s, NULL, PRIM_INT__o_s_k_s);


                    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,
                            9);


                    VRR_K_p_s_i_s(
                            PRIM_INT__p_s_i_s,
                            PRIM_INT__p_s_h_s,
                            PRIM_INT__p_s_g_s,
                            PRIM_INT__s_s_h_s,
                            Q_PA,
                            a_over_q,
                            aoq_PQ,
                            one_over_2pq,
                            one_over_2q,
                            8);


                    ostei_general_vrr_K(2, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__d_s_i_s, PRIM_INT__d_s_h_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);


                    ostei_general_vrr_K(3, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__f_s_k_s, PRIM_INT__f_s_i_s, NULL, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_l_s);


                    ostei_general_vrr_K(4, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__g_s_l_s, PRIM_INT__g_s_k_s, NULL, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_m_s);


                    ostei_general_vrr_K(5, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_m_s, PRIM_INT__h_s_l_s, NULL, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_n_s);


                    ostei_general_vrr_K(6, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_n_s, PRIM_INT__i_s_m_s, NULL, PRIM_INT__h_s_n_s, NULL, PRIM_INT__i_s_o_s);


                    ostei_general_vrr_K(7, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_o_s, PRIM_INT__k_s_n_s, NULL, PRIM_INT__i_s_o_s, NULL, PRIM_INT__k_s_q_s);


                    ostei_general_vrr_K(8, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_n_s, PRIM_INT__l_s_m_s, NULL, PRIM_INT__k_s_n_s, NULL, PRIM_INT__l_s_o_s);


                    ostei_general_vrr_K(9, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_m_s, PRIM_INT__m_s_l_s, NULL, PRIM_INT__l_s_m_s, NULL, PRIM_INT__m_s_n_s);


                    ostei_general_vrr_K(10, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_l_s, PRIM_INT__n_s_k_s, NULL, PRIM_INT__m_s_l_s, NULL, PRIM_INT__n_s_m_s);


                    ostei_general_vrr_K(11, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_k_s, PRIM_INT__o_s_i_s, NULL, PRIM_INT__n_s_k_s, NULL, PRIM_INT__o_s_l_s);


                    ostei_general_vrr1_I(12, 15,
                            one_over_2p, a_over_p, aop_PQ, P_PA,
                            PRIM_INT__o_s_s_s, PRIM_INT__n_s_s_s, PRIM_INT__q_s_s_s);


                    ostei_general_vrr_K(12, 0, 1, 0, 13,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_s_s, NULL, NULL, PRIM_INT__o_s_s_s, NULL, PRIM_INT__q_s_p_s);


                    ostei_general_vrr_K(12, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_p_s, PRIM_INT__q_s_s_s, NULL, PRIM_INT__o_s_p_s, NULL, PRIM_INT__q_s_d_s);


                    ostei_general_vrr_K(12, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_d_s, PRIM_INT__q_s_p_s, NULL, PRIM_INT__o_s_d_s, NULL, PRIM_INT__q_s_f_s);


                    ostei_general_vrr_K(12, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_f_s, PRIM_INT__q_s_d_s, NULL, PRIM_INT__o_s_f_s, NULL, PRIM_INT__q_s_g_s);


                    ostei_general_vrr_K(12, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_g_s, PRIM_INT__q_s_f_s, NULL, PRIM_INT__o_s_g_s, NULL, PRIM_INT__q_s_h_s);


                    ostei_general_vrr_K(12, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_h_s, PRIM_INT__q_s_g_s, NULL, PRIM_INT__o_s_h_s, NULL, PRIM_INT__q_s_i_s);


                    ostei_general_vrr_K(12, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_i_s, PRIM_INT__q_s_h_s, NULL, PRIM_INT__o_s_i_s, NULL, PRIM_INT__q_s_k_s);


                    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,
                            8);


                    ostei_general_vrr_K(1, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__p_s_i_s, PRIM_INT__p_s_h_s, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);


                    ostei_general_vrr_K(2, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__d_s_k_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_l_s);


                    ostei_general_vrr_K(3, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__f_s_l_s, PRIM_INT__f_s_k_s, NULL, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_m_s);


                    ostei_general_vrr_K(4, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__g_s_m_s, PRIM_INT__g_s_l_s, NULL, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_n_s);


                    ostei_general_vrr_K(5, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__h_s_n_s, PRIM_INT__h_s_m_s, NULL, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_o_s);


                    ostei_general_vrr_K(6, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__i_s_o_s, PRIM_INT__i_s_n_s, NULL, PRIM_INT__h_s_o_s, NULL, PRIM_INT__i_s_q_s);


                    ostei_general_vrr_K(7, 0, 13, 0, 1,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__k_s_q_s, PRIM_INT__k_s_o_s, NULL, PRIM_INT__i_s_q_s, NULL, PRIM_INT__k_s_r_s);


                    ostei_general_vrr_K(8, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_o_s, PRIM_INT__l_s_n_s, NULL, PRIM_INT__k_s_o_s, NULL, PRIM_INT__l_s_q_s);


                    ostei_general_vrr_K(9, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_n_s, PRIM_INT__m_s_m_s, NULL, PRIM_INT__l_s_n_s, NULL, PRIM_INT__m_s_o_s);


                    ostei_general_vrr_K(10, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_m_s, PRIM_INT__n_s_l_s, NULL, PRIM_INT__m_s_m_s, NULL, PRIM_INT__n_s_n_s);


                    ostei_general_vrr_K(11, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_l_s, PRIM_INT__o_s_k_s, NULL, PRIM_INT__n_s_l_s, NULL, PRIM_INT__o_s_m_s);


                    ostei_general_vrr_K(12, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_k_s, PRIM_INT__q_s_i_s, NULL, PRIM_INT__o_s_k_s, NULL, PRIM_INT__q_s_l_s);


                    ostei_general_vrr1_I(13, 14,
                            one_over_2p, a_over_p, aop_PQ, P_PA,
                            PRIM_INT__q_s_s_s, PRIM_INT__o_s_s_s, PRIM_INT__r_s_s_s);


                    ostei_general_vrr_K(13, 0, 1, 0, 13,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_s_s, NULL, NULL, PRIM_INT__q_s_s_s, NULL, PRIM_INT__r_s_p_s);


                    ostei_general_vrr_K(13, 0, 2, 0, 12,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_p_s, PRIM_INT__r_s_s_s, NULL, PRIM_INT__q_s_p_s, NULL, PRIM_INT__r_s_d_s);


                    ostei_general_vrr_K(13, 0, 3, 0, 11,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_d_s, PRIM_INT__r_s_p_s, NULL, PRIM_INT__q_s_d_s, NULL, PRIM_INT__r_s_f_s);


                    ostei_general_vrr_K(13, 0, 4, 0, 10,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_f_s, PRIM_INT__r_s_d_s, NULL, PRIM_INT__q_s_f_s, NULL, PRIM_INT__r_s_g_s);


                    ostei_general_vrr_K(13, 0, 5, 0, 9,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_g_s, PRIM_INT__r_s_f_s, NULL, PRIM_INT__q_s_g_s, NULL, PRIM_INT__r_s_h_s);


                    ostei_general_vrr_K(13, 0, 6, 0, 8,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_h_s, PRIM_INT__r_s_g_s, NULL, PRIM_INT__q_s_h_s, NULL, PRIM_INT__r_s_i_s);


                    ostei_general_vrr_K(13, 0, 7, 0, 7,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_i_s, PRIM_INT__r_s_h_s, NULL, PRIM_INT__q_s_i_s, NULL, PRIM_INT__r_s_k_s);


                    ostei_general_vrr_K(8, 0, 13, 0, 1,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__l_s_q_s, PRIM_INT__l_s_o_s, NULL, PRIM_INT__k_s_q_s, NULL, PRIM_INT__l_s_r_s);


                    ostei_general_vrr_K(9, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_o_s, PRIM_INT__m_s_n_s, NULL, PRIM_INT__l_s_o_s, NULL, PRIM_INT__m_s_q_s);


                    ostei_general_vrr_K(10, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_n_s, PRIM_INT__n_s_m_s, NULL, PRIM_INT__m_s_n_s, NULL, PRIM_INT__n_s_o_s);


                    ostei_general_vrr_K(11, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_m_s, PRIM_INT__o_s_l_s, NULL, PRIM_INT__n_s_m_s, NULL, PRIM_INT__o_s_n_s);


                    ostei_general_vrr_K(12, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_l_s, PRIM_INT__q_s_k_s, NULL, PRIM_INT__o_s_l_s, NULL, PRIM_INT__q_s_m_s);


                    ostei_general_vrr_K(13, 0, 8, 0, 6,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_k_s, PRIM_INT__r_s_i_s, NULL, PRIM_INT__q_s_k_s, NULL, PRIM_INT__r_s_l_s);


                    ostei_general_vrr_K(9, 0, 13, 0, 1,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__m_s_q_s, PRIM_INT__m_s_o_s, NULL, PRIM_INT__l_s_q_s, NULL, PRIM_INT__m_s_r_s);


                    ostei_general_vrr_K(10, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_o_s, PRIM_INT__n_s_n_s, NULL, PRIM_INT__m_s_o_s, NULL, PRIM_INT__n_s_q_s);


                    ostei_general_vrr_K(11, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_n_s, PRIM_INT__o_s_m_s, NULL, PRIM_INT__n_s_n_s, NULL, PRIM_INT__o_s_o_s);


                    ostei_general_vrr_K(12, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_m_s, PRIM_INT__q_s_l_s, NULL, PRIM_INT__o_s_m_s, NULL, PRIM_INT__q_s_n_s);


                    ostei_general_vrr_K(13, 0, 9, 0, 5,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_l_s, PRIM_INT__r_s_k_s, NULL, PRIM_INT__q_s_l_s, NULL, PRIM_INT__r_s_m_s);


                    ostei_general_vrr_K(10, 0, 13, 0, 1,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__n_s_q_s, PRIM_INT__n_s_o_s, NULL, PRIM_INT__m_s_q_s, NULL, PRIM_INT__n_s_r_s);


                    ostei_general_vrr_K(11, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_o_s, PRIM_INT__o_s_n_s, NULL, PRIM_INT__n_s_o_s, NULL, PRIM_INT__o_s_q_s);


                    ostei_general_vrr_K(12, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_n_s, PRIM_INT__q_s_m_s, NULL, PRIM_INT__o_s_n_s, NULL, PRIM_INT__q_s_o_s);


                    ostei_general_vrr_K(13, 0, 10, 0, 4,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_m_s, PRIM_INT__r_s_l_s, NULL, PRIM_INT__q_s_m_s, NULL, PRIM_INT__r_s_n_s);


                    ostei_general_vrr_K(11, 0, 13, 0, 1,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__o_s_q_s, PRIM_INT__o_s_o_s, NULL, PRIM_INT__n_s_q_s, NULL, PRIM_INT__o_s_r_s);


                    ostei_general_vrr_K(12, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_o_s, PRIM_INT__q_s_n_s, NULL, PRIM_INT__o_s_o_s, NULL, PRIM_INT__q_s_q_s);


                    ostei_general_vrr_K(13, 0, 11, 0, 3,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_n_s, PRIM_INT__r_s_m_s, NULL, PRIM_INT__q_s_n_s, NULL, PRIM_INT__r_s_o_s);


                    ostei_general_vrr_K(12, 0, 13, 0, 1,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__q_s_q_s, PRIM_INT__q_s_o_s, NULL, PRIM_INT__o_s_q_s, NULL, PRIM_INT__q_s_r_s);


                    ostei_general_vrr_K(13, 0, 12, 0, 2,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_o_s, PRIM_INT__r_s_n_s, NULL, PRIM_INT__q_s_o_s, NULL, PRIM_INT__r_s_q_s);


                    ostei_general_vrr_K(13, 0, 13, 0, 1,
                            one_over_2q, a_over_q, one_over_2pq, aoq_PQ, Q_PA,
                            PRIM_INT__r_s_q_s, PRIM_INT__r_s_o_s, NULL, PRIM_INT__q_s_q_s, NULL, PRIM_INT__r_s_r_s);




                    ////////////////////////////////////
                    // Accumulate contracted integrals
                    ////////////////////////////////////
                    if(lastoffset == 0)
                    {
                        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(3780, PRIM_INT__k_s_r_s, PRIM_PTR_INT__k_s_r_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(4725, PRIM_INT__l_s_r_s, PRIM_PTR_INT__l_s_r_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);
                        contract_all(5775, PRIM_INT__m_s_r_s, PRIM_PTR_INT__m_s_r_s);
                        contract_all(2376, PRIM_INT__n_s_k_s, PRIM_PTR_INT__n_s_k_s);
                        contract_all(2970, PRIM_INT__n_s_l_s, PRIM_PTR_INT__n_s_l_s);
                        contract_all(3630, PRIM_INT__n_s_m_s, PRIM_PTR_INT__n_s_m_s);
                        contract_all(4356, PRIM_INT__n_s_n_s, PRIM_PTR_INT__n_s_n_s);
                        contract_all(5148, PRIM_INT__n_s_o_s, PRIM_PTR_INT__n_s_o_s);
                        contract_all(6006, PRIM_INT__n_s_q_s, PRIM_PTR_INT__n_s_q_s);
                        contract_all(6930, PRIM_INT__n_s_r_s, PRIM_PTR_INT__n_s_r_s);
                        contract_all(2808, PRIM_INT__o_s_k_s, PRIM_PTR_INT__o_s_k_s);
                        contract_all(3510, PRIM_INT__o_s_l_s, PRIM_PTR_INT__o_s_l_s);
                        contract_all(4290, PRIM_INT__o_s_m_s, PRIM_PTR_INT__o_s_m_s);
                        contract_all(5148, PRIM_INT__o_s_n_s, PRIM_PTR_INT__o_s_n_s);
                        contract_all(6084, PRIM_INT__o_s_o_s, PRIM_PTR_INT__o_s_o_s);
                        contract_all(7098, PRIM_INT__o_s_q_s, PRIM_PTR_INT__o_s_q_s);
                        contract_all(8190, PRIM_INT__o_s_r_s, PRIM_PTR_INT__o_s_r_s);
                        contract_all(3276, PRIM_INT__q_s_k_s, PRIM_PTR_INT__q_s_k_s);
                        contract_all(4095, PRIM_INT__q_s_l_s, PRIM_PTR_INT__q_s_l_s);
                        contract_all(5005, PRIM_INT__q_s_m_s, PRIM_PTR_INT__q_s_m_s);
                        contract_all(6006, PRIM_INT__q_s_n_s, PRIM_PTR_INT__q_s_n_s);
                        contract_all(7098, PRIM_INT__q_s_o_s, PRIM_PTR_INT__q_s_o_s);
                        contract_all(8281, PRIM_INT__q_s_q_s, PRIM_PTR_INT__q_s_q_s);
                        contract_all(9555, PRIM_INT__q_s_r_s, PRIM_PTR_INT__q_s_r_s);
                        contract_all(3780, PRIM_INT__r_s_k_s, PRIM_PTR_INT__r_s_k_s);
                        contract_all(4725, PRIM_INT__r_s_l_s, PRIM_PTR_INT__r_s_l_s);
                        contract_all(5775, PRIM_INT__r_s_m_s, PRIM_PTR_INT__r_s_m_s);
                        contract_all(6930, PRIM_INT__r_s_n_s, PRIM_PTR_INT__r_s_n_s);
                        contract_all(8190, PRIM_INT__r_s_o_s, PRIM_PTR_INT__r_s_o_s);
                        contract_all(9555, PRIM_INT__r_s_q_s, PRIM_PTR_INT__r_s_q_s);
                        contract_all(11025, PRIM_INT__r_s_r_s, PRIM_PTR_INT__r_s_r_s);
                    }
                    else
                    {
                        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(3780, shelloffsets, PRIM_INT__k_s_r_s, PRIM_PTR_INT__k_s_r_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(4725, shelloffsets, PRIM_INT__l_s_r_s, PRIM_PTR_INT__l_s_r_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);
                        contract(5775, shelloffsets, PRIM_INT__m_s_r_s, PRIM_PTR_INT__m_s_r_s);
                        contract(2376, shelloffsets, PRIM_INT__n_s_k_s, PRIM_PTR_INT__n_s_k_s);
                        contract(2970, shelloffsets, PRIM_INT__n_s_l_s, PRIM_PTR_INT__n_s_l_s);
                        contract(3630, shelloffsets, PRIM_INT__n_s_m_s, PRIM_PTR_INT__n_s_m_s);
                        contract(4356, shelloffsets, PRIM_INT__n_s_n_s, PRIM_PTR_INT__n_s_n_s);
                        contract(5148, shelloffsets, PRIM_INT__n_s_o_s, PRIM_PTR_INT__n_s_o_s);
                        contract(6006, shelloffsets, PRIM_INT__n_s_q_s, PRIM_PTR_INT__n_s_q_s);
                        contract(6930, shelloffsets, PRIM_INT__n_s_r_s, PRIM_PTR_INT__n_s_r_s);
                        contract(2808, shelloffsets, PRIM_INT__o_s_k_s, PRIM_PTR_INT__o_s_k_s);
                        contract(3510, shelloffsets, PRIM_INT__o_s_l_s, PRIM_PTR_INT__o_s_l_s);
                        contract(4290, shelloffsets, PRIM_INT__o_s_m_s, PRIM_PTR_INT__o_s_m_s);
                        contract(5148, shelloffsets, PRIM_INT__o_s_n_s, PRIM_PTR_INT__o_s_n_s);
                        contract(6084, shelloffsets, PRIM_INT__o_s_o_s, PRIM_PTR_INT__o_s_o_s);
                        contract(7098, shelloffsets, PRIM_INT__o_s_q_s, PRIM_PTR_INT__o_s_q_s);
                        contract(8190, shelloffsets, PRIM_INT__o_s_r_s, PRIM_PTR_INT__o_s_r_s);
                        contract(3276, shelloffsets, PRIM_INT__q_s_k_s, PRIM_PTR_INT__q_s_k_s);
                        contract(4095, shelloffsets, PRIM_INT__q_s_l_s, PRIM_PTR_INT__q_s_l_s);
                        contract(5005, shelloffsets, PRIM_INT__q_s_m_s, PRIM_PTR_INT__q_s_m_s);
                        contract(6006, shelloffsets, PRIM_INT__q_s_n_s, PRIM_PTR_INT__q_s_n_s);
                        contract(7098, shelloffsets, PRIM_INT__q_s_o_s, PRIM_PTR_INT__q_s_o_s);
                        contract(8281, shelloffsets, PRIM_INT__q_s_q_s, PRIM_PTR_INT__q_s_q_s);
                        contract(9555, shelloffsets, PRIM_INT__q_s_r_s, PRIM_PTR_INT__q_s_r_s);
                        contract(3780, shelloffsets, PRIM_INT__r_s_k_s, PRIM_PTR_INT__r_s_k_s);
                        contract(4725, shelloffsets, PRIM_INT__r_s_l_s, PRIM_PTR_INT__r_s_l_s);
                        contract(5775, shelloffsets, PRIM_INT__r_s_m_s, PRIM_PTR_INT__r_s_m_s);
                        contract(6930, shelloffsets, PRIM_INT__r_s_n_s, PRIM_PTR_INT__r_s_n_s);
                        contract(8190, shelloffsets, PRIM_INT__r_s_o_s, PRIM_PTR_INT__r_s_o_s);
                        contract(9555, shelloffsets, PRIM_INT__r_s_q_s, PRIM_PTR_INT__r_s_q_s);
                        contract(11025, shelloffsets, PRIM_INT__r_s_r_s, PRIM_PTR_INT__r_s_r_s);
                        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__k_s_r_s += lastoffset*3780;
                        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__l_s_r_s += lastoffset*4725;
                        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;
                        PRIM_PTR_INT__m_s_r_s += lastoffset*5775;
                        PRIM_PTR_INT__n_s_k_s += lastoffset*2376;
                        PRIM_PTR_INT__n_s_l_s += lastoffset*2970;
                        PRIM_PTR_INT__n_s_m_s += lastoffset*3630;
                        PRIM_PTR_INT__n_s_n_s += lastoffset*4356;
                        PRIM_PTR_INT__n_s_o_s += lastoffset*5148;
                        PRIM_PTR_INT__n_s_q_s += lastoffset*6006;
                        PRIM_PTR_INT__n_s_r_s += lastoffset*6930;
                        PRIM_PTR_INT__o_s_k_s += lastoffset*2808;
                        PRIM_PTR_INT__o_s_l_s += lastoffset*3510;
                        PRIM_PTR_INT__o_s_m_s += lastoffset*4290;
                        PRIM_PTR_INT__o_s_n_s += lastoffset*5148;
                        PRIM_PTR_INT__o_s_o_s += lastoffset*6084;
                        PRIM_PTR_INT__o_s_q_s += lastoffset*7098;
                        PRIM_PTR_INT__o_s_r_s += lastoffset*8190;
                        PRIM_PTR_INT__q_s_k_s += lastoffset*3276;
                        PRIM_PTR_INT__q_s_l_s += lastoffset*4095;
                        PRIM_PTR_INT__q_s_m_s += lastoffset*5005;
                        PRIM_PTR_INT__q_s_n_s += lastoffset*6006;
                        PRIM_PTR_INT__q_s_o_s += lastoffset*7098;
                        PRIM_PTR_INT__q_s_q_s += lastoffset*8281;
                        PRIM_PTR_INT__q_s_r_s += lastoffset*9555;
                        PRIM_PTR_INT__r_s_k_s += lastoffset*3780;
                        PRIM_PTR_INT__r_s_l_s += lastoffset*4725;
                        PRIM_PTR_INT__r_s_m_s += lastoffset*5775;
                        PRIM_PTR_INT__r_s_n_s += lastoffset*6930;
                        PRIM_PTR_INT__r_s_o_s += lastoffset*8190;
                        PRIM_PTR_INT__r_s_q_s += lastoffset*9555;
                        PRIM_PTR_INT__r_s_r_s += lastoffset*11025;
                    }

                }  // 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__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__k_s_r_s = INT__k_s_r_s + abcd * 3780;
                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__l_s_r_s = INT__l_s_r_s + abcd * 4725;
                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 const * restrict HRR_INT__m_s_r_s = INT__m_s_r_s + abcd * 5775;
                double const * restrict HRR_INT__n_s_k_s = INT__n_s_k_s + abcd * 2376;
                double const * restrict HRR_INT__n_s_l_s = INT__n_s_l_s + abcd * 2970;
                double const * restrict HRR_INT__n_s_m_s = INT__n_s_m_s + abcd * 3630;
                double const * restrict HRR_INT__n_s_n_s = INT__n_s_n_s + abcd * 4356;
                double const * restrict HRR_INT__n_s_o_s = INT__n_s_o_s + abcd * 5148;
                double const * restrict HRR_INT__n_s_q_s = INT__n_s_q_s + abcd * 6006;
                double const * restrict HRR_INT__n_s_r_s = INT__n_s_r_s + abcd * 6930;
                double const * restrict HRR_INT__o_s_k_s = INT__o_s_k_s + abcd * 2808;
                double const * restrict HRR_INT__o_s_l_s = INT__o_s_l_s + abcd * 3510;
                double const * restrict HRR_INT__o_s_m_s = INT__o_s_m_s + abcd * 4290;
                double const * restrict HRR_INT__o_s_n_s = INT__o_s_n_s + abcd * 5148;
                double const * restrict HRR_INT__o_s_o_s = INT__o_s_o_s + abcd * 6084;
                double const * restrict HRR_INT__o_s_q_s = INT__o_s_q_s + abcd * 7098;
                double const * restrict HRR_INT__o_s_r_s = INT__o_s_r_s + abcd * 8190;
                double const * restrict HRR_INT__q_s_k_s = INT__q_s_k_s + abcd * 3276;
                double const * restrict HRR_INT__q_s_l_s = INT__q_s_l_s + abcd * 4095;
                double const * restrict HRR_INT__q_s_m_s = INT__q_s_m_s + abcd * 5005;
                double const * restrict HRR_INT__q_s_n_s = INT__q_s_n_s + abcd * 6006;
                double const * restrict HRR_INT__q_s_o_s = INT__q_s_o_s + abcd * 7098;
                double const * restrict HRR_INT__q_s_q_s = INT__q_s_q_s + abcd * 8281;
                double const * restrict HRR_INT__q_s_r_s = INT__q_s_r_s + abcd * 9555;
                double const * restrict HRR_INT__r_s_k_s = INT__r_s_k_s + abcd * 3780;
                double const * restrict HRR_INT__r_s_l_s = INT__r_s_l_s + abcd * 4725;
                double const * restrict HRR_INT__r_s_m_s = INT__r_s_m_s + abcd * 5775;
                double const * restrict HRR_INT__r_s_n_s = INT__r_s_n_s + abcd * 6930;
                double const * restrict HRR_INT__r_s_o_s = INT__r_s_o_s + abcd * 8190;
                double const * restrict HRR_INT__r_s_q_s = INT__r_s_q_s + abcd * 9555;
                double const * restrict HRR_INT__r_s_r_s = INT__r_s_r_s + abcd * 11025;
                double * restrict HRR_INT__k_i_k_i = INT__k_i_k_i + real_abcd * 1016064;

                // 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__k_p_r_s
                HRR_J_k_p(
                    HRR_INT__k_p_r_s,
                    HRR_INT__k_s_r_s,
                    HRR_INT__l_s_r_s,
                    hAB, 105);

                // 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__l_p_r_s
                HRR_J_l_p(
                    HRR_INT__l_p_r_s,
                    HRR_INT__l_s_r_s,
                    HRR_INT__m_s_r_s,
                    hAB, 105);

                // form INT__m_p_k_s
                ostei_general_hrr_J(9, 1, 7, 0, hAB, HRR_INT__n_s_k_s, HRR_INT__m_s_k_s, HRR_INT__m_p_k_s);

                // form INT__m_p_l_s
                ostei_general_hrr_J(9, 1, 8, 0, hAB, HRR_INT__n_s_l_s, HRR_INT__m_s_l_s, HRR_INT__m_p_l_s);

                // form INT__m_p_m_s
                ostei_general_hrr_J(9, 1, 9, 0, hAB, HRR_INT__n_s_m_s, HRR_INT__m_s_m_s, HRR_INT__m_p_m_s);

                // form INT__m_p_n_s
                ostei_general_hrr_J(9, 1, 10, 0, hAB, HRR_INT__n_s_n_s, HRR_INT__m_s_n_s, HRR_INT__m_p_n_s);

                // form INT__m_p_o_s
                ostei_general_hrr_J(9, 1, 11, 0, hAB, HRR_INT__n_s_o_s, HRR_INT__m_s_o_s, HRR_INT__m_p_o_s);

                // form INT__m_p_q_s
                ostei_general_hrr_J(9, 1, 12, 0, hAB, HRR_INT__n_s_q_s, HRR_INT__m_s_q_s, HRR_INT__m_p_q_s);

                // form INT__m_p_r_s
                ostei_general_hrr_J(9, 1, 13, 0, hAB, HRR_INT__n_s_r_s, HRR_INT__m_s_r_s, HRR_INT__m_p_r_s);

                // form INT__n_p_k_s
                ostei_general_hrr_J(10, 1, 7, 0, hAB, HRR_INT__o_s_k_s, HRR_INT__n_s_k_s, HRR_INT__n_p_k_s);

                // form INT__n_p_l_s
                ostei_general_hrr_J(10, 1, 8, 0, hAB, HRR_INT__o_s_l_s, HRR_INT__n_s_l_s, HRR_INT__n_p_l_s);

                // form INT__n_p_m_s
                ostei_general_hrr_J(10, 1, 9, 0, hAB, HRR_INT__o_s_m_s, HRR_INT__n_s_m_s, HRR_INT__n_p_m_s);

                // form INT__n_p_n_s
                ostei_general_hrr_J(10, 1, 10, 0, hAB, HRR_INT__o_s_n_s, HRR_INT__n_s_n_s, HRR_INT__n_p_n_s);

                // form INT__n_p_o_s
                ostei_general_hrr_J(10, 1, 11, 0, hAB, HRR_INT__o_s_o_s, HRR_INT__n_s_o_s, HRR_INT__n_p_o_s);

                // form INT__n_p_q_s
                ostei_general_hrr_J(10, 1, 12, 0, hAB, HRR_INT__o_s_q_s, HRR_INT__n_s_q_s, HRR_INT__n_p_q_s);

                // form INT__n_p_r_s
                ostei_general_hrr_J(10, 1, 13, 0, hAB, HRR_INT__o_s_r_s, HRR_INT__n_s_r_s, HRR_INT__n_p_r_s);

                // form INT__o_p_k_s
                ostei_general_hrr_J(11, 1, 7, 0, hAB, HRR_INT__q_s_k_s, HRR_INT__o_s_k_s, HRR_INT__o_p_k_s);

                // form INT__o_p_l_s
                ostei_general_hrr_J(11, 1, 8, 0, hAB, HRR_INT__q_s_l_s, HRR_INT__o_s_l_s, HRR_INT__o_p_l_s);

                // form INT__o_p_m_s
                ostei_general_hrr_J(11, 1, 9, 0, hAB, HRR_INT__q_s_m_s, HRR_INT__o_s_m_s, HRR_INT__o_p_m_s);

                // form INT__o_p_n_s
                ostei_general_hrr_J(11, 1, 10, 0, hAB, HRR_INT__q_s_n_s, HRR_INT__o_s_n_s, HRR_INT__o_p_n_s);

                // form INT__o_p_o_s
                ostei_general_hrr_J(11, 1, 11, 0, hAB, HRR_INT__q_s_o_s, HRR_INT__o_s_o_s, HRR_INT__o_p_o_s);

                // form INT__o_p_q_s
                ostei_general_hrr_J(11, 1, 12, 0, hAB, HRR_INT__q_s_q_s, HRR_INT__o_s_q_s, HRR_INT__o_p_q_s);

                // form INT__o_p_r_s
                ostei_general_hrr_J(11, 1, 13, 0, hAB, HRR_INT__q_s_r_s, HRR_INT__o_s_r_s, HRR_INT__o_p_r_s);

                // form INT__q_p_k_s
                ostei_general_hrr_J(12, 1, 7, 0, hAB, HRR_INT__r_s_k_s, HRR_INT__q_s_k_s, HRR_INT__q_p_k_s);

                // form INT__q_p_l_s
                ostei_general_hrr_J(12, 1, 8, 0, hAB, HRR_INT__r_s_l_s, HRR_INT__q_s_l_s, HRR_INT__q_p_l_s);

                // form INT__q_p_m_s
                ostei_general_hrr_J(12, 1, 9, 0, hAB, HRR_INT__r_s_m_s, HRR_INT__q_s_m_s, HRR_INT__q_p_m_s);

                // form INT__q_p_n_s
                ostei_general_hrr_J(12, 1, 10, 0, hAB, HRR_INT__r_s_n_s, HRR_INT__q_s_n_s, HRR_INT__q_p_n_s);

                // form INT__q_p_o_s
                ostei_general_hrr_J(12, 1, 11, 0, hAB, HRR_INT__r_s_o_s, HRR_INT__q_s_o_s, HRR_INT__q_p_o_s);

                // form INT__q_p_q_s
                ostei_general_hrr_J(12, 1, 12, 0, hAB, HRR_INT__r_s_q_s, HRR_INT__q_s_q_s, HRR_INT__q_p_q_s);

                // form INT__q_p_r_s
                ostei_general_hrr_J(12, 1, 13, 0, hAB, HRR_INT__r_s_r_s, HRR_INT__q_s_r_s, HRR_INT__q_p_r_s);

                // 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__k_d_r_s
                HRR_J_k_d(
                    HRR_INT__k_d_r_s,
                    HRR_INT__k_p_r_s,
                    HRR_INT__l_p_r_s,
                    hAB, 105);

                // form INT__l_d_k_s
                ostei_general_hrr_J(8, 2, 7, 0, hAB, HRR_INT__m_p_k_s, HRR_INT__l_p_k_s, HRR_INT__l_d_k_s);

                // form INT__l_d_l_s
                ostei_general_hrr_J(8, 2, 8, 0, hAB, HRR_INT__m_p_l_s, HRR_INT__l_p_l_s, HRR_INT__l_d_l_s);

                // form INT__l_d_m_s
                ostei_general_hrr_J(8, 2, 9, 0, hAB, HRR_INT__m_p_m_s, HRR_INT__l_p_m_s, HRR_INT__l_d_m_s);

                // form INT__l_d_n_s
                ostei_general_hrr_J(8, 2, 10, 0, hAB, HRR_INT__m_p_n_s, HRR_INT__l_p_n_s, HRR_INT__l_d_n_s);

                // form INT__l_d_o_s
                ostei_general_hrr_J(8, 2, 11, 0, hAB, HRR_INT__m_p_o_s, HRR_INT__l_p_o_s, HRR_INT__l_d_o_s);

                // form INT__l_d_q_s
                ostei_general_hrr_J(8, 2, 12, 0, hAB, HRR_INT__m_p_q_s, HRR_INT__l_p_q_s, HRR_INT__l_d_q_s);

                // form INT__l_d_r_s
                ostei_general_hrr_J(8, 2, 13, 0, hAB, HRR_INT__m_p_r_s, HRR_INT__l_p_r_s, HRR_INT__l_d_r_s);

                // form INT__m_d_k_s
                ostei_general_hrr_J(9, 2, 7, 0, hAB, HRR_INT__n_p_k_s, HRR_INT__m_p_k_s, HRR_INT__m_d_k_s);

                // form INT__m_d_l_s
                ostei_general_hrr_J(9, 2, 8, 0, hAB, HRR_INT__n_p_l_s, HRR_INT__m_p_l_s, HRR_INT__m_d_l_s);

                // form INT__m_d_m_s
                ostei_general_hrr_J(9, 2, 9, 0, hAB, HRR_INT__n_p_m_s, HRR_INT__m_p_m_s, HRR_INT__m_d_m_s);

                // form INT__m_d_n_s
                ostei_general_hrr_J(9, 2, 10, 0, hAB, HRR_INT__n_p_n_s, HRR_INT__m_p_n_s, HRR_INT__m_d_n_s);

                // form INT__m_d_o_s
                ostei_general_hrr_J(9, 2, 11, 0, hAB, HRR_INT__n_p_o_s, HRR_INT__m_p_o_s, HRR_INT__m_d_o_s);

                // form INT__m_d_q_s
                ostei_general_hrr_J(9, 2, 12, 0, hAB, HRR_INT__n_p_q_s, HRR_INT__m_p_q_s, HRR_INT__m_d_q_s);

                // form INT__m_d_r_s
                ostei_general_hrr_J(9, 2, 13, 0, hAB, HRR_INT__n_p_r_s, HRR_INT__m_p_r_s, HRR_INT__m_d_r_s);

                // form INT__n_d_k_s
                ostei_general_hrr_J(10, 2, 7, 0, hAB, HRR_INT__o_p_k_s, HRR_INT__n_p_k_s, HRR_INT__n_d_k_s);

                // form INT__n_d_l_s
                ostei_general_hrr_J(10, 2, 8, 0, hAB, HRR_INT__o_p_l_s, HRR_INT__n_p_l_s, HRR_INT__n_d_l_s);

                // form INT__n_d_m_s
                ostei_general_hrr_J(10, 2, 9, 0, hAB, HRR_INT__o_p_m_s, HRR_INT__n_p_m_s, HRR_INT__n_d_m_s);

                // form INT__n_d_n_s
                ostei_general_hrr_J(10, 2, 10, 0, hAB, HRR_INT__o_p_n_s, HRR_INT__n_p_n_s, HRR_INT__n_d_n_s);

                // form INT__n_d_o_s
                ostei_general_hrr_J(10, 2, 11, 0, hAB, HRR_INT__o_p_o_s, HRR_INT__n_p_o_s, HRR_INT__n_d_o_s);

                // form INT__n_d_q_s
                ostei_general_hrr_J(10, 2, 12, 0, hAB, HRR_INT__o_p_q_s, HRR_INT__n_p_q_s, HRR_INT__n_d_q_s);

                // form INT__n_d_r_s
                ostei_general_hrr_J(10, 2, 13, 0, hAB, HRR_INT__o_p_r_s, HRR_INT__n_p_r_s, HRR_INT__n_d_r_s);

                // form INT__o_d_k_s
                ostei_general_hrr_J(11, 2, 7, 0, hAB, HRR_INT__q_p_k_s, HRR_INT__o_p_k_s, HRR_INT__o_d_k_s);

                // form INT__o_d_l_s
                ostei_general_hrr_J(11, 2, 8, 0, hAB, HRR_INT__q_p_l_s, HRR_INT__o_p_l_s, HRR_INT__o_d_l_s);

                // form INT__o_d_m_s
                ostei_general_hrr_J(11, 2, 9, 0, hAB, HRR_INT__q_p_m_s, HRR_INT__o_p_m_s, HRR_INT__o_d_m_s);

                // form INT__o_d_n_s
                ostei_general_hrr_J(11, 2, 10, 0, hAB, HRR_INT__q_p_n_s, HRR_INT__o_p_n_s, HRR_INT__o_d_n_s);

                // form INT__o_d_o_s
                ostei_general_hrr_J(11, 2, 11, 0, hAB, HRR_INT__q_p_o_s, HRR_INT__o_p_o_s, HRR_INT__o_d_o_s);

                // form INT__o_d_q_s
                ostei_general_hrr_J(11, 2, 12, 0, hAB, HRR_INT__q_p_q_s, HRR_INT__o_p_q_s, HRR_INT__o_d_q_s);

                // form INT__o_d_r_s
                ostei_general_hrr_J(11, 2, 13, 0, hAB, HRR_INT__q_p_r_s, HRR_INT__o_p_r_s, HRR_INT__o_d_r_s);

                // form INT__k_f_k_s
                ostei_general_hrr_J(7, 3, 7, 0, hAB, HRR_INT__l_d_k_s, HRR_INT__k_d_k_s, HRR_INT__k_f_k_s);

                // form INT__k_f_l_s
                ostei_general_hrr_J(7, 3, 8, 0, hAB, HRR_INT__l_d_l_s, HRR_INT__k_d_l_s, HRR_INT__k_f_l_s);

                // form INT__k_f_m_s
                ostei_general_hrr_J(7, 3, 9, 0, hAB, HRR_INT__l_d_m_s, HRR_INT__k_d_m_s, HRR_INT__k_f_m_s);

                // form INT__k_f_n_s
                ostei_general_hrr_J(7, 3, 10, 0, hAB, HRR_INT__l_d_n_s, HRR_INT__k_d_n_s, HRR_INT__k_f_n_s);

                // form INT__k_f_o_s
                ostei_general_hrr_J(7, 3, 11, 0, hAB, HRR_INT__l_d_o_s, HRR_INT__k_d_o_s, HRR_INT__k_f_o_s);

                // form INT__k_f_q_s
                ostei_general_hrr_J(7, 3, 12, 0, hAB, HRR_INT__l_d_q_s, HRR_INT__k_d_q_s, HRR_INT__k_f_q_s);

                // form INT__k_f_r_s
                ostei_general_hrr_J(7, 3, 13, 0, hAB, HRR_INT__l_d_r_s, HRR_INT__k_d_r_s, HRR_INT__k_f_r_s);

                // form INT__l_f_k_s
                ostei_general_hrr_J(8, 3, 7, 0, hAB, HRR_INT__m_d_k_s, HRR_INT__l_d_k_s, HRR_INT__l_f_k_s);

                // form INT__l_f_l_s
                ostei_general_hrr_J(8, 3, 8, 0, hAB, HRR_INT__m_d_l_s, HRR_INT__l_d_l_s, HRR_INT__l_f_l_s);

                // form INT__l_f_m_s
                ostei_general_hrr_J(8, 3, 9, 0, hAB, HRR_INT__m_d_m_s, HRR_INT__l_d_m_s, HRR_INT__l_f_m_s);

                // form INT__l_f_n_s
                ostei_general_hrr_J(8, 3, 10, 0, hAB, HRR_INT__m_d_n_s, HRR_INT__l_d_n_s, HRR_INT__l_f_n_s);

                // form INT__l_f_o_s
                ostei_general_hrr_J(8, 3, 11, 0, hAB, HRR_INT__m_d_o_s, HRR_INT__l_d_o_s, HRR_INT__l_f_o_s);

                // form INT__l_f_q_s
                ostei_general_hrr_J(8, 3, 12, 0, hAB, HRR_INT__m_d_q_s, HRR_INT__l_d_q_s, HRR_INT__l_f_q_s);

                // form INT__l_f_r_s
                ostei_general_hrr_J(8, 3, 13, 0, hAB, HRR_INT__m_d_r_s, HRR_INT__l_d_r_s, HRR_INT__l_f_r_s);

                // form INT__m_f_k_s
                ostei_general_hrr_J(9, 3, 7, 0, hAB, HRR_INT__n_d_k_s, HRR_INT__m_d_k_s, HRR_INT__m_f_k_s);

                // form INT__m_f_l_s
                ostei_general_hrr_J(9, 3, 8, 0, hAB, HRR_INT__n_d_l_s, HRR_INT__m_d_l_s, HRR_INT__m_f_l_s);

                // form INT__m_f_m_s
                ostei_general_hrr_J(9, 3, 9, 0, hAB, HRR_INT__n_d_m_s, HRR_INT__m_d_m_s, HRR_INT__m_f_m_s);

                // form INT__m_f_n_s
                ostei_general_hrr_J(9, 3, 10, 0, hAB, HRR_INT__n_d_n_s, HRR_INT__m_d_n_s, HRR_INT__m_f_n_s);

                // form INT__m_f_o_s
                ostei_general_hrr_J(9, 3, 11, 0, hAB, HRR_INT__n_d_o_s, HRR_INT__m_d_o_s, HRR_INT__m_f_o_s);

                // form INT__m_f_q_s
                ostei_general_hrr_J(9, 3, 12, 0, hAB, HRR_INT__n_d_q_s, HRR_INT__m_d_q_s, HRR_INT__m_f_q_s);

                // form INT__m_f_r_s
                ostei_general_hrr_J(9, 3, 13, 0, hAB, HRR_INT__n_d_r_s, HRR_INT__m_d_r_s, HRR_INT__m_f_r_s);

                // form INT__n_f_k_s
                ostei_general_hrr_J(10, 3, 7, 0, hAB, HRR_INT__o_d_k_s, HRR_INT__n_d_k_s, HRR_INT__n_f_k_s);

                // form INT__n_f_l_s
                ostei_general_hrr_J(10, 3, 8, 0, hAB, HRR_INT__o_d_l_s, HRR_INT__n_d_l_s, HRR_INT__n_f_l_s);

                // form INT__n_f_m_s
                ostei_general_hrr_J(10, 3, 9, 0, hAB, HRR_INT__o_d_m_s, HRR_INT__n_d_m_s, HRR_INT__n_f_m_s);

                // form INT__n_f_n_s
                ostei_general_hrr_J(10, 3, 10, 0, hAB, HRR_INT__o_d_n_s, HRR_INT__n_d_n_s, HRR_INT__n_f_n_s);

                // form INT__n_f_o_s
                ostei_general_hrr_J(10, 3, 11, 0, hAB, HRR_INT__o_d_o_s, HRR_INT__n_d_o_s, HRR_INT__n_f_o_s);

                // form INT__n_f_q_s
                ostei_general_hrr_J(10, 3, 12, 0, hAB, HRR_INT__o_d_q_s, HRR_INT__n_d_q_s, HRR_INT__n_f_q_s);

                // form INT__n_f_r_s
                ostei_general_hrr_J(10, 3, 13, 0, hAB, HRR_INT__o_d_r_s, HRR_INT__n_d_r_s, HRR_INT__n_f_r_s);

                // form INT__k_g_k_s
                ostei_general_hrr_J(7, 4, 7, 0, hAB, HRR_INT__l_f_k_s, HRR_INT__k_f_k_s, HRR_INT__k_g_k_s);

                // form INT__k_g_l_s
                ostei_general_hrr_J(7, 4, 8, 0, hAB, HRR_INT__l_f_l_s, HRR_INT__k_f_l_s, HRR_INT__k_g_l_s);

                // form INT__k_g_m_s
                ostei_general_hrr_J(7, 4, 9, 0, hAB, HRR_INT__l_f_m_s, HRR_INT__k_f_m_s, HRR_INT__k_g_m_s);

                // form INT__k_g_n_s
                ostei_general_hrr_J(7, 4, 10, 0, hAB, HRR_INT__l_f_n_s, HRR_INT__k_f_n_s, HRR_INT__k_g_n_s);

                // form INT__k_g_o_s
                ostei_general_hrr_J(7, 4, 11, 0, hAB, HRR_INT__l_f_o_s, HRR_INT__k_f_o_s, HRR_INT__k_g_o_s);

                // form INT__k_g_q_s
                ostei_general_hrr_J(7, 4, 12, 0, hAB, HRR_INT__l_f_q_s, HRR_INT__k_f_q_s, HRR_INT__k_g_q_s);

                // form INT__k_g_r_s
                ostei_general_hrr_J(7, 4, 13, 0, hAB, HRR_INT__l_f_r_s, HRR_INT__k_f_r_s, HRR_INT__k_g_r_s);

                // form INT__l_g_k_s
                ostei_general_hrr_J(8, 4, 7, 0, hAB, HRR_INT__m_f_k_s, HRR_INT__l_f_k_s, HRR_INT__l_g_k_s);

                // form INT__l_g_l_s
                ostei_general_hrr_J(8, 4, 8, 0, hAB, HRR_INT__m_f_l_s, HRR_INT__l_f_l_s, HRR_INT__l_g_l_s);

                // form INT__l_g_m_s
                ostei_general_hrr_J(8, 4, 9, 0, hAB, HRR_INT__m_f_m_s, HRR_INT__l_f_m_s, HRR_INT__l_g_m_s);

                // form INT__l_g_n_s
                ostei_general_hrr_J(8, 4, 10, 0, hAB, HRR_INT__m_f_n_s, HRR_INT__l_f_n_s, HRR_INT__l_g_n_s);

                // form INT__l_g_o_s
                ostei_general_hrr_J(8, 4, 11, 0, hAB, HRR_INT__m_f_o_s, HRR_INT__l_f_o_s, HRR_INT__l_g_o_s);

                // form INT__l_g_q_s
                ostei_general_hrr_J(8, 4, 12, 0, hAB, HRR_INT__m_f_q_s, HRR_INT__l_f_q_s, HRR_INT__l_g_q_s);

                // form INT__l_g_r_s
                ostei_general_hrr_J(8, 4, 13, 0, hAB, HRR_INT__m_f_r_s, HRR_INT__l_f_r_s, HRR_INT__l_g_r_s);

                // form INT__m_g_k_s
                ostei_general_hrr_J(9, 4, 7, 0, hAB, HRR_INT__n_f_k_s, HRR_INT__m_f_k_s, HRR_INT__m_g_k_s);

                // form INT__m_g_l_s
                ostei_general_hrr_J(9, 4, 8, 0, hAB, HRR_INT__n_f_l_s, HRR_INT__m_f_l_s, HRR_INT__m_g_l_s);

                // form INT__m_g_m_s
                ostei_general_hrr_J(9, 4, 9, 0, hAB, HRR_INT__n_f_m_s, HRR_INT__m_f_m_s, HRR_INT__m_g_m_s);

                // form INT__m_g_n_s
                ostei_general_hrr_J(9, 4, 10, 0, hAB, HRR_INT__n_f_n_s, HRR_INT__m_f_n_s, HRR_INT__m_g_n_s);

                // form INT__m_g_o_s
                ostei_general_hrr_J(9, 4, 11, 0, hAB, HRR_INT__n_f_o_s, HRR_INT__m_f_o_s, HRR_INT__m_g_o_s);

                // form INT__m_g_q_s
                ostei_general_hrr_J(9, 4, 12, 0, hAB, HRR_INT__n_f_q_s, HRR_INT__m_f_q_s, HRR_INT__m_g_q_s);

                // form INT__m_g_r_s
                ostei_general_hrr_J(9, 4, 13, 0, hAB, HRR_INT__n_f_r_s, HRR_INT__m_f_r_s, HRR_INT__m_g_r_s);

                // form INT__k_h_k_s
                ostei_general_hrr_J(7, 5, 7, 0, hAB, HRR_INT__l_g_k_s, HRR_INT__k_g_k_s, HRR_INT__k_h_k_s);

                // form INT__k_h_l_s
                ostei_general_hrr_J(7, 5, 8, 0, hAB, HRR_INT__l_g_l_s, HRR_INT__k_g_l_s, HRR_INT__k_h_l_s);

                // form INT__k_h_m_s
                ostei_general_hrr_J(7, 5, 9, 0, hAB, HRR_INT__l_g_m_s, HRR_INT__k_g_m_s, HRR_INT__k_h_m_s);

                // form INT__k_h_n_s
                ostei_general_hrr_J(7, 5, 10, 0, hAB, HRR_INT__l_g_n_s, HRR_INT__k_g_n_s, HRR_INT__k_h_n_s);

                // form INT__k_h_o_s
                ostei_general_hrr_J(7, 5, 11, 0, hAB, HRR_INT__l_g_o_s, HRR_INT__k_g_o_s, HRR_INT__k_h_o_s);

                // form INT__k_h_q_s
                ostei_general_hrr_J(7, 5, 12, 0, hAB, HRR_INT__l_g_q_s, HRR_INT__k_g_q_s, HRR_INT__k_h_q_s);

                // form INT__k_h_r_s
                ostei_general_hrr_J(7, 5, 13, 0, hAB, HRR_INT__l_g_r_s, HRR_INT__k_g_r_s, HRR_INT__k_h_r_s);

                // form INT__l_h_k_s
                ostei_general_hrr_J(8, 5, 7, 0, hAB, HRR_INT__m_g_k_s, HRR_INT__l_g_k_s, HRR_INT__l_h_k_s);

                // form INT__l_h_l_s
                ostei_general_hrr_J(8, 5, 8, 0, hAB, HRR_INT__m_g_l_s, HRR_INT__l_g_l_s, HRR_INT__l_h_l_s);

                // form INT__l_h_m_s
                ostei_general_hrr_J(8, 5, 9, 0, hAB, HRR_INT__m_g_m_s, HRR_INT__l_g_m_s, HRR_INT__l_h_m_s);

                // form INT__l_h_n_s
                ostei_general_hrr_J(8, 5, 10, 0, hAB, HRR_INT__m_g_n_s, HRR_INT__l_g_n_s, HRR_INT__l_h_n_s);

                // form INT__l_h_o_s
                ostei_general_hrr_J(8, 5, 11, 0, hAB, HRR_INT__m_g_o_s, HRR_INT__l_g_o_s, HRR_INT__l_h_o_s);

                // form INT__l_h_q_s
                ostei_general_hrr_J(8, 5, 12, 0, hAB, HRR_INT__m_g_q_s, HRR_INT__l_g_q_s, HRR_INT__l_h_q_s);

                // form INT__l_h_r_s
                ostei_general_hrr_J(8, 5, 13, 0, hAB, HRR_INT__m_g_r_s, HRR_INT__l_g_r_s, HRR_INT__l_h_r_s);

                // form INT__k_i_k_s
                ostei_general_hrr_J(7, 6, 7, 0, hAB, HRR_INT__l_h_k_s, HRR_INT__k_h_k_s, HRR_INT__k_i_k_s);

                // form INT__k_i_l_s
                ostei_general_hrr_J(7, 6, 8, 0, hAB, HRR_INT__l_h_l_s, HRR_INT__k_h_l_s, HRR_INT__k_i_l_s);

                // form INT__k_i_m_s
                ostei_general_hrr_J(7, 6, 9, 0, hAB, HRR_INT__l_h_m_s, HRR_INT__k_h_m_s, HRR_INT__k_i_m_s);

                // form INT__k_i_n_s
                ostei_general_hrr_J(7, 6, 10, 0, hAB, HRR_INT__l_h_n_s, HRR_INT__k_h_n_s, HRR_INT__k_i_n_s);

                // form INT__k_i_o_s
                ostei_general_hrr_J(7, 6, 11, 0, hAB, HRR_INT__l_h_o_s, HRR_INT__k_h_o_s, HRR_INT__k_i_o_s);

                // form INT__k_i_q_s
                ostei_general_hrr_J(7, 6, 12, 0, hAB, HRR_INT__l_h_q_s, HRR_INT__k_h_q_s, HRR_INT__k_i_q_s);

                // form INT__k_i_r_s
                ostei_general_hrr_J(7, 6, 13, 0, hAB, HRR_INT__l_h_r_s, HRR_INT__k_h_r_s, HRR_INT__k_i_r_s);

                // form INT__k_i_k_p
                HRR_L_k_p(
                    HRR_INT__k_i_k_p,
                    HRR_INT__k_i_k_s,
                    HRR_INT__k_i_l_s,
                    hCD, 1008);

                // form INT__k_i_l_p
                HRR_L_l_p(
                    HRR_INT__k_i_l_p,
                    HRR_INT__k_i_l_s,
                    HRR_INT__k_i_m_s,
                    hCD, 1008);

                // form INT__k_i_m_p
                ostei_general_hrr_L(7, 6, 9, 1, hCD, HRR_INT__k_i_n_s, HRR_INT__k_i_m_s, HRR_INT__k_i_m_p);

                // form INT__k_i_n_p
                ostei_general_hrr_L(7, 6, 10, 1, hCD, HRR_INT__k_i_o_s, HRR_INT__k_i_n_s, HRR_INT__k_i_n_p);

                // form INT__k_i_o_p
                ostei_general_hrr_L(7, 6, 11, 1, hCD, HRR_INT__k_i_q_s, HRR_INT__k_i_o_s, HRR_INT__k_i_o_p);

                // form INT__k_i_q_p
                ostei_general_hrr_L(7, 6, 12, 1, hCD, HRR_INT__k_i_r_s, HRR_INT__k_i_q_s, HRR_INT__k_i_q_p);

                // form INT__k_i_k_d
                HRR_L_k_d(
                    HRR_INT__k_i_k_d,
                    HRR_INT__k_i_k_p,
                    HRR_INT__k_i_l_p,
                    hCD, 1008);

                // form INT__k_i_l_d
                ostei_general_hrr_L(7, 6, 8, 2, hCD, HRR_INT__k_i_m_p, HRR_INT__k_i_l_p, HRR_INT__k_i_l_d);

                // form INT__k_i_m_d
                ostei_general_hrr_L(7, 6, 9, 2, hCD, HRR_INT__k_i_n_p, HRR_INT__k_i_m_p, HRR_INT__k_i_m_d);

                // form INT__k_i_n_d
                ostei_general_hrr_L(7, 6, 10, 2, hCD, HRR_INT__k_i_o_p, HRR_INT__k_i_n_p, HRR_INT__k_i_n_d);

                // form INT__k_i_o_d
                ostei_general_hrr_L(7, 6, 11, 2, hCD, HRR_INT__k_i_q_p, HRR_INT__k_i_o_p, HRR_INT__k_i_o_d);

                // form INT__k_i_k_f
                ostei_general_hrr_L(7, 6, 7, 3, hCD, HRR_INT__k_i_l_d, HRR_INT__k_i_k_d, HRR_INT__k_i_k_f);

                // form INT__k_i_l_f
                ostei_general_hrr_L(7, 6, 8, 3, hCD, HRR_INT__k_i_m_d, HRR_INT__k_i_l_d, HRR_INT__k_i_l_f);

                // form INT__k_i_m_f
                ostei_general_hrr_L(7, 6, 9, 3, hCD, HRR_INT__k_i_n_d, HRR_INT__k_i_m_d, HRR_INT__k_i_m_f);

                // form INT__k_i_n_f
                ostei_general_hrr_L(7, 6, 10, 3, hCD, HRR_INT__k_i_o_d, HRR_INT__k_i_n_d, HRR_INT__k_i_n_f);

                // form INT__k_i_k_g
                ostei_general_hrr_L(7, 6, 7, 4, hCD, HRR_INT__k_i_l_f, HRR_INT__k_i_k_f, HRR_INT__k_i_k_g);

                // form INT__k_i_l_g
                ostei_general_hrr_L(7, 6, 8, 4, hCD, HRR_INT__k_i_m_f, HRR_INT__k_i_l_f, HRR_INT__k_i_l_g);

                // form INT__k_i_m_g
                ostei_general_hrr_L(7, 6, 9, 4, hCD, HRR_INT__k_i_n_f, HRR_INT__k_i_m_f, HRR_INT__k_i_m_g);

                // form INT__k_i_k_h
                ostei_general_hrr_L(7, 6, 7, 5, hCD, HRR_INT__k_i_l_g, HRR_INT__k_i_k_g, HRR_INT__k_i_k_h);

                // form INT__k_i_l_h
                ostei_general_hrr_L(7, 6, 8, 5, hCD, HRR_INT__k_i_m_g, HRR_INT__k_i_l_g, HRR_INT__k_i_l_h);

                // form INT__k_i_k_i
                ostei_general_hrr_L(7, 6, 7, 6, hCD, HRR_INT__k_i_l_h, HRR_INT__k_i_k_h, HRR_INT__k_i_k_i);


            }  // close HRR loop


        }   // close loop cdbatch

        istart = iend;
    }  // close loop over ab

    return P.nshell12_clip * Q.nshell12_clip;
}

int ostei_i_k_k_i(struct simint_multi_shellpair const P,
                  struct simint_multi_shellpair const Q,
                  double screen_tol,
                  double * const restrict work,
                  double * const restrict INT__i_k_k_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_k_i_k_i(P_tmp, Q, screen_tol, work, INT__i_k_k_i);
    double buffer[1016064] SIMINT_ALIGN_ARRAY_DBL;

    for(int q = 0; q < ret; q++)
    {
        int idx = 0;
        for(int a = 0; a < 28; ++a)
        for(int b = 0; b < 36; ++b)
        for(int c = 0; c < 36; ++c)
        for(int d = 0; d < 28; ++d)
            buffer[idx++] = INT__i_k_k_i[q*1016064+b*28224+a*1008+c*28+d];

        memcpy(INT__i_k_k_i+q*1016064, buffer, 1016064*sizeof(double));
    }

    return ret;
}

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

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

    int ret = ostei_k_i_k_i(P, Q_tmp, screen_tol, work, INT__k_i_i_k);
    double buffer[1016064] SIMINT_ALIGN_ARRAY_DBL;

    for(int q = 0; q < ret; q++)
    {
        int idx = 0;
        for(int a = 0; a < 36; ++a)
        for(int b = 0; b < 28; ++b)
        for(int c = 0; c < 28; ++c)
        for(int d = 0; d < 36; ++d)
            buffer[idx++] = INT__k_i_i_k[q*1016064+a*28224+b*1008+d*28+c];

        memcpy(INT__k_i_i_k+q*1016064, buffer, 1016064*sizeof(double));
    }

    return ret;
}

int ostei_i_k_i_k(struct simint_multi_shellpair const P,
                  struct simint_multi_shellpair const Q,
                  double screen_tol,
                  double * const restrict work,
                  double * const restrict INT__i_k_i_k)
{
    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];
    }

    double Q_AB[3*Q.nshell12];
    struct simint_multi_shellpair Q_tmp = Q;
    Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
    Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
    Q_tmp.AB_x = Q_AB;
    Q_tmp.AB_y = Q_AB + Q.nshell12;
    Q_tmp.AB_z = Q_AB + 2*Q.nshell12;

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

    int ret = ostei_k_i_k_i(P_tmp, Q_tmp, screen_tol, work, INT__i_k_i_k);
    double buffer[1016064] SIMINT_ALIGN_ARRAY_DBL;

    for(int q = 0; q < ret; q++)
    {
        int idx = 0;
        for(int a = 0; a < 28; ++a)
        for(int b = 0; b < 36; ++b)
        for(int c = 0; c < 28; ++c)
        for(int d = 0; d < 36; ++d)
            buffer[idx++] = INT__i_k_i_k[q*1016064+b*28224+a*1008+d*28+c];

        memcpy(INT__i_k_i_k+q*1016064, buffer, 1016064*sizeof(double));
    }

    return ret;
}

