1 #include "simint/boys/boys.h"
2 #include "simint/ostei/gen/ostei_generated.h"
3 #include "simint/vectorization/vectorization.h"
4 #include <math.h>
5 #include <string.h>
6 
7 
ostei_k_p_i_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__k_p_i_h)8 int ostei_k_p_i_h(struct simint_multi_shellpair const P,
9                   struct simint_multi_shellpair const Q,
10                   double screen_tol,
11                   double * const restrict work,
12                   double * const restrict INT__k_p_i_h)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__k_p_i_h);
17     int ab, cd, abcd;
18     int istart, jstart;
19     int iprimcd, nprim_icd, icd;
20     const int check_screen = (screen_tol > 0.0);
21     int i, j;
22     int n;
23     int not_screened;
24     int real_abcd;
25     int iket;
26     int ibra;
27 
28     // partition workspace
29     double * const INT__k_s_i_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__k_s_k_s = work + (SIMINT_NSHELL_SIMD * 1008);
31     double * const INT__k_s_l_s = work + (SIMINT_NSHELL_SIMD * 2304);
32     double * const INT__k_s_m_s = work + (SIMINT_NSHELL_SIMD * 3924);
33     double * const INT__k_s_n_s = work + (SIMINT_NSHELL_SIMD * 5904);
34     double * const INT__k_s_o_s = work + (SIMINT_NSHELL_SIMD * 8280);
35     double * const INT__l_s_i_s = work + (SIMINT_NSHELL_SIMD * 11088);
36     double * const INT__l_s_k_s = work + (SIMINT_NSHELL_SIMD * 12348);
37     double * const INT__l_s_l_s = work + (SIMINT_NSHELL_SIMD * 13968);
38     double * const INT__l_s_m_s = work + (SIMINT_NSHELL_SIMD * 15993);
39     double * const INT__l_s_n_s = work + (SIMINT_NSHELL_SIMD * 18468);
40     double * const INT__l_s_o_s = work + (SIMINT_NSHELL_SIMD * 21438);
41     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*24948);
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 20;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 77;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 185;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 355;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 595;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 910;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 1302;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1770;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_m_s = primwork + 2310;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_n_s = primwork + 2915;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_o_s = primwork + 3575;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 4277;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 4301;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 4373;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 4517;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 4757;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 5117;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 5621;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 6293;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 7157;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_m_s = primwork + 8237;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_n_s = primwork + 9557;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_o_s = primwork + 11141;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_s_s = primwork + 13013;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 13055;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 13181;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 13433;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 13853;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 14483;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 15365;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 16541;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 18053;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_m_s = primwork + 19943;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_n_s = primwork + 22253;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_o_s = primwork + 25025;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_p_s = primwork + 28301;
79     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 28481;
80     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 28841;
81     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 29441;
82     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 30341;
83     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 31601;
84     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 33281;
85     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 35441;
86     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_m_s = primwork + 38141;
87     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_n_s = primwork + 41441;
88     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_o_s = primwork + 45401;
89     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_d_s = primwork + 50081;
90     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 50531;
91     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 51281;
92     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 52406;
93     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 53981;
94     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 56081;
95     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 58781;
96     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_m_s = primwork + 62156;
97     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_n_s = primwork + 66281;
98     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_o_s = primwork + 71231;
99     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_f_s = primwork + 77081;
100     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 77921;
101     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 79181;
102     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 80945;
103     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 83297;
104     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_l_s = primwork + 86321;
105     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_m_s = primwork + 90101;
106     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_n_s = primwork + 94721;
107     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_o_s = primwork + 100265;
108     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_g_s = primwork + 106817;
109     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_h_s = primwork + 108077;
110     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_i_s = primwork + 109841;
111     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_k_s = primwork + 112193;
112     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_l_s = primwork + 115217;
113     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_m_s = primwork + 118997;
114     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_n_s = primwork + 123617;
115     SIMINT_DBLTYPE * const restrict PRIM_INT__i_s_o_s = primwork + 129161;
116     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_h_s = primwork + 135713;
117     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_i_s = primwork + 137225;
118     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_k_s = primwork + 139241;
119     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_l_s = primwork + 141833;
120     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_m_s = primwork + 145073;
121     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_n_s = primwork + 149033;
122     SIMINT_DBLTYPE * const restrict PRIM_INT__k_s_o_s = primwork + 153785;
123     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_i_s = primwork + 159401;
124     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_k_s = primwork + 160661;
125     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_l_s = primwork + 162281;
126     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_m_s = primwork + 164306;
127     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_n_s = primwork + 166781;
128     SIMINT_DBLTYPE * const restrict PRIM_INT__l_s_o_s = primwork + 169751;
129     double * const hrrwork = (double *)(primwork + 173261);
130     double * const HRR_INT__k_p_i_s = hrrwork + 0;
131     double * const HRR_INT__k_p_i_p = hrrwork + 3024;
132     double * const HRR_INT__k_p_i_d = hrrwork + 12096;
133     double * const HRR_INT__k_p_i_f = hrrwork + 30240;
134     double * const HRR_INT__k_p_i_g = hrrwork + 60480;
135     double * const HRR_INT__k_p_k_s = hrrwork + 105840;
136     double * const HRR_INT__k_p_k_p = hrrwork + 109728;
137     double * const HRR_INT__k_p_k_d = hrrwork + 121392;
138     double * const HRR_INT__k_p_k_f = hrrwork + 144720;
139     double * const HRR_INT__k_p_k_g = hrrwork + 183600;
140     double * const HRR_INT__k_p_l_s = hrrwork + 241920;
141     double * const HRR_INT__k_p_l_p = hrrwork + 246780;
142     double * const HRR_INT__k_p_l_d = hrrwork + 261360;
143     double * const HRR_INT__k_p_l_f = hrrwork + 290520;
144     double * const HRR_INT__k_p_m_s = hrrwork + 339120;
145     double * const HRR_INT__k_p_m_p = hrrwork + 345060;
146     double * const HRR_INT__k_p_m_d = hrrwork + 362880;
147     double * const HRR_INT__k_p_n_s = hrrwork + 398520;
148     double * const HRR_INT__k_p_n_p = hrrwork + 405648;
149     double * const HRR_INT__k_p_o_s = hrrwork + 427032;
150 
151 
152     // Create constants
153     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
154     const SIMINT_DBLTYPE const_10 = SIMINT_DBLSET1(10);
155     const SIMINT_DBLTYPE const_11 = SIMINT_DBLSET1(11);
156     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
157     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
158     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
159     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
160     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
161     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
162     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
163     const SIMINT_DBLTYPE const_9 = SIMINT_DBLSET1(9);
164     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
165 
166 
167     ////////////////////////////////////////
168     // Loop over shells and primitives
169     ////////////////////////////////////////
170 
171     real_abcd = 0;
172     istart = 0;
173     for(ab = 0; ab < P.nshell12_clip; ++ab)
174     {
175         const int iend = istart + P.nprim12[ab];
176 
177         cd = 0;
178         jstart = 0;
179 
180         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
181         {
182             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
183             int jend = jstart;
184             for(i = 0; i < nshellbatch; i++)
185                 jend += Q.nprim12[cd+i];
186 
187             // Clear the beginning of the workspace (where we are accumulating integrals)
188             memset(work, 0, SIMINT_NSHELL_SIMD * 24948 * sizeof(double));
189             abcd = 0;
190 
191 
192             for(i = istart; i < iend; ++i)
193             {
194                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
195 
196                 if(check_screen)
197                 {
198                     // Skip this whole thing if always insignificant
199                     if((P.screen[i] * Q.screen_max) < screen_tol)
200                         continue;
201                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
202                 }
203 
204                 icd = 0;
205                 iprimcd = 0;
206                 nprim_icd = Q.nprim12[cd];
207                 double * restrict PRIM_PTR_INT__k_s_i_s = INT__k_s_i_s + abcd * 1008;
208                 double * restrict PRIM_PTR_INT__k_s_k_s = INT__k_s_k_s + abcd * 1296;
209                 double * restrict PRIM_PTR_INT__k_s_l_s = INT__k_s_l_s + abcd * 1620;
210                 double * restrict PRIM_PTR_INT__k_s_m_s = INT__k_s_m_s + abcd * 1980;
211                 double * restrict PRIM_PTR_INT__k_s_n_s = INT__k_s_n_s + abcd * 2376;
212                 double * restrict PRIM_PTR_INT__k_s_o_s = INT__k_s_o_s + abcd * 2808;
213                 double * restrict PRIM_PTR_INT__l_s_i_s = INT__l_s_i_s + abcd * 1260;
214                 double * restrict PRIM_PTR_INT__l_s_k_s = INT__l_s_k_s + abcd * 1620;
215                 double * restrict PRIM_PTR_INT__l_s_l_s = INT__l_s_l_s + abcd * 2025;
216                 double * restrict PRIM_PTR_INT__l_s_m_s = INT__l_s_m_s + abcd * 2475;
217                 double * restrict PRIM_PTR_INT__l_s_n_s = INT__l_s_n_s + abcd * 2970;
218                 double * restrict PRIM_PTR_INT__l_s_o_s = INT__l_s_o_s + abcd * 3510;
219 
220 
221 
222                 // Load these one per loop over i
223                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
224                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
225                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
226 
227                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
228 
229                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
230                 {
231                     // calculate the shell offsets
232                     // these are the offset from the shell pointed to by cd
233                     // for each element
234                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
235                     int lastoffset = 0;
236                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
237 
238                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
239                     {
240                         // Handle if the first element of the vector is a new shell
241                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
242                         {
243                             nprim_icd += Q.nprim12[cd + (++icd)];
244                             PRIM_PTR_INT__k_s_i_s += 1008;
245                             PRIM_PTR_INT__k_s_k_s += 1296;
246                             PRIM_PTR_INT__k_s_l_s += 1620;
247                             PRIM_PTR_INT__k_s_m_s += 1980;
248                             PRIM_PTR_INT__k_s_n_s += 2376;
249                             PRIM_PTR_INT__k_s_o_s += 2808;
250                             PRIM_PTR_INT__l_s_i_s += 1260;
251                             PRIM_PTR_INT__l_s_k_s += 1620;
252                             PRIM_PTR_INT__l_s_l_s += 2025;
253                             PRIM_PTR_INT__l_s_m_s += 2475;
254                             PRIM_PTR_INT__l_s_n_s += 2970;
255                             PRIM_PTR_INT__l_s_o_s += 3510;
256                         }
257                         iprimcd++;
258                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
259                         {
260                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
261                             {
262                                 shelloffsets[n] = shelloffsets[n-1] + 1;
263                                 lastoffset++;
264                                 nprim_icd += Q.nprim12[cd + (++icd)];
265                             }
266                             else
267                                 shelloffsets[n] = shelloffsets[n-1];
268                             iprimcd++;
269                         }
270                     }
271                     else
272                         iprimcd += SIMINT_SIMD_LEN;
273 
274                     // Do we have to compute this vector (or has it been screened out)?
275                     // (not_screened != 0 means we have to do this vector)
276                     if(check_screen)
277                     {
278                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
279                         if(vmax < screen_tol)
280                         {
281                             PRIM_PTR_INT__k_s_i_s += lastoffset*1008;
282                             PRIM_PTR_INT__k_s_k_s += lastoffset*1296;
283                             PRIM_PTR_INT__k_s_l_s += lastoffset*1620;
284                             PRIM_PTR_INT__k_s_m_s += lastoffset*1980;
285                             PRIM_PTR_INT__k_s_n_s += lastoffset*2376;
286                             PRIM_PTR_INT__k_s_o_s += lastoffset*2808;
287                             PRIM_PTR_INT__l_s_i_s += lastoffset*1260;
288                             PRIM_PTR_INT__l_s_k_s += lastoffset*1620;
289                             PRIM_PTR_INT__l_s_l_s += lastoffset*2025;
290                             PRIM_PTR_INT__l_s_m_s += lastoffset*2475;
291                             PRIM_PTR_INT__l_s_n_s += lastoffset*2970;
292                             PRIM_PTR_INT__l_s_o_s += lastoffset*3510;
293                             continue;
294                         }
295                     }
296 
297                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
298                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
299                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
300                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
301 
302 
303                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
304                     SIMINT_DBLTYPE PQ[3];
305                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
306                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
307                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
308                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
309                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
310                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
311 
312                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
313                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
314                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
315                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
316                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
317                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
318                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
319 
320                     // NOTE: Minus sign!
321                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
322                     SIMINT_DBLTYPE aop_PQ[3];
323                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
324                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
325                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
326 
327                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
328                     SIMINT_DBLTYPE aoq_PQ[3];
329                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
330                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
331                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
332                     // Put a minus sign here so we don't have to in RR routines
333                     a_over_q = SIMINT_NEG(a_over_q);
334 
335 
336                     //////////////////////////////////////////////
337                     // Fjt function section
338                     // Maximum v value: 19
339                     //////////////////////////////////////////////
340                     // The parameter to the Fjt function
341                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
342 
343 
344                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
345 
346 
347                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 19);
348                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
349                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
350                     for(n = 0; n <= 19; n++)
351                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
352 
353                     //////////////////////////////////////////////
354                     // Primitive integrals: Vertical recurrance
355                     //////////////////////////////////////////////
356 
357                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
358                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
359                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
360                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
361                     const SIMINT_DBLTYPE vrr_const_5_over_2p = SIMINT_MUL(const_5, one_over_2p);
362                     const SIMINT_DBLTYPE vrr_const_6_over_2p = SIMINT_MUL(const_6, one_over_2p);
363                     const SIMINT_DBLTYPE vrr_const_7_over_2p = SIMINT_MUL(const_7, one_over_2p);
364                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
365                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
366                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
367                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
368                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
369                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
370                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
371                     const SIMINT_DBLTYPE vrr_const_8_over_2q = SIMINT_MUL(const_8, one_over_2q);
372                     const SIMINT_DBLTYPE vrr_const_9_over_2q = SIMINT_MUL(const_9, one_over_2q);
373                     const SIMINT_DBLTYPE vrr_const_10_over_2q = SIMINT_MUL(const_10, one_over_2q);
374                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
375                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
376                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
377                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
378                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
379                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
380                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
381                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
382                     const SIMINT_DBLTYPE vrr_const_9_over_2pq = SIMINT_MUL(const_9, one_over_2pq);
383                     const SIMINT_DBLTYPE vrr_const_10_over_2pq = SIMINT_MUL(const_10, one_over_2pq);
384                     const SIMINT_DBLTYPE vrr_const_11_over_2pq = SIMINT_MUL(const_11, one_over_2pq);
385 
386 
387 
388                     // Forming PRIM_INT__s_s_p_s[19 * 3];
389                     for(n = 0; n < 19; ++n)  // loop over orders of auxiliary function
390                     {
391 
392                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
393                         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]);
394 
395                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
396                         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]);
397 
398                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
399                         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]);
400 
401                     }
402 
403 
404 
405                     // Forming PRIM_INT__s_s_d_s[18 * 6];
406                     for(n = 0; n < 18; ++n)  // loop over orders of auxiliary function
407                     {
408 
409                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
410                         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]);
411                         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]);
412 
413                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
414                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 1]);
415 
416                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
417                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_d_s[n * 6 + 2]);
418 
419                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
420                         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]);
421                         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]);
422 
423                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
424                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_d_s[n * 6 + 4]);
425 
426                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
427                         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]);
428                         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]);
429 
430                     }
431 
432 
433 
434                     // Forming PRIM_INT__s_s_f_s[17 * 10];
435                     for(n = 0; n < 17; ++n)  // loop over orders of auxiliary function
436                     {
437 
438                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
439                         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]);
440                         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]);
441 
442                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
443                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 1]);
444 
445                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
446                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__s_s_f_s[n * 10 + 2]);
447 
448                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
449                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 3]);
450 
451                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
452                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__s_s_f_s[n * 10 + 4]);
453 
454                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
455                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_FMADD( aoq_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 5]);
456 
457                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
458                         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]);
459                         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]);
460 
461                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
462                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_FMADD( aoq_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__s_s_f_s[n * 10 + 7]);
463 
464                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
465                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_FMADD( aoq_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__s_s_f_s[n * 10 + 8]);
466 
467                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
468                         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]);
469                         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]);
470 
471                     }
472 
473 
474                     VRR_K_s_s_g_s(
475                             PRIM_INT__s_s_g_s,
476                             PRIM_INT__s_s_f_s,
477                             PRIM_INT__s_s_d_s,
478                             Q_PA,
479                             a_over_q,
480                             aoq_PQ,
481                             one_over_2q,
482                             16);
483 
484 
485                     VRR_K_s_s_h_s(
486                             PRIM_INT__s_s_h_s,
487                             PRIM_INT__s_s_g_s,
488                             PRIM_INT__s_s_f_s,
489                             Q_PA,
490                             a_over_q,
491                             aoq_PQ,
492                             one_over_2q,
493                             15);
494 
495 
496                     ostei_general_vrr1_K(6, 14,
497                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
498                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
499 
500 
501                     ostei_general_vrr_I(1, 0, 6, 0, 8,
502                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
503                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
504 
505 
506                     ostei_general_vrr_I(1, 0, 5, 0, 8,
507                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
508                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
509 
510 
511                     ostei_general_vrr_I(2, 0, 6, 0, 7,
512                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
513                             PRIM_INT__p_s_i_s, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_i_s);
514 
515 
516                     VRR_I_p_s_g_s(
517                             PRIM_INT__p_s_g_s,
518                             PRIM_INT__s_s_g_s,
519                             PRIM_INT__s_s_f_s,
520                             P_PA,
521                             aop_PQ,
522                             one_over_2pq,
523                             8);
524 
525 
526                     ostei_general_vrr_I(2, 0, 5, 0, 7,
527                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
528                             PRIM_INT__p_s_h_s, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_h_s);
529 
530 
531                     ostei_general_vrr_I(3, 0, 6, 0, 6,
532                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
533                             PRIM_INT__d_s_i_s, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_i_s);
534 
535 
536                     VRR_I_p_s_f_s(
537                             PRIM_INT__p_s_f_s,
538                             PRIM_INT__s_s_f_s,
539                             PRIM_INT__s_s_d_s,
540                             P_PA,
541                             aop_PQ,
542                             one_over_2pq,
543                             8);
544 
545 
546                     ostei_general_vrr_I(2, 0, 4, 0, 7,
547                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
548                             PRIM_INT__p_s_g_s, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_g_s);
549 
550 
551                     ostei_general_vrr_I(3, 0, 5, 0, 6,
552                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
553                             PRIM_INT__d_s_h_s, PRIM_INT__p_s_h_s, NULL, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_h_s);
554 
555 
556                     ostei_general_vrr_I(4, 0, 6, 0, 5,
557                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
558                             PRIM_INT__f_s_i_s, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_i_s);
559 
560 
561 
562                     // Forming PRIM_INT__p_s_d_s[8 * 18];
563                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
564                     {
565 
566                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
567                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
568                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 0]);
569 
570                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
571                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
572                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 1]);
573 
574                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
575                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
576                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 2]);
577 
578                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
579                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 3]);
580 
581                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
582                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 4]);
583 
584                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
585                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 5]);
586 
587                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
588                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 6]);
589 
590                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
591                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 7]);
592                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 7]);
593 
594                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
595                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 8]);
596 
597                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
598                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 9]);
599                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 9]);
600 
601                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
602                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 10]);
603                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 10]);
604 
605                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
606                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 11]);
607 
608                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
609                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 0], PRIM_INT__p_s_d_s[n * 18 + 12]);
610 
611                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
612                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 1], PRIM_INT__p_s_d_s[n * 18 + 13]);
613 
614                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
615                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 2], PRIM_INT__p_s_d_s[n * 18 + 14]);
616                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_d_s[n * 18 + 14]);
617 
618                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
619                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 3], PRIM_INT__p_s_d_s[n * 18 + 15]);
620 
621                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
622                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 4], PRIM_INT__p_s_d_s[n * 18 + 16]);
623                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_d_s[n * 18 + 16]);
624 
625                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
626                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_d_s[(n+1) * 6 + 5], PRIM_INT__p_s_d_s[n * 18 + 17]);
627                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_2_over_2pq, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_d_s[n * 18 + 17]);
628 
629                     }
630 
631 
632                     VRR_I_d_s_f_s(
633                             PRIM_INT__d_s_f_s,
634                             PRIM_INT__p_s_f_s,
635                             PRIM_INT__s_s_f_s,
636                             PRIM_INT__p_s_d_s,
637                             P_PA,
638                             a_over_p,
639                             aop_PQ,
640                             one_over_2p,
641                             one_over_2pq,
642                             7);
643 
644 
645                     ostei_general_vrr_I(3, 0, 4, 0, 6,
646                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
647                             PRIM_INT__d_s_g_s, PRIM_INT__p_s_g_s, NULL, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_g_s);
648 
649 
650                     ostei_general_vrr_I(4, 0, 5, 0, 5,
651                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
652                             PRIM_INT__f_s_h_s, PRIM_INT__d_s_h_s, NULL, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_h_s);
653 
654 
655                     ostei_general_vrr_I(5, 0, 6, 0, 4,
656                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
657                             PRIM_INT__g_s_i_s, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_i_s);
658 
659 
660 
661                     // Forming PRIM_INT__p_s_p_s[8 * 9];
662                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
663                     {
664 
665                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
666                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 0]);
667                         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]);
668 
669                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
670                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 1]);
671 
672                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
673                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 2]);
674 
675                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
676                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 3]);
677 
678                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
679                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 4]);
680                         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]);
681 
682                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
683                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 5]);
684 
685                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
686                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__p_s_p_s[n * 9 + 6]);
687 
688                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
689                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__p_s_p_s[n * 9 + 7]);
690 
691                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
692                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__p_s_p_s[n * 9 + 8]);
693                         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]);
694 
695                     }
696 
697 
698                     VRR_I_d_s_d_s(
699                             PRIM_INT__d_s_d_s,
700                             PRIM_INT__p_s_d_s,
701                             PRIM_INT__s_s_d_s,
702                             PRIM_INT__p_s_p_s,
703                             P_PA,
704                             a_over_p,
705                             aop_PQ,
706                             one_over_2p,
707                             one_over_2pq,
708                             7);
709 
710 
711                     ostei_general_vrr_I(3, 0, 3, 0, 6,
712                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
713                             PRIM_INT__d_s_f_s, PRIM_INT__p_s_f_s, NULL, PRIM_INT__d_s_d_s, NULL, PRIM_INT__f_s_f_s);
714 
715 
716                     ostei_general_vrr_I(4, 0, 4, 0, 5,
717                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
718                             PRIM_INT__f_s_g_s, PRIM_INT__d_s_g_s, NULL, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_g_s);
719 
720 
721                     ostei_general_vrr_I(5, 0, 5, 0, 4,
722                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
723                             PRIM_INT__g_s_h_s, PRIM_INT__f_s_h_s, NULL, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_h_s);
724 
725 
726                     ostei_general_vrr_I(6, 0, 6, 0, 3,
727                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
728                             PRIM_INT__h_s_i_s, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_i_s);
729 
730 
731 
732                     // Forming PRIM_INT__p_s_s_s[8 * 3];
733                     for(n = 0; n < 8; ++n)  // loop over orders of auxiliary function
734                     {
735 
736                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
737                         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]);
738 
739                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
740                         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]);
741 
742                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
743                         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]);
744 
745                     }
746 
747 
748 
749                     // Forming PRIM_INT__d_s_p_s[7 * 18];
750                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
751                     {
752 
753                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 0]);
754                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
755                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 0]);
756                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 0], PRIM_INT__d_s_p_s[n * 18 + 0]);
757 
758                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 1]);
759                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 1], PRIM_INT__d_s_p_s[n * 18 + 1]);
760                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 1]);
761 
762                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 2]);
763                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( aop_PQ[0], PRIM_INT__p_s_p_s[(n+1) * 9 + 2], PRIM_INT__d_s_p_s[n * 18 + 2]);
764                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 2]);
765 
766                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 3]);
767                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 3], PRIM_INT__d_s_p_s[n * 18 + 9]);
768                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 9]);
769 
770                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 4]);
771                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 4], PRIM_INT__d_s_p_s[n * 18 + 10]);
772                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 10]);
773                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 1], PRIM_INT__d_s_p_s[n * 18 + 10]);
774 
775                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 5]);
776                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( aop_PQ[1], PRIM_INT__p_s_p_s[(n+1) * 9 + 5], PRIM_INT__d_s_p_s[n * 18 + 11]);
777                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 11]);
778 
779                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 6]);
780                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 6], PRIM_INT__d_s_p_s[n * 18 + 15]);
781                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 0], PRIM_INT__s_s_p_s[n * 3 + 0]), PRIM_INT__d_s_p_s[n * 18 + 15]);
782 
783                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 7]);
784                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 7], PRIM_INT__d_s_p_s[n * 18 + 16]);
785                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 1], PRIM_INT__s_s_p_s[n * 3 + 1]), PRIM_INT__d_s_p_s[n * 18 + 16]);
786 
787                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 8]);
788                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( aop_PQ[2], PRIM_INT__p_s_p_s[(n+1) * 9 + 8], PRIM_INT__d_s_p_s[n * 18 + 17]);
789                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2p, SIMINT_FMADD(a_over_p, PRIM_INT__s_s_p_s[(n+1) * 3 + 2], PRIM_INT__s_s_p_s[n * 3 + 2]), PRIM_INT__d_s_p_s[n * 18 + 17]);
790                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_FMADD( vrr_const_1_over_2pq, PRIM_INT__p_s_s_s[(n+1) * 3 + 2], PRIM_INT__d_s_p_s[n * 18 + 17]);
791 
792                     }
793 
794 
795                     VRR_I_f_s_d_s(
796                             PRIM_INT__f_s_d_s,
797                             PRIM_INT__d_s_d_s,
798                             PRIM_INT__p_s_d_s,
799                             PRIM_INT__d_s_p_s,
800                             P_PA,
801                             a_over_p,
802                             aop_PQ,
803                             one_over_2p,
804                             one_over_2pq,
805                             6);
806 
807 
808                     ostei_general_vrr_I(4, 0, 3, 0, 5,
809                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
810                             PRIM_INT__f_s_f_s, PRIM_INT__d_s_f_s, NULL, PRIM_INT__f_s_d_s, NULL, PRIM_INT__g_s_f_s);
811 
812 
813                     ostei_general_vrr_I(5, 0, 4, 0, 4,
814                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
815                             PRIM_INT__g_s_g_s, PRIM_INT__f_s_g_s, NULL, PRIM_INT__g_s_f_s, NULL, PRIM_INT__h_s_g_s);
816 
817 
818                     ostei_general_vrr_I(6, 0, 5, 0, 3,
819                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
820                             PRIM_INT__h_s_h_s, PRIM_INT__g_s_h_s, NULL, PRIM_INT__h_s_g_s, NULL, PRIM_INT__i_s_h_s);
821 
822 
823                     ostei_general_vrr_I(7, 0, 6, 0, 2,
824                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
825                             PRIM_INT__i_s_i_s, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_h_s, NULL, PRIM_INT__k_s_i_s);
826 
827 
828                     ostei_general_vrr1_K(7, 13,
829                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
830                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
831 
832 
833                     ostei_general_vrr_I(1, 0, 7, 0, 8,
834                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
835                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
836 
837 
838                     ostei_general_vrr_I(2, 0, 7, 0, 7,
839                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
840                             PRIM_INT__p_s_k_s, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_i_s, NULL, PRIM_INT__d_s_k_s);
841 
842 
843                     ostei_general_vrr_I(3, 0, 7, 0, 6,
844                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
845                             PRIM_INT__d_s_k_s, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_i_s, NULL, PRIM_INT__f_s_k_s);
846 
847 
848                     ostei_general_vrr_I(4, 0, 7, 0, 5,
849                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
850                             PRIM_INT__f_s_k_s, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_i_s, NULL, PRIM_INT__g_s_k_s);
851 
852 
853                     ostei_general_vrr_I(5, 0, 7, 0, 4,
854                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
855                             PRIM_INT__g_s_k_s, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_i_s, NULL, PRIM_INT__h_s_k_s);
856 
857 
858                     ostei_general_vrr_I(6, 0, 7, 0, 3,
859                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
860                             PRIM_INT__h_s_k_s, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_i_s, NULL, PRIM_INT__i_s_k_s);
861 
862 
863                     ostei_general_vrr_I(7, 0, 7, 0, 2,
864                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
865                             PRIM_INT__i_s_k_s, PRIM_INT__h_s_k_s, NULL, PRIM_INT__i_s_i_s, NULL, PRIM_INT__k_s_k_s);
866 
867 
868 
869                     // Forming PRIM_INT__d_s_s_s[7 * 6];
870                     for(n = 0; n < 7; ++n)  // loop over orders of auxiliary function
871                     {
872 
873                         PRIM_INT__d_s_s_s[n * 6 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_s_s[n * 3 + 0]);
874                         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]);
875                         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]);
876 
877                         PRIM_INT__d_s_s_s[n * 6 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_s_s[n * 3 + 1]);
878                         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]);
879                         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]);
880 
881                         PRIM_INT__d_s_s_s[n * 6 + 5] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_s_s[n * 3 + 2]);
882                         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]);
883                         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]);
884 
885                     }
886 
887 
888                     VRR_I_f_s_p_s(
889                             PRIM_INT__f_s_p_s,
890                             PRIM_INT__d_s_p_s,
891                             PRIM_INT__p_s_p_s,
892                             PRIM_INT__d_s_s_s,
893                             P_PA,
894                             a_over_p,
895                             aop_PQ,
896                             one_over_2p,
897                             one_over_2pq,
898                             6);
899 
900 
901                     ostei_general_vrr_I(4, 0, 2, 0, 5,
902                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
903                             PRIM_INT__f_s_d_s, PRIM_INT__d_s_d_s, NULL, PRIM_INT__f_s_p_s, NULL, PRIM_INT__g_s_d_s);
904 
905 
906                     ostei_general_vrr_I(5, 0, 3, 0, 4,
907                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
908                             PRIM_INT__g_s_f_s, PRIM_INT__f_s_f_s, NULL, PRIM_INT__g_s_d_s, NULL, PRIM_INT__h_s_f_s);
909 
910 
911                     ostei_general_vrr_I(6, 0, 4, 0, 3,
912                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
913                             PRIM_INT__h_s_g_s, PRIM_INT__g_s_g_s, NULL, PRIM_INT__h_s_f_s, NULL, PRIM_INT__i_s_g_s);
914 
915 
916                     ostei_general_vrr_I(7, 0, 5, 0, 2,
917                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
918                             PRIM_INT__i_s_h_s, PRIM_INT__h_s_h_s, NULL, PRIM_INT__i_s_g_s, NULL, PRIM_INT__k_s_h_s);
919 
920 
921                     ostei_general_vrr_I(8, 0, 6, 0, 1,
922                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
923                             PRIM_INT__k_s_i_s, PRIM_INT__i_s_i_s, NULL, PRIM_INT__k_s_h_s, NULL, PRIM_INT__l_s_i_s);
924 
925 
926                     ostei_general_vrr1_K(8, 12,
927                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
928                             PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
929 
930 
931                     ostei_general_vrr_I(1, 0, 8, 0, 8,
932                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
933                             PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
934 
935 
936                     ostei_general_vrr_I(2, 0, 8, 0, 7,
937                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
938                             PRIM_INT__p_s_l_s, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_k_s, NULL, PRIM_INT__d_s_l_s);
939 
940 
941                     ostei_general_vrr_I(3, 0, 8, 0, 6,
942                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
943                             PRIM_INT__d_s_l_s, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_k_s, NULL, PRIM_INT__f_s_l_s);
944 
945 
946                     ostei_general_vrr_I(4, 0, 8, 0, 5,
947                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
948                             PRIM_INT__f_s_l_s, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_k_s, NULL, PRIM_INT__g_s_l_s);
949 
950 
951                     ostei_general_vrr_I(5, 0, 8, 0, 4,
952                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
953                             PRIM_INT__g_s_l_s, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_k_s, NULL, PRIM_INT__h_s_l_s);
954 
955 
956                     ostei_general_vrr_I(6, 0, 8, 0, 3,
957                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
958                             PRIM_INT__h_s_l_s, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_k_s, NULL, PRIM_INT__i_s_l_s);
959 
960 
961                     ostei_general_vrr_I(7, 0, 8, 0, 2,
962                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
963                             PRIM_INT__i_s_l_s, PRIM_INT__h_s_l_s, NULL, PRIM_INT__i_s_k_s, NULL, PRIM_INT__k_s_l_s);
964 
965 
966                     ostei_general_vrr_I(8, 0, 7, 0, 1,
967                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
968                             PRIM_INT__k_s_k_s, PRIM_INT__i_s_k_s, NULL, PRIM_INT__k_s_i_s, NULL, PRIM_INT__l_s_k_s);
969 
970 
971                     ostei_general_vrr1_K(9, 11,
972                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
973                             PRIM_INT__s_s_l_s, PRIM_INT__s_s_k_s, PRIM_INT__s_s_m_s);
974 
975 
976                     ostei_general_vrr_I(1, 0, 9, 0, 8,
977                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
978                             PRIM_INT__s_s_m_s, NULL, NULL, PRIM_INT__s_s_l_s, NULL, PRIM_INT__p_s_m_s);
979 
980 
981                     ostei_general_vrr_I(2, 0, 9, 0, 7,
982                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
983                             PRIM_INT__p_s_m_s, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_l_s, NULL, PRIM_INT__d_s_m_s);
984 
985 
986                     ostei_general_vrr_I(3, 0, 9, 0, 6,
987                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
988                             PRIM_INT__d_s_m_s, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_l_s, NULL, PRIM_INT__f_s_m_s);
989 
990 
991                     ostei_general_vrr_I(4, 0, 9, 0, 5,
992                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
993                             PRIM_INT__f_s_m_s, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_l_s, NULL, PRIM_INT__g_s_m_s);
994 
995 
996                     ostei_general_vrr_I(5, 0, 9, 0, 4,
997                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
998                             PRIM_INT__g_s_m_s, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_l_s, NULL, PRIM_INT__h_s_m_s);
999 
1000 
1001                     ostei_general_vrr_I(6, 0, 9, 0, 3,
1002                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1003                             PRIM_INT__h_s_m_s, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_l_s, NULL, PRIM_INT__i_s_m_s);
1004 
1005 
1006                     ostei_general_vrr_I(7, 0, 9, 0, 2,
1007                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1008                             PRIM_INT__i_s_m_s, PRIM_INT__h_s_m_s, NULL, PRIM_INT__i_s_l_s, NULL, PRIM_INT__k_s_m_s);
1009 
1010 
1011                     ostei_general_vrr_I(8, 0, 8, 0, 1,
1012                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1013                             PRIM_INT__k_s_l_s, PRIM_INT__i_s_l_s, NULL, PRIM_INT__k_s_k_s, NULL, PRIM_INT__l_s_l_s);
1014 
1015 
1016                     ostei_general_vrr1_K(10, 10,
1017                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
1018                             PRIM_INT__s_s_m_s, PRIM_INT__s_s_l_s, PRIM_INT__s_s_n_s);
1019 
1020 
1021                     ostei_general_vrr_I(1, 0, 10, 0, 8,
1022                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1023                             PRIM_INT__s_s_n_s, NULL, NULL, PRIM_INT__s_s_m_s, NULL, PRIM_INT__p_s_n_s);
1024 
1025 
1026                     ostei_general_vrr_I(2, 0, 10, 0, 7,
1027                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1028                             PRIM_INT__p_s_n_s, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_m_s, NULL, PRIM_INT__d_s_n_s);
1029 
1030 
1031                     ostei_general_vrr_I(3, 0, 10, 0, 6,
1032                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1033                             PRIM_INT__d_s_n_s, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_m_s, NULL, PRIM_INT__f_s_n_s);
1034 
1035 
1036                     ostei_general_vrr_I(4, 0, 10, 0, 5,
1037                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1038                             PRIM_INT__f_s_n_s, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_m_s, NULL, PRIM_INT__g_s_n_s);
1039 
1040 
1041                     ostei_general_vrr_I(5, 0, 10, 0, 4,
1042                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1043                             PRIM_INT__g_s_n_s, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_m_s, NULL, PRIM_INT__h_s_n_s);
1044 
1045 
1046                     ostei_general_vrr_I(6, 0, 10, 0, 3,
1047                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1048                             PRIM_INT__h_s_n_s, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_m_s, NULL, PRIM_INT__i_s_n_s);
1049 
1050 
1051                     ostei_general_vrr_I(7, 0, 10, 0, 2,
1052                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1053                             PRIM_INT__i_s_n_s, PRIM_INT__h_s_n_s, NULL, PRIM_INT__i_s_m_s, NULL, PRIM_INT__k_s_n_s);
1054 
1055 
1056                     ostei_general_vrr_I(8, 0, 9, 0, 1,
1057                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1058                             PRIM_INT__k_s_m_s, PRIM_INT__i_s_m_s, NULL, PRIM_INT__k_s_l_s, NULL, PRIM_INT__l_s_m_s);
1059 
1060 
1061                     ostei_general_vrr1_K(11, 9,
1062                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
1063                             PRIM_INT__s_s_n_s, PRIM_INT__s_s_m_s, PRIM_INT__s_s_o_s);
1064 
1065 
1066                     ostei_general_vrr_I(1, 0, 11, 0, 8,
1067                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1068                             PRIM_INT__s_s_o_s, NULL, NULL, PRIM_INT__s_s_n_s, NULL, PRIM_INT__p_s_o_s);
1069 
1070 
1071                     ostei_general_vrr_I(2, 0, 11, 0, 7,
1072                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1073                             PRIM_INT__p_s_o_s, PRIM_INT__s_s_o_s, NULL, PRIM_INT__p_s_n_s, NULL, PRIM_INT__d_s_o_s);
1074 
1075 
1076                     ostei_general_vrr_I(3, 0, 11, 0, 6,
1077                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1078                             PRIM_INT__d_s_o_s, PRIM_INT__p_s_o_s, NULL, PRIM_INT__d_s_n_s, NULL, PRIM_INT__f_s_o_s);
1079 
1080 
1081                     ostei_general_vrr_I(4, 0, 11, 0, 5,
1082                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1083                             PRIM_INT__f_s_o_s, PRIM_INT__d_s_o_s, NULL, PRIM_INT__f_s_n_s, NULL, PRIM_INT__g_s_o_s);
1084 
1085 
1086                     ostei_general_vrr_I(5, 0, 11, 0, 4,
1087                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1088                             PRIM_INT__g_s_o_s, PRIM_INT__f_s_o_s, NULL, PRIM_INT__g_s_n_s, NULL, PRIM_INT__h_s_o_s);
1089 
1090 
1091                     ostei_general_vrr_I(6, 0, 11, 0, 3,
1092                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1093                             PRIM_INT__h_s_o_s, PRIM_INT__g_s_o_s, NULL, PRIM_INT__h_s_n_s, NULL, PRIM_INT__i_s_o_s);
1094 
1095 
1096                     ostei_general_vrr_I(7, 0, 11, 0, 2,
1097                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1098                             PRIM_INT__i_s_o_s, PRIM_INT__h_s_o_s, NULL, PRIM_INT__i_s_n_s, NULL, PRIM_INT__k_s_o_s);
1099 
1100 
1101                     ostei_general_vrr_I(8, 0, 10, 0, 1,
1102                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1103                             PRIM_INT__k_s_n_s, PRIM_INT__i_s_n_s, NULL, PRIM_INT__k_s_m_s, NULL, PRIM_INT__l_s_n_s);
1104 
1105 
1106                     ostei_general_vrr_I(8, 0, 11, 0, 1,
1107                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
1108                             PRIM_INT__k_s_o_s, PRIM_INT__i_s_o_s, NULL, PRIM_INT__k_s_n_s, NULL, PRIM_INT__l_s_o_s);
1109 
1110 
1111 
1112 
1113                     ////////////////////////////////////
1114                     // Accumulate contracted integrals
1115                     ////////////////////////////////////
1116                     if(lastoffset == 0)
1117                     {
1118                         contract_all(1008, PRIM_INT__k_s_i_s, PRIM_PTR_INT__k_s_i_s);
1119                         contract_all(1296, PRIM_INT__k_s_k_s, PRIM_PTR_INT__k_s_k_s);
1120                         contract_all(1620, PRIM_INT__k_s_l_s, PRIM_PTR_INT__k_s_l_s);
1121                         contract_all(1980, PRIM_INT__k_s_m_s, PRIM_PTR_INT__k_s_m_s);
1122                         contract_all(2376, PRIM_INT__k_s_n_s, PRIM_PTR_INT__k_s_n_s);
1123                         contract_all(2808, PRIM_INT__k_s_o_s, PRIM_PTR_INT__k_s_o_s);
1124                         contract_all(1260, PRIM_INT__l_s_i_s, PRIM_PTR_INT__l_s_i_s);
1125                         contract_all(1620, PRIM_INT__l_s_k_s, PRIM_PTR_INT__l_s_k_s);
1126                         contract_all(2025, PRIM_INT__l_s_l_s, PRIM_PTR_INT__l_s_l_s);
1127                         contract_all(2475, PRIM_INT__l_s_m_s, PRIM_PTR_INT__l_s_m_s);
1128                         contract_all(2970, PRIM_INT__l_s_n_s, PRIM_PTR_INT__l_s_n_s);
1129                         contract_all(3510, PRIM_INT__l_s_o_s, PRIM_PTR_INT__l_s_o_s);
1130                     }
1131                     else
1132                     {
1133                         contract(1008, shelloffsets, PRIM_INT__k_s_i_s, PRIM_PTR_INT__k_s_i_s);
1134                         contract(1296, shelloffsets, PRIM_INT__k_s_k_s, PRIM_PTR_INT__k_s_k_s);
1135                         contract(1620, shelloffsets, PRIM_INT__k_s_l_s, PRIM_PTR_INT__k_s_l_s);
1136                         contract(1980, shelloffsets, PRIM_INT__k_s_m_s, PRIM_PTR_INT__k_s_m_s);
1137                         contract(2376, shelloffsets, PRIM_INT__k_s_n_s, PRIM_PTR_INT__k_s_n_s);
1138                         contract(2808, shelloffsets, PRIM_INT__k_s_o_s, PRIM_PTR_INT__k_s_o_s);
1139                         contract(1260, shelloffsets, PRIM_INT__l_s_i_s, PRIM_PTR_INT__l_s_i_s);
1140                         contract(1620, shelloffsets, PRIM_INT__l_s_k_s, PRIM_PTR_INT__l_s_k_s);
1141                         contract(2025, shelloffsets, PRIM_INT__l_s_l_s, PRIM_PTR_INT__l_s_l_s);
1142                         contract(2475, shelloffsets, PRIM_INT__l_s_m_s, PRIM_PTR_INT__l_s_m_s);
1143                         contract(2970, shelloffsets, PRIM_INT__l_s_n_s, PRIM_PTR_INT__l_s_n_s);
1144                         contract(3510, shelloffsets, PRIM_INT__l_s_o_s, PRIM_PTR_INT__l_s_o_s);
1145                         PRIM_PTR_INT__k_s_i_s += lastoffset*1008;
1146                         PRIM_PTR_INT__k_s_k_s += lastoffset*1296;
1147                         PRIM_PTR_INT__k_s_l_s += lastoffset*1620;
1148                         PRIM_PTR_INT__k_s_m_s += lastoffset*1980;
1149                         PRIM_PTR_INT__k_s_n_s += lastoffset*2376;
1150                         PRIM_PTR_INT__k_s_o_s += lastoffset*2808;
1151                         PRIM_PTR_INT__l_s_i_s += lastoffset*1260;
1152                         PRIM_PTR_INT__l_s_k_s += lastoffset*1620;
1153                         PRIM_PTR_INT__l_s_l_s += lastoffset*2025;
1154                         PRIM_PTR_INT__l_s_m_s += lastoffset*2475;
1155                         PRIM_PTR_INT__l_s_n_s += lastoffset*2970;
1156                         PRIM_PTR_INT__l_s_o_s += lastoffset*3510;
1157                     }
1158 
1159                 }  // close loop over j
1160             }  // close loop over i
1161 
1162             //Advance to the next batch
1163             jstart = SIMINT_SIMD_ROUND(jend);
1164 
1165             //////////////////////////////////////////////
1166             // Contracted integrals: Horizontal recurrance
1167             //////////////////////////////////////////////
1168 
1169 
1170             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
1171 
1172 
1173             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
1174             {
1175                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
1176 
1177                 // set up HRR pointers
1178                 double const * restrict HRR_INT__k_s_i_s = INT__k_s_i_s + abcd * 1008;
1179                 double const * restrict HRR_INT__k_s_k_s = INT__k_s_k_s + abcd * 1296;
1180                 double const * restrict HRR_INT__k_s_l_s = INT__k_s_l_s + abcd * 1620;
1181                 double const * restrict HRR_INT__k_s_m_s = INT__k_s_m_s + abcd * 1980;
1182                 double const * restrict HRR_INT__k_s_n_s = INT__k_s_n_s + abcd * 2376;
1183                 double const * restrict HRR_INT__k_s_o_s = INT__k_s_o_s + abcd * 2808;
1184                 double const * restrict HRR_INT__l_s_i_s = INT__l_s_i_s + abcd * 1260;
1185                 double const * restrict HRR_INT__l_s_k_s = INT__l_s_k_s + abcd * 1620;
1186                 double const * restrict HRR_INT__l_s_l_s = INT__l_s_l_s + abcd * 2025;
1187                 double const * restrict HRR_INT__l_s_m_s = INT__l_s_m_s + abcd * 2475;
1188                 double const * restrict HRR_INT__l_s_n_s = INT__l_s_n_s + abcd * 2970;
1189                 double const * restrict HRR_INT__l_s_o_s = INT__l_s_o_s + abcd * 3510;
1190                 double * restrict HRR_INT__k_p_i_h = INT__k_p_i_h + real_abcd * 63504;
1191 
1192                 // form INT__k_p_i_s
1193                 ostei_general_hrr_J(7, 1, 6, 0, hAB, HRR_INT__l_s_i_s, HRR_INT__k_s_i_s, HRR_INT__k_p_i_s);
1194 
1195                 // form INT__k_p_k_s
1196                 ostei_general_hrr_J(7, 1, 7, 0, hAB, HRR_INT__l_s_k_s, HRR_INT__k_s_k_s, HRR_INT__k_p_k_s);
1197 
1198                 // form INT__k_p_l_s
1199                 ostei_general_hrr_J(7, 1, 8, 0, hAB, HRR_INT__l_s_l_s, HRR_INT__k_s_l_s, HRR_INT__k_p_l_s);
1200 
1201                 // form INT__k_p_m_s
1202                 ostei_general_hrr_J(7, 1, 9, 0, hAB, HRR_INT__l_s_m_s, HRR_INT__k_s_m_s, HRR_INT__k_p_m_s);
1203 
1204                 // form INT__k_p_n_s
1205                 ostei_general_hrr_J(7, 1, 10, 0, hAB, HRR_INT__l_s_n_s, HRR_INT__k_s_n_s, HRR_INT__k_p_n_s);
1206 
1207                 // form INT__k_p_o_s
1208                 ostei_general_hrr_J(7, 1, 11, 0, hAB, HRR_INT__l_s_o_s, HRR_INT__k_s_o_s, HRR_INT__k_p_o_s);
1209 
1210                 // form INT__k_p_i_p
1211                 ostei_general_hrr_L(7, 1, 6, 1, hCD, HRR_INT__k_p_k_s, HRR_INT__k_p_i_s, HRR_INT__k_p_i_p);
1212 
1213                 // form INT__k_p_k_p
1214                 ostei_general_hrr_L(7, 1, 7, 1, hCD, HRR_INT__k_p_l_s, HRR_INT__k_p_k_s, HRR_INT__k_p_k_p);
1215 
1216                 // form INT__k_p_l_p
1217                 ostei_general_hrr_L(7, 1, 8, 1, hCD, HRR_INT__k_p_m_s, HRR_INT__k_p_l_s, HRR_INT__k_p_l_p);
1218 
1219                 // form INT__k_p_m_p
1220                 ostei_general_hrr_L(7, 1, 9, 1, hCD, HRR_INT__k_p_n_s, HRR_INT__k_p_m_s, HRR_INT__k_p_m_p);
1221 
1222                 // form INT__k_p_n_p
1223                 ostei_general_hrr_L(7, 1, 10, 1, hCD, HRR_INT__k_p_o_s, HRR_INT__k_p_n_s, HRR_INT__k_p_n_p);
1224 
1225                 // form INT__k_p_i_d
1226                 ostei_general_hrr_L(7, 1, 6, 2, hCD, HRR_INT__k_p_k_p, HRR_INT__k_p_i_p, HRR_INT__k_p_i_d);
1227 
1228                 // form INT__k_p_k_d
1229                 ostei_general_hrr_L(7, 1, 7, 2, hCD, HRR_INT__k_p_l_p, HRR_INT__k_p_k_p, HRR_INT__k_p_k_d);
1230 
1231                 // form INT__k_p_l_d
1232                 ostei_general_hrr_L(7, 1, 8, 2, hCD, HRR_INT__k_p_m_p, HRR_INT__k_p_l_p, HRR_INT__k_p_l_d);
1233 
1234                 // form INT__k_p_m_d
1235                 ostei_general_hrr_L(7, 1, 9, 2, hCD, HRR_INT__k_p_n_p, HRR_INT__k_p_m_p, HRR_INT__k_p_m_d);
1236 
1237                 // form INT__k_p_i_f
1238                 ostei_general_hrr_L(7, 1, 6, 3, hCD, HRR_INT__k_p_k_d, HRR_INT__k_p_i_d, HRR_INT__k_p_i_f);
1239 
1240                 // form INT__k_p_k_f
1241                 ostei_general_hrr_L(7, 1, 7, 3, hCD, HRR_INT__k_p_l_d, HRR_INT__k_p_k_d, HRR_INT__k_p_k_f);
1242 
1243                 // form INT__k_p_l_f
1244                 ostei_general_hrr_L(7, 1, 8, 3, hCD, HRR_INT__k_p_m_d, HRR_INT__k_p_l_d, HRR_INT__k_p_l_f);
1245 
1246                 // form INT__k_p_i_g
1247                 ostei_general_hrr_L(7, 1, 6, 4, hCD, HRR_INT__k_p_k_f, HRR_INT__k_p_i_f, HRR_INT__k_p_i_g);
1248 
1249                 // form INT__k_p_k_g
1250                 ostei_general_hrr_L(7, 1, 7, 4, hCD, HRR_INT__k_p_l_f, HRR_INT__k_p_k_f, HRR_INT__k_p_k_g);
1251 
1252                 // form INT__k_p_i_h
1253                 ostei_general_hrr_L(7, 1, 6, 5, hCD, HRR_INT__k_p_k_g, HRR_INT__k_p_i_g, HRR_INT__k_p_i_h);
1254 
1255 
1256             }  // close HRR loop
1257 
1258 
1259         }   // close loop cdbatch
1260 
1261         istart = iend;
1262     }  // close loop over ab
1263 
1264     return P.nshell12_clip * Q.nshell12_clip;
1265 }
1266 
ostei_p_k_i_h(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__p_k_i_h)1267 int ostei_p_k_i_h(struct simint_multi_shellpair const P,
1268                   struct simint_multi_shellpair const Q,
1269                   double screen_tol,
1270                   double * const restrict work,
1271                   double * const restrict INT__p_k_i_h)
1272 {
1273     double P_AB[3*P.nshell12];
1274     struct simint_multi_shellpair P_tmp = P;
1275     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
1276     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
1277     P_tmp.AB_x = P_AB;
1278     P_tmp.AB_y = P_AB + P.nshell12;
1279     P_tmp.AB_z = P_AB + 2*P.nshell12;
1280 
1281     for(int i = 0; i < P.nshell12; i++)
1282     {
1283         P_tmp.AB_x[i] = -P.AB_x[i];
1284         P_tmp.AB_y[i] = -P.AB_y[i];
1285         P_tmp.AB_z[i] = -P.AB_z[i];
1286     }
1287 
1288     int ret = ostei_k_p_i_h(P_tmp, Q, screen_tol, work, INT__p_k_i_h);
1289     double buffer[63504] SIMINT_ALIGN_ARRAY_DBL;
1290 
1291     for(int q = 0; q < ret; q++)
1292     {
1293         int idx = 0;
1294         for(int a = 0; a < 3; ++a)
1295         for(int b = 0; b < 36; ++b)
1296         for(int c = 0; c < 28; ++c)
1297         for(int d = 0; d < 21; ++d)
1298             buffer[idx++] = INT__p_k_i_h[q*63504+b*1764+a*588+c*21+d];
1299 
1300         memcpy(INT__p_k_i_h+q*63504, buffer, 63504*sizeof(double));
1301     }
1302 
1303     return ret;
1304 }
1305 
ostei_k_p_h_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_p_h_i)1306 int ostei_k_p_h_i(struct simint_multi_shellpair const P,
1307                   struct simint_multi_shellpair const Q,
1308                   double screen_tol,
1309                   double * const restrict work,
1310                   double * const restrict INT__k_p_h_i)
1311 {
1312     double Q_AB[3*Q.nshell12];
1313     struct simint_multi_shellpair Q_tmp = Q;
1314     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1315     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1316     Q_tmp.AB_x = Q_AB;
1317     Q_tmp.AB_y = Q_AB + Q.nshell12;
1318     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1319 
1320     for(int i = 0; i < Q.nshell12; i++)
1321     {
1322         Q_tmp.AB_x[i] = -Q.AB_x[i];
1323         Q_tmp.AB_y[i] = -Q.AB_y[i];
1324         Q_tmp.AB_z[i] = -Q.AB_z[i];
1325     }
1326 
1327     int ret = ostei_k_p_i_h(P, Q_tmp, screen_tol, work, INT__k_p_h_i);
1328     double buffer[63504] SIMINT_ALIGN_ARRAY_DBL;
1329 
1330     for(int q = 0; q < ret; q++)
1331     {
1332         int idx = 0;
1333         for(int a = 0; a < 36; ++a)
1334         for(int b = 0; b < 3; ++b)
1335         for(int c = 0; c < 21; ++c)
1336         for(int d = 0; d < 28; ++d)
1337             buffer[idx++] = INT__k_p_h_i[q*63504+a*1764+b*588+d*21+c];
1338 
1339         memcpy(INT__k_p_h_i+q*63504, buffer, 63504*sizeof(double));
1340     }
1341 
1342     return ret;
1343 }
1344 
ostei_p_k_h_i(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__p_k_h_i)1345 int ostei_p_k_h_i(struct simint_multi_shellpair const P,
1346                   struct simint_multi_shellpair const Q,
1347                   double screen_tol,
1348                   double * const restrict work,
1349                   double * const restrict INT__p_k_h_i)
1350 {
1351     double P_AB[3*P.nshell12];
1352     struct simint_multi_shellpair P_tmp = P;
1353     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
1354     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
1355     P_tmp.AB_x = P_AB;
1356     P_tmp.AB_y = P_AB + P.nshell12;
1357     P_tmp.AB_z = P_AB + 2*P.nshell12;
1358 
1359     for(int i = 0; i < P.nshell12; i++)
1360     {
1361         P_tmp.AB_x[i] = -P.AB_x[i];
1362         P_tmp.AB_y[i] = -P.AB_y[i];
1363         P_tmp.AB_z[i] = -P.AB_z[i];
1364     }
1365 
1366     double Q_AB[3*Q.nshell12];
1367     struct simint_multi_shellpair Q_tmp = Q;
1368     Q_tmp.PA_x = Q.PB_x;  Q_tmp.PA_y = Q.PB_y;  Q_tmp.PA_z = Q.PB_z;
1369     Q_tmp.PB_x = Q.PA_x;  Q_tmp.PB_y = Q.PA_y;  Q_tmp.PB_z = Q.PA_z;
1370     Q_tmp.AB_x = Q_AB;
1371     Q_tmp.AB_y = Q_AB + Q.nshell12;
1372     Q_tmp.AB_z = Q_AB + 2*Q.nshell12;
1373 
1374     for(int i = 0; i < Q.nshell12; i++)
1375     {
1376         Q_tmp.AB_x[i] = -Q.AB_x[i];
1377         Q_tmp.AB_y[i] = -Q.AB_y[i];
1378         Q_tmp.AB_z[i] = -Q.AB_z[i];
1379     }
1380 
1381     int ret = ostei_k_p_i_h(P_tmp, Q_tmp, screen_tol, work, INT__p_k_h_i);
1382     double buffer[63504] SIMINT_ALIGN_ARRAY_DBL;
1383 
1384     for(int q = 0; q < ret; q++)
1385     {
1386         int idx = 0;
1387         for(int a = 0; a < 3; ++a)
1388         for(int b = 0; b < 36; ++b)
1389         for(int c = 0; c < 21; ++c)
1390         for(int d = 0; d < 28; ++d)
1391             buffer[idx++] = INT__p_k_h_i[q*63504+b*1764+a*588+d*21+c];
1392 
1393         memcpy(INT__p_k_h_i+q*63504, buffer, 63504*sizeof(double));
1394     }
1395 
1396     return ret;
1397 }
1398 
1399